Beispiel #1
0
/**
**  Mix into buffer.
**
**  @param buffer   Buffer to be filled with samples. Buffer must be big enough.
**  @param samples  Number of samples.
*/
static void MixIntoBuffer(void *buffer, int samples)
{
	// FIXME: can save the memset here, if first channel sets the values
	memset(Audio.MixerBuffer, 0, samples * sizeof(*Audio.MixerBuffer));

	if (EffectsEnabled) {
		// Add channels to mixer buffer
		MixChannelsToStereo32(Audio.MixerBuffer, samples);
	}
	if (MusicEnabled) {
		// Add music to mixer buffer
		MixMusicToStereo32(Audio.MixerBuffer, samples);
	}
	ClipMixToStereo16(Audio.MixerBuffer, samples, (short *)buffer);
}
Beispiel #2
0
/**
**  Mix into buffer.
**
**  @param buffer   Buffer to be filled with samples. Buffer must be big enough.
**  @param samples  Number of samples.
*/
static void MixIntoBuffer(void *buffer, int samples)
{
	// FIXME: can save the memset here, if first channel sets the values
	memset(Audio.MixerBuffer, 0, samples * sizeof(*Audio.MixerBuffer));

	if (EffectsEnabled) {
		// Add channels to mixer buffer
		MixChannelsToStereo32(Audio.MixerBuffer, samples);
	}
	if (MusicEnabled) {
		// Add music to mixer buffer
		MixMusicToStereo32(Audio.MixerBuffer, samples);
	}
	ClipMixToStereo16(Audio.MixerBuffer, samples, (short *)buffer);

#ifdef USE_OAML
	if (enableOAML && oaml) {
		oaml->SetAudioFormat(Audio.Format.freq, Audio.Format.channels, SDL_AUDIO_BITSIZE(Audio.Format.format) / 8);
		oaml->MixToBuffer(buffer, samples);
	}
#endif
}