Original Post
Ok, I''m having the weirdest bug I had in the last month or so. It''s a bit long to explain, so I don''t mind if you don''t have the patience to read through.Hope someone is listening ''though:
1. I''m using DirectSound (9.0).
I have 3 .wav sounds, each played from it''s own secondary buffers.No streaming.
Also, I have 3 .ogg sounds, each from a buffer, but the .ogg files are quite large so I''m streaming them.
2. When I create the streaming sounds I use
IID_IDirectSoundNotify to set up a notification when buffer reaches 0%, 33% and 66%. I do this for EACH stream, and setup diferent handles for each stream respectivly, but the same handle for each of the 3 positions.
...
hNotifyEvent[0] = CreateEvent( NULL, FALSE, FALSE, NULL );
hNotifyEvent[1] = CreateEvent( NULL, FALSE, FALSE, NULL );
hNotifyEvent[2] = CreateEvent( NULL, FALSE, FALSE, NULL );
...
::CreateStreamingOGG(..int ID..)
{
...
m_pDS->CreateSoundBuffer( &dsbd, &pDSBuffer, NULL );
pDSBuffer->QueryInterface( IID_IDirectSoundNotify,
(VOID**)&pDSNotify ) ) );
aPosNotify = new DSBPOSITIONNOTIFY[ dwNotifyCount ];
for( DWORD i = 0; i < dwNotifyCount; i++ )
{
aPosNotify[i].dwOffset = (dwNotifySize * i) + dwNotifySize - 1;
aPosNotify[i].hEventNotify = hNotifyEvent[ID];
}
pDSNotify->SetNotificationPositions( dwNotifyCount,aPosNotify ) ) );
...
};
3. Now, in a loop I''m using
dwResult = MsgWaitForMultipleObjects( 3,&(theSoundManager->hNotifyEvent[0]), FALSE, 1000,QS_ALLINPUT );
switch (dwResult)
{ case WAIT_OBJECT_0 + 0:
stream[0]->HandleWaveStreamNotification(TRUE);
case WAIT_OBJECT_0 +1:
stream[1]->HandleWaveStreamNotification(TRUE);
case WAIT_OBJECT_0 + 1:
stream[2]->HandleWaveStreamNotification(TRUE);
}
Funkyest thing (and this goes beyond my comprehension)... this works as expected on W2000. On WinXP hoever, I get notifications for WAIT_OBJECT_0 + 0 regardless on what sound is playing . Even if one of the non-streaming buffer sounds is played I get 3 notifications for WAIT_OBJECT_0 + 0 and 1 for WAIT_OBJECT_0 + 2 ... ???
What is this all about??