20 May '13 - 00:41 *
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: Normal (stereo) Ogg file to Mono Speaker out Problem  (Read 898 times)
icecbr
Posts: 16


« on: 7 Mar '11 - 02:31 »
Reply with quoteQuote

Hi all,

I use c# and bass.net

I try to make a small multi zone player, I ve discovered that I can successfully play mp3 files, which are common and stereo, to Mono (only) Left speaker and another mp3 to Mono right speaker using the flags:

....BASSFlag.BASS_SPEAKER_FRONTLEFT | BASSFlag.BASS_SAMPLE_MONO

but when I try to create a new stream from ogg (common stereo) file I get:
BASS_ERROR_SPEAKER

am I missing something? is there any way to successfully do this?
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #1 on: 7 Mar '11 - 15:42 »
Reply with quoteQuote

Unlike the MP3 decoder, the OGG decoder doesn't support the BASS_SAMPLE_MONO flag. So the problem there is that you end up trying to assign a stereo stream to a mono speaker, resulting in BASS_ERROR_SPEAKER. To convert any stereo stream to mono, you could use the BASSmix add-on. Something like this...

HSTREAM decoder=BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_DECODE); // create a decoder for the file
BASS_CHANNELINFO ci;
BASS_ChannelGetInfo(decoder, &ci); // get the format info
downmix=BASS_Mixer_StreamCreate(ci.freq, 1, BASS_SPEAKER_FRONTLEFT); // create mono mixer with same sample rate on front-left speaker
BASS_Mixer_StreamAddChannel(downmix, decoder, BASS_MIXER_DOWNMIX); // add the decoder to the mixer with downmixing enabled
BASS_ChannelPlay(downmix, FALSE); // start playing
Logged
icecbr
Posts: 16


« Reply #2 on: 8 Mar '11 - 20:42 »
Reply with quoteQuote

Thank you very much Ian, I converted to c# and successfully no errors and sound ok.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines