INT COggStream::FillBuffer_OggF(LPDIRECTSOUNDBUFFER8 lpdsb){ DebugStr("COggStream::FillBuffer_OggF()"); HRESULT hr; register INT iBytesRead = 0; INT section; register INT iPos = 0; register CHAR *buff; register ULONG len; hr = lpdsb->Lock(0,0,(void **)&buff,&len,NULL,NULL,DSBLOCK_ENTIREBUFFER); if(FAILED(hr)){ Log->Write(SOUND,true,"Could Not Lock COggSound::FillBuffF(buff)\r\n"); PRINT_DS_ERROR(hr); return 0; } len-=(len%oggInfo->channels); while(iPos < len){ iBytesRead = ov_read(&oggStream,buff+iPos,len-iPos,0,2,1,§ion); if(iBytesRead > 0){ iPos+=iBytesRead; }else{ if(iBytesRead < 0){ this->GetError(iBytesRead,"Open(filename):pushinbuff1"); Profiler->Close(); return 0; }else{ break; } } } hr = lpdsb->Unlock(buff,len,NULL,0); if(FAILED(hr)){ Log->Write(SOUND,true,"Could not Unlock CWaveSound\r\n"); PRINT_DS_ERROR(hr); return 0; } lpdsb->SetCurrentPosition(0); return 1;}void COggStream::UpdateStream(){ if(this->iBuffPlaying < 1){ return; } Profiler->Open(this->iProfiler); if(iBuffPlaying == 1){ this->Snd2->Play(); this->Snd->Stop(); this->iBuffPlaying = 2; this->FillBuffer_OggF(this->Snd->GetBuff()); Profiler->Close(); return; }else if(iBuffPlaying == 2){ this->Snd->Play(); this->Snd2->Stop(); this->iBuffPlaying = 1; this->FillBuffer_OggF(this->Snd2->GetBuff()); Profiler->Close(); return; }}
and instead of constantly checking the play cursor, i use dsoundnotifiers
hr = lpBuff->QueryInterface(IID_IDirectSoundNotify8,(LPVOID *)&(lpNot1));if(FAILED(hr)){ Log->Write(SOUND,true,"Could not create Notifier1 for Ogg Stream\r\n"); PRINT_DS_ERROR(hr); this->Destroy(); return 0;}else{ HANDLE hnd1 = CreateEvent(NULL,false,false,NULL); posNot.dwOffset = iBuffSize-OGG_SKIP; posNot.hEventNotify = hnd1; lpNot1->SetNotificationPositions(1,&posNot); CStreamManager::Push(this,hnd1); lpNot1->Release();}
Cartman''s definition of sexual harrasement:
"When you are trying to have intercourse with a lady friend, and some other guy comes up and tickles your balls from behind"
(watch South Park, it rocks)