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


C++ LPDIRECTSOUND::DuplicateSoundBuffer方法代码示例

本文整理汇总了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;
}
开发者ID:cbxbiker61,项目名称:nogravity,代码行数:32,代码来源:snd_ds6.cpp

示例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);
}
开发者ID:mreiferson,项目名称:hajiworld,代码行数:33,代码来源:hwdsound.cpp

示例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();
};
开发者ID:shaxbee,项目名称:maszyna,代码行数:11,代码来源:Sound.cpp

示例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;
}
开发者ID:kodack64,项目名称:koma2010,代码行数:11,代码来源:DxAudioApi.cpp

示例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
开发者ID:giantchen2012,项目名称:tricks-of-the-3d-game-programming-gurus,代码行数:51,代码来源:t3dlib3.cpp

示例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;
}
开发者ID:jaeseock,项目名称:MiniKey,代码行数:14,代码来源:MkSound_MkSoundBuffer.cpp

示例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;
}
开发者ID:grakidov,项目名称:Render3D,代码行数:47,代码来源:dsutil.cpp

示例8: DuplicateSoundBuffer

HRESULT STDMETHODCALLTYPE DirectSound::DuplicateSoundBuffer(LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate)
{
	return m_ds->DuplicateSoundBuffer(pDSBufferOriginal, ppDSBufferDuplicate);
}
开发者ID:ThrDev,项目名称:dsbridge,代码行数:4,代码来源:DirectSound.cpp


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