- Home
·
- Games
·
- How to play a wav file using DirectX
How to play a wav file using DirectX
How to play a wav file using DirectX
API Declarations
Dim DX As New DirectX7
Dim Ds As DirectSound 'The root object
Dim dsBuffer As DirectSoundBuffer 'Note, there is not a fixed number of
Dim bufferDesc As DSBUFFERDESC
Dim waveFormat As WAVEFORMATEX
Rate How to play a wav file using DirectX
(1(1 Vote))
Set Ds = DX.DirectSoundCreate("")
Ds.SetCooperativeLevel Me.hWnd, DSSCL_NORMAL
'bufferDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
waveFormat.nFormatTag = WAVE_FORMAT_PCM
waveFormat.nChannels = 2 'or 2 for stereo.
waveFormat.lSamplesPerSec = 22050
waveFormat.nBitsPerSample = 8 'or 16 for 16bit sounds
'waveFormat.nBlockAlign = waveFormat.nBitsPerSample / 8 * waveFormat.nChannels
'waveFormat.lAvgBytesPerSec = waveFormat.lSamplesPerSec * waveFormat.nBlockAlign
Set dsBuffer = Nothing
Set Laugh = Nothing
Set dsBuffer = Ds.CreateSoundBufferFromFile("type here wave file", bufferDesc, waveFormat)
dsBuffer.Play DSBPLAY_LOOPING
End Sub
How to play a wav file using DirectX Comments
No comments yet — be the first to post one!
Post a Comment