Exemple #1
0
usize pullable::move_data_left(source& src, u8* new_buffer) {
	usize data_left = src.size();
	if (data_left != 0 && src.begin() != new_buffer) {
		// Data left. Must move it to beginning.
		memmove(new_buffer, src.begin(), data_left);
	}

	src.unsafe_set_buffer(new_buffer, new_buffer + data_left);

	return data_left;
}
Exemple #2
0
	midi_loader(source &src, std::string const &filename) : source_(src), filename_(filename) {
		src.init_midi();
		source_.player.reset(new_fluid_player(source_.synth.get()), &delete_fluid_player);
		if (fluid_player_add(source_.player.get(), filename.c_str()) == FLUID_FAILED)
			Output::Warning("Couldn't load %s midi sound.", filename.c_str());
		if (fluid_player_play(source_.player.get()) == FLUID_FAILED)
			Output::Warning("Couldn't play %s midi sound.", filename.c_str());
	}
Exemple #3
0
void
cxxll::read_exactly(source &src, unsigned char *p, size_t count)
{
  unsigned char *end = p + count;
  while (p != end) {
    size_t ret = src.read(p, end - p);
    if (ret == 0) {
      throw eof_exception();
    }
    p += ret;
  }
}
Exemple #4
0
int file_pullable_win::pull(source& src, usize min_size) {
	usize space_left = pull_begin(src, min_size);

	DWORD c;
	BOOL r = ReadFile(this->f, (void *)src.end(), DWORD(space_left), &c, NULL);

	pull_done(src, c);

	if (!r) {
		printf("err: %d\n", GetLastError());
	}

	return c < min_size;
}
Exemple #5
0
	midi_loader(source &src, std::string const &filename) : source_(src), filename_(filename) {
		src.init_midi();
		source_.player.reset(new_fluid_player(source_.synth.get()), &delete_fluid_player);
		BOOST_VERIFY(fluid_player_add(source_.player.get(), filename.c_str()) != FLUID_FAILED);
		BOOST_VERIFY(fluid_player_play(source_.player.get()) != FLUID_FAILED);
	}