@Chris
It returns 2, just like it's supposed to be when I switch devices first. If not, it returns 0...
This is how I start playback:
Public Sub Abspielen_Execute(obj As Object)
If IsNewSong = True Then
Bass.BASS_ChannelStop(stream) 'stop source channel
BassMix.BASS_Mixer_ChannelRemove(MainModule.streamfx(WhichDeck - 1))
If stream <> 0 Then Bass.BASS_StreamFree(stream) 'free source channel
Dim AudioFile As System.IO.FileStream = System.IO.File.OpenRead(AktuelleMP3Info.FileName) 'load audio file
Dim Length As Long = AudioFile.Length
Dim Buffer(CInt(Length)) As Byte
AudioFile.Read(Buffer, 0, CInt(Laenge))
AudioFile.Close()
Dim Handle As System.Runtime.InteropServices.GCHandle = Runtime.InteropServices.GCHandle.Alloc(Buffer, Runtime.InteropServices.GCHandleType.Pinned)
stream = Bass.BASS_StreamCreateFile(Handle.AddrOfPinnedObject(), 0L, Length, BASSFlag.BASS_STREAM_PRESCAN Or BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_STREAM_DECODE)
CreateMyWaveForm()
WaveFormTimer.Start()
If MainModule.streamfx(WhichDeck - 1) <> 0 Then Bass.BASS_StreamFree(MainModule.streamfx(WhichDeck - 1)) 'free source effects channel
MainModule.streamfx(WhichDeck - 1) = BassFx.BASS_FX_TempoCreate(stream, BASSFlag.BASS_STREAM_DECODE) 'set source effects channel
BassMix.BASS_Mixer_StreamAddChannel(MainModule.mixer, MainModule.streamfx(WhichDeck - 1), BASSFlag.BASS_MIXER_NORAMPIN Or BASSFlag.BASS_MIXER_BUFFER) 'start playing
SyncStreamFreed = New SYNCPROC(AddressOf FreedSync)
Bass.BASS_ChannelSetSync(MainModule.streamfx(WhichDeck - 1), BASSSync.BASS_SYNC_FREE, 0, SyncStreamFreed, IntPtr.Zero)SyncTrackEnd = New SYNCPROC(AddressOf WhenTrackEnded)
Bass.BASS_ChannelSetSync(stream, BASSSync.BASS_SYNC_END, 0, SyncTrackEnd, IntPtr.Zero)
End If
End Sub
Public Sub CreateMyWaveForm()
MyWaveForm = New WaveForm(AktuelleMP3Info.Dateiname, New WAVEFORMPROC(AddressOf MeineWellenFormCallBackFunktion), Nothing)
InitializeWaveForm()
MyWaveFrom.RenderStart(True, BASSFlag.BASS_SAMPLE_FLOAT Or BASSFlag.BASS_STREAM_PRESCAN Or BASSFlag.BASS_DEFAULT)
End Sub
Private Sub InitializeWaveForm()
MeineWellenForm.ColorBackground = System.Drawing.Color.Black
[... all the different colors of the wavform are being set here...]
End Sub