I'm using the code below to play a simple rhythm. However, playback is very inconsistent, in terms of sample attack definition, relative prominence, etc. Can anyone suggest what I might be doing wrong?
bool RBBGenerator::Init()
{
BASS_Init(-1,44100,BASS_DEVICE_MONO,0); BASS_Start();
t=0; delta_t = 125;
return true;
}
void RBBGenerator::run()
{
DWORD lastTime=GetTickCount(), tmp;
HSAMPLE bass = BASS_SampleLoad(FALSE,"g:\\hugh\\rave\\samples\\909 bd 1.wav",0,0,40,BASS_SAMPLE_OVER_VOL);
HSAMPLE snare = BASS_SampleLoad(FALSE,"g:\\hugh\\rave\\samples\\909 snare 2.wav",0,0,40,BASS_SAMPLE_OVER_VOL);
HSAMPLE hat = BASS_SampleLoad(FALSE,"g:\\hugh\\rave\\samples\\909 c_hat 1.wav",0,0,40,BASS_SAMPLE_OVER_VOL);
while(1)
{
tmp = GetTickCount();
if (tmp - lastTime > delta_t)
{
lastTime = tmp;
if (t % 8 == 0) BASS_SamplePlayEx(bass,0,-1,100,0,0);
if (t % 8 == 3) BASS_SamplePlayEx(bass,0,-1,60,0,0);
if (t % 8 == 7) BASS_SamplePlayEx(bass,0,-1,60,0,0);
if (t % 8 == 4) BASS_SamplePlayEx(snare,0,-1,100,0,0);
if (t % 2 == 0) BASS_SamplePlay(hat);
t++;
}
Sleep(5);
}
}