这篇教程C++ IDirectSound_CreateSoundBuffer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IDirectSound_CreateSoundBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ IDirectSound_CreateSoundBuffer函数的具体用法?C++ IDirectSound_CreateSoundBuffer怎么用?C++ IDirectSound_CreateSoundBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IDirectSound_CreateSoundBuffer函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: createDSBufferint createDSBuffer(DWORD flags, int samples, int freq, int bits, int channels, LPDIRECTSOUNDBUFFER *bufAddr){ DSBUFFERDESC bufd; WAVEFORMATEX form; DWORD dataBytes = samples * bits/8 * channels; // Prepare the buffer description. memset(&bufd, 0, sizeof(bufd)); bufd.dwSize = sizeof(bufd); bufd.dwFlags = flags; bufd.dwBufferBytes = dataBytes; bufd.lpwfxFormat = &form; // Prepare the format description. memset(&form, 0, sizeof(form)); form.wFormatTag = WAVE_FORMAT_PCM; form.nChannels = channels; form.nSamplesPerSec = freq; form.nBlockAlign = channels * bits/8; form.nAvgBytesPerSec = form.nSamplesPerSec * form.nBlockAlign; form.wBitsPerSample = bits; return IDirectSound_CreateSoundBuffer(dsound, &bufd, bufAddr, NULL);}
开发者ID:cmbruns,项目名称:Doomsday-Engine,代码行数:25,
示例2: CreateChannel//static BOOL CreateChannel( char* Name, DSBUFFERDESC* dsBD, Channel** chanelPtr)static BOOL CreateChannel(DSBUFFERDESC* dsBD, Channel** chanelPtr){ Channel* channel;// channel = malloc( sizeof( Channel ) ); channel = geRam_Allocate( sizeof( Channel ) ); if ( channel == NULL ) { geErrorLog_Add(GE_ERR_OUT_OF_MEMORY, NULL); return( FALSE ); } if(DS_OK != IDirectSound_CreateSoundBuffer(lpDirectSound, dsBD, &channel->buffer, NULL)) { geErrorLog_Add(GE_ERR_CREATE_SOUND_BUFFER_FAILED, NULL); return FALSE; } if(DS_OK != IDirectSoundBuffer_GetFrequency(channel->buffer, &channel->BaseFreq) ) { geErrorLog_Add(GE_ERR_DS_ERROR, NULL); return FALSE; } channel->next = NULL; channel->nextDup = NULL; channel->ID = 0; channel->cfg.Volume = 1.0f; channel->cfg.Pan = 0.0f; channel->cfg.Frequency = 0.0f;// channel->name = Name; *chanelPtr = channel; return( TRUE );}
开发者ID:RealityFactory,项目名称:Genesis3D,代码行数:33,
示例3: CreateStaticSoundBuffer//---------------------------------------------------------------------------////---------------------------------------------------------------------------LPDIRECTSOUNDBUFFER CreateStaticSoundBuffer(void* buffer, int ndata){ LPDIRECTSOUNDBUFFER pDSB = NULL;; memset( &pcmwf, 0, sizeof (WAVEFORMATEX )); pcmwf.wFormatTag = WAVE_FORMAT_PCM; pcmwf.nChannels = 1; pcmwf.nSamplesPerSec = SR; pcmwf.nBlockAlign = 2; pcmwf.nAvgBytesPerSec = SR * 2; pcmwf.wBitsPerSample = bits; // --- start sound --- // Set up DSBUFFERDESC structure. memset(&dsbdesc, 0, sizeof (DSBUFFERDESC)); // Zero it out. dsbdesc.dwSize = sizeof (DSBUFFERDESC); dsbdesc.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLFREQUENCY;// | DSBCAPS_GETCURRENTPOSITION2;/* #define DSBCAPS_CTRLFREQUENCY 0x00000020#define DSBCAPS_CTRLPAN 0x00000040#define DSBCAPS_CTRLVOLUME 0x00000080 */ dsbdesc.dwBufferBytes = ndata; dsbdesc.lpwfxFormat = &pcmwf; if(!SUCCEEDED(IDirectSound_CreateSoundBuffer(lpDirectSound,&dsbdesc, &(pDSB), NULL))) { MessageBox(0,"ERROR BUFFER","ERROR BUFFER",MB_OK); return NULL; } FillDSBufer(pDSB,buffer,ndata); return pDSB;}
开发者ID:javisantana,项目名称:cubyshot,代码行数:38,
|