当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTSOUNDBUFFER::Release方法代码示例

本文整理汇总了C++中LPDIRECTSOUNDBUFFER::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUNDBUFFER::Release方法的具体用法?C++ LPDIRECTSOUNDBUFFER::Release怎么用?C++ LPDIRECTSOUNDBUFFER::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTSOUNDBUFFER的用法示例。


在下文中一共展示了LPDIRECTSOUNDBUFFER::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SNDDXDeInit

void SNDDXDeInit()
{
	DWORD status=0;

	doterminate = true;
	while(!terminated)
		Sleep(1);
	terminated = false;

	if (lpDSB2)
	{
		lpDSB2->GetStatus(&status);

		if(status == DSBSTATUS_PLAYING)
			lpDSB2->Stop();

		lpDSB2->Release();
		lpDSB2 = NULL;
	}

	if (lpDSB)
	{
		lpDSB->Release();
		lpDSB = NULL;
	}

	if (lpDS8)
	{
		lpDS8->Release();
		lpDS8 = NULL;
	}

	delete stereodata16;
	stereodata16=0;
}
开发者ID:BlueSplash,项目名称:svn-desmume,代码行数:35,代码来源:snddx.cpp

示例2: Release

static void Release(void)
{
    if (!g_lpDSDevice)
		return;

    if ( g_lpPrimaryBuffer!=NULL )
    {
        ULONG status;
		ChannelFlushAll(0);
        g_lpPrimaryBuffer->GetStatus(&status);

		if ( (status&DSBSTATUS_PLAYING)==DSBSTATUS_PLAYING )
			g_lpPrimaryBuffer->Stop();

		if (g_lpDS3DListener)
			g_lpDS3DListener->Release();

        g_lpPrimaryBuffer->Release();
        g_lpPrimaryBuffer = NULL;
    }
    if (V3XA.p_driverList)
	{
		array_free(V3XA.p_driverList);
		V3XA.p_driverList = NULL;
	}
}
开发者ID:cbxbiker61,项目名称:nogravity,代码行数:26,代码来源:snd_ds6.cpp

示例3: dsCreateSoundBuffer

//--------------------------------------------------------------------------------------------
//	関数名		:	dsCreateSoundBuffer
//	作成者		:	植山沙欧
//	作成日		:	2004.6.8
//	機能		:	バッファを作成します
//	機能効果	:	「numBuffer」バッファを「wf_ptr」フォーマットで「dwBufbyte」バイト作成します
//	引数		:	<入力>numBuffer		作成するバッファ番号
//					<入力>wf_ptr		WAVEフォーマット
//					<入力>dwBufbyte	バッファのバイト数
//	使用変数	:	DSBUFFERDESC		desc		バッファ作成に必要な情報を格納します
//					LPDIRECTSOUNDBUFFER lpTempBuff	IDirectSoundBuffer8インターフェース取得に必要
//					MYERROR_DS			hRet		関数戻り値の格納
//	使用関数	:	ZeroMemory				メモリ0クリア
//					IDirectSoundBuffer::CreateSoundBuffer	サウンドバッファの作成を行ないます
//					IDirectSoundBuffer::QueryInterface		上位のインターフェースを取得します
//	戻り値		:	eERRORDS_CSB			バッファ作成に失敗
//					eERRORDS_QI				QueryInterfaceに失敗
//					eERRORDS_NOTHING		成功
//	更新履歴	:	2004.6.8	Ver1.00		植山沙欧	機能の実現
//--------------------------------------------------------------------------------------------
MYERROR_DS dsCreateSoundBuffer(int numBuffer, WAVEFORMATEX* wf_ptr, DWORD dwBufbyte)
{
	DSBUFFERDESC desc;
	LPDIRECTSOUNDBUFFER lpTempBuff = NULL;
	MYERROR_DS hRet = eERRORDS_NOTHING;		//	関数戻り値

//	サウンドデータ
	if(!wf_ptr)
	{
		return eERRORDS_SFMT;
	}
//	サウンドバッファの設定
	ZeroMemory(&desc, sizeof(desc));
	desc.lpwfxFormat = wf_ptr;
	desc.dwSize = sizeof(DSBUFFERDESC);
	desc.dwFlags = DSBCAPS_STATIC|DSBCAPS_LOCDEFER|
		DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN;
	desc.dwBufferBytes = dwBufbyte;	//	バッファサイズ
//	DirectSoundBuffer生成
	if(FAILED(g_ds.ds_ptr->CreateSoundBuffer(&desc, &lpTempBuff, NULL)))
	{
		hRet = eERRORDS_CSB;
		goto end;
	}
//	DirectSoundBuffer8取得
	if(FAILED(lpTempBuff->QueryInterface(IID_IDirectSoundBuffer8, (void**)&g_ds.sec_ptr[numBuffer])))
	{
		hRet = eERRORDS_QI;
		goto end;
	}
end:
	if(lpTempBuff != NULL) lpTempBuff->Release();
	return hRet;
}
开发者ID:jecDiceButtle,项目名称:DiceBattle_Beta,代码行数:54,代码来源:Ds2008.cpp

