20 May '13 - 05:00 *
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: BASSASIO, BASSMIX & VB.NET No Audio  (Read 463 times)
DjPsychoNL
Posts: 6


« on: 2 Mar '12 - 12:22 »
Reply with quoteQuote

Having problems with initialising BASSASIO. I have 2 streams pluged into a mixer, and want the output of the mixer sent to channel 0 and 1 of the ASIO audio interface. All init functions return True, but still no audio. Suggestions?

iDeviceID = Integer = my audio device id
IMixer = Integer = my mixer handle

Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)
BassAsio.BASS_ASIO_Init(iDeviceID, BASSASIOInit.BASS_ASIO_THREAD)

iMixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT)
Bass.BASS_ChannelPlay(iMixer, False)

_myAsioProc = New ASIOPROC(AddressOf AsioCallback)

BassAsio.BASS_ASIO_ChannelEnable(False, 0, _myAsioProc, New IntPtr(iMixer))
BassAsio.BASS_ASIO_ChannelJoin(False, 1, 0)
BassAsio.BASS_ASIO_Start(512)

I plug in my streams like this:
pStream = Bass.BASS_StreamCreateFile("C:\Test.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
BassMix.BASS_Mixer_StreamAddChannel(iMixer, pStream, BASSFlag.BASS_MIXER_PAUSE)

When i play/start the streams they won't play, they stay at position 0. Having no problems at all using the standard WDM driver (bass.dll)
Thank you for your time! Help is much appreciated!
« Last Edit: 2 Mar '12 - 12:30 by DjPsychoNL » Logged
radio42
Posts: 4012


« Reply #1 on: 2 Mar '12 - 12:23 »
Reply with quoteQuote

a) How does your "AsioCallback" look like?
I assume, that you call 'BASS_ChannelGetData' on the 'iMixer' stream in it?!
Note, that you should make your 'iMixer' stream a decoding one, i.e. add the BASS_STREAM_DECODE flag to your mixer creation.
Otherwise the mixer stream would be already 'playing' through your default device (-1) and as such this would 'steal' the data from it.

b) You are adding the 'pStream' in paused mode to the mixer.
Are you unpausing it somewhere?
Logged
DjPsychoNL
Posts: 6


« Reply #2 on: 2 Mar '12 - 12:35 »
Reply with quoteQuote

Hi Radio42 thank you for your time,

this is my asio callback routine:

Private Function AsioCallback(ByVal input As Boolean, ByVal channel As Integer, ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr) As Integer
        Return Bass.BASS_ChannelGetData(user.ToInt32(), buffer, length)
    End Function

I also tried to replace the Bass.BASS_ChannelGetData for the mixer function BassMix.BASS_Mixer_ChannelGetData but then my soundcard is making a realy iritating haning noise on the application startup.

Your questions:

A) Yes i'm doing Bass_ChannelGetData on the iMixer stream (wich is the handle of the mixer stream).

B) Yes i'm initialising the streams in pause mode and start the streams manualy using BassMix.BASS_Mixer_ChannelPlay

Also i checked the return state's of init commands of my first post, they all return true, so i guess everything is initialised correct.
« Last Edit: 2 Mar '12 - 12:39 by DjPsychoNL » Logged
DjPsychoNL
Posts: 6


« Reply #3 on: 2 Mar '12 - 12:44 »
Reply with quoteQuote

Yesss it works, i added the DECODING flag the the mixer creation just like you said. But now my stream is playing twice as slow. In the documentation i thought i read that i always need to init Bass with the Default sounddevice (-1), do i need to set this to 0 or some sort of Disabled state when only using ASIO?

i Tried to delete the FLOAT flag from the mixer creation, so that leaves me up to:

iMixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE)

But that result in correct tempo play, but terrible distorted.

Ok so now i have this (resulting in play twice as slow playing):

If Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) = False Then MsgBox("Failed: Bass.BASS_Init")
If BassAsio.BASS_ASIO_Init(iDeviceID, BASSASIOInit.BASS_ASIO_THREAD) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_Init")

iMixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_STREAM_DECODE)
Bass.BASS_ChannelPlay(iMixer, False)

_myAsioProc = New ASIOPROC(AddressOf AsioCallback)

If BassAsio.BASS_ASIO_ChannelEnable(False, 0, _myAsioProc, New IntPtr(iMixer)) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_ChannelEnable")
If BassAsio.BASS_ASIO_ChannelSetFormat(False, 0, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_ChannelSetFormat")
If BassAsio.BASS_ASIO_Start(0) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_Start")

« Last Edit: 2 Mar '12 - 12:51 by DjPsychoNL » Logged
DjPsychoNL
Posts: 6


« Reply #4 on: 2 Mar '12 - 12:56 »
Reply with quoteQuote

Ok i forgot to join the second channel, everythink works like a charm now Smiley Thank you Radio42!!
This the final code, maybe to help someone else:

If Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) = False Then MsgBox("Failed: Bass.BASS_Init")
If BassAsio.BASS_ASIO_Init(iDeviceID, BASSASIOInit.BASS_ASIO_THREAD) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_Init")

iMixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_STREAM_DECODE)

_myAsioProc = New ASIOPROC(AddressOf AsioCallback)

If BassAsio.BASS_ASIO_ChannelEnable(False, 0, _myAsioProc, New IntPtr(iMixer)) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_ChannelEnable")
If BassAsio.BASS_ASIO_ChannelSetFormat(False, 0, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_ChannelSetFormat")
If BassAsio.BASS_ASIO_ChannelJoin(False, 1, 0) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_ChannelJoin")

If BassAsio.BASS_ASIO_Start(0) = False Then MsgBox("Failed: BassAsio.BASS_ASIO_Start")
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines