23 May '13 - 09:09 *
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: [VB.NET] - BassMix Question  (Read 2016 times)
radioDJro
Posts: 42


« on: 11 Aug '09 - 10:40 »
Reply with quoteQuote

In my application i use two alternating bass channels for music and a few for jingles and promos. Yesterday i decided to add a audio compressor to the final output, but without BassMix i don't think is possible to use a global efx from BassFx.

So, my question is: how to use BassMix in vb.net because i didn't find any example for vb.net in documentation (or i missed it  Huh).

For what i undestand, with bassmix i can mix all the channels i have into one and maybe i will manage to put the efx there.

Thanks,
Mario
Logged
radio42
Posts: 4012


« Reply #1 on: 11 Aug '09 - 11:05 »
Reply with quoteQuote

The "BassMix.BASS_Mixer_StreamCreate" method contains an example.
It is located in the BASS.NET help under the namespace: Un4seen.Bass.AddOn.Mix

' this will be the final mixer output stream being played
Dim mixer As Integer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT)
' now we need some channels to plug them in...create two decoding sources
Dim streamA As Integer = Bass.BASS_StreamCreateFile("testA.mp3", 0, 0,
                              BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
Dim streamB As Integer = Bass.BASS_StreamCreateFile("testB.mp3", 0, 0,
                              BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
' finally we plug them into the mixer (no downmix, since we assume the sources to be stereo)
Dim okA As Boolean = BassMix.BASS_Mixer_StreamAddChannel(mixer, streamA, BASSFlag.BASS_DEFAULT)
Dim okB As Boolean = BassMix.BASS_Mixer_StreamAddChannel(mixer, streamB, BASSFlag.BASS_DEFAULT)
' and play it...
Bass.BASS_ChannelPlay(mixer, False)

However, without BASSmix you would need to set the FX on each individual channel - but with a mixer steam you might set the FX to this one.
Logged
radioDJro
Posts: 42


« Reply #2 on: 11 Aug '09 - 12:35 »
Reply with quoteQuote

Thank you very much Bernd.
Logged
Sherlock
Guest
« Reply #3 on: 27 Aug '09 - 18:49 »
Reply with quoteQuote

I'm using same example (only in C#, which doesn't matter) and instead of loading files I'm using byte[]. For some reason sounds don't play in parallel, rather sequentially and I'm only able to play sequence once. Subsequent calls to Bass.BASS_ChannelPlay(mixerStream, true); don't produce anything.

Additionally I'm looking at public class SimpleMix from installed samples, but I'm not able to determine how it should work from a user's perspective. App runs first file added and if I"m fast enough to add second track (while 1st is playing) it'll play it also. Once it stops I can't make it play again. Setting envelope yields no results. Ultimately I'm looking for working example (or pseudo-code) to mix multiple inputs into single output. Will library be able to handle the fact that each input was encoded with different codec? Individually it plays them just fine, so codecs are located from the system ok.

Logged
radio42
Posts: 4012


« Reply #4 on: 27 Aug '09 - 19:41 »
Reply with quoteQuote

Note, that you only need to call Bass.BASS_ChannelPlay once for the mixer stream!
There is no need to call BASS_ChannelPlay again for new sources being added (as the mixer is already playing ;-)

So adding source to the mixer should immediately play then (even in parallel and independed from the ormat of the sources).

So may be I don't fully understand your issue or better to say why the sources would play sequentially one after to other.
So may be you can post some of your code to see what exactly is wrong with it...
Logged
Sherlock
Guest
« Reply #5 on: 27 Aug '09 - 23:15 »
Reply with quoteQuote

Note, that you only need to call Bass.BASS_ChannelPlay once for the mixer stream!
There is no need to call BASS_ChannelPlay again for new sources being added (as the mixer is already playing ;-)

So adding source to the mixer should immediately play then (even in parallel and independed from the ormat of the sources).

So may be I don't fully understand your issue or better to say why the sources would play sequentially one after to other.
So may be you can post some of your code to see what exactly is wrong with it...

Thanks for your quick response. I got it working now. I think I was confused by some audio sources I was using, mainly because one of them had initial "blank" period.
Now I see that once all sources are finished playing mixer's output becomes BASS_ACTIVE_STALLED. So if I to "rewind' to beginning and play it again, I assume to use Bass.BASS_ChannelSetPosition(mixerStream, 0), it returns true, but doesn't produce desired result. Any advice?
Logged
radioDJro
Posts: 42


« Reply #6 on: 28 Aug '09 - 05:30 »
Reply with quoteQuote

I don't think is possible to rewind the whole mix using Bass.BASS_ChannelSetPosition().
Instead you can rewind any stream
BassMix.BASS_Mixer_ChannelSetPosition(streamA, 0)
Bass.BASS_ChannelPlay(mixer, False)
This will set up a new position only for the streamA.

Regards,
Mario
« Last Edit: 28 Aug '09 - 05:52 by radioDJro » Logged
Sherlock
Guest
« Reply #7 on: 28 Aug '09 - 16:22 »
Reply with quoteQuote

I don't think is possible to rewind the whole mix using Bass.BASS_ChannelSetPosition().
Instead you can rewind any stream
BassMix.BASS_Mixer_ChannelSetPosition(streamA, 0)
Bass.BASS_ChannelPlay(mixer, False)
This will set up a new position only for the streamA.

Regards,
Mario

Thanks. So what happens if mix channel is stopped? Or should it be paused?
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines