23 May '13 - 09:23 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: WMA TargetSampleRate  (Read 862 times)
renzska
Posts: 22


« on: 16 Sep '09 - 23:38 »
Reply with quoteQuote

I'm implementing the settings screen in my app for WMA files and I'm not seeing a WMA_TargetSampleRate setting to allow me to specify the KHz output.  How would I specify this so I can call the encoder as follows?:

EncoderWMA encoder = new EncoderWMA(-1);
bool encResult = BaseEncoder.EncodeFile(encoder, new BaseEncoder.ENCODEFILEPROC(FileEncodingNotification), true, false, false, 0, -1);

I also use it to recording audio as well, doing the following:

_myRecProc = new RECORDPROC(RecordingCallBack);
_recHandle = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, _myRecProc, new IntPtr(_encHandle));

_bassEncoder = new BassEncoding(_recHandle, audioFile.OutputFilename, audioFile);
_bassEncoder.Start();

Does it work such that for the recording, I can replace the 44100 with the KHz I want recorded and when doing a straight encoding, it automatically gets the KHz from the source?

Thanks,

John
« Last Edit: 16 Sep '09 - 23:42 by renzska » Logged
radio42
Posts: 4012


« Reply #1 on: 17 Sep '09 - 09:17 »
Reply with quoteQuote

Currently the EncoderWMA uses the 'freq' and 'chans' values directly of the source channel (which defaults to 44100 and 2, if no valid channel handle is used).
E.g. when you create an instance of EncoderWMA like this:
EncoderWMA encoder = new EncoderWMA(source);
The encoder will use the samplerate (freq) and number of channels (chans) of this source stream.

However you are right, that when using the "BaseEncoder.EncodeFile" method those internal values have not been correctly set.
A fix is included here:
www.un4seen.com/filez/4/Bass24.Net_pre.zip
« Last Edit: 17 Sep '09 - 12:15 by radio42 » Logged
renzska
Posts: 22


« Reply #2 on: 17 Sep '09 - 18:38 »
Reply with quoteQuote

Thanks for that.  I'll test it out soon.

For the recording side of things:

_recHandle = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, _myRecProc, new IntPtr(_encHandle));
_bassEncoder = new EncoderWMA(_recHandle...)
_bassEncoder.Start(null, IntPtr.Zero, false);
Bass.BASS_ChannelPlay(_recHandle, false);

Just to verify, since when creating my encoder, I'm passing in the _recHandle from the Bass.BASS_RecordStart method, does the freq and channels from "Bass.BASS_RecordStart(44100, 2" set what the values will be on the output wma file?

Thanks,

John
Logged
radio42
Posts: 4012


« Reply #3 on: 17 Sep '09 - 21:10 »
Reply with quoteQuote

Yes, exactly!
Internally I will always call BASS_ChannelGetInfo to retrieve the samplerate and number of channels of the current stream/channel being used with the encoder. And these values are then used in the BASS_WMA_EncodeXXX call as the 'freq' resp. 'chans' param.

So if you want to support different output sample rates or number of channels - you might use a BASSmix mixer stream in between and use this one with your encoders.
This is actually what I am doing in my apps. I always create a 'downmix' mixer stream with the desired target sample rate and add my real source as a decoding channel to this mixer.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines