0

I am trying to create an audio player that can play multiple MP3 files at the same time. I thought I needed the BASSMIX add-on for that. I am using a code example from un4seen site.

It looks like this:

Imports System
Imports Un4seen.Bass
Imports Un4seen.Bass.AddOn.Mix

SNIP

    Shared Sub MixMeNow()
        Try


            Dim mixerStream As Integer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT)
            Debug.Print("MIXER STREAM: {0}", Bass.BASS_ErrorGetCode())

            ' now we need some source channels (must be decoding)
            Dim streamA As Integer = Bass.BASS_StreamCreateFile("KOUD-HE.mp3", 0, 0,
                                                BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
            Debug.Print("STREAM A: {0}", Bass.BASS_ErrorGetCode())
            Dim streamB As Integer = Bass.BASS_StreamCreateFile("Jij bent Zo.mp3", 0, 0,
                                               BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_SAMPLE_FLOAT)
            Debug.Print("STREAM B: {0}", Bass.BASS_ErrorGetCode())

            ' finally we plug them into the mixer
            BassMix.BASS_Mixer_StreamAddChannel(mixerStream, streamA,
                               BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_DOWNMIX)
            Debug.Print("STREAM A TO MIX: {0}", Bass.BASS_ErrorGetCode())


            BassMix.BASS_Mixer_StreamAddChannel(mixerStream, streamB,
                                BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_DOWNMIX)
            Debug.Print("STREAM B TO MIX: {0}", Bass.BASS_ErrorGetCode())

            ' and play the mixer channel
            Bass.BASS_ChannelPlay(mixerStream, False)
            Debug.Print("PLAY: {0}", Bass.BASS_ErrorGetCode())

        Catch ex As Exception
            Debug.Print("Anything else....")
        End Try
    End Sub

And then:

The only thing I have changed from the original sample is that I added a try/catch and I am echo-ing the error codes back to the console:

Debug.Print("STREAM A: {0}", Bass.BASS_ErrorGetCode())

I thought this was pretty straight-forward, but... The output is:

MIXER STREAM: BASS_OK
STREAM A: BASS_ERROR_INIT
STREAM B: BASS_ERROR_INIT
STREAM A TO MIX: BASS_ERROR_HANDLE
STREAM B TO MIX: BASS_ERROR_HANDLE
PLAY: BASS_ERROR_HANDLE

I have verified that the application can find the files it needs to play. So what do I keep getting the INIT error?

Jeroen
  • 460
  • 6
  • 14
  • Is that really all there is in terms of getting BASS to tell you details of the error? "There was an error during init"? Surely not-- add more code to make the output of your debug print more useful? – Caius Jard May 03 '20 at 06:04
  • Not that I am aware of... This is the official documentation: http://www.un4seen.com/doc/#bass/BASS_ErrorGetCode.html – Jeroen May 03 '20 at 10:18
  • Does it work if you give it the full paths to the files? – Andrew Morton May 03 '20 at 15:53
  • @AndrewMorton I was able to play the files using the example from here: http://www.bass.radio42.com/help/html/b8b8a713-7af4-465e-a612-1acd769d4639.htm#Using (look for "My First BASS Application"). – Jeroen May 06 '20 at 00:17

0 Answers0