本文整理汇总了C++中LPDIRECTSOUND::DuplicateSoundBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUND::DuplicateSoundBuffer方法的具体用法?C++ LPDIRECTSOUND::DuplicateSoundBuffer怎么用?C++ LPDIRECTSOUND::DuplicateSoundBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTSOUND
的用法示例。
在下文中一共展示了LPDIRECTSOUND::DuplicateSoundBuffer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DSS_DuplicateHandle
/*------------------------------------------------------------------------
*
* PROTOTYPE : static int DSS_RegisterHandle(V3XA_HANDLE *sam, int channel)
*
* DESCRIPTION : Try to duplicate the sample.
*
*/
static int DSS_DuplicateHandle(V3XA_HANDLE *sam, int channel)
{
HRESULT hr;
int i;
DS_handle *hnd = g_pDSHandles + channel;
for (i=0;i<RLX.Audio.ChannelToMix;i++)
{
DS_handle *p = g_pDSHandles + i ;
if ((i!=channel)&&(p->sample == sam))
{
// Same on a different channel
hnd->sample = sam;
hr = g_lpDSDevice->DuplicateSoundBuffer(p->pbuffer, &hnd->pbuffer);
if (SYS_DXTRACE(hr))
{
return -1;
}
DS_Register3D(sam, hnd, 0);
sam->sampleFormat&=~V3XA_FMTVOLATILE;
return i;
}
}
return -1;
}
示例2: ReplicateSound
int ReplicateSound(int source_id)
{
if (source_id != -1) {
// duplicate the sound buffer
// first hunt for an open id
for (int id = 0; id < MAX_SOUNDS; id++) {
// is this sound open?
if (sound_fx[id].state == SOUND_NULL) {
// first make an identical copy
sound_fx[id] = sound_fx[source_id];
// now actually replicate the directsound buffer
if (lpDS->DuplicateSoundBuffer(sound_fx[source_id].dsbuffer, &sound_fx[id].dsbuffer) != DS_OK) {
// reset sound to NULL
sound_fx[id].dsbuffer = NULL;
sound_fx[id].state = SOUND_NULL;
// return error
return(-1);
}
// now fix up id
sound_fx[id].id = id;
// return replicated sound
return(id);
}
}
} else {
return(-1);
}
// else failure
return(-1);
}
示例3: GetUnique
LPDIRECTSOUNDBUFFER TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
{
if (!DSBuffer)
return NULL;
// jeœli siê dobrze zainicjowa³o
LPDIRECTSOUNDBUFFER buff;
pDS->DuplicateSoundBuffer(DSBuffer, &buff);
if (buff)
DSBuffers.push(buff);
return DSBuffers.top();
};
示例4: PlayDuplicateWavFile
bool Audio::PlayDuplicateWavFile(LPDIRECTSOUND lpDS,Audio* a) {
if(lpDSB!=NULL)return false;
lpDS->DuplicateSoundBuffer(a->GetWavBuffer(),&lpDSB);
if(a->ex==true)
{
lpDSB->QueryInterface(IID_IDirectSound3DBuffer,(void **)&lp3D);
lp3D->SetPosition(x,0.0f,y,DS3D_IMMEDIATE);
}
lpDSB->Play(0,0,0);
return true;
}
示例5: DSound_Replicate_Sound
int DSound_Replicate_Sound(int source_id)
{
// this function replicates the sent sound and sends back the
// id of the replicated sound, you would use this function
// to make multiple copies of a gunshot or something that
// you want to play multiple times simulataneously, but you
// only want to load once
if (source_id!=-1)
{
// duplicate the sound buffer
// first hunt for an open id
for (int id=0; id < MAX_SOUNDS; id++)
{
// is this sound open?
if (sound_fx[id].state==SOUND_NULL)
{
// first make an identical copy
sound_fx[id] = sound_fx[source_id];
// now actually replicate the directsound buffer
if (FAILED(lpds->DuplicateSoundBuffer(sound_fx[source_id].dsbuffer,
&sound_fx[id].dsbuffer)))
{
// reset sound to NULL
sound_fx[id].dsbuffer = NULL;
sound_fx[id].state = SOUND_NULL;
// return error
return(-1);
} // end if
// now fix up id
sound_fx[id].id = id;
// return replicated sound
return(id);
} // end if found
} // end for id
} // end if
else
return(-1);
// else failure
return(-1);
} // end DSound_Replicate_Sound
示例6: SetUp
bool MkSoundBuffer::SetUp(LPDIRECTSOUND directSound, LPDIRECTSOUNDBUFFER srcBuffer)
{
Clear();
if ((directSound == NULL) || (srcBuffer == NULL))
return false;
directSound->DuplicateSoundBuffer(srcBuffer, &m_SoundBuffer);
if (m_SoundBuffer == NULL)
return false;
_UpdateInformation();
return true;
}
示例7: DSUtil_CreateSound
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
SoundObject* DSUtil_CreateSound( LPCTSTR strName, DWORD dwNumConcurrentBuffers )
{
SoundObject* pSound = NULL;
LPWAVEFORMATEX pWaveHeader;
BYTE* pbData;
DWORD cbData;
if( NULL == g_pDS )
return NULL;
if( dwNumConcurrentBuffers < 1 )
dwNumConcurrentBuffers = 1;
if( SUCCEEDED( DSUtil_GetWaveResource( NULL, strName, &pWaveHeader,
&pbData, &cbData ) ) )
{
pSound = new SoundObject;
pSound->dwNumBuffers = dwNumConcurrentBuffers;
pSound->pbWaveData = pbData;
pSound->cbWaveSize = cbData;
pSound->dwCurrent = 0;
pSound->pdsbBuffers = new LPDIRECTSOUNDBUFFER[dwNumConcurrentBuffers+1];
pSound->pdsbBuffers[0] = DSUtil_LoadSoundBuffer( g_pDS, strName );
for( DWORD i=1; i<pSound->dwNumBuffers; i++ )
{
if( FAILED( g_pDS->DuplicateSoundBuffer( pSound->pdsbBuffers[0],
&pSound->pdsbBuffers[i] ) ) )
{
pSound->pdsbBuffers[i] = DSUtil_LoadSoundBuffer( g_pDS, strName );
if( NULL == pSound->pdsbBuffers[i] )
{
DSUtil_DestroySound( pSound );
pSound = NULL;
break;
}
}
}
}
return pSound;
}
示例8: DuplicateSoundBuffer
HRESULT STDMETHODCALLTYPE DirectSound::DuplicateSoundBuffer(LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate)
{
return m_ds->DuplicateSoundBuffer(pDSBufferOriginal, ppDSBufferDuplicate);
}