这篇教程C++ IDirectSoundBuffer_Restore函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IDirectSoundBuffer_Restore函数的典型用法代码示例。如果您正苦于以下问题:C++ IDirectSoundBuffer_Restore函数的具体用法?C++ IDirectSoundBuffer_Restore怎么用?C++ IDirectSoundBuffer_Restore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IDirectSoundBuffer_Restore函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DSReloadSoundBufferBOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName){ BOOL result=FALSE; BYTE *pbWaveData; DWORD cbWaveSize; void *pvBase; if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) { if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) { result = TRUE; } } else if( DSGetWaveFile(NULL, lpName, NULL, &pbWaveData, &cbWaveSize, &pvBase)) { if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) { result = TRUE; } UnmapViewOfFile (pvBase); } return result;}
开发者ID:fenglinnet,项目名称:ddongddongbae,代码行数:26,
示例2: DSOUND_GetDeviceBufstatic Uint8 *DSOUND_GetDeviceBuf(_THIS){ DWORD cursor = 0; DWORD junk = 0; HRESULT result = DS_OK; DWORD rawlen = 0; /* Figure out which blocks to fill next */ this->hidden->locked_buf = NULL; result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, &junk, &cursor); if (result == DSERR_BUFFERLOST) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, &junk, &cursor); } if (result != DS_OK) { SetDSerror("DirectSound GetCurrentPosition", result); return (NULL); } cursor /= this->hidden->mixlen;#ifdef DEBUG_SOUND /* Detect audio dropouts */ { DWORD spot = cursor; if (spot < this->hidden->lastchunk) { spot += this->hidden->num_buffers; } if (spot > this->hidden->lastchunk + 1) { fprintf(stderr, "Audio dropout, missed %d fragments/n", (spot - (this->hidden->lastchunk + 1))); } }#endif this->hidden->lastchunk = cursor; cursor = (cursor + 1) % this->hidden->num_buffers; cursor *= this->hidden->mixlen; /* Lock the audio buffer */ result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, this->hidden->mixlen, (LPVOID *) & this->hidden->locked_buf, &rawlen, NULL, &junk, 0); if (result == DSERR_BUFFERLOST) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, this->hidden->mixlen, (LPVOID *) & this-> hidden->locked_buf, &rawlen, NULL, &junk, 0); } if (result != DS_OK) { SetDSerror("DirectSound Lock", result); return (NULL); } return (this->hidden->locked_buf);}
开发者ID:BoonsNaibot,项目名称:kivy-ios,代码行数:58,
示例3: DSOUND_WaitDevicestatic voidDSOUND_WaitDevice(_THIS){ DWORD status = 0; DWORD cursor = 0; DWORD junk = 0; HRESULT result = DS_OK; /* Semi-busy wait, since we have no way of getting play notification on a primary mixing buffer located in hardware (DirectX 5.0) */ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, &junk, &cursor); if (result != DS_OK) { if (result == DSERR_BUFFERLOST) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); }#ifdef DEBUG_SOUND SetDSerror("DirectSound GetCurrentPosition", result);#endif return; } while ((cursor / this->hidden->mixlen) == this->hidden->lastchunk) { /* FIXME: find out how much time is left and sleep that long */ SDL_Delay(1); /* Try to restore a lost sound buffer */ IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); if ((status & DSBSTATUS_BUFFERLOST)) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); if ((status & DSBSTATUS_BUFFERLOST)) { break; } } if (!(status & DSBSTATUS_PLAYING)) { result = IDirectSoundBuffer_Play(this->hidden->mixbuf, 0, 0, DSBPLAY_LOOPING); if (result == DS_OK) { continue; }#ifdef DEBUG_SOUND SetDSerror("DirectSound Play", result);#endif return; } /* Find out where we are playing */ result = IDirectSoundBuffer_GetCurrentPosition(this->hidden->mixbuf, &junk, &cursor); if (result != DS_OK) { SetDSerror("DirectSound GetCurrentPosition", result); return; } }}
开发者ID:BoonsNaibot,项目名称:kivy-ios,代码行数:57,
示例4: DX5_WaitAudio_BusyWaitstatic void DX5_WaitAudio_BusyWait(_THIS){ DWORD status; DWORD cursor, junk; HRESULT result; /* Semi-busy wait, since we have no way of getting play notification on a primary mixing buffer located in hardware (DirectX 5.0) */ result = IDirectSoundBuffer_GetCurrentPosition(mixbuf, &cursor, &junk); if ( result != DS_OK ) { if ( result == DSERR_BUFFERLOST ) { IDirectSoundBuffer_Restore(mixbuf); }#ifdef DEBUG_SOUND SetDSerror("DirectSound GetCurrentPosition", result);#endif return; } cursor /= mixlen; while ( cursor == playing ) { /* FIXME: find out how much time is left and sleep that long */ SDL_Delay(10); /* Try to restore a lost sound buffer */ IDirectSoundBuffer_GetStatus(mixbuf, &status); if ( (status&DSBSTATUS_BUFFERLOST) ) { IDirectSoundBuffer_Restore(mixbuf); IDirectSoundBuffer_GetStatus(mixbuf, &status); if ( (status&DSBSTATUS_BUFFERLOST) ) { break; } } if ( ! (status&DSBSTATUS_PLAYING) ) { result = IDirectSoundBuffer_Play(mixbuf, 0, 0, DSBPLAY_LOOPING); if ( result == DS_OK ) { continue; }#ifdef DEBUG_SOUND SetDSerror("DirectSound Play", result);#endif return; } /* Find out where we are playing */ result = IDirectSoundBuffer_GetCurrentPosition(mixbuf, &cursor, &junk); if ( result != DS_OK ) { SetDSerror("DirectSound GetCurrentPosition", result); return; } cursor /= mixlen; }}
开发者ID:bohwaz,项目名称:ozex,代码行数:55,
示例5: IDirectSoundBuffer_GetCurrentPositionstatic Uint8 *DX5_GetAudioBuf(_THIS){ DWORD cursor, junk; HRESULT result; DWORD rawlen; /* Figure out which blocks to fill next */ locked_buf = NULL; result = IDirectSoundBuffer_GetCurrentPosition(mixbuf, &junk, &cursor); if ( result == DSERR_BUFFERLOST ) { IDirectSoundBuffer_Restore(mixbuf); result = IDirectSoundBuffer_GetCurrentPosition(mixbuf, &junk, &cursor); } if ( result != DS_OK ) { SetDSerror("DirectSound GetCurrentPosition", result); return(NULL); } cursor /= mixlen;#ifdef DEBUG_SOUND /* Detect audio dropouts */ { DWORD spot = cursor; if ( spot < lastchunk ) { spot += NUM_BUFFERS; } if ( spot > lastchunk+1 ) { fprintf(stderr, "Audio dropout, missed %d fragments/n", (spot - (lastchunk+1))); } }#endif lastchunk = cursor; cursor = (cursor+1)%NUM_BUFFERS; cursor *= mixlen; /* Lock the audio buffer */ result = IDirectSoundBuffer_Lock(mixbuf, cursor, mixlen, (LPVOID *)&locked_buf, &rawlen, NULL, &junk, 0); if ( result == DSERR_BUFFERLOST ) { IDirectSoundBuffer_Restore(mixbuf); result = IDirectSoundBuffer_Lock(mixbuf, cursor, mixlen, (LPVOID *)&locked_buf, &rawlen, NULL, &junk, 0); } if ( result != DS_OK ) { SetDSerror("DirectSound Lock", result); return(NULL); } return(locked_buf);}
开发者ID:3bu1,项目名称:crossbridge,代码行数:49,
示例6: Playstatic HRESULT Play( vlc_object_t *obj, aout_stream_sys_t *sys, block_t *p_buffer ){ HRESULT dsresult; dsresult = FillBuffer( obj, sys, p_buffer ); if( dsresult != DS_OK ) return dsresult; /* start playing the buffer */ dsresult = IDirectSoundBuffer_Play( sys->p_dsbuffer, 0, 0, DSBPLAY_LOOPING ); if( dsresult == DSERR_BUFFERLOST ) { IDirectSoundBuffer_Restore( sys->p_dsbuffer ); dsresult = IDirectSoundBuffer_Play( sys->p_dsbuffer, 0, 0, DSBPLAY_LOOPING ); } if( dsresult != DS_OK ) msg_Err( obj, "cannot start playing buffer: (hr=0x%0lx)", dsresult ); else { vlc_mutex_lock( &sys->lock ); sys->b_playing = true; vlc_cond_signal(&sys->cond); vlc_mutex_unlock( &sys->lock ); } return dsresult;}
开发者ID:videolan,项目名称:vlc,代码行数:29,
示例7: RestoreBuffers/* * バッファをリストアする */static BOOL RestoreBuffers(int nBuffer){ DWORD dwStatus; HRESULT hRet; assert(pDSBuffer[nBuffer] != NULL); assert(nBuffer >= 0 && nBuffer < MIXER_STREAMS); hRet = IDirectSoundBuffer_GetStatus(pDSBuffer[nBuffer], &dwStatus); if(hRet != DS_OK) return FALSE; if(dwStatus & DSBSTATUS_BUFFERLOST) { /* * アプリケ C++ IDirectSoundBuffer_Stop函数代码示例 C++ IDirectSoundBuffer_Play函数代码示例
|