please help with parameters for AddAudioStream

Petr Danecek <[email protected]> Sat, 06 Mar 2004 17:08:22 +0100
Newsgroups gmane.comp.multimedia.avifile.general
Message-ID <[email protected]>
hi!

i'd like to create a video file with an audio stream, but my knowledge
of sound making is rather poor. my first try was to open an existing wav
file and stream it to the IAudioWriteStream. however, it does not work.
(i would be rather surprised if it did :) 

my question is: If i take an uncompressed PCM wav file and feed it with
correct parameters to AddAudioStream, CAN it work?

obviously, second question follows: HOW to set the parameters???

i would greatly appreciate your help!
petr

------------

the wav file parameter's are
	bitrate:352800 (8000000) 
	samprate:11025  
	chn:2  
	framerate:25
(taken from output of avitype, a sample program in avifile distribution)

and the (nonfunctional) program is:

WAVEFORMATEX wfm;
wfm.wFormatTag      = WAVE_FORMAT_PCM;
wfm.nChannels       = 2;    
wfm.nSamplesPerSec  = 11025;
wfm.nAvgBytesPerSec = 44100;
wfm.nBlockAlign     = 1;
wfm.wBitsPerSample  = 16;
wfm.cbSize          = 0;

avm::IAudioWriteStream* audStr = outFile->AddAudioStream(0x55, &wfm,
16000);
audStr->Start();
while ( ! feof(fp) )
{
  int nbytes = fread(sound_data, 1000, 1, fp);
  audStr->AddData(sound_data, nbytes);
}
audStr->Stop();


please,