예제 #1
0
OpenALBackend::OpenALBackend()
	: m_sampling_rate(get_sampling_rate())
	, m_sample_size(get_sample_size())
{
	ALCdevice* m_device = alcOpenDevice(nullptr);
	checkForAlcError("OpenALBackend->alcOpenDevice");

	ALCcontext* m_context = alcCreateContext(m_device, nullptr);
	checkForAlcError("OpenALBackend->alcCreateContext");

	alcMakeContextCurrent(m_context);
	checkForAlcError("OpenALBackend->alcMakeContextCurrent");

	if (get_channels() == 2)
	{
		m_format = (m_sample_size == 2) ? AL_FORMAT_STEREO16 : AL_FORMAT_STEREO_FLOAT32;
	}
	else
	{
		m_format = (m_sample_size == 2) ? AL_FORMAT_71CHN16 : AL_FORMAT_71CHN32;
	}
}
예제 #2
0
파일: parser.c 프로젝트: tommie/modplug
static unsigned int get_length_in_samples(struct sppb_plugin_description *plugin, void *context)
{
	MPSP_DPRINTF("parser: get_length_in_samples(): %u\n", (ModPlug_GetLength(self) + 500) / 1000 * getSamplingRate());

	return (ModPlug_GetLength(self) + 500) / 1000 * get_sampling_rate();
}