Hellhound
04-09-2004, 11:15 AM
Hi,
i've implemented an avi-player for my Application. The video part works fine, now i try to play the audio stream. I've decided to play the audio with openAL but i got several problems, hope someone of u could help...
Before i try to play the audio data directly from the stream, i will test the audio playback from memory. Therefore i loading the wave datas by the following way:
// get the size
if(AVIStreamRead(m_pAudioStream, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &lSize, NULL))
*return FALSE;
LPBYTE pChunk = new BYTE[lSize];
if(!pChunk)
return FALSE;
if(AVIStreamReadFormat(m_pAudioStream, AVIStreamStart(m_pAudioStream), pChunk, &lSize))
*return FALSE;
pWaveFormat = (LPWAVEFORMATEX)pChunk;
m_length = AVIStreamLength(m_pAudioStream); //Member int
//check Audio Compression
if(pWaveFormat->wFormatTag!=1)
return FALSE; *// FIX:: Audio datas copressed, decompress them
// Definie Databuffers (size of one sample is 4)
m_lpAudioBuffer = new BYTE[m_length*4];
if(!m_lpAudioBuffer)
return FALSE;
// Get the full stream
for(int i=0; i<m_length; i++){
// Auslesen der Audiodaten in den Datenpuffer
if(AVIStreamRead(m_pAudioStream, 0, AVISTREAMREAD_CONVENIENT, &m_lpAudioBuffer[i], lSize, NULL, NULL))
* return FALSE;
}
To Play the data i try to use the alBufferData-Method by the following way:
alBufferData(buffer, AL_FORMAT_STEREO16, m_lpAudioBuffer, m_length*4, pWaveFormat->nSamplesPerSec);
I got no compiler or linker failures and the method call works, but when i call
alSourcePlay i hear nothing (volume 20.0f) ...
Can anyone tell me what i've made wrong? Or knows a tutorial or a solution how
i can handle this problem?
Thx in advance,
Christian
i've implemented an avi-player for my Application. The video part works fine, now i try to play the audio stream. I've decided to play the audio with openAL but i got several problems, hope someone of u could help...
Before i try to play the audio data directly from the stream, i will test the audio playback from memory. Therefore i loading the wave datas by the following way:
// get the size
if(AVIStreamRead(m_pAudioStream, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &lSize, NULL))
*return FALSE;
LPBYTE pChunk = new BYTE[lSize];
if(!pChunk)
return FALSE;
if(AVIStreamReadFormat(m_pAudioStream, AVIStreamStart(m_pAudioStream), pChunk, &lSize))
*return FALSE;
pWaveFormat = (LPWAVEFORMATEX)pChunk;
m_length = AVIStreamLength(m_pAudioStream); //Member int
//check Audio Compression
if(pWaveFormat->wFormatTag!=1)
return FALSE; *// FIX:: Audio datas copressed, decompress them
// Definie Databuffers (size of one sample is 4)
m_lpAudioBuffer = new BYTE[m_length*4];
if(!m_lpAudioBuffer)
return FALSE;
// Get the full stream
for(int i=0; i<m_length; i++){
// Auslesen der Audiodaten in den Datenpuffer
if(AVIStreamRead(m_pAudioStream, 0, AVISTREAMREAD_CONVENIENT, &m_lpAudioBuffer[i], lSize, NULL, NULL))
* return FALSE;
}
To Play the data i try to use the alBufferData-Method by the following way:
alBufferData(buffer, AL_FORMAT_STEREO16, m_lpAudioBuffer, m_length*4, pWaveFormat->nSamplesPerSec);
I got no compiler or linker failures and the method call works, but when i call
alSourcePlay i hear nothing (volume 20.0f) ...
Can anyone tell me what i've made wrong? Or knows a tutorial or a solution how
i can handle this problem?
Thx in advance,
Christian