示例4: Destroy

// Destroy
BOOL AudioStream::Destroy (void)
{
	BOOL fRtn = SUCCESS;

	EnterCriticalSection(&write_lock);
	
	// Stop playback
	Stop ();

	// Release DirectSound buffer
	if (m_pdsb) {
		m_pdsb->Release ();
		m_pdsb = NULL;
		Snd_sram -= m_cbBufSize;
	}

	// Delete WaveFile object
	if (m_pwavefile) {
		m_pwavefile->Close();
		free(m_pwavefile);
		m_pwavefile = NULL;
	}

	status = ASF_FREE;

	LeaveCriticalSection(&write_lock);

	return fRtn;
}
开发者ID:NonCreature0714,项目名称:freespace2,代码行数:30,代码来源:AudioStr.cpp

示例5: DSUtil_LoadSoundBuffer

//-----------------------------------------------------------------------------
// Name: DSUtil_LoadSoundBuffer()
// Desc:
//-----------------------------------------------------------------------------
LPDIRECTSOUNDBUFFER DSUtil_LoadSoundBuffer( LPDIRECTSOUND pDS, LPCTSTR strName )
{
    LPDIRECTSOUNDBUFFER pDSB = NULL;
    DSBUFFERDESC        dsbd;
    BYTE*               pbWaveData;

    ZeroMemory( &dsbd, sizeof(dsbd) );
    dsbd.dwSize  = sizeof(dsbd);
    dsbd.dwFlags = DSBCAPS_STATIC|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME|
                   DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPOSITIONNOTIFY;

    if( SUCCEEDED( DSUtil_GetWaveResource( NULL, strName, &dsbd.lpwfxFormat,
                                           &pbWaveData, &dsbd.dwBufferBytes ) ) )
    {

        if( SUCCEEDED( pDS->CreateSoundBuffer( &dsbd, &pDSB, NULL ) ) )
        {
            if( FAILED( DSUtil_FillSoundBuffer( pDSB, pbWaveData,
                                                dsbd.dwBufferBytes ) ) )
            {
                pDSB->Release();
                pDSB = NULL;
            }
        }
        else
        {
            pDSB = NULL;
        }
    }

    return pDSB;
}
开发者ID:grakidov,项目名称:Render3D,代码行数:36,代码来源:dsutil.cpp

示例6: SNDDMA_Shutdown

