BASSWMA and what BASS_WMA_EncodeWrite is expecting

Started by oddsock,

oddsock

I'm having a bit of a difficulty generating a wma stream using BASSWMA that is NOT 44100/Stereo.  So if call BASS_WMA_EncodeOpenNetwork() with BASS_SAMPLE_MONO, then what exactly am I expected to pass in via BASS_WMA_EncodeWrite() ? It takes in a buffer pointer (this is a pointer to an array of shorts), and length (is that the entire size of the buffer ? sizeof(short)*numberofsamples ?)

and if I tell WMA to stream mono, do I still need to send it interleaved samples ? and just zero out every other one ? and what do I specify for length in that case ?

and I also have implemented a resampler, so if I am streaming at 22kHz and my source is at 44kHz, then I have already resampled the samples to appropriate levels, if I told BASSWMA to stream at 22kHz, would I then pass in the modified samplerate or does BASSWMA do resampling on it's own..?

alot of questions I know... :)

thanks for any help though.

oddsock

Irrational86

QuoteSo if call BASS_WMA_EncodeOpenNetwork() with BASS_SAMPLE_MONO, then what exactly am I expected to pass in via BASS_WMA_EncodeWrite() ? It takes in a buffer pointer (this is a pointer to an array of shorts), and length (is that the entire size of the buffer ? sizeof(short)*numberofsamples ?)
A stream will have only the amount of bits it has per channel, 16 bit, means that its 16bit (shorts) each channel. As to mono, it means that you will only have one channel, and not have them interleaved.

Quoteand if I tell WMA to stream mono, do I still need to send it interleaved samples ? and just zero out every other one ? and what do I specify for length in that case ?
Nope, no interleaved and not zero out every other one, just give it one channel for every byte. The size will always be the sample size, no matter what format it is.

Quoteand I also have implemented a resampler, so if I am streaming at 22kHz and my source is at 44kHz, then I have already resampled the samples to appropriate levels, if I told BASSWMA to stream at 22kHz, would I then pass in the modified samplerate or does BASSWMA do resampling on it's own..?
You pass the modified Samples, BASSWMA will not do the resampling for you...and talking about a resampler, can i get the code for this? i have been trying to make one for a long time and with no luck, can you share this code with me?

oddsock


Quote...and talking about a resampler, can i get the code for this? i have been trying to make one for a long time and with no luck, can you share this code with me?
http://cvs.casterclub.com/horde/chora/cvs.php/liboddcast?rt=CVS.ODDSOCK.ORG

check out resample.c and resample.h....I borrowed these from utilities found over at xiph (part of one of their tools)..but not sure if they wrote it or where they got it, but the author's name is preserved, and it's GPL.  I modified it to take in floats as samples, as I was using this with vorbis (which uses float samples) and foobar2k (which also uses floats - or used to, now they use doubles)....

anyway, if you have questions on the use, just check the other source files there, or send me questions...

oddsock