Problems with AVI Audio and OpenAL

Ef2c5c5a8d8ed14e03498addc09e23d0
0
Hellhound 101 Apr 09, 2004 at 17:15

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

1 Reply

Please log in or register to post a reply.

9e8e9afb595cf6ad18ad67d255796f1c
0
kitt3n 101 Sep 03, 2004 at 14:25

Does playing wav’s work (just loading from harddisk)?

Just a guess (I’m by no way an expert) - is the wav compressed
as adpcm?
I couldn’t play these when I started playing around with openAL,
so I just converted them to standard wav’s.

btw… isn’t the max for volume 1.0f?

Regards,
Roger