Hi there :-)
I have a little problem concerning the switching to another playback device.
I am playing my mixer source channel like this:
stream = Bass.BASS_StreamCreateFile(CurrentMP3Info.Filename, 0, 0, BASSFlag.BASS_STREAM_PRESCAN Or BASSFlag.BASS_STREAM_DECODE)
MainModule.streamfx(WhichDeck - 1) = BassFx.BASS_FX_TempoCreate(stream, BASSFlag.BASS_FX_FREESOURCE Or BASSFlag.BASS_STREAM_DECODE)
BassMix.BASS_Mixer_StreamAddChannel(MainModule.mixer, MainModule.streamfx(WhichDeck - 1), BASSFlag.BASS_MIXER_NORAMPIN Or BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_BUFFER)
Now I want streamfx(WhichDeck - 1) to not play via the mixer anymore, but to hear over another playback device:
Public Sub SwitchToHeadPhones_Execute(obj As Object)
Dim Position As Long = Bass.BASS_ChannelGetPosition(stream)
Debug.WriteLine("Position: " & CStr(Position) & " Error: " & CStr(Bass.BASS_ErrorGetCode))
BassMix.BASS_Mixer_ChannelRemove(MainModule.streamfx(WhichDeck - 1))
Debug.WriteLine("ChannelRemove Error: " & CStr(Bass.BASS_ErrorGetCode))
Bass.BASS_ChannelSetDevice(MainModule.streamfx(WhichDeck - 1), MainModule.HeadPhoneIndex)
Debug.WriteLine("ChannelSetDevice Error: " & CStr(Bass.BASS_ErrorGetCode))
Bass.BASS_ChannelSetPosition(stream, Position)
Debug.WriteLine("ChannelSetPosition Error: " & CStr(Bass.BASS_ErrorGetCode))
Bass.BASS_ChannelPlay(MainModule.streamfx(WhichDeck - 1), False)
Debug.WriteLine("ChannelPlay Fehler: " & CStr(Bass.BASS_ErrorGetCode))
End Sub
Unfortunately, I get error #5 (invalid handle) on ChannelSetDevice, ChannelSetPosition and ChannelPlay...
Anybody know what I am doing wrong or can give me a recoemmendation on how to do this better?