void COggDlg::Closeds() { // fade1=1; if(m_dsb){ m_dsb->Stop(); if(m_dsb3d != NULL){m_dsb3d->Release();m_dsb3d =NULL;} if(m_dsb != NULL){m_dsb->Release();m_dsb =NULL;} } }
BOOL COggDlg::ReleaseDXSound(void) { if(m_ds){ Closeds(); if(m_dsb3d != NULL){m_dsb3d->Release();m_dsb3d =NULL;} if(m_dsb != NULL) {m_dsb->Release();m_dsb=NULL;} if (m_dsb1 != NULL) { m_dsb1->Release(); m_dsb1 = NULL; } if(m_lpDS3DBuffer != NULL){m_lpDS3DBuffer->Release();} m_dsb =NULL; m_lpDS3DBuffer= NULL; if(m_p!=NULL){m_p->Release();m_p=NULL;} if(m_ds){ m_ds->Release(); m_ds = NULL; } } return TRUE; }
int GlobalSoundManager::getAvailableBufferIndex(SoundPriority priority) { int available_buffer = -1; // index of a buffer that could be overwritten if no // empty one is found for (int buffer = 0; buffer < NUMBER_OF_SOUND_BUFFERS; ++buffer) { if (sound_buffers_[buffer] == NULL) return buffer; if (sound_buffer_priority_[buffer] <= priority) { available_buffer = buffer; } } if (available_buffer < 0) return -1; LPDIRECTSOUNDBUFFER8 buffer = sound_buffers_[available_buffer]; buffer->Stop(); buffer->Release(); sound_buffers_[available_buffer] = NULL; sound_buffer_priority_[available_buffer] = SOUNDPRIORITY_AMBIENT; return available_buffer; }