/*
==================
SNDDMA_Shutdown
==================
*/
void SNDDMA_Shutdown( void ) {
	Com_DPrintf( "Shutting down sound system\n" );

	if ( pDS ) {
		Com_DPrintf( "Destroying DS buffers\n" );
		if ( pDS )
		{
			Com_DPrintf( "...setting NORMAL coop level\n" );
			// FIXME JA was DSSCL_NORMAL and Q3 says DSSCL_PRIORITY but the printf says setting normal
			pDS->SetCooperativeLevel( g_wv.hWnd, DSSCL_PRIORITY );
		}

		if ( pDSBuf )
		{
			Com_DPrintf( "...stopping and releasing sound buffer\n" );
			pDSBuf->Stop( );
			pDSBuf->Release( );
		}

		// only release primary buffer if it's not also the mixing buffer we just released
		if ( pDSPBuf && ( pDSBuf != pDSPBuf ) )
		{
			Com_DPrintf( "...releasing primary buffer\n" );
			pDSPBuf->Release( );
		}
		pDSBuf = NULL;
		pDSPBuf = NULL;

		dma.buffer = NULL;

		Com_DPrintf( "...releasing DS object\n" );
		pDS->Release( );
	}

	if ( hInstDS ) {
		Com_DPrintf( "...freeing DSOUND.DLL\n" );
		FreeLibrary( hInstDS );
		hInstDS = NULL;
	}

	pDS = NULL;
	pDSBuf = NULL;
	pDSPBuf = NULL;
	dsound_init = qfalse;
	memset ((void *)&dma, 0, sizeof (dma));
	CoUninitialize( );
}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:52,代码来源:win_snd.cpp

示例7: ds_TestAlgorithm

//-----------------------------------------------------------------------------
//	Проверка возможности использования алгоритма трехмерного звука
// на входе    :  direct   - указатель интерфейс Direct Sound
//  			  alg      - тестируемый алгорим
// на выходе   :	успешность использования
//-----------------------------------------------------------------------------
int ds_TestAlgorithm(LPDIRECTSOUND direct, int alg)
{
	// объявление переменных
	int ret;
	DSBUFFERDESC dsbd;
	WAVEFORMATEX wfx;
	LPDIRECTSOUNDBUFFER buffer;

	// заполним структуру с форматом
	wfx.wFormatTag = 1;
	wfx.nChannels = 2;
	wfx.nSamplesPerSec = 44100;
	wfx.wBitsPerSample = 16;
	wfx.nBlockAlign = (wfx.nChannels * wfx.wBitsPerSample) >> 3;
	wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
	wfx.cbSize = 0;

	// проверка наличия объекта воспроизведения
	if (direct) {
		// занесение данных вторичного буфера
		ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
		dsbd.dwSize = sizeof(DSBUFFERDESC);
		dsbd.dwFlags = DSBCAPS_STATIC |
			DSBCAPS_CTRLFREQUENCY |
			DSBCAPS_CTRLVOLUME |
			DSBCAPS_GLOBALFOCUS |
			DSBCAPS_CTRL3D |
			DSBCAPS_MUTE3DATMAXDISTANCE;
		dsbd.dwBufferBytes = 128;
		dsbd.lpwfxFormat = &wfx;
		/* !!! убрать !!!
					// подбор способа общета трехмерного звука
					switch(alg)
				  {
						case 0x0:
						dsbd.guid3DAlgorithm = DS3DALG_DEFAULT;
						break;
						case 0x1:
						dsbd.guid3DAlgorithm = DS3DALG_NO_VIRTUALIZATION;
						break;
						case 0x2:
						dsbd.guid3DAlgorithm = DS3DALG_HRTF_FULL;
						break;
						case 0x3:
						dsbd.guid3DAlgorithm = DS3DALG_HRTF_LIGHT;
						break;
					}*/

		// Создание вторичного буфера
		ret = (direct->CreateSoundBuffer(&dsbd, & buffer, NULL) == DS_OK) ?
			true :
			false;
		if (ret)
			buffer->Release();
	}

	// вернем результат
	return ret;
}
开发者ID:doveiya,项目名称:isilme,代码行数:65,代码来源:DirectSound.cpp

示例8: DriverReleaseA

static void DriverReleaseA(void)
{
	if (g_lpDS3DListener)
		g_lpDS3DListener->Release();

	if (g_lpPrimaryBuffer)
		g_lpPrimaryBuffer->Release();

}
开发者ID:cbxbiker61,项目名称:nogravity,代码行数:9,代码来源:snd_ds6.cpp

示例9: DS_DestroyBuffers

/*
** DS_DestroyBuffers
*/
static void DS_DestroyBuffers( void )
{
	Com_Printf( "Destroying DirectSound 8 buffers\n" );
	if ( pDS )
	{
		Com_Printf( "...setting NORMAL coop level\n" );
#ifdef QDSNDCOMPILERHACK
		pDS->lpVtbl->SetCooperativeLevel( pDS, cl_hwnd, DSSCL_NORMAL );
#else
		pDS->SetCooperativeLevel(cl_hwnd, DSSCL_NORMAL);
#endif
	}

	if ( pDSBuf )
	{
		Com_Printf( "...stopping and releasing secondary buffer\n" );
#ifdef QDSNDCOMPILERHACK
		pDSBuf->lpVtbl->Stop(pDSBuf);
		pDSBuf->lpVtbl->Release(pDSBuf);
#else
		pDSBuf->Stop();
		pDSBuf->Release();
#endif
	}
	
	// only release primary buffer if it's not also the mixing buffer we just released
	if ( pDSPBuf && ( pDSBuf != pDSPBuf ) )
	{
		Com_Printf( "...releasing primary buffer\n" );
#ifdef QDSNDCOMPILERHACK
		pDSPBuf->lpVtbl->Stop(pDSPBuf);
		pDSPBuf->lpVtbl->Release(pDSPBuf);
#else
		pDSPBuf->Stop();
		pDSPBuf->Release();
#endif
	}

	pDSBuf = NULL;
	pDSPBuf = NULL;

	dma.buffer = NULL;
}
开发者ID:Jaegermeiste,项目名称:quake2_322,代码行数:46,代码来源:snd_win.c

示例10: ReleaseDXSound

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;
}
开发者ID:otoboku,项目名称:oggYSEDbgm,代码行数:19,代码来源:oggDlg_ds.cpp

示例11: setWaveData

void TDDSDChannel::setWaveData( TDDSDGenWave* wav )
{
	//サウンドカード無しでは、何も出来ん
	if( ! FOwner->Initialized() )
		return;

	//既存のサウンドバッファの解放
	if( ! IsStream() ) {
		SAFE_RELEASE(F3DBuffer);
		SAFE_RELEASE(FSoundBuffer);
		
	} else {
		//いま乗せているのと同じオブジェクトなら、何もしない
		if( wav == FWaveData )
			return;

		//いままでの再生を止めさせる
		Stop();
	}

	if( wav == NULL ) {
		FWaveData = NULL;
		return;
	}

	//ストリームならば、単純に代入。そうでないならDuplicateSoundBufferして多重再生できるようにする
	//FX対応の場合、DUplicateしたくても出来ないDSoundの仕様があるので、泣く泣く代入だけ
	if( wav->IsStream() || wav->UseFX() ) {
		FSoundBuffer = wav->Buffer();
		FSoundBuffer->AddRef();
		wav->FPlayer = this;
	} else {
		LPDIRECTSOUNDBUFFER dsb;
		FOwner->DSound()->DuplicateSoundBuffer(wav->Buffer(), &dsb);
		dsb->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*)&FSoundBuffer);
		dsb->Release();
	}

	FIsStream = wav->IsStream();


	//3D再生できるようにする
	//if( wav is TDDSDWave3D ) {
	//	FIs3D = true;

	//	TRYDS(FSoundBuffer->QueryInterface(IID_IDirectSound3DBuffer,F3DBuffer),'setWaveData 3Dサウンドバッファの作成に失敗しました');
	//	Params3D = TDDSDWave3D(wav).Params3D;
	//} else {
		FIs3D = false;
	//}

	FSrcFreq = wav->WaveFormat()->nSamplesPerSec;
	FWaveData = wav;

}
开发者ID:ukifuku,项目名称:cloudphobia_cpp,代码行数:55,代码来源:DDSD.cpp

示例12: CreateSecondaryBuffer

