Jump to content


Problems with AVI Audio and OpenAL


1 reply to this topic

#1 Hellhound

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 April 2004 - 05:15 PM

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

#2 kitt3n

    New Member

  • Members
  • PipPip
  • 15 posts

Posted 03 September 2004 - 02:25 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users