Beispiel #1
0
// Mixer Controller
void Mix (float* buf, slBU samples, bool stereo, slScalar persample)
{
	slBU cur;
	if (SongPlaying)
	{
		if (GetSongPosition() > GetSongLength())
		{
			if (LoopSong) SetSongPosition(0);
			else
			{
				TogglePlaying();
				SetSongPosition(GetSongLength());
				ReachedEnd = true;
			}
		}
	}
	if (SongPlaying)
	{
		for (cur = 0; cur < samples; cur++)
		{
			// Get a sample from the MusicMap.
			slScalar value = GetMixerSample(persample);
			// Copy this sample into the audio.
			*(buf + cur) = value;
			// Since we're only making mono sound,
			// the right channel in stereo sound
			// should have the same data as left.
			if (stereo) *(buf + samples + cur) = value;
		}
	}
	else
	{
		for (cur = 0; cur < samples; cur++) *(buf + cur) = 0;
		if (stereo) for (cur = 0; cur < samples; cur++) *(buf + samples + cur) = 0;
	}
}
void
TransportControlGroup::_TogglePlaying()
{
	TogglePlaying();
}