//===============================================
//セカンダリ・バッファの生成
//===============================================
//[input]
//	なし
//[return]
//
//===============================================
bool CSound::CreateSecondaryBuffer()
{
	HRESULT hr;
	
	WAVEFORMATEX pcmwf;
	DSBUFFERDESC dsbdesc;
	
	ZeroMemory(&pcmwf, sizeof(WAVEFORMATEX) );
	
	//----------------------------------------------
	//バッファのWAVEフォーマットを設定
	//----------------------------------------------
	pcmwf.wFormatTag = WAVE_FORMAT_PCM;
	pcmwf.nChannels = 2;//ステレオ
	pcmwf.nSamplesPerSec = SAMPLING_RATE;//サンプリングレート
	pcmwf.nBlockAlign = 4;
	pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign;
	pcmwf.wBitsPerSample = NUM_BIT;//16ビット
	
	ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC) );
	dsbdesc.dwSize = sizeof(DSBUFFERDESC);
	dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_LOCDEFER;//サウンドバッファの生成
	dsbdesc.dwBufferBytes = 3 * pcmwf.nAvgBytesPerSec;//3秒のバッファを作る
	dsbdesc.lpwfxFormat = &pcmwf;
	
	LPDIRECTSOUNDBUFFER pDSB;
	
	/*バッファの生成*/
	hr = m_pDirectSound->CreateSoundBuffer(&dsbdesc, &pDSB, NULL);
	
	if(FAILED(hr) )
	{
		MESSAGE("バッファの作成に失敗");
		
		return false;
	}
	
	/*DirectSoundBuffer8インターフェースを取り出す*/
	hr = pDSB->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*)m_pDirectSoundBuffer);
	
	/*解放*/
	pDSB->Release();
	
	if(FAILED(hr) )
	{
		MESSAGE("インターフェースの取得に失敗");
		
		return false;
	}
	
	return true;
}
开发者ID:Taka03,项目名称:Procon2007,代码行数:60,代码来源:sound.cpp

示例13: get3DListener

//获得3D收听对象
HRESULT get3DListener(LPDIRECTSOUND8 lpds, LPDIRECTSOUND3DBUFFER8* ppListener){
	DSBUFFERDESC dsbd;
	LPDIRECTSOUNDBUFFER lpdsbPrimary;
	LPDIRECTSOUND3DLISTENER lp3DListener = NULL;
	HRESULT hr;
	ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
	dsbd.dwSize = sizeof(DSBUFFERDESC);
	dsbd.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER;
	if (SUCCEEDED(hr = lpds->CreateSoundBuffer(&dsbd, &lpdsbPrimary, NULL))){
		hr = lpdsbPrimary->QueryInterface(IID_IDirectSound3DListener8, (LPVOID*)ppListener);
		lpdsbPrimary->Release();
	}
	return hr;
}
开发者ID:u-stone,项目名称:code-database,代码行数:15,代码来源:DirectSound.cpp

示例14: pcmdestroy

static void pcmdestroy(void) {

	UINT				i;
	LPDIRECTSOUNDBUFFER	dsbuf;

	for (i=0; i<SOUND_MAXPCM; i++) {
		dsbuf = pDSwave3[i];
		pDSwave3[i] = NULL;
		if (dsbuf) {
			dsbuf->Stop();
			dsbuf->Release();
		}
	}
}
开发者ID:josejl1987,项目名称:neko-tracer,代码行数:14,代码来源:soundmng.cpp

示例15: soundmng_destroy

void soundmng_destroy(void) {

	if (pDSData3) {
#if defined(VERMOUTH_LIB)
		midimod_destroy(vermouth_module);
		vermouth_module = NULL;
#endif
#if defined(MT32SOUND_DLL)
		mt32sound_setrate(0);
#endif
		pDSData3->Stop();
		pDSData3->Release();
		pDSData3 = NULL;
	}
}
开发者ID:josejl1987,项目名称:neko-tracer,代码行数:15,代码来源:soundmng.cpp


注:本文中的LPDIRECTSOUNDBUFFER::Release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。