Hi,

i'm develop an avi-video plugin for an openGL based framework. The video part works fine, now i try to read out the audio data as buffered data to play them with openAL.

I'know the concept of reading audio datas, but i have some implementation problems, here is the code fragment of the audio reading part:

Code:
LONG lSize=0;

// Getting the size for DataChunk
if(AVIStreamRead(m_pAudioStream, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &lSize, NULL))
		return FALSE;

// Build Chunk
LPBYTE pChunk = new BYTE[lSize];
if(!pChunk)
  return FALSE;

// Get stream positions
LONG lAudioBeginSample = AVIStreamTimeToSample(m_pAudioStream, AVIStreamStartTime(m_pAudioStream)); 
LONG lAudioEndSample = AVIStreamTimeToSample(m_pAudioStream, AVIStreamEndTime(m_pAudioStream));

// Read format data
if(AVIStreamReadFormat(m_pAudioStream, lAudioBeginSample, pChunk, &lSize))
		return FALSE;

pWaveFormat = (LPWAVEFORMATEX)pChunk;

// Check compression
if(pWaveFormat->wFormatTag!=1)
	return FALSE;  // FIX:: decompression

/* Definine buffer size based on Sample rate
    (16 Bits per Sample -> 2 Bytes per Sample)*/

m_lBufferSize = lAudioEndSample*2;
m_lpAudioBuffer = new BYTE[m_lBufferSize]; 
	
if(!m_lpAudioBuffer)
	return FALSE;
	
LONG nSampRead = 0;
HRESULT res = AVIStreamRead(m_pAudioStream, lAudioBeginSample, lAudioEndSample, &m_lpAudioBuffer, m_lBufferSize, NULL, &nSampRead);

if(res!=0)
   return FALSE;

return SUCCESS;
The biggest part works fine, but when i read the stream, mostly i got only 4300 Samples in nSampRead (141120 are nessessary) or 0 !! I can't understand what i made wrong?

Knows anyone what i've made wrong or has any solution or tip?

Thx in advance,
Chrisitan