Montag, 9. Februar 2015

Piano Musiksoftware mit allen Features in Visual Basic programmieren


Piano Musiksoftware mit allen Features in Visual Basic programmieren

Author D.Selzer-McKenzie

Video: http://youtu.be/Rk1-AvurwfU

In diesem Video zeige ich Ihnen, wie Sie eine komplette umfangreiche Musiksoftware mit allen Features entwickeln und programmieren.

Den Quellecode finden Sie im


Und


 

Code:

Imports System.IO

Imports System.Diagnostics

Imports System.Drawing.Imaging

Imports System.Runtime.InteropServices

Imports System.Drawing.Drawing2D

Public Class frmPianoKeyboard

    '.............................

    'für Tonaufnahme

    Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrreturnString As String, ByVal uReturnLength As Integer, ByVal hvndCallback As Integer) As Integer

    '.............................

 

    Private WithEvents CMI As clsMIDIin

    Private WithEvents CMO As clsMidiOut

    Private mSFManager As clsSFMan

 

    Private mBankTable As DataTable

 

    Private mPresetTable As DataTable

 

    Private mMidiRunning As Boolean

    Private mButtonText() As String = {"Midi Stop", "Midi Start"}

 

    Private Delegate Sub delgSetChkSust1(ByVal value As Boolean)

 

    Private Delegate Sub DelgSetX(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

 

    Private mVolFlag As Boolean

    Private mPitchBendFlag As Boolean

    Private mSust1Flag As Boolean

    Private mModulationFlag As Boolean

    Private mInitialPitchFlag As Boolean

    Private mReverbFlag As Boolean

    Private mChorusFlag As Boolean

 

    Private mMidiOutFlag As Boolean

    Private mMidiInFlag As Boolean

 

    Private mPresetFlag As Boolean

    Private mBankSelectFlag As Boolean

    Private mPanFlag As Boolean

 

    Private mMidiStartFlag As Boolean

 

    Private mMidiOutDevName As String = ""

    Private mMidiInDevName As String = ""

    Private mMidiOutIndex As Integer = -1

    Private mMidiInIndex As Integer = -1

    Private mBankIndex As Integer

    Private mPresetIndex As Integer

 

    Private mLoading As Boolean

 

    Private mFlag As Boolean

 

#Region "Private Hilfsprozeduren"

 

    Private Sub SetChkSust1(ByVal value As Boolean)

        If Me.InvokeRequired Then

            Dim D As New delgSetChkSust1(AddressOf SetChkSust1)

            Me.Invoke(D, value)

        Else

            chkSust1.Checked = value

        End If

    End Sub

 

    Private Sub SetBank(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetBank)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If CMO IsNot Nothing Then

                If Not mBankSelectFlag Then

                    mBankSelectFlag = True

                    If CMO.SBBankSelect(Channel, Value) Then

                        cboBank.SelectedIndex = Value

                        mBankIndex = Value

                        EnableSFBButtons()

                        ' ComboBox cboPreset mit den neuen Presets füllen.

                        FillCboPreset()

                    End If

                    mBankSelectFlag = False

                End If

            End If

        End If

    End Sub

 

    Private Sub SetPreset(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetPreset)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mPresetFlag Then

                mPresetFlag = True

                Dim OldPreset As Integer = cboPreset.SelectedIndex

                If CMO IsNot Nothing Then

                    If CMO.ProgramChange(Channel, CByte(Value)) Then

 

                        cboPreset.SelectedIndex = Value

 

                    Else

                        cboPreset.SelectedIndex = OldPreset

                    End If

                Else

                    cboPreset.SelectedIndex = OldPreset

                End If

 

                mPresetFlag = False

                mPresetIndex = cboPreset.SelectedIndex

                lblInstrument.Text = "Instrument"

                If mPresetIndex > -1 Then

                    lblInstrument.Text &= "   [" & cboPreset.SelectedIndex.ToString & "]"

                End If

            End If

        End If

    End Sub

 

    Private Sub SetPanorama(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetPanorama)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mPanFlag Then

                mPanFlag = True

                If CMO IsNot Nothing Then

                    If CMO.Panorama(Channel, Value) Then

                        trbPanorama.Value = Value

                        lblPanorama.Text = "Panorama: " & (Value - 64).ToString

                    End If

                End If

                mPanFlag = False

            End If

        End If

    End Sub

 

    Private Sub SetVolume(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetVolume)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mVolFlag Then

                mVolFlag = True

                If CMO IsNot Nothing Then

                    CMO.ControlChange(clsMidiOut.MidiChannels.Ch0, 7, CByte(Value))

                End If

                lblVolLeft.Text = Value.ToString

                trbVolume.Value = Value

                trbVolume.Tag = Value / 127

                mVolFlag = False

            End If

        End If

    End Sub

 

    Private Sub SetPitchBend(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetPitchBend)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mPitchBendFlag Then

                mPitchBendFlag = True

 

                If CMO IsNot Nothing Then

                    If CMO.IsSoundFontDevice Then

                        CMO.PitchBend(Channel, Value)

                    End If

                    trbPitchBend.Value = Value

                End If

 

                lblPitchBendValue.Text = (Value - 64).ToString

                mPitchBendFlag = False

            End If

        End If

    End Sub

 

    Private Sub SetModulation(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetModulation)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mModulationFlag Then

                mModulationFlag = True

                If CMO IsNot Nothing Then

                    CMO.Modulation(Channel, Value)

                    trbModulation.Value = Value

                End If

                lblModulationValue.Text = Value.ToString

                mModulationFlag = False

            End If

        End If

    End Sub

 

    Private Sub SetInitialPitch(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetInitialPitch)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mInitialPitchFlag Then

                mInitialPitchFlag = True

                If CMO IsNot Nothing Then

                    CMO.InitialPitch(Channel, Value)

                    trbInitialPitch.Value = Value

                End If

                gbInitialPitch.Text = "Initial Pitch: " & Value.ToString

                mInitialPitchFlag = False

            End If

        End If

    End Sub

 

    Private Sub SetReverb(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetReverb)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mReverbFlag Then

                mReverbFlag = True

                If CMO IsNot Nothing Then

                    CMO.Reverb(Channel, Value)

                    trbReverb.Value = Value

                End If

            End If

            mReverbFlag = False

        End If

    End Sub

 

    Private Sub SetChorus(ByVal Channel As clsMidiOut.MidiChannels, ByVal Value As Integer)

        If Me.InvokeRequired Then

            Dim D As New DelgSetX(AddressOf SetChorus)

            Dim ParArray(1) As Object

            ParArray(0) = Channel

            ParArray(1) = Value

            Me.Invoke(D, ParArray)

        Else

            If Not mChorusFlag Then

                mChorusFlag = True

                If CMO IsNot Nothing Then

                    CMO.Chorus(Channel, Value)

                    trbChorus.Value = Value

                End If

            End If

            mChorusFlag = False

        End If

    End Sub

 

 

 

    Private Sub FillCboBank(ByVal SfDeviceIndex As UShort)

        ' bindet die ComboBox cboBank an eine DataTable mit den Feldern

        ' 0 ID (Int16)

        ' 1 ExtDescription (String)

        ' 2 Description (String)

        ' 3 FilePath (String)

 

 

        If mSFManager Is Nothing Then

            mSFManager = New clsSFMan

        End If

 

        cboBank.DataSource = Nothing

        cboBank.Items.Clear()

 

        If mBankTable IsNot Nothing Then

            mBankTable.Clear()

            mBankTable.Dispose()

        End If

 

        mBankTable = mSFManager.GetBankTable(SfDeviceIndex)

 

 

        cboBank.ValueMember = mBankTable.Columns(0).ColumnName

        cboBank.DisplayMember = mBankTable.Columns(1).ColumnName

 

        mBankSelectFlag = True

        cboBank.DataSource = mBankTable

        mBankSelectFlag = False

 

    End Sub

 

    Private Sub FillCboPreset()

        'Bindet die ComboBox cboPreset an eine DataTable mit den Feldern

        ' 0 PresetIndex (Integer)

        ' 1 ExtPresetDescription (String) z.B. "[001]  Piano"

        ' 2 PresetDescription(String) z.B. "Piano"

 

        If cboMidiOut.SelectedIndex > -1 Then

            Dim CMoc As clsMidiOut.CMidiOutCaps

            CMoc = DirectCast(cboMidiOut.SelectedItem, clsMidiOut.CMidiOutCaps)

 

            mPresetFlag = True  ' ***

            cboPreset.DataSource = Nothing

            cboPreset.Items.Clear()

            mPresetFlag = False ' ***

 

            If mPresetTable IsNot Nothing Then

                mPresetTable.Clear()

                mPresetTable.Dispose()

            End If

 

 

            If CMoc.IsSoundFontDevice Then

                ' Preset für Soundfont-Geräte

                If mSFManager Is Nothing Then

                    mSFManager = New clsSFMan

                End If

                Dim DevIndex As UShort = CMoc.SFDeviceIndex

 

                If cboBank.Text.Length > 0 Then

                    Dim BankIndex As UShort = CType(cboBank.SelectedValue, UShort)

                    mPresetTable = mSFManager.GetLoadedPresetsDT(DevIndex, BankIndex)

 

                Else

                    ' Soundfont-Gerät ohne akt. Bankauswahl.

                    ' Dieser Zweig könnte vorkommen,wenn alle

                    ' SF-Bänke z.B. von einem externen Programm

                    ' gelöscht worden sind.

                    cboPreset.DataSource = Nothing

                    cboPreset.Items.Clear()

 

                    Exit Sub

                End If

 

            Else

 

                ' Preset für NICHT-Soundfont-Geräte

                mPresetTable = clsPreset.GetGMPresetTable

 

            End If

 

            cboPreset.DisplayMember = "extPresetDescription"

            cboPreset.ValueMember = "PresetIndex"

 

            mPresetFlag = True  ' ***

            cboPreset.DataSource = mPresetTable

            mPresetFlag = False ' ***

 

 

            Dim PresetDescription As String = DirectCast(cboPreset.Items(mPresetIndex), DataRowView).Item(2).ToString

 

            If PresetDescription.Length > 0 Then

                ' cboPreset.Items(mPresetIndex) enthält einen gültigen Instrumenteneintrag.

                cboPreset.SelectedIndex = mPresetIndex

            Else

                ' cboPreset.Items(mPresetIndex) ist leer.

                Dim i As Integer

                ' ersten nicht leeren Eintrag in cboPreset suchen

                For i = 0 To 127

                    PresetDescription = DirectCast(cboPreset.Items(i), DataRowView).Item(2).ToString

                    If PresetDescription.Length > 0 Then

                        cboPreset.SelectedIndex = i

                        Exit For

                    End If

                Next

            End If

 

        End If

    End Sub

 

    Private Sub FillCboMidiIn()

        ' Füllt die ComboBox cboMidiIn mit clsMIDIin.CMidiInCaps-Objekten

 

        Dim ExcList As List(Of Exception) = Nothing

        Dim MiList As List(Of clsMIDIin.CMidiInCaps) = Nothing

        Dim MIC As clsMIDIin.CMidiInCaps

        Dim OldSelection As Integer = -1

 

        clsMIDIin.GetAllMidiInCaps(MiList, ExcList)

        cboMidiIn.Items.Clear()

        For Each MIC In MiList

            cboMidiIn.Items.Add(MIC)

        Next

        cboMidiIn.DisplayMember = "ProductName"

    End Sub

 

    Private Sub FillCboMidiOut()

        ' Füllt die ComboBox cboMidiOut mit clsMidiOut.CMidiOutCaps-Objekten.

 

        If mSFManager Is Nothing Then

            mSFManager = New clsSFMan

        End If

 

        ' Alle Midi-Out-Geräte

        Dim ExList As List(Of Exception) = Nothing

        Dim MoList As List(Of clsMidiOut.CMidiOutCaps) = Nothing

 

        clsMidiOut.GetAllMidiOutCaps(mSFManager, MoList, ExList)

 

        cboMidiOut.DisplayMember = "ProductName"

 

        cboMidiOut.DataSource = MoList

    End Sub

 

    Private Sub MidiStart()

        Dim strMsg As String = ""

 

        If mSFManager Is Nothing Then

            mSFManager = New clsSFMan

        End If

 

 

        ' *************************

        ' cboMidiOut neu befüllen

        ' *************************

        mMidiOutFlag = True

        FillCboMidiOut()

        ' Code in cboMidiOut_SelectedIndexChanged wird durch FillCboMidiOut wg. mLoading = True noch nicht ausgeführt.

        If cboMidiOut.Items.Count > 0 Then

            If mLoading Then

                Dim MidiOutDevName As String = My.Settings.MidiOutDevice

                mMidiOutIndex = cboMidiOut.FindStringExact(MidiOutDevName)

            End If

            If mMidiOutIndex < 0 Then

                mMidiOutIndex = 0

            End If

 

            cboMidiOut.SelectedIndex = mMidiOutIndex

 

        Else

            MsgBox("Kein Midi-Ausgabegerät gefunden!")

        End If

        mMidiOutFlag = False

 

 

 

        ' *************************

        ' cboMidiIn neu befüllen

        ' *************************

        mMidiInFlag = True

        FillCboMidiIn()

        ' Code in cboMidiIn_SelectedIndexChanged wird durch FillCboMidiIn wg. mLoading = True noch nicht ausgeführt.

        If cboMidiIn.Items.Count > 0 Then

            If mLoading Then

                mMidiInDevName = My.Settings.MidiInDevice

                mMidiInIndex = cboMidiIn.FindStringExact(mMidiInDevName)

            End If

            If mMidiInIndex < 0 Then

                mMidiInIndex = 0

            End If

 

            cboMidiIn.SelectedIndex = mMidiInIndex

        Else

            MsgBox("Kein Midi-Eingabegerät gefunden!")

        End If

        mMidiInFlag = False

 

 

        Dim VolumeValue As Integer

        Dim ReverbValue As Integer

        Dim ChorusValue As Integer

        Dim ModulationValue As Integer

        Dim PanoramaValue As Integer

        Dim InitialPitchValue As Integer

        Dim PitchBendValue As Integer

 

        If mLoading Then

            VolumeValue = My.Settings.VolumeValue

            ReverbValue = My.Settings.ReverbValue

            ChorusValue = My.Settings.ChorusValue

            ModulationValue = My.Settings.ModulationValue

            PanoramaValue = My.Settings.Panorama

            InitialPitchValue = My.Settings.InitialPitchValue

            PitchBendValue = My.Settings.PitchBendValue

            If PitchBendValue = 0 Then

                PitchBendValue = 64

            End If

 

            mBankIndex = My.Settings.BankIndex

            mPresetIndex = My.Settings.PresetIndex

        Else

            VolumeValue = trbVolume.Value

            ReverbValue = trbReverb.Value

            ChorusValue = trbChorus.Value

            ModulationValue = trbModulation.Value

            PanoramaValue = trbPanorama.Value

            InitialPitchValue = trbInitialPitch.Value

            PitchBendValue = trbPitchBend.Value

        End If

 

 

        ' *************************

        ' falls mLoading noch gesetzt

        ' ist, hier rücksetzen.

        mLoading = False

        ' *************************

 

 

        If cboMidiOut.SelectedIndex > -1 Then

 

            ' MidiOut-Klasse erstellen

            CMO = New clsMidiOut(cboMidiOut.SelectedIndex, mSFManager)

 

 

            ' Midi-Out öffnen

            If CMO.Open(True) Then

 

                If cboMidiIn.SelectedIndex > -1 Then

                    CMI = New clsMIDIin(cboMidiIn.SelectedIndex)

                    If CMI.Open(True) Then

 

                        CMI.StartMidiIn()

                        CMO.Connect(CMI)

 

                    Else

                        strMsg = CMI.LastException.Message

                    End If

                Else

                    strMsg = "Kein MidiIn-Gerät ausgewählt!"

                End If

 

 

                mMidiRunning = True

 

                If CMO.IsSoundFontDevice Then

 

                    ' *************************

                    ' Wenn SoundFont-Gerät, dann

                    ' ComboBox cboBank füllen

                    ' *************************

                    mBankSelectFlag = True

                    FillCboBank(CType(CMO.SoundFontDeviceID, UInt16))

                    mBankSelectFlag = False

 

 

                    ' Feldbelegung der in cboBank gespeicherten DataRowViews

                    ' 0 ID (Int16)

                    ' 1 ExtDescription (String)

                    ' 2 Description (String)

                    ' 3 FilePath (String)

 

                    If cboBank.Items.Count > 0 Then

                        If mBankIndex < 0 Then

                            mBankIndex = 0

                        End If

                        ' *************************

                        ' SF-Bank setzen

                        ' *************************

                        Dim BankDescription As String = DirectCast(cboBank.Items(mBankIndex), DataRowView).Item(2).ToString

                        If BankDescription.Length > 0 Then

                            ' cboBank.items(mBankIndex) verweist auf eine geladene Bank.

 

                            ' SetBank ruft auch FillCboPreset auf.

                            SetBank(clsMidiOut.MidiChannels.Ch0, mBankIndex)

 

                        Else

                            ' cboBank.items(mBankIndex) verweist auf eine leere Bank.

                            Dim i As Integer

                            For i = 0 To 127

                                BankDescription = DirectCast(cboBank.Items(i), DataRowView).Item(2).ToString

                                If BankDescription.Length > 0 Then

 

                                    ' SetBank ruft auch FillCboPreset auf.

                                    SetBank(clsMidiOut.MidiChannels.Ch0, i)

                                    Exit Sub

 

                                End If

                            Next

                        End If

 

 

                    End If

 

                    SetInitialPitch(clsMidiOut.MidiChannels.Ch0, InitialPitchValue)

 

                Else

                    ' Kein Soundfont-Gerät.

 

                    ' Combobox cboPreset füllen, da bei Nicht-Soundfontgeräten

                    ' kein SetBank mit implizitem FillcboPreset ausgeführt wird.

                    mPresetFlag = True

                    FillCboPreset()

                    mPresetFlag = False

 

                    SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

 

                End If

 

 

 

 

 

 

                If cboPreset.Items.Count > 0 Then

                    If mPresetIndex < 0 Then

                        mPresetIndex = 0

                    End If

                    ' *************************

                    ' Preset (Instrument) setzen

                    ' *************************

                    SetPreset(clsMidiOut.MidiChannels.Ch0, mPresetIndex)

 

                End If

 

                SetVolume(clsMidiOut.MidiChannels.Ch0, VolumeValue)

                SetReverb(clsMidiOut.MidiChannels.Ch0, ReverbValue)

                SetChorus(clsMidiOut.MidiChannels.Ch0, ChorusValue)

                SetModulation(clsMidiOut.MidiChannels.Ch0, ModulationValue)

                SetPitchBend(clsMidiOut.MidiChannels.Ch0, PitchBendValue)

                SetPanorama(clsMidiOut.MidiChannels.Ch0, PanoramaValue)

 

                btnStart.Text = mButtonText(0)

 

            Else

                ' Midi-Out konnte nicht geöffnet werden

                strMsg = CMO.LastException.Message

            End If

 

        Else

            strMsg = "Kein MidiOut-Gerät ausgewählt!"

        End If

 

 

        If strMsg.Length > 0 Then

            MsgBox(strMsg, MsgBoxStyle.Exclamation)

        End If

 

        EnableSFBButtons()

 

    End Sub

 

    '''

    ''' Trennt Verbindung zwischen MidiIn und MidiOut,

    ''' Schliesst MidiIn und MidiOut,

    ''' Sperrt Bank- und Instrumentauswahl

    '''

    '''

    '''

    Private Sub MidiStop(ByVal CloseFlag As Boolean)

 

        If CMO IsNot Nothing Then

 

            If CMO.Status = clsMidiOut.MidiOutStatus.Open Then

                CMO.Reset()

            End If

            If CMI IsNot Nothing Then

                If CMI.Status = clsMIDIin.MidiInStatus.Open Then

                    CMI.Reset()

                End If

                CMO.Disconnect(CMI.Handle)

                If Not CMI.Close() Then

                    '***********************************

                    MsgBox("CMI.Close" & ControlChars.CrLf & CMI.LastException.Message, MsgBoxStyle.Exclamation)

                    '***********************************

                End If

                CMI.Dispose()

            End If

            If Not CMO.Close() Then

                '***********************************

                MsgBox("CMO.Close" & ControlChars.CrLf & CMO.LastException.Message, MsgBoxStyle.Exclamation)

                '***********************************

            End If

            CMO.Dispose()

        Else

            If CMI IsNot Nothing Then

                If CMI.Status = clsMIDIin.MidiInStatus.Open Then

                    CMI.Close()

                End If

                CMI.Dispose()

            End If

        End If

 

        mMidiRunning = False

        If Not CloseFlag Then

            btnStart.Text = mButtonText(1)

        End If

 

    End Sub

 

 

    Private Function ShowMsgBox(ByVal Message As String, ByVal Icon As MessageBoxIcon) As DialogResult

        Return ShowMsgBox(Message, MessageBoxButtons.OK, Icon, MessageBoxDefaultButton.Button1)

    End Function

 

    Private Function ShowMsgBox(ByVal Message As String, ByVal Button As MessageBoxButtons, ByVal Icon As MessageBoxIcon, ByVal DefaultButton As MessageBoxDefaultButton) As DialogResult

        Return MessageBox.Show(Message, IO.Path.GetFileName(Application.ExecutablePath), Button, Icon, DefaultButton)

    End Function

 

#End Region

 

 

#Region "Ereignisprozeduren Form/Controls"

 

 

    Private Sub frmMidiOrchestra_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        mLoading = True

 

        Me.Text = Application.ProductName

        cboMidiOut.DropDownStyle = ComboBoxStyle.DropDownList

        cboMidiIn.DropDownStyle = ComboBoxStyle.DropDownList

        cboBank.DropDownStyle = ComboBoxStyle.DropDownList

        cboPreset.DropDownStyle = ComboBoxStyle.DropDownList

        cboPreset.MaxDropDownItems = 15

 

        Me.Bounds = My.Settings.FormBounds

 

        mSFManager = New clsSFMan

 

        ' Midi-Verarbeitung wird in Sub frmMidiOrchestra_Shown gestartet.

    End Sub

 

    Private Function CheckValue(ByVal Value As Integer, ByVal Min As Integer, ByVal Max As Integer) As Boolean

        Select Case Value

            Case Min To Max

                Return True

            Case Else

                Return False

        End Select

    End Function

 

 

    Private Sub frmMidiOrchestra_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown

 

        ' Midi-Verarbeitung starten, nachdem die

        ' Form vollständig angezeigt wird.

        ' mLoading hat hier noch den Wert True

        MidiStart()

 

        ' mLoding wird normalerweise schon in MidiStart auf False gesetzt

        mLoading = False

 

        If hsbKeyboard.Maximum > hsbKeyboard.Minimum Then

            Try

                hsbKeyboard.Value = My.Settings.KeyBordPosition

 

            Catch ex As Exception

                ' Notausgang,

                ' falls ungültige Settings für KeyBoardPosition oder FormSettings eingelesen worden sind.

                hsbKeyboard.Value = (hsbKeyboard.Maximum + hsbKeyboard.Minimum) \ 2

            End Try

        End If

 

    End Sub

 

    Private Sub frmMidiOrchestra_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

 

        With My.Settings

 

            .FormBounds = Me.Bounds

 

            If cboMidiOut.SelectedIndex > -1 Then

                .MidiOutDevice = cboMidiOut.Text

            Else

                .MidiOutDevice = ""

            End If

 

 

            If cboMidiIn.SelectedIndex > -1 Then

                .MidiInDevice = DirectCast(cboMidiIn.SelectedItem, clsMIDIin.CMidiInCaps).ProductName

            Else

                .MidiInDevice = ""

            End If

 

            If cboBank.Items.Count > 0 Then

                .BankIndex = cboBank.SelectedIndex

            End If

 

            .PresetIndex = cboPreset.SelectedIndex

 

            .Panorama = trbPanorama.Value

            .ModulationValue = trbModulation.Value

            .PitchBendValue = trbPitchBend.Value

            .ChorusValue = trbChorus.Value

            .ReverbValue = trbReverb.Value

            .VolumeValue = trbVolume.Value

            .InitialPitchValue = trbInitialPitch.Value

            .KeyBordPosition = hsbKeyboard.Value

        End With

 

        MidiStop(True)

 

 

        If mSFManager IsNot Nothing Then

            mSFManager.Dispose()

        End If

 

    End Sub

 

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

 

        If btnStart.Text = mButtonText(0) Then

            MidiStop(False)

        Else

            Select Case True

                Case cboMidiOut.SelectedIndex < 0

                    FillCboMidiOut()

                    If cboMidiOut.SelectedIndex < 0 Then

                        MsgBox("Kein MidiOut-Gerät gefunden.", MsgBoxStyle.Exclamation)

                    Else

                        cboMidiOut.SelectedIndex = 0

                    End If

 

 

                Case cboMidiIn.SelectedIndex < 0

                    FillCboMidiIn()

                    If cboMidiIn.SelectedIndex < 0 Then

                        MsgBox("Kein MidiIN-Gerät gefunden.", MsgBoxStyle.Exclamation)

                    Else

                        cboMidiIn.SelectedIndex = 0

                    End If

 

                Case Else

                    MidiStart()

            End Select

        End If

    End Sub

 

 

    Private Sub cboMidiOut_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboMidiOut.SelectedIndexChanged

 

        If mMidiRunning Then

            MidiStop(False)

        End If

 

        If Not mLoading Then

            If Not mMidiOutFlag Then

                mMidiOutIndex = cboMidiOut.SelectedIndex

                If cboMidiOut.SelectedIndex > -1 Then

                    MidiStart()

                End If

 

            End If

        End If

 

    End Sub

 

    Private Sub cboMidiIn_SelectedIndexChanged _

                (ByVal sender As Object, ByVal e As System.EventArgs) _

                Handles cboMidiIn.SelectedIndexChanged

 

        If mMidiRunning Then

            MidiStop(False)

        End If

 

 

        If Not mLoading Then

            If Not mMidiInFlag Then

                mMidiInIndex = cboMidiIn.SelectedIndex

                MidiStart()

            End If

        End If

 

    End Sub

 

 

    Private Sub btnPanic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPanic.Click

        chkSust1.Checked = False

        chkTest.Checked = False

        If CMO IsNot Nothing Then

            CMO.Reset()

        End If

    End Sub

 

 

#End Region

 

 

#Region "MidiEvents"

 

    Private Sub CMI_MidiInEvent(ByVal sender As Object, ByVal e As clsMIDIin.MidiInEventArgs) Handles CMI.MidiInEvent

        Dim PName As String = "CMI_MidiEvent: "

        Dim MiPar1 As clsMIDIin.MidiInParam1 = CType(e.Param1, clsMIDIin.MidiInParam1)

        Dim MiPar2 As clsMIDIin.MidiInParam2 = CType(e.Param2, clsMIDIin.MidiInParam2)

 

        'With MiPar1

        '    Console.WriteLine("MidiCommand:" & .MidiCommand.ToString & "; MidiChannel: " & .MidiChannel.ToString & "; MidiData1: &h" & Hex(.MidiData1) & "; MidiData2: &h" & Hex(.MidiData2) & "; Mididata3: &h" & Hex(.MidiData3))

        'End With

 

        Select Case MiPar1.MidiCommand

 

            Case clsMIDIin.MidiCommands.ProgramChange

                ' Preset / Instrumentenauswahl

                Dim Channel As clsMidiOut.MidiChannels = CType(e.Param1.MidiChannel, clsMidiOut.MidiChannels)

                Dim PresetIndex As Integer = e.Param1.MidiData1

                SetPreset(Channel, PresetIndex)

 

            Case clsMIDIin.MidiCommands.ControlChange

                Select Case MiPar1.MidiData1

                    Case 1

                        ' Modulation

                        SetModulation(clsMidiOut.MidiChannels.Ch0, MiPar1.MidiData2)

 

                    Case 7

                        ' Volume

                        SetVolume(clsMidiOut.MidiChannels.Ch0, MiPar1.MidiData2)

 

                    Case 10

                        ' Panorama

                        SetPanorama(clsMidiOut.MidiChannels.Ch0, MiPar1.MidiData2)

 

                    Case 64

                        ' Sustain

                        mSust1Flag = True

                        SetChkSust1(MiPar1.MidiData2 > 0)

                        mSust1Flag = False

                End Select

 

            Case clsMIDIin.MidiCommands.PitchBend

                SetPitchBend(clsMidiOut.MidiChannels.Ch0, MiPar1.MidiData2)

 

                'Case clsMIDIin.MidiCommands.ActiveSensing

 

                'Case clsMIDIin.MidiCommands.NoteOn, clsMIDIin.MidiCommands.NoteOff

 

                'Case Else

 

        End Select

    End Sub

 

    Private Sub CMO_MidiOutEvent(ByVal sender As Object, ByVal e As clsMidiOut.MidiOutEventArgs) Handles CMO.MidiOutEvent

 

        'Console.WriteLine("CMO_MidiOutEvent: " & e.Message.ToString)

 

    End Sub

 

#End Region

 

    Private Sub trbPanorama_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles trbPanorama.PreviewKeyDown

        If (e.KeyCode = Keys.D0) Or (e.KeyCode = Keys.NumPad0) Then

            SetPanorama(clsMidiOut.MidiChannels.Ch0, 64)

        End If

    End Sub

 

 

    Private Sub trbPanorama_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbPanorama.ValueChanged

        SetPanorama(clsMidiOut.MidiChannels.Ch0, trbPanorama.Value)

    End Sub

 

    Private Sub lblPanorama_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPanorama.DoubleClick

        ' Panorama mit Doppelklick auf lblPanorama in Neutralstellung bringen.

        SetPanorama(clsMidiOut.MidiChannels.Ch0, 64)

    End Sub

 

    Private Sub trbVolume_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbVolume.ValueChanged

        SetVolume(clsMidiOut.MidiChannels.Ch0, trbVolume.Value)

    End Sub

 

    Private Sub trbReverb_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbReverb.ValueChanged

        Dim Value As Byte = CByte(trbReverb.Value)

        If CMO IsNot Nothing Then

            CMO.Reverb(clsMidiOut.MidiChannels.Ch0, Value)

        End If

        lblReverbValue.Text = Value.ToString

    End Sub

 

    Private Sub trbChorus_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbChorus.ValueChanged

        Dim Value As Byte = CByte(trbChorus.Value)

        If CMO IsNot Nothing Then

            CMO.Chorus(clsMidiOut.MidiChannels.Ch0, Value)

        End If

        lblChorusValue.Text = Value.ToString

    End Sub

 

 

    Private Sub lblInitialPitchValue_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)

        ' InitialPitch mit Doppelklick auf lblInitialPitchValue in Neutralstellung bringen

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

    End Sub

 

    Private Sub lblInitialPitch_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)

        ' InitialPitch mit Doppelklick auf lblInitialPitch in Neutralstellung bringen

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

    End Sub

 

    Private Sub trbInitialPitch_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles trbInitialPitch.PreviewKeyDown

        If (e.KeyCode = Keys.D0) Or (e.KeyCode = Keys.NumPad0) Then

            SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

        End If

    End Sub

 

    Private Sub trbInitialPitch_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbInitialPitch.ValueChanged

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, trbInitialPitch.Value)

    End Sub

 

 

    Private Sub cboBank_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        ' führt CMO.SBBankSelect() aus,

        ' löst FillCboPreset aus.

 

        If Not mBankSelectFlag Then

            Dim BankIndex As Integer = CboBank.SelectedIndex

 

            If BankIndex < 0 Then

                If CboBank.Items.Count > 0 Then

                    BankIndex = 0

                End If

            End If

 

            If BankIndex > -1 Then

 

                If CMO IsNot Nothing Then

 

                    SetBank(clsMidiOut.MidiChannels.Ch0, CboBank.SelectedIndex)

 

                    If cboPreset.SelectedIndex > -1 Then

                        SetPreset(clsMidiOut.MidiChannels.Ch0, cboPreset.SelectedIndex)

                    End If

 

                End If

 

            End If

 

        End If

    End Sub

 

 

    Private Sub cboPreset_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboPreset.SelectedIndexChanged

        ' führt in SetPreset() CMO.ProgramChange aus.

 

        If Not mPresetFlag Then

            If cboPreset.SelectedIndex > -1 Then

                SetPreset(clsMidiOut.MidiChannels.Ch0, cboPreset.SelectedIndex)

            Else

                lblInstrument.Text = "Instrument"

            End If

        End If

    End Sub

 

 

 

    Private Sub chkTest_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkTest.CheckedChanged

        If CMO IsNot Nothing Then

            If chkTest.Checked Then

                CMO.NoteOn(clsMidiOut.MidiChannels.Ch0, 60, 127)

            Else

                CMO.NoteOff(clsMidiOut.MidiChannels.Ch0, 60, 0)

            End If

        End If

    End Sub

 

 

    Private Sub chkTest_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles chkTest.MouseDown

        If e.Button = Windows.Forms.MouseButtons.Right Then

            ' löst chkTest_CheckedChanged aus

            chkTest.Checked = True

        End If

    End Sub

 

    Private Sub chkTest_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles chkTest.MouseUp

        If e.Button = Windows.Forms.MouseButtons.Right Then

            ' löst chkTest_CheckedChanged aus

            chkTest.Checked = False

        End If

    End Sub

 

 

    Private Sub chkSust1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSust1.CheckedChanged

        If Not mSust1Flag Then

            If CMO IsNot Nothing Then

                If chkSust1.Checked Then

                    CMO.SustainOn(clsMidiOut.MidiChannels.Ch0)

                Else

                    CMO.SustainOff(clsMidiOut.MidiChannels.Ch0)

                End If

            End If

        End If

    End Sub

 

 

    Private Sub chkSust1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles chkSust1.MouseDown

        If e.Button = Windows.Forms.MouseButtons.Right Then

            ' löst chkSust1_CheckedChanged aus

            chkSust1.Checked = True

        End If

    End Sub

 

    Private Sub chkSust1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles chkSust1.MouseUp

        If e.Button = Windows.Forms.MouseButtons.Right Then

            ' löst chkSust1_CheckedChanged aus

            chkSust1.Checked = False

        End If

    End Sub

 

    '''

    ''' Setzt PitchBend auf den Neutralwert 64

    ''' (Anzeige 0)

    '''

    '''

    Private Sub ResetPitchbend()

        SetPitchBend(clsMidiOut.MidiChannels.Ch0, 64)

    End Sub

 

    Private Sub trbPitchBend_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles trbPitchBend.PreviewKeyDown

        ' Pitchbend in Neutralstellung (64) durch Taste 0

        If (e.KeyCode = Keys.D0) Or (e.KeyCode = Keys.NumPad0) Then

            ResetPitchbend()

        End If

    End Sub

 

    Private Sub trbPitchBend_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbPitchBend.ValueChanged

        SetPitchBend(clsMidiOut.MidiChannels.Ch0, trbPitchBend.Value)

    End Sub

 

    Private Sub lblPitchBendValue_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPitchBendValue.DoubleClick

        'Pitchbend auf Mittelstellung (64)

        ResetPitchbend()

    End Sub

 

 

    Private Sub lblPitchBend_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPitchBend.DoubleClick

        'Pitchbend auf Mittelstellung (64)

        ResetPitchbend()

    End Sub

 

    Private Sub trbModulation_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbModulation.ValueChanged

        SetModulation(clsMidiOut.MidiChannels.Ch0, trbModulation.Value)

    End Sub

 

 

    Private Sub lblInitialPitchValue_DoubleClick1(ByVal sender As Object, ByVal e As System.EventArgs)

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

    End Sub

 

    Private Sub btnInitialPitchReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInitialPitchReset.Click

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, 0)

    End Sub

 

    Private Sub btnInitialPitchMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInitialPitchMinus.Click

        ' nächst tiefer gelegenen 1/2 Ton ermitteln

        Dim Value As Integer = trbInitialPitch.Value - (trbInitialPitch.Value Mod 100)

        Value -= 100    ' Stimmung um 1/2 Ton vermindern

        If Value < trbInitialPitch.Minimum Then

            Value = trbInitialPitch.Minimum

        End If

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, Value)

    End Sub

 

    Private Sub btnInitialPitchPlus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInitialPitchPlus.Click

        ' nächst tiefer gelegenen 1/2 Ton ermitteln

        Dim Value As Integer = trbInitialPitch.Value - (trbInitialPitch.Value Mod 100)

        Value += 100    ' Stimmung um 1/2 Ton erhöhen

        If Value > trbInitialPitch.Maximum Then

            Value = trbInitialPitch.Maximum

        End If

        SetInitialPitch(clsMidiOut.MidiChannels.Ch0, Value)

    End Sub

 

    Private Sub pnlKeyBoard_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pnlKeyBoard.SizeChanged

        Dim Value As Integer = (KeyBoard.Width - pnlKeyBoard.Width) '\ 2

        hsbKeyboard.Maximum = Value + 20

        hsbKeyboard.Minimum = -10

        RepositionKeyBoard()

    End Sub

 

    Private Sub hsbKeyboard_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles hsbKeyboard.ValueChanged

        RepositionKeyBoard()

    End Sub

 

    Private Sub RepositionKeyBoard()

        If pnlKeyBoard.Width < KeyBoard.Width Then

            KeyBoard.Left = -hsbKeyboard.Value

        Else

            KeyBoard.Left = (pnlKeyBoard.Width - KeyBoard.Width) \ 2

        End If

    End Sub

 

    Private Sub KeyBoard_KeyEvent(ByVal KeyNumber As Byte, ByVal Velocity As Byte) Handles KeyBoard.KeyEvent

        If CMO IsNot Nothing Then

            If Velocity > 0 Then

                CMO.NoteOn(clsMidiOut.MidiChannels.Ch0, KeyNumber, Velocity)

            Else

                CMO.NoteOff(clsMidiOut.MidiChannels.Ch0, KeyNumber, 0)

            End If

        End If

    End Sub

 

 

    Private Sub btnBankRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBankRemove.Click

        ' diese Funktionalität ist nur bei Soundfont-Geräten verfügbar.

        Dim CMOC As clsMidiOut.CMidiOutCaps = DirectCast(cboMidiOut.SelectedItem, clsMidiOut.CMidiOutCaps)

        Dim SfDevID As UInt16 = CMOC.SFDeviceIndex

        Dim BankIndex As UInt16 = CType(DirectCast(cboBank.SelectedItem, DataRowView).Item(0), UInt16)

 

 

        If mSFManager.ClearLoadedBank(SfDevID, BankIndex) Then

            ' cboBank neu füllen.

            FillCboBank(SfDevID)

            If cboBank.Items.Count > 0 Then

                ' bisherigen BankIndex um 1 vermindern

                BankIndex -= CType(1, UInt16)

                If BankIndex < 0 Then

                    ' falls BankIndex < 0 dann auf 0 setzen

                    BankIndex = 0

                End If

                ' Bank setzen

                SetBank(clsMidiOut.MidiChannels.Ch0, BankIndex)

                ' SetBank löst FillcboPreset aus.

 

                If cboPreset.Items.Count > 0 Then

                    SetPreset(clsMidiOut.MidiChannels.Ch0, 0)

                End If

            End If

        End If

 

    End Sub

 

    Private Sub btnBankReplace_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBankReplace.Click

        ' diese Funktionalität ist nur bei Soundfont-Geräten verfügbar.

        Dim FileName As String

        Dim FDlg As New OpenFileDialog

        With FDlg

            .DefaultExt = "*.sf2"

            .Filter = "SoundFont Dateien (*.sf2)|*.sf2|alle Dateien (*.*)|*.*"

            .Multiselect = False

            If .ShowDialog(Me) = Windows.Forms.DialogResult.OK Then

                FileName = .FileName

            Else

                FileName = ""

            End If

        End With

 

        FDlg.Dispose()

 

        If FileName.Length > 0 Then

 

            Dim SfDevID As UInt16 = CType(CMO.SoundFontDeviceID, UInt16)

            Dim Bankindex As UInt16 = CType(DirectCast(cboBank.SelectedItem, DataRowView).Item(0), UInt16)

 

            If mSFManager.ClearLoadedBank(SfDevID, Bankindex) Then

                mBankSelectFlag = True

                cboBank.DataSource = Nothing

                mBankSelectFlag = False

                cboBank.Items.Clear()

                cboBank.Refresh()

 

                If mSFManager.LoadBankFromFile(SfDevID, Bankindex, FileName) Then

                    FillCboBank(SfDevID)

                    SetBank(clsMidiOut.MidiChannels.Ch0, Bankindex)

                    If cboPreset.Items.Count > 0 Then

                        SetPreset(clsMidiOut.MidiChannels.Ch0, 0)

                    End If

                End If

            End If

            'End If

        End If

    End Sub

 

    Private Sub btnBankLoad_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBankLoad.Click

        ' diese Funktionalität ist nur bei Soundfont-Geräten verfügbar.

        Dim FileName As String

        Dim FDlg As New OpenFileDialog

        With FDlg

            .DefaultExt = "*.sf2"

            .Filter = "SoundFont Dateien (*.sf2)|*.sf2|alle Dateien (*.*)|*.*"

            .Multiselect = False

            If .ShowDialog(Me) = Windows.Forms.DialogResult.OK Then

                FileName = .FileName

            Else

                FileName = ""

            End If

        End With

        FDlg.Dispose()

 

        If FileName.Length > 0 Then

 

            Dim CMOC As clsMidiOut.CMidiOutCaps = DirectCast(cboMidiOut.SelectedItem, clsMidiOut.CMidiOutCaps)

            'Dim SfDevID As UInt16 = CMOC.SFDeviceIndex

            Dim SfDevID As UInt16 = CType(CMO.SoundFontDeviceID, UInt16)

            Dim BankID As UInt16 = CType(cboBank.SelectedIndex, UInt16)

 

            If mSFManager.LoadBankFromFile(SfDevID, CType(cboBank.SelectedIndex, UInt16), FileName) Then

                FillCboBank(SfDevID)

 

                SetBank(clsMidiOut.MidiChannels.Ch0, BankID)

                If cboPreset.Items.Count > 0 Then

                    SetPreset(clsMidiOut.MidiChannels.Ch0, 0)

                End If

            End If

        End If

    End Sub

 

    Private Sub EnableSFBButtons()

        Dim Switch As Boolean

        If cboMidiOut.SelectedIndex < 0 Then

            btnBankLoad.Enabled = False

            btnBankReplace.Enabled = False

            btnBankRemove.Enabled = False

            btnBankPath.Enabled = False

            gbInitialPitch.Enabled = False

        Else

            Dim CMOC As clsMidiOut.CMidiOutCaps = DirectCast(cboMidiOut.SelectedItem, clsMidiOut.CMidiOutCaps)

 

            If CMOC.IsSoundFontDevice Then

                ' Ausgewähltes Gerät ist ein Soundfont-Gerät

 

                If cboBank.SelectedIndex < 1 Then

                    btnBankLoad.Enabled = False

                    btnBankReplace.Enabled = False

                    btnBankRemove.Enabled = False

                    If cboBank.SelectedIndex = 0 Then

                        btnBankPath.Enabled = True

                    Else

                        btnBankPath.Enabled = False

                    End If

                Else

                    Dim BankName As String = DirectCast(cboBank.SelectedItem, DataRowView).Item(2).ToString

                    Switch = BankName.Length > 0

 

                    btnBankLoad.Enabled = Not Switch

                    btnBankReplace.Enabled = Switch

                    btnBankRemove.Enabled = Switch

                    btnBankPath.Enabled = Switch

                End If

                gbInitialPitch.Enabled = True

 

            Else

 

                ' Ausgewähltes Gerät ist kein SoundfontGerät

                btnBankLoad.Enabled = False

                btnBankReplace.Enabled = False

                btnBankRemove.Enabled = False

                btnBankPath.Enabled = False

                gbInitialPitch.Enabled = False

 

            End If

        End If

    End Sub

 

 

    Private Sub btnBankPath_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBankPath.Click

        Dim strBuffer As String = ""

 

        Dim CurrentShowErrorMessages As Boolean = mSFManager.ShowErrorMessages

        mSFManager.ShowErrorMessages = True

        If mSFManager.GetLoadedBankPathname(CMO.SoundFontDeviceID, cboBank.SelectedIndex, strBuffer) Then

            MsgBox(strBuffer, MsgBoxStyle.Information)

        End If

        mSFManager.ShowErrorMessages = CurrentShowErrorMessages

 

    End Sub

 

    Private Sub SchieberRadioSenderSuchen_Scroll(sender As Object, e As ScrollEventArgs) Handles SchieberRadioSenderSuchen.Scroll

        Dim aktPos As Integer : aktPos = Val(SchieberRadioSenderSuchen.Value)

 

 

 

        ReDim Station(990)

        Station(1) = "http://webcast.wonc.org:8000/wonclive-128s"

        Station(2) = "http://live96.917xfm.de"

        Station(3) = "http://sites.89.0rtl.de/streams/mp3_128k.m3u"

        Station(4) = "http://stream.104.6rtl.com/rtl-live/mp3-128 "

        Station(5) = "http://www.antenne.de/webradio/antenne.m3u"

        Station(6) = "http://streams.antennemv.de/antennemv-live/mp3-192/amv"

        Station(7) = "http://streams.br.de/bayern1_2.m3u "

        Station(8) = "http://streams.br.de/bayern2_2.m3u"

        Station(9) = "http://streams.br.de/bayern3_2.m3u "

        Station(10) = "http://streams.br.de/br-klassik_2.m3u"

        Station(11) = "http://streams.br.de/b5aktuell_2.m3u"

        Station(12) = "http://streams.br.de/b5plus_2.m3u "

        Station(13) = "http://streams.br.de/bayernplus_2.m3u"

        Station(14) = "http://streams.br.de/puls_2.m3u"

        'DeutschlandRadio

        Station(15) = "http://surround.webradio.rockantenne.de" 'Rockantenne

        Station(16) = "http://www.swr3.de/wraps/swr3_mp3.m3u.php" 'SWR-2

        Station(17) = "http://www.dradio.de/streaming/dradiowissen_hq_ogg.m3u" 'DRadio Wissen

        'Die Neue107 Rock und Pop

        Station(18) = "http://edge.live.mp3.mdn.newmedia.nacamar.net/ps-dieneue_rock/livestream_hi.mp3.m3u"

        Station(19) = "http://www.egofm.de/stream/128kb" 'egoFM

        Station(20) = "http://www.dragonland-radio.de/Dragonland-Radio.asx" 'DragonlandRadio

        'Radio Energy

        Station(21) = "http://energyradio.de/berlin" 'Berlin

        Station(22) = "http://energyradio.de/hamburg" ' #Hamburg

        Station(23) = "http://energyradio.de/nuernberg" ' #Nürnberg"

        Station(24) = "http://energyradio.de/stuttgart" ' #Stuttgart

        Station(25) = "http://energyradio.de/muenchen" ' #München

        Station(26) = "http://energyradio.de/sachsen" '#Sachsen

        Station(27) = "http://energyradio.de/bremen" ' #Bremen

        Station(28) = "http://antenne90erhits.radio.de "

        Station(29) = "http://antennenewhits.radio.de "

        Station(30) = "http://wdr4.radio.de "

        Station(31) = "http://stream.antenne1.de/stream1/livestream.mp3 "

        Station(32) = "http://sites.89.0rtl.de/streams/mp3_128k.m3u " 'RTL Halle

        Station(33) = "http://stream.antenne1.de/stream1/livestream.mp3 " 'Antenne1 BW

        Station(34) = "http://stream.antenne1.de/stream2/livestream.mp3 " 'Antenne 1 BW

        Station(35) = "http://srv05.bigstreams.de/balkan.m3u" 'bigFM

        Station(36) = "http://srv05.bigstreams.de/bigfm-aacp-48.m3u" 'bigFM

        Station(37) = "http://srv05.bigstreams.de/bigfm-aacp-64.m3u" 'bigFM

        Station(38) = "http://srv05.bigstreams.de/bigfm-mp3-64.m3u" 'bigFM

        Station(39) = "http://srv05.bigstreams.de/bigfm-mp3-96.m3u" 'bigFM

        Station(40) = "http://srv05.bigstreams.de/bigfm-ogg-45.ogg.m3u" 'bigFM

        Station(41) = "http://srv05.bigstreams.de/bigfm-ogg-64.ogg.m3u" 'bigFM

        Station(42) = "http://srv05.bigstreams.de/dnb.m3u" 'bigFM

        Station(43) = "http://srv05.bigstreams.de/ethno.m3u" 'bigFM

        Station(44) = "http://srv05.bigstreams.de/orient.m3u" 'bigFM

        Station(45) = "http://srv05.bigstreams.de/turkey.m3u" 'bigFM

        Station(46) = "http://srv01.bigstreams.de/stream01-64" 'bigFM

        Station(47) = "http://blackbeats.fm/listen.m3u " 'blackbeats

        Station(48) = "http://blackbeats.fm/listen.asx" 'blackbeats

        Station(49) = "http://blackbeats.fm/live.ram" 'blackbeats

        Station(50) = "http://132.252.179.253:8000/" 'Campus FM Duisburg-Essen

        Station(51) = "http://4093.live.streamtheworld.com/AFNE_PWNAAC_SC            #AFN 360 Europe (Rheinland-Pfalz - Kaiserslautern)"

        Station(52) = "http://4103.live.streamtheworld.com/AFNE_BAVAAC_SC #AFN Bavaria (Bayern - Muenchen)"

        Station(52) = "http://2433.live.streamtheworld.com/AFN_CTYAAC_SC     #AFN Country (Rheinland-Pfalz - Ramstein Air, Country)"

        Station(54) = "http://2133.live.streamtheworld.com/AFN_GRVAAC_SC    #AFN Gravity (Rheinland-Pfalz - Ramstein Air, Urban)"

        Station(55) = "http://2513.live.streamtheworld.com/AFN_HOTAAC_SC    #AFN Hot AC (Rheinland-Pfalz - Ramstein Air Base, Top 40)"

        Station(56) = "http://1081.live.streamtheworld.com/AFN_JOEAAC_SC     #AFN Joe Radio (Rheinland-Pfalz - Ramstein Air, Mix)"

        Station(57) = "http://4113.live.streamtheworld.com/AFNE_KTNAAC_SC  #AFN Kaiserslautern (Rheinland-Pfalz - Kaiserslautern, Mix)"

        Station(58) = "http://2633.live.streamtheworld.com/AFN_LGYAAC_SC     #AFN Legacy (Rheinland-Pfalz - Ramstein Air, Rock Classics)"

        Station(59) = "http://3983.live.streamtheworld.com/AFNE_SPGAAC_SC  #AFN Spangdahlem (Rheinland-Pfalz - Spangdahlem Air, Mix)"

        Station(60) = "http://3983.live.streamtheworld.com/AFNE_STUAAC_SC  #AFN Stuttgart (Baden-Wuerttemberg - Stuttgart)"

        Station(61) = "http://4113.live.streamtheworld.com:443/AFNE_KTNAAC_SC     #AFN The Eagle (Rheinland-Pfalz - Kaiserslautern, Mix)"

        Station(62) = "http://2353.live.streamtheworld.com/AFN_VCEAAC_SC     #AFN The Voice (Rheinland-Pfalz - Ramstein Air Base, News+Talk)"

        Station(63) = "http://4113.live.streamtheworld.com/AFNE_WBNAAC_SC           #AFN Wiesbaden (Hessen - Wiesbaden)"

        Station(64) = "http://www.byte.fm/stream/bytefm.m3u" 'ByteFM

        Station(65) = "http://streamingserver01.byte.fm:8000/" 'ByteFM

        Station(66) = "http://live96.106acht.de" 'Alsterradio

        Station(67) = "http://live64.106acht.de" 'Alsterradio

        Station(68) = "http://stream.hoerradar.de/deltaradio128" 'deltaRadio

        Station(69) = "http://detektor.fm/stream/mp3/wort/" 'detektor.fm

        Station(70) = "http://detektor.fm/stream/mp3/musik/" 'detektor.FM

        Station(71) = "http://www.dradio.de/streaming/dlf_hq_ogg.m3u" 'Deutschlandradio"

        Station(72) = "http://www.dradio.de/streaming/dlf_mq_ogg.m3u" 'Deutschlandradio

        Station(73) = "http://www.dradio.de/streaming/dlf_lq_ogg.m3u " 'Deutschlandradio

        Station(74) = "http://www.dradio.de/streaming/dlf.m3u" 'Deutschlandradio      

        Station(75) = "http://www.dradio.de/streaming/dkultur_hq_ogg.m3u" 'Dradio Kultur

        Station(76) = "http://www.dradio.de/streaming/dkultur_mq_ogg.m3u" 'Dradio Kultur

        Station(77) = "http://www.dradio.de/streaming/dkultur_lq_ogg.m3u" 'Dradio Kultur

        Station(78) = "http://www.dradio.de/streaming/dkultur.m3u" 'Dradio Kultur

        Station(79) = "http://www.dradio.de/streaming/dradiowissen_hq_ogg.m3u" 'Dradio Wissen

        Station(80) = "http://www.dradio.de/streaming/dradiowissen_lq_ogg.m3u" 'Dradio Wissen

        Station(81) = "http://www.dradio.de/streaming/dradiowissen.m3u" 'Dradio Wissen

        Station(82) = "http://www.meine-neue-welle.de/dnw_128.m3u" 'Die Neue Welle

        Station(83) = "http://domradio-mp3-l.akacast.akamaistream.net/7/809/237368/v1/gnl.akacast.akamaistream.net/domradio-mp3-l" 'Domradio Köln

        Station(84) = "http://domradio-mp3-m.akacast.akamaistream.net/7/148/237368/v1/gnl.akacast.akamaistream.net/domradio-mp3-m" 'Domradio Köln

        Station(85) = "http://domradio-ogg.akacast.akamaistream.net/7/511/237368/v1/gnl.akacast.akamaistream.net/domradio-ogg" 'Domradio Köln

        Station(86) = "http://www.fluxfm.de/stream-berlin" 'FluxFM Berlin

        Station(87) = "http://radigo01.nci.de:8000/high_q.m3u" 'RadioGong

        Station(88) = "http://radigo01.nci.de:8000/low_q.m3u" 'Radio Gong

        Station(89) = "http://player.ffn.de/tunein_ffn.pls" 'ffn Niedersachsen

        Station(90) = "http://player.ffn.de/ffn.mp3" 'ffn Niedersachsen

        Station(91) = "http://www.jam.fm/streams/jam-nmr-mp3.asx" 'JamFM

        Station(92) = "http://www.jam.fm/streams/jam-nmr-mp3.m3u" 'Jam FM

        Station(93) = "http://www.jam.fm/streams/jam-nmr-mp3.pls" 'Jam FM

        Station(94) = "http://www.jam.fm/streams/jam-nmr-mp3.rm" 'Jam FM

        Station(95) = "http://edge.live.mp3.mdn.newmedia.nacamar.net/klassikradio96/livestream.mp3 " 'KlassikRadio

        Station(96) = "http://edge.live.mp3.mdn.newmedia.nacamar.net/klassikradio128/livestream.mp3 " 'KlassikRadio

        Station(97) = "http://koelncampus.uni-koeln.de:7999/listen.pls" 'Kölncampus

        Station(98) = "http://koelncampus.uni-koeln.de:8001/listen.pls" 'Kölncampus

        Station(99) = "http://lwt.hoerradar.de/lwtmp3" 'Landeswelle Thüringen

        Station(100) = "http://lwt.hoerradar.de/lwtaac" 'Landeswelle Thüringen

        Station(101) = "http://www.egofm.de/stream/192kb" 'egoFM

        Station(102) = "http://www.egofm.de/stream/192kb.pls" 'egoFM

        Station(103) = "http://www.egofm.de/stream/192kb.m3u" 'egoFM

        Station(104) = "http://www.egofm.de/stream/128kb" 'egoFM

        Station(105) = "http://www.egofm.de/stream/128kb.pls" 'egoFM

        Station(106) = "http://www.egofm.de/stream/128kb.m3u" 'egoFM

        Station(107) = "http://www.egofm.de/stream/44kb" 'egoFM

        Station(108) = "http://www.egofm.de/stream/44kb.pls" 'egoFM

        Station(109) = "http://www.egofm.de/stream/44kb.m3u" 'egoFM

        Station(110) = "http://metafiles.gl-systemhaus.de/hr/hr1_2.m3u" 'HR

        Station(111) = "http://metafiles.gl-systemhaus.de/hr/hr2_2.m3u" 'HR

        Station(112) = "http://metafiles.gl-systemhaus.de/hr/hr3_2.m3u" 'HR

        Station(113) = "http://metafiles.gl-systemhaus.de/hr/hr4_2.m3u" 'HR

        Station(114) = "http://metafiles.gl-systemhaus.de/hr/hrinfo_2.m3u" 'HR

        Station(115) = "http://metafiles.gl-systemhaus.de/hr/youfm_2.m3u" 'HR

        Station(116) = "http://metafiles.gl-systemhaus.de/hr/youfm_black.m3u" 'HR

        Station(117) = "http://metafiles.gl-systemhaus.de/hr/youfm_club.m3u" 'HR

        Station(118) = "http://metafiles.gl-systemhaus.de/hr/youfm_rock.m3u" 'HR

        Station(119) = "https://www.livezwei.de/infusions/gr_radiostatus_panel/gr_radiostatus_player.php?id=2&typ=flash " 'livezwei Niedersachsen

        Station(120) = "https://www.livezwei.de/infusions/gr_radiostatus_panel/gr_radiostatus_player.php?id=2&p=pls " 'livetwei Niedersachsen

        Station(121) = "https://www.livezwei.de/infusions/gr_radiostatus_panel/gr_radiostatus_player.php?id=2&p=asx " 'livezwei Niedersachsen

        Station(122) = "https://www.livezwei.de/infusions/gr_radiostatus_panel/gr_radiostatus_player.php?id=2&p=ram" 'livezwei Niedersachsen

        Station(123) = "http://live.lora924.de:8000/lora.ogg" 'Lora München

        Station(124) = "http://live.lora924.de:8000/lora-hq.mp3" 'LORA München

        Station(125) = "http://live.lora924.de:8000/loramp3.mp3 " 'LORA München

        Station(126) = "http://stream.m945.mwn.de/m945-hq.mp3.m3u" '95,5

        Station(127) = "http://stream.m945.mwn.de/m945-lq.mp3.m3u" '94,5

        Station(128) = "http://stream.m945.mwn.de/m945-hq.ogg.m3u" '95,5

        Station(129) = "http://stream.m945.mwn.de/m945-mq.ogg.m3u" '94,5

        Station(130) = "http://stream.m945.mwn.de/m945-lq.ogg.m3u" '94,5

        Station(131) = "http://avw.mdr.de/livestreams/mdr1_radio_sachsen_live_128.m3u" 'mdr

        Station(132) = "http://avw.mdr.de/livestreams/mdr1_radio_sachsen-anhalt_live_128.m3u"

        Station(133) = "http://avw.mdr.de/livestreams/mdr1_radio_thueringen_live_128.m3u"

        Station(134) = "http://avw.mdr.de/livestreams/mdr_figaro_live_128.m3u"

        Station(135) = "http://avw.mdr.de/livestreams/mdr_figaro_classic_128.m3u"

        Station(136) = "http://avw.mdr.de/livestreams/mdr_figaro_figarino_128.m3u"

        Station(137) = "http://avw.mdr.de/livestreams/mdr_figaro_folk_128.m3u"

        Station(138) = "http://avw.mdr.de/livestreams/mdr_info_live_128.m3u"

        Station(139) = "http://www.jumpradio.de/static/webchannel/jump_live_channel_high.m3u"

        Station(140) = "http://www.jumpradio.de/static/webchannel/jump_interaktiv_channel_128.m3u"

        Station(140) = "http://www.jumpradio.de/static/webchannel/jump_piraten_channel_128.m3u"

        Station(141) = "http://www.jumpradio.de/static/webchannel/jump_rock_channel_128.m3u"

        Station(142) = "http://www.jumpradio.de/static/webchannel/jump_trend_channel_128.m3u"

        Station(143) = "http://avw.mdr.de/livestreams/mdr_klassik_live_128.m3u"

        Station(144) = "http://www.sputnik.de/m3u/live.hi.m3u" 'Radio Sputnik

        Station(145) = "http://www.sputnik.de/m3u/black.hi.m3u"

        Station(146) = "http://www.sputnik.de/m3u/club.hi.m3u"

        Station(147) = "http://www.sputnik.de/m3u/insomnia.hi.m3u"

        Station(148) = "http://www.sputnik.de/m3u/makossa.hi.m3u"

        Station(149) = "http://www.sputnik.de/m3u/popkult.hi.m3u"

        Station(150) = "http://www.sputnik.de/m3u/rock.hi.m3u"

        Station(151) = "http://www.sputnik.de/m3u/soundcheck.hi.m3u"

        Station(152) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndr1niedersachsen.m3u" 'NDR

        Station(153) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndr1radiomv.m3u"

        Station(154) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndr903.m3u"

        Station(155) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndr1wellenord.m3u"

        Station(156) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndr2.m3u"

        Station(157) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrkultur.m3u"

        Station(158) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrinfo.m3u"

        Station(159) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrinfo_spezial.m3u"

        Station(160) = "http://www.ndr.de/resources/metadaten/audio/m3u/n-joy.m3u"

        Station(161) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrmusikplus.m3u"

        Station(162) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrblue.m3u "

        Station(163) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop5.m3u  #N-JOY Soundfiles Alternative"

        Station(164) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop6.m3u  #N-JOY Soundfiles Hip-Hop "

        Station(165) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop7.m3u  #N-JOY Flavor Mix"

        Station(166) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop8.m3u  #N-JOY TOP 30"

        Station(167) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop25.m3u #N-JOY Abstrait"

        Station(168) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop27.m3u #Die N-JOY Morningshow"

        Station(169) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop28.m3u #N-JOY In The Mix"

        Station(170) = "http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop29.m3u "

        Station(171) = "http://httpmedia.radiobremen.de/nordwestradio.m3u" 'Nordwestradio

        Station(172) = "http://edge.live.mp3.mdn.newmedia.nacamar.net/ostseewellelive/livestream.mp3" 'Ostseewelle

        Station(173) = "http://stream.hoerradar.de/rsh128" 'Radio SchleswigHolstein

        Station(174) = "http://213.251.129.69:8080/radio7.ogg" 'Radio-7

        Station(175) = "http://www.radio21.de/livestream/livestream.m3u" 'Radio21

        Station(176) = "http://stream.bobblogger.de/stream.m3u" 'RadioBOB

        Station(177) = "http://stream.hoerradar.de/mp3-radiobob" ' RadioBOB

        Station(178) = "http://gffstream.ic.llnwd.net/stream/gffstream_mp3_w48a" 'RadioBremen

        Station(179) = "http://httpmedia.radiobremen.de/bremenvier.m3u"

        Station(180) = "http://80.252.104.101:8000/rockt.m3u"

        Station(181) = "http://80.252.104.101:8000/zeiglerswwdp.m3u"

        Station(182) = "http://mp3.radiobrocken.de:80/" 'RadioBrocken

        Station(183) = "http://www.radiobrocken.de/webradio/brocken-high.m3u"

        Station(184) = "http://sites.radiobrocken.de/streams/mp3_128k.pls"

        Station(185) = "http://stream.multicult20.de:8000/listen.pls" 'Radio multikulti

        Station(186) = "http://stream.multicult20.de:80/listen.pls"

        Station(187) = "http://stream.multicult.fm:8000/hifi.m3u"

        Station(188) = "http://stream1.multicult20.de:80/listen.pls"

        Station(189) = "http://ogg.multicult20.de:80/stream128.ogg.m3u"

        Station(190) = "http://ogg.multicult20.de:80/stream48.ogg.m3u"

        Station(191) = "http://ogg.multicult20.de:80/stream16.ogg.m3u"

        Station(192) = "http://xapp2023227392c40000.f.l.i.lb.core-cdn.net/40000mb/live/app2023227392/w2075033610/live_de_128.mp3" 'Radio-Top40 Thüringen

        Station(193) = "http://xapp2023227392c40000.f.l.i.lb.core-cdn.net/40000mb/live/app2023227392/w2075033610/live_de_64.mp3"

        Station(194) = "http://xapp2023227392c40000.f.l.i.lb.core-cdn.net/40000mb/live/app2023227392/w2023292928/live_de_192.mp3"

        Station(195) = "http://xapp2023227392c40000.f.l.i.lb.core-cdn.net/40000mb/live/app2023227392/w2023292928/live_de_64.mp3"

        Station(196) = "http://stream.laut.fm/total-instrumental.m3u" 'Total Instrumental

        Station(197) = "http://dsl.hb-stream.net:80" 'Radio HardFM

        Station(198) = "http://www.charivari.de/webradio/r8082.m3u" 'Charivari München

        Station(199) = "http://webradio.charivari986.de:8000/ " 'Charivari Nürnberg

        Station(200) = "http://www.charivari.de/webradio/r8082.pls" 'Charivari Webradio

        '..................................

        'Australia

        Station(201) = "http://streaming.mytalk.com.au/6pr"

        Station(202) = "http://66.70.119.243:81/2DayFM"

        Station(203) = "http://streaming.mytalk.com.au/2ue"

        Station(204) = "http://www.streamx.com.au/radio/3aw/3aw-radio.asx"

        Station(205) = "http://66.70.119.243:81/B105"

        Station(206) = "http://streaming.mytalk.com.au/4bc"

        Station(207) = "http://streaming.mytalk.com.au/4bh"

        Station(208) = "mms://svc1934-4kz.conexim.com.au/svc1934-CoastalBroadcasters4KZ"

        Station(209) = "http://www.abc.net.au/streaming/774/774stream.ram"

        Station(210) = "http://www.96fm.com.au/live.asx"

        Station(211) = "http://streaming.amnet.net.au/96fm"

        Station(212) = "http://202.147.105.26/973fm"

        Station(213) = "http://mp3media1.abc.net.au:8060/classicfm.mp3"

        Station(214) = "http://abc.net.au/streaming/digcountry/digcountry.m3u"

        Station(215) = "http://abc.net.au/streaming/digjazz/digjazz.m3u"

        Station(216) = "http://abc.net.au/streaming/digradio/digradio.m3u"

        Station(217) = "http://www.abc.net.au/streaming/newsradio.asx"

        Station(218) = "http://www.abc.net.au/streaming/RN.ram"

        Station(219) = "http://www.abc.net.au/streaming/triplej.asx"

        Station(220) = "http://www.bondifm.com.au/stream/bondifm.asx"

        Station(221) = "http://www.abc.net.au/streaming/coast.ram"

        Station(222) = "mms://coolcountry.stream.integritynet.com.au/coolcountry"

        Station(223) = "http://208.96.14.149/cruise1323"

        Station(224) = "http://www.netfm.net/netfm.asx"

        Station(225) = "http://203.30.47.38/6pr"

        Station(226) = "http://www.apstream.net/clients/streams/3pbsfm.asx"

        Station(227) = "http://www.abc.net.au/streaming/triplej.asx"

        Station(228) = "http://rawfm.stream.integritynet.com.au/rawfm"

        Station(229) = "http://64.202.98.51:7100"

        Station(230) = "http://www.abc.net.au/sydney/702stream.ram"

        Station(231) = "http://www.tabonline.com.au/radiotab/radiotab.asx"

        '....................................................

        'diverse Sender

        Station(232) = "http://62.75.228.171:8226" 'Dolfijn FM Curacao

        Station(233) = "http://38.96.175.97:4210/" 'Paradise FM Curacao

        Station(234) = "http://174.133.64.226:8103/listen.pls" 'Monumental-FM DominicRepublik

        Station(235) = "http://mediau.yle.fi/liveklassinen" 'Ylen Klassinen, Finnland

        Station(236) = "mms://mediau.yle.fi/liveradiopeili" ' YLE Puhe, Finnland

        Station(237) = "http://81.175.250.3:8000" 'Radio Voima, Finland

        Station(238) = "http://webcast.wonc.org:8000/wonclive-128s" 'Pure Rock FM 89/WONC USA

        Station(239) = "http://www.sky.fm/mp3/rootsreggae.pls " 'Sky FM USA

        Station(240) = "http://audio-mp3.ibiblio.org:8000/wncw-128k" 'WNCW 88.7 FM USA

        Station(241) = "http://www.kwur.com/icecast/kwurogg.m3u" 'KWUR USA

        Station(242) = "http://www.kwur.com/icecast/kwur128.m3u" 'KWUR USA

        Station(243) = "http://toronto.etn.fm:8230" 'ETN USA

        '.....................................................................

        'Argentina

        Station(244) = "http://200.55.6.22/cadena3envivo"

        Station(245) = "http://www.surfmusik.de/media/ar-5.asx"

        Station(246) = "http://www.ipradio.com.ar/fmsoldados.asx"

        Station(247) = "http://200.69.237.185:8000"

        Station(248) = "mms://2x4.telecomdatacenter.com.ar/2x4"

        Station(249) = "http://stream.alsolnet.com/LaRocka975"

        Station(250) = "http://mega.telecomdatacenter.com.ar/mega"

        Station(251) = "mms://wmedia02.uigc.net/mitrevivo"

        Station(252) = "http://www1.neti.tv/cnt/asxgen.aspx?id=27"

        Station(253) = "http://213.35.156.21/raadio-4"

        Station(254) = "http://wms4.neti.tv/raadioring"

        Station(255) = "http://www1.neti.tv/cnt/asxgen.aspx?id=13"

        Station(256) = "http://streaming.euro-web.com.ar:8000/listen.pls"

        Station(257) = "http://www.radiobuenosaires.com.ar/image/ambaires.asx"

        Station(258) = "http://www.radioflashfm.com.ar/flash-playlist.pls"

        Station(259) = "http://200.58.112.14:10065"

        '.......................................................................

        'Bolivia

        Station(260) = "http://200.31.17.46:8000"

        Station(261) = "mms://200.58.160.36/RadioActiva"

        Station(262) = "http://win41nj.audiovideoweb.com/njwinlive7540"

        Station(263) = "http://win45nj.audiovideoweb.com/nj45winlive9719"

        Station(264) = "http://128.59.222.11:8000"

        '..........................................................................

        'Brazil

        Station(265) = "http://hot108.com/hot108.pls"

        Station(266) = "http://www.audiogrooves.net/audiogrooves_CLUB/winamp.m3u"

        Station(267) = "http://www.audiogrooves.net/audiogrooves_SOUL/winamp.m3u"

        Station(268) = "http://agoranatv.radiobras.gov.br/jornais/jn00h.asf"

        Station(269) = "http://200.101.120.136:1067"

        Station(270) = "http://agoranatv.radiobras.gov.br/rnb/rnb.mp3"

        Station(271) = "http://www.ucpel.tche.br/alfa.ram"

        Station(272) = "http://200.202.254.131/radio/radio.asx"

        Station(274) = "http://www.tvcultura.com.br/radioam/radioam.asx"

        Station(275) = "http://media.itatiaia.com.br/Itatiaia"

        Station(276) = "http://wm01.mediaservices.ws/radioharoldodeandra1-live"

        Station(277) = "http://media.itatiaia.com.br/Itatiaia"

        Station(278) = "http://radiorox.oi.com.br/listen.m3u"

        Station(279) = "http://72.36.202.154:8106"

        Station(280) = "http://radio.unesp.br/players/mp3_high.pls"

        Station(281) = "http://208.53.190.146:9080"

        Station(282) = "http://agoranatv.radiobras.gov.br/jornais/voz.asf"

        '..............................................................

        'Chile

        Station(283) = "http://www.corazon.cl/player/corazon.asx"

        Station(284) = "http://200.54.182.4:8004"

        Station(285) = "http://200.54.182.4:8000"

        Station(286) = "http://www.fmdos.cl/player/fmdos_cl.asx"

        Station(287) = "http://190.54.48.154:8000"

        Station(288) = "http://www.concierto.cl/player/concierto_cl.asx"

        Station(289) = "http://www.futuro.cl/player/futuro_cl.asx"

        '..................................................................

        'CostaRica

        Station(290) = "http://www.monumental.co.cr/asx/Monumental.asx"

        Station(291) = "http://www.monumental.co.cr/asx/Monumental.asx"

        '..............................................................................

        'Cuba

        Station(292) = "http://mp3.batanga.com:80/Norteno"

        Station(293) = "http://mp3.batanga.com:80/Reggaeton"

        Station(294) = "http://mp3.batanga.com:80/Salsa"

        Station(295) = "http://live.str3am.com:2430"

        Station(296) = "http://www.tv-radio.com/station/jerico/jerico-20k.asx"

        Station(297) = "http://media.enet.cu/radiorebelde"

        Station(298) = "http://media.enet.cu/radiotaino"

        '.....................................................................................

        'Venezuela

        Station(299) = "http://www.surfmusik.de/media/ve-1.asx"

        Station(300) = "http://128.241.247.68/cnbp"

        Station(301) = "http://www.surfmusik.de/media/ve-6.asx"

        Station(302) = "http://212.31.53.39/elive/v1001/1.wma"

        '..............................................................................

        'India

        Station(303) = "http://64.71.145.133:8017"

        Station(304) = "http://www.bollywood.mu/pls24.php?filename=listen.pls"

        Station(305) = "http://213.251.129.23:80"

        Station(306) = "http://66.98.142.30:8000"

        Station(307) = "http://shared.streamwebtown.com/NTCradio"

        Station(308) = "http://radio3.sikhnet.com:80/sikhnetradio-channel4.mp3"

        Station(309) = "http://radio3.sikhnet.com:80/sikhnetradio-channel2.mp3"

        Station(310) = "http://radio3.sikhnet.com:80/sikhnetradio-channel1.mp3"

        Station(311) = "http://radio3.sikhnet.com:80/sikhnetradio-channel5.mp3"

        Station(312) = "http://radio3.sikhnet.com:80/sikhnetradio-channel9.mp3"

        '.......................................................................

        'Israel

        Station(313) = "http://www.poweredbyhadavar.com/broadcast.mp3"

        Station(314) = "mms://213.8.143.164/audiomedia"

        '.............................................................

        'Japan

        Station(315) = "mms://43.244.255.28/BeachFM"

        Station(316) = "http://67.19.249.226:8000"

        Station(317) = "http://keiichiradio84.purestream.net:9050"

        Station(318) = "http://219.117.214.201:8000"

        Station(319) = "http://server1.kawaii-radio.net:9000/listen.pls"

        Station(320) = "http://www.nhk.or.jp/rj/asx/rjwmt56.asx"

        Station(321) = "http://218.117.183.3:8000/listen.m3u"

        Station(322) = "http://music.buriguri.jp:8000/"

        Station(323) = "http://www.tokyo-ninja.com:8010/listen.pls"

        Station(324) = "http://www.tokyo-ninja.com:8020/listen.pls"

        Station(325) = "http://www.tokyo-ninja.com:8020/listen.pls"

        '...........................................................

        'Korea

        Station(326) = "http://222.122.43.54:8700"

        Station(327) = "http://222.122.43.54:8700"

        Station(328) = "http://inewage.com/listen.m3u"

        Station(329) = "http://inewage.com/listen.pls"

        Station(330) = "http://inewage.com/listen.pls"

        Station(331) = "http://ohmytrance.com/listen2.pls"

        Station(332) = "http://222.122.131.25:22000"

        Station(333) = "http://www.mukulcast.com/listen.pls"

        '.............................................................

        'Pakistan

        Station(334) = "mms://202.83.163.149/radio"

        '......................................................................

        'Singapore

        Station(335) = "http://media.netroasia.com/radio1003/radio100.3.asx"

        Station(336) = "http://media.netroasia.com/wkrz913/wkrz913.asx"

        '....................................................................

        'Sri Lanka

        Station(337) = "http://astream.net/live/asia/sirasa.asx"

        '..............................................................

        'Thailand

        Station(338) = "http://streamcaster.siamportals.com/station26"

        Station(339) = "http://streamcaster.siamportals.com/station21"

        Station(340) = "http://streamcaster.siamportals.com/station22"

        Station(341) = "http://streamcaster.siamportals.com/station23"

        Station(342) = "http://streamcaster.siamportals.com/station23"

        Station(343) = "http://rs1.radiostreamer.com:8250/"

        Station(344) = "http://64.62.253.55/bangkok64"

        Station(345) = "http://www.radiohosting.de:8000/listen.pls"

        Station(346) = "http://www.radiohosting.de:8020/listen.pls"

        '...............................................................

        'Algeria

        Station(347) = "mms://193.194.64.116/chaine2"

        Station(348) = "mms://193.194.64.116/chaine3"

        Station(349) = "mms://193.194.64.116/elbahdja"

        '............................................................

        'Angola

        Station(350) = "mms://193.194.64.116/elbahdja"

        '....................................................................

        'Marocco

        Station(351) = "mms://adams.wm-live.abacast.com/arabian_radio-alarabiya-64"

        Station(352) = "http://www.medi1.com/medi1/medi1.ram"

        Station(353) = "http://streaming1.mpl1.ovea.net:8000/medi1"

        Station(354) = "http://www.yabiladi.com/radio/adsl.wax"

        '..............................................................

        'Canada

        Station(355) = "http://streamer2.webstream.net/CHMY"

        Station(356) = "http://www.beatboxradio.com/listen.pls"

        Station(357) = "http://213.251.176.140:7020"

        Station(358) = "http://www.919bobfm.com/stream/bobfm.asx"

        Station(359) = "http://mfile.akamai.com/9617/live/reflector:36813.asx?bkup=36814"

        Station(360) = "http://www.radio-canada.ca/util/endirect/culturelle.asx"

        Station(361) = "http://69.72.212.222:9000/listen.pls"

        Station(362) = "http://stream.netro.ca/cfax"

        Station(363) = "http://cfmu.wwworks-inc.com:8000/listen.pls"

        Station(364) = "http://www.oricom.ca/cfomdirect.asx"

        Station(365) = "http://www.oricom.ca/cfomdirect.asx"

        Station(366) = "http://cfou.infoteck.com/listen.pls"

        Station(367) = "http://www.cfru.ca/cfruhi2.pls"

        Station(368) = "http://artichoke.alma.uvic.ca:7070/listen.pls"

        Station(369) = "http://www.mun.ca/chmr/chmr-live.m3u"

        Station(370) = "http://chrwradio.com/listen/listen.m3u"

        Station(371) = "http://130.63.20.59:8000/listen.pls"

        Station(372) = "http://www.cibl.cam.org/new/cibl.ram"

        Station(373) = "http://rtsp://real.cam.org/live/cism.ra"

        Station(374) = "http://www.citr.ca/live.rm"

        Station(375) = "http://www.cjad.com/player/resources/cjad.com/live.asx"

        Station(376) = "http://137.207.3.25:8000/listen.pls"

        Station(377) = "http://137.207.3.25:8004/listen.pls"

        Station(378) = "http://cjlo.com/cjlo.m3u"

        Station(379) = "http://206.167.193.23:8080/listen.pls"

        Station(380) = "http://live.str3am.com:2300"

        Station(381) = "http://live.str3am.com:2300"

        Station(382) = "http://www.cjsf.ca:8000/listen"

        Station(383) = "http://stream.cjsw.com/cjsw.mp3.m3u"

        Station(384) = "http://stream.cjsw.com/cjsw-low.mp3.m3u"

        Station(385) = "http://stream.cjsw.com/cjsw.ogg.m3u"

        Station(386) = "http://stream.cjsw.com/cjsw-low.ogg.m3u"

        Station(387) = "http://www.cjtr.ca/cjtr.asx"

        Station(388) = "http://live.umfm.com"

        Station(389) = "http://ckcu.magma.ca/ckcu.ram"

        Station(390) = "http://www.ckln.fm/streams/ckln.m3u"

        Station(391) = "http://www.ckln.fm/streams/ckln-lo.m3u"

        Station(392) = "http://www.ckln.fm/streams/ckln.ram"

        Station(393) = "http://www.ckln.fm/streams/ckln-lo.ram"

        Station(394) = "http://www.ckln.fm/audio/ckln.ram"

        Station(395) = "http://www.ckln.fm/audio/ckln-lo.ram"

        Station(396) = "http://stream.megaquebec.net/ckrl.asx"

        Station(397) = "http://rtsp://real.cam.org/live/ckut.ra"

        Station(398) = "http://206.45.95.171:8000"

        Station(399) = "http://media.trytel.net/thewolf"

        Station(400) = "http://142.66.48.43:8000/listen.pls"

        Station(401) = "http://65.39.171.11:9595"

        Station(402) = "http://www.coopradio.org/listen/cfro-mid.mp3.pls"

        Station(403) = "http://www.coopradio.org/listen/128.m3u"

        Station(404) = "http://www.coopradio.org/listen/net.m3u"

        Station(405) = "http://rtsp://204.14.19.66/corus-edge2-unicast"

        Station(406) = "http://stream.frequencecaribou.com:8000/listen.pls"

        Station(407) = "http://www.frequencecaribou.com/fc_haut.ram"

        Station(408) = "http://www.frequencecaribou.com/fc_haut.ram"

        Station(409) = "http://66.15.146.37:8004"

        Station(410) = "http://idealsound.ca/ids002-128k.pls"

        Station(411) = "http://205.188.215.232:8004"

        Station(412) = "http://ridgeradio.no-ip.org:8000/listen.pls"

        Station(413) = "http://kootenaycoopradio.com/live.pls"

        Station(414) = "http://media.trytel.net/980kruz/"

        Station(415) = "http://www.kx96.fm/RA/kx96fm.asx"

        Station(416) = "http://www.marcusradio.ca/media/MarcusRadio.m3u"

        Station(417) = "http://38.99.208.186/ckwx"

        Station(418) = "http://38.99.208.186/cftr"

        Station(419) = "http://www.prairiesable.com:3789/listen.m3u"

        Station(420) = "http://www.radiocentreville.com/pages/rcville2.ram"

        Station(421) = "http://mms://24.226.221.194/ckau"

        Station(422) = "http://streams.radiofreenetwork.ca:8000/rfp-hifi.m3u"

        Station(423) = "http://streams.radiofreenetwork.ca:8000/lo-fi.m3u"

        Station(424) = "http://radiojazzplus.com/radioh.m3u"

        Station(425) = "http://www.azevedo.ca/scratch/scratch.pls"

        Station(426) = "http://139.142.90.9:8000"

        Station(427) = "http://67.79.189.38:8000/listen.m3u"

        Station(428) = "http://mms://64.69.87.77/beatradio"

        Station(429) = "http://212.227.165.215:9052/listen.pls"

        Station(430) = "http://trentradio.ca:8800/hi-fi.m3u"

        Station(431) = "http://trentradio.ca:8800/hi-fi.ogg.m3u"

        Station(432) = "http://trentradio.ca:8800/lo-fi.ogg.m3u"

        Station(433) = "http://trentradio.ca:8800/lo-fi.m3u"

        Station(434) = "http://idealsound.ca/ids002-128k.pls"

        Station(435) = "http://idealsound.ca/ids002-128k.pls"

        Station(436) = "http://idealsound.ca/ids003-128k.pls"

        Station(437) = "http://24.68.130.94:8000/listen.m3u"

        Station(438) = "http://www.village900.ca/ckmo.asx"

        Station(439) = "http://radio.wiccanweb.ca:8000/radio1.mp3.m3u"

        Station(440) = "http://www.jr-digital.com/asx/chym.asx"

        '.............................................................................

        'Carribean

        Station(441) = "http://200.122.132.2:8556"

        Station(442) = "http://www.94-7.com/asx/Radio947uni.asx"

        Station(443) = "http://tess.fast-serv.com:8142/"

        Station(444) = "http://www.bachata106.com/Bachata106.ram"

        Station(445) = "http://tv10.stream-music.net:8016"

        Station(446) = "mms://win81il.audiovideoweb.com/il81winlive2025"

        Station(447) = "http://64.18.139.67:8000"

        Station(448) = "http://Live921.hotwavestreams.com:8000"

        Station(449) = "http://www.eltapondelacinco.com/Audio/audio(1).asx"

        Station(450) = "http://www.decibelesmusic.com:8000/decibeles.mp3"

        Station(451) = "mms://64.246.26.127/estrella90"

        Station(452) = "http://www.loudcity.net/Portals/0/LCPlayLists/120/24hr.dakine.ram"

        Station(453) = "mms://64.95.53.21/klassic_live"

        Station(454) = "http://64.202.98.32:6680/listen.pls"

        Station(455) = "http://www.lan103.net/lan103.asx"

        Station(456) = "http://212.72.186.18:8600/listen.pls"

        Station(457) = "http://64.202.98.32:6690"

        Station(458) = "http://www.dominioonline.net/rdominicana/128/listen.m3u"

        Station(459) = "http://www.dominioonline.net/rdominicana/48/listen.m3u"

        Station(460) = "http://www.radioesperanza.org.sv:8000/listen.pls"

        Station(461) = "mms://67.19.103.58/ritmo96"

        Station(462) = "http://212.72.165.24:9012"

        Station(463) = "http://www.rootsrockreggae.com.jm/rrrstream.ram"

        Station(464) = "http://www.rootsrockreggae.com.jm/rrrstream.ram"

        Station(465) = "http://www.rumbafm.com.do/audio/los_angeles_rumbafm_audiostream.m3u"

        Station(466) = "http://www.rumbafm.com.do/audio/los_angeles_rumbafm_audiostream.m3u"

        Station(467) = "http://www.spiceislander.com/media/siradio.wvx"

        Station(468) = "http://alpha.expodns.com:2006/listen.pls"

        Station(469) = "http://tv9.stream-music.net:8030/"

        'deutsche Sender

        Station(470) = "http://surround.webradio.antenne.de"

        Station(471) = "http://surround.webradio.rockantenne.de"

        Station(472) = "http://gffstream.ic.llnwd.net/stream/gffstream_w12a"

        Station(473) = "http://gffstream.ic.llnwd.net/stream/gffstream_w12b"

        Station(474) = "http://gffstream.ic.llnwd.net/stream/gffstream_w10a"

        Station(475) = "http://gffstream.ic.llnwd.net/stream/gffstream_w10b"

        Station(476) = "http://gffstream.ic.llnwd.net/stream/gffstream_w13a"

        Station(477) = "http://gffstream.ic.llnwd.net/stream/gffstream_w13b"

        Station(478) = "http://gffstream.ic.llnwd.net/stream/gffstream_w14a"

        Station(479) = "http://gffstream.ic.llnwd.net/stream/gffstream_w14b"

        Station(480) = "http://www.swr3.de/wraps/swr3_mp3.m3u.php"

 

 

        '....................................................

        'MEXICO

        '...................................................

        'USA

        '...................................................

 

        '::::::::::::::::::::::::::::::::::::::

        ReDim NameSender(990)

        NameSender(1) = "Radio SelMcKenzie"

        NameSender(2) = "Radio 917 XFM Hamburg"

        NameSender(3) = "RTL Berlin"

        NameSender(4) = "RTL"

        NameSender(5) = "Antenne Bayern "

        NameSender(6) = "Antenne Mecklenburg-Vorpommern"

        NameSender(7) = "Bayern-1"

        NameSender(8) = "Bayern-2"

        NameSender(9) = "Bayern-3"

        NameSender(10) = "Bayern Klassik"

        NameSender(11) = "Bayern 5-aktuell"

        NameSender(12) = "Radio"

        NameSender(13) = "Radio"

        NameSender(14) = "Radio"

        NameSender(15) = "Rock-Antenne"

        NameSender(16) = "SWR-3"

        NameSender(17) = "Deutschland-Radio Wissen"

        NameSender(18) = "Radio Die Neue 107.7 Stuttgart"

        NameSender(19) = "Radio EGO-FM"

        NameSender(20) = "Dragondland-Radio"

        NameSender(21) = "Radio Energy Berlin"

        NameSender(22) = "Radio Energy Hamburg"

        NameSender(23) = "Radio Energy Nürnberg"

        NameSender(24) = "Radio Energy Stutrtgart"

        NameSender(25) = "Radio Energy München"

        NameSender(26) = "Radio Energy Sachsen"

        NameSender(27) = "Radio Energy Bremen"

        NameSender(28) = "Radio"

        NameSender(29) = "Radio"

        NameSender(30) = "WDR-4"

        NameSender(31) = "Radio"

        NameSender(32) = "RTL Halle"

        NameSender(33) = "Antenne 1 Baden-Württemberg"

        NameSender(34) = "Antenne 1 Baden-Württemberg"

        NameSender(35) = "big FM"

        NameSender(36) = "big FM"

        NameSender(37) = "big FM"

        NameSender(38) = "big FM"

        NameSender(39) = "big FM"

        NameSender(40) = "big FM"

        NameSender(41) = "big FM"

        NameSender(42) = "big FM"

        NameSender(43) = "big FM"

        NameSender(44) = "big FM"

        NameSender(45) = "big FM"

        NameSender(46) = "big FM"

        NameSender(47) = "Radio BlackBeats"

        NameSender(48) = "Radio BlackBeats"

        NameSender(49) = "Radio Blackbeats"

        NameSender(50) = "Radio Campus FM Duisburg-Essen"

        NameSender(51) = "AFN Rheinland-Pfalz"

        NameSender(52) = "AFN Bayaria (Bayern)"

        NameSender(53) = "AFN Country Rheinland-Pfalz"

        NameSender(54) = "AFN Gravity Rheinland-Pfalz"

        NameSender(55) = "AFN Hot Rheinland-Pfalz"

        NameSender(56) = "AFN Joe Radio Rheinland-Pfalz"

        NameSender(57) = "AFN Kaiserslautern Rheinland-Pfalz"

        NameSender(58) = "AFN Legacy Rheinland-Pfalz"

        NameSender(59) = "AFN Spangdahlem Rheinland-Pfalz"

        NameSender(60) = "AFN Stuttgart Baden-Württemberg"

        NameSender(61) = "AFN The Eagle Rheinland-Pfalz"

        NameSender(62) = "AFN The Voice Rheinland-Pfalz Ramstein Air Base"

        NameSender(63) = "AFN Wiesbaden Hessen "

        NameSender(64) = "Radio ByteFM"

        NameSender(65) = "Radio BeyteFM"

        NameSender(66) = "Alsterradio"

        NameSender(67) = "Alsterradio"

        NameSender(68) = "Radio deltaradio"

        NameSender(69) = "Radio detektor.FM"

        NameSender(70) = "Radio detektor.FM"

        NameSender(71) = "Deutschlandradio"

        NameSender(72) = "Deutschlandradio"

        NameSender(73) = "Deutschlandradio"

        NameSender(74) = "Deutschlandradio"

        NameSender(75) = "Deutschlandradio Kultur"

        NameSender(76) = "Deutschlandradio Kultur"

        NameSender(77) = "Deutschlandradio Kultur"

        NameSender(78) = "Deutschlandradio Kultur"

        NameSender(79) = "Deutschlandradio Wissen"

        NameSender(80) = "Deutschlandradio Wissen"

        NameSender(81) = "Deutschlandradio Wissen"

        NameSender(82) = "Radio Die Neue Welle"

        NameSender(83) = "Domradio Köln"

        NameSender(84) = "Domradio Köln"

        NameSender(85) = "Domradio Köln"

        NameSender(86) = "Radio Flux FM Berlin"

        NameSender(87) = "Radio GONG"

        NameSender(88) = "Radio GONG"

        NameSender(89) = "Radio ffn Niedersachsen"

        NameSender(90) = "Radio ffn Niedersachsen"

        NameSender(91) = "Radio Jam FM"

        NameSender(92) = "Radio Jam FM"

        NameSender(93) = "Radio Jam FM"

        NameSender(94) = "Radio Jam FM"

        NameSender(95) = "Klassik-Radio"

        NameSender(96) = "Klassik-Radio"

        NameSender(97) = "Radio Kölncampus"

        NameSender(98) = "Radio Kölncampus"

        NameSender(99) = "Landeswelle Thüringen"

        NameSender(100) = "Landeswelle Thüringen"

        NameSender(100) = "egoFM"

        NameSender(101) = "egoFM"

        NameSender(102) = "egoFM"

        NameSender(103) = "egoFM"

        NameSender(104) = "egoFM"

        NameSender(105) = "egoFM"

        NameSender(106) = "egoFM"

        NameSender(107) = "egoFM"

        NameSender(108) = "egoFM"

        NameSender(109) = "egoFM"

        NameSender(110) = "Hessischer Rundfunk"

        NameSender(111) = "Hessischer Rundfunk"

        NameSender(112) = "Hessischer Rundfunk"

        NameSender(113) = "Hessischer Rundfunk"

        NameSender(114) = "Hessischer Rundfunk"

        NameSender(115) = "Hessischer Rundfunk"

        NameSender(116) = "Hessischer Rundfunk"

        NameSender(117) = "Hessischer Rundfunk"

        NameSender(118) = "Hessischer Rundfunk"

        NameSender(119) = "livezwei Niedersachsen"

        NameSender(120) = "livezwei Niedersachsen"

        NameSender(121) = "livezwei Niedersachsen"

        NameSender(122) = "livezwei Niedersachsen"

        NameSender(123) = "LORA München"

        NameSender(124) = "LORA München"

        NameSender(125) = "LORA München"

        NameSender(126) = "94,5"

        NameSender(127) = "94,5"

        NameSender(128) = "94,5"

        NameSender(129) = "94,5"

        NameSender(130) = "94,5"

        NameSender(131) = "mdr Mitteldeutscher Rundfunk"

        NameSender(132) = "mdr Mitteldeutscher Rundfunk"

        NameSender(133) = "mdr Mitteldeutscher Rundfunk"

        NameSender(134) = "mdr Mitteldeutscher Rundfunk"

        NameSender(135) = "mdr Mitteldeutscher Rundfunk"

        NameSender(136) = "mdr Mitteldeutscher Rundfunk"

        NameSender(137) = "mdr Mitteldeutscher Rundfunk"

        NameSender(138) = "mdr Mitteldeutscher Rundfunk"

        NameSender(139) = "mdr Mitteldeutscher Rundfunk"

        NameSender(140) = "mdr Mitteldeutscher Rundfunk"

        NameSender(141) = "mdr Mitteldeutscher Rundfunk"

        NameSender(142) = "mdr Mitteldeutscher Rundfunk"

        NameSender(143) = "mdr Mitteldeutscher Rundfunk"

        NameSender(144) = "Sputnik"

        NameSender(145) = "Sputnik"

        NameSender(146) = "Sputnik"

        NameSender(147) = "Sputnik"

        NameSender(148) = "Sputnik"

        NameSender(149) = "Sputnik"

        NameSender(150) = "Sputnik"

        NameSender(151) = "Sputnik"

        NameSender(152) = "NDR Norddeutscher Rundfunk"

        NameSender(153) = "NDR Norddeutscher Rundfunk"

        NameSender(154) = "NDR Norddeutscher Rundfunk"

        NameSender(155) = "NDR Norddeutscher Rundfunk"

        NameSender(156) = "NDR Norddeutscher Rundfunk"

        NameSender(157) = "NDR Norddeutscher Rundfunk"

        NameSender(158) = "NDR Norddeutscher Rundfunk"

        NameSender(159) = "NDR Norddeutscher Rundfunk"

        NameSender(160) = "NDR Norddeutscher Rundfunk"

        NameSender(161) = "NDR Norddeutscher Rundfunk"

        NameSender(162) = "NDR Norddeutscher Rundfunk"

        NameSender(163) = "NDR Norddeutscher Rundfunk"

        NameSender(164) = "NDR Norddeutscher Rundfunk"

        NameSender(165) = "NDR Norddeutscher Rundfunk"

        NameSender(166) = "NDR Norddeutscher Rundfunk"

        NameSender(167) = "NDR Norddeutscher Rundfunk"

        NameSender(168) = "NDR Norddeutscher Rundfunk"

        NameSender(169) = "NDR Norddeutscher Rundfunk"

        NameSender(170) = "NDR Norddeutscher Rundfunk"

        NameSender(171) = "Nordwestradio"

        NameSender(172) = "Ostseewelle Mecklenburg-Vorpommern"

        NameSender(173) = "Radio Schleswig-Holstein"

        NameSender(174) = "Radio7"

        NameSender(175) = "Radio21"

        NameSender(176) = "RadioBOB"

        NameSender(177) = "RadioBOB"

        NameSender(178) = "Radio-Bremen"

        NameSender(179) = "Radio-Bremen"

        NameSender(180) = "Radio-Bremen"

        NameSender(181) = "Radio-Bremen"

        NameSender(182) = "Radio Brocken"

        NameSender(183) = "Radio Brocken"

        NameSender(184) = "Radio Brocken"

        NameSender(185) = "Radio multikulti"

        NameSender(186) = "Radio multikulti"

        NameSender(187) = "Radio multikulti"

        NameSender(188) = "Radio multikulti"

        NameSender(189) = "Radio multikulti"

        NameSender(190) = "Radio multikulti"

        NameSender(191) = "Radio multikulti"

        NameSender(192) = "Radio Top40 Thüringen"

        NameSender(193) = "Radio Top 40 Thüringen"

        NameSender(194) = "Radio Top 40 Thüringen"

        NameSender(195) = "Radio Top 40 Thüringen"

        NameSender(196) = "Radio Total Instrumental"

        NameSender(197) = "Radio Hard FM"

        NameSender(198) = "Radio Charivari München"

        NameSender(199) = "Radio Charivari Nürnberg"

        NameSender(200) = "Radio Charivari Webradio"

        For a = 201 To 231

            NameSender(a) = "AUSTRALIA: " & Station(a)

        Next a

        NameSender(232) = "Dolfijn FM (Curacao)"

        NameSender(233) = "Paradise FM (Curacao)"

        NameSender(234) = "Monumental-FM (Dominicanische Republik)"

        NameSender(235) = "Ylen Klassinen  (Finland)"

        NameSender(236) = "YLE Puhe  (Finland)"

        NameSender(237) = "Radio Voima, (Finland)"

        NameSender(238) = "Pure Rock FM 89/WONC (USA)"

        NameSender(239) = "Sky FM (USA)"

        NameSender(240) = "WNCW 88.7 FM (USA)"

        NameSender(241) = "KWUR (USA)"

        NameSender(242) = "KWUR (USA)"

        NameSender(243) = "ETN (USA)"

        For a = 244 To 259

            NameSender(a) = "ARGENTINA: " & Station(a)

        Next a

        For a = 260 To 264

            NameSender(a) = "BOLIVIA: " & Station(a)

        Next a

        For a = 265 To 282

            NameSender(a) = "BRAZIL: " & Station(a)

        Next a

        For a = 283 To 289

            NameSender(a) = "CHILE: " & Station(a)

        Next a

        For a = 290 To 291

            NameSender(a) = "COSTA RICA: " & Station(a)

        Next a

        For a = 292 To 298

            NameSender(a) = "CUBA: " & Station(a)

        Next a

        For a = 299 To 302

            NameSender(a) = "VENEZUELA: " & Station(a)

        Next a

        For a = 303 To 312

            NameSender(a) = "INDIA: " & Station(a)

        Next a

        For a = 313 To 314

            NameSender(a) = "ISRAEL: " & Station(a)

        Next a

        For a = 315 To 325

            NameSender(a) = "JAPAN: " & Station(a)

        Next a

        For a = 326 To 333

            NameSender(a) = "KOREA: " & Station(a)

        Next a

        For a = 334 To 334

            NameSender(a) = "PAKISTAN: " & Station(a)

        Next a

        For a = 335 To 336

            NameSender(a) = "SINGAPORE: " & Station(a)

        Next a

        For a = 337 To 337

            NameSender(a) = "SRI LANKA: " & Station(a)

        Next a

        For a = 338 To 346

            NameSender(a) = "THAILAND: " & Station(a)

        Next a

        For a = 347 To 348

            NameSender(a) = "ALGERIA: " & Station(a)

        Next a

        For a = 350 To 350

            NameSender(a) = "ANGOLA: " & Station(a)

        Next a

        For a = 351 To 354

            NameSender(a) = "MAROCCO: " & Station(a)

        Next a

        For a = 355 To 440

            NameSender(a) = "CANADA: " & Station(a)

        Next a

        For a = 441 To 469

            NameSender(a) = "CARRIBEAN: " & Station(a)

        Next a

        For a = 470 To 480

            NameSender(a) = "deutsch: " & Station(a)

        Next a

 

 

        MediaPlayer.URL = Station(aktPos)

        Me.Text = "Radio-Sender-Nr. " & aktPos & " " & NameSender(aktPos) & " Adresse: " & Station(aktPos)

 

 

    End Sub

 

    'ab hier alle BlattVideoAudio

    Private VideoProgramm As New VideoUnterprogrammierung()

    Private kf As Single = 1

    Private Sub KnopfVideoDateiOeffnen_Click(sender As Object, e As EventArgs) Handles KnopfVideoDateiOeffnen.Click

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

            VideoProgramm.Open(OpenFileDialog1.FileName)

            kf = Convert.ToSingle(VideoProgramm.Length) / TrackBarVideoPosition.Maximum

            'ToolStripStatusLabel1.Text = OpenFileDialog1.FileName

            KnopfVideoAbspielen.Text = "PLAY"

        End If

        MediaPlayer.URL = OpenFileDialog1.FileName

    End Sub

 

    Private Sub KnopfVideoAbspielen_Click(sender As Object, e As EventArgs) Handles KnopfVideoAbspielen.Click

        If KnopfVideoAbspielen.Text = "PLAY" Then

            VideoProgramm.Play()

            UhrVideoAudio.Enabled = True

            KnopfVideoAbspielen.Text = "STOPP"

        Else

            VideoProgramm.Stop_()

            UhrVideoAudio.Enabled = False

            TrackBarVideoPosition.Value = 0

            AbspielZeitAnzeige.Text = "00:00"

            KnopfVideoAbspielen.Text = "PLAY"

        End If

    End Sub

 

    Private Sub KnopfVideoPause_Click(sender As Object, e As EventArgs) Handles KnopfVideoPause.Click

        If KnopfVideoPause.Text = "PAUSE" Then

            VideoProgramm.Pause()

            KnopfVideoPause.Text = "WEITER"

        Else

            KnopfVideoPause.Text = "PAUSE"

            VideoProgramm.Resume_()

        End If

    End Sub

 

    Private Sub TrackBarVideoPosition_Scroll(sender As Object, e As EventArgs) Handles TrackBarVideoPosition.Scroll

        Try

            Me.VideoProgramm.Position = Convert.ToInt32(TrackBarVideoPosition.Value * kf)

        Catch ex As Exception

            MessageBox.Show(ex.Message, Application.ProductName,

                MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try

    End Sub

 

    Private Sub TrackBarVideoLautstärke_Scroll(sender As Object, e As EventArgs) Handles TrackBarVideoLautstärke.Scroll

        VideoProgramm.volume(TrackBarVideoLautstärke.Value)

 

        MediaPlayer.settings.volume = TrackBarVideoLautstärke.Value 'geht nicht

    End Sub

 

    Private Sub KnopfTonaufnahmeBeginnen_Click(sender As Object, e As EventArgs) Handles KnopfTonaufnahmeBeginnen.Click

        DerText = "Beginn der Tonaufnahme (sprechen Sie nunmehr ins Microphone bzw. schalten Sie die andere aufzunehmende Quelle ein"

        MessageBox.Show(DerText, DerText)

        mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)

        mciSendString("record recsound", "", 0, 0) 'ab jetzt erfolgt Aufnahme

        KnopfTonaufnahmeBeginnen.BackColor = Color.Teal

        KnopfTonaufnahmeBeginnen.Text = "läuft"

        KnopfTonaufnahmeBeenden.BackColor = Color.Red

        KnopfTonaufnahmeBeenden.Text = "stop"

        KnopfTonaufnahmeAnhören.Visible = True

    End Sub

 

    Private Sub KnopfTonaufnahmeBeenden_Click(sender As Object, e As EventArgs) Handles KnopfTonaufnahmeBeenden.Click

        Directory.CreateDirectory("c:\1")

 

        mciSendString("stop recsound", "", 0, 0) 'Aufnahme stoppen

        mciSendString("save recsound c:\1\MeineAufnahme.wav", "", 0, 0)

        'C:\1\MeineAufnahme.wav ist Pfad wo Aufnahme abgespeichert werden soll. Beachten: die Dateiendung muss .wav sein!

        mciSendString("close recsound", "", 0, 0)

        KnopfTonaufnahmeBeginnen.BackColor = Color.Teal

        KnopfTonaufnahmeBeginnen.Text = "start"

        KnopfTonaufnahmeBeenden.BackColor = Color.Teal

        KnopfTonaufnahmeBeenden.Text = "stop"

        KnopfTonaufnahmeAnhören.Visible = True

 

        DerText = "Aufnahme gespeichert: c:\1\MeineAufnahme.wav "

        MessageBox.Show(DerText, DerText)

    End Sub

 

    Private Sub KnopfTonaufnahmeAnhören_Click(sender As Object, e As EventArgs) Handles KnopfTonaufnahmeAnhören.Click

        My.Computer.Audio.Play("C:\1\MeineAufnahme.wav", AudioPlayMode.WaitToComplete) 'die erstellte Datei abzuspielen

    End Sub

 

    Private Sub UhrVideoAudio_Tick(sender As Object, e As EventArgs) Handles UhrVideoAudio.Tick

 

    End Sub

End Class

Imports System.Runtime.InteropServices

'Imports VBnetMIDI.MidiValueClass

 

Public Class clsMidiOut

    Implements IDisposable

 

#Region "Konstantendeklarationen"

 

    Private Const MAXPNAMELEN As Integer = 32

    Private Const mMocLen As Integer = 52      ' Länge MidioutCaps-Structur

    Private Const MOHiMask As UInt32 = 4294901760  ' &hFFFF0000

    Private Const MOLoMask As UInt32 = 65535       ' &h0000FFFF

 

#End Region

 

#Region "Variablendeklarationen"

    Private mDisposed As Boolean = False

    Private mShowErrorMessages As Boolean

    Private mLastException As Exception

    Private mHandle As IntPtr = IntPtr.Zero

    Private mDeviceID As Integer

    Private mCMidiOutCaps As CMidiOutCaps

    Private mSFMan As clsSFMan

    'Private mMOCaps As MIDIOUTCAPS

    Private mIsSoundFontDevice As Boolean

    Private mSoundFontDeviceID As Integer

    Private mSfDevIsOpen As Boolean

#End Region

 

#Region "Delegaten"

    Private Delegate Sub DMidiOutProc(ByVal hMidiOut As IntPtr, ByVal Msg As MidiOutMessages, ByVal UserData As Integer, ByVal Param1 As Integer, ByVal Param2 As Integer)

    Private mDelgMidiOutProc As DMidiOutProc = New DMidiOutProc(AddressOf MidiOutProc)

#End Region

 

#Region "Event-Deklarationen"

    Public Event MidiOutEvent(ByVal sender As Object, ByVal e As MidiOutEventArgs)

#End Region

 

#Region "    Enums "

 

    'Private Const MIDICAPS_CACHE As Int32 = &H4

    'Private Const MIDICAPS_LRVOLUME As Int32 = &H2

    'Private Const MIDICAPS_STREAM As Int32 = &H8

    'Private Const MIDICAPS_VOLUME As Int32 = &H1

 

    _

    Public Enum SupportFlags As Integer

        Volume = 1

        LRVolume = 2

        PatchCaching = 4

        DirectMidiStreamOut = 8

    End Enum

 

    Public Enum MidiCommands As Byte

        NoteOff = &H80

        NoteOn = &H90

        PolyphonPressure = &HA0

        ControlChange = &HB0

        ProgramChange = &HC0

        ChannelPressure = &HD0

        PitchBend = &HE0

 

        SystemExclusive = &HF0

        MidiTimeCode = &HF1

        SongPositionPointer = &HF2

        SongSelect = &HF3

        TuneRequest = &HF6

        EndOfExclusive = &HF7

 

        TimingClock = &HF8

        sStart = &HFA

        sContinue = &HFB

        sStop = &HFC

        ActiveSensing = &HFE

        SystemReset = &HFF

    End Enum

 

 

    Public Enum MidiChannels As Byte

        Ch0 = 0

        Ch1

        Ch2

        Ch3

        Ch4

        Ch5

        Ch6

        Ch7

        Ch8

        Ch9

        Ch10

        Ch11

        Ch12

        Ch13

        Ch14

        Ch15

        None = 255

    End Enum

 

    Public Enum MMSysErrors As Integer

        'Private Const MMSYSERR_BASE As Int32 = 0

        NoError = 0

        UnspecError = 1

        BadDeciveID = 2

        NotEnabled = 3

        DeviceAlreadyAllocated = 4

        InvalidHandle = 5

        NoDriver = 6

        NoMem = 7

        NotSupported = 8

        BadErrNum = 9

        InvalidFlag = 10

        InvalidParam = 11

        HandleBusy = 12

        InvalidAlias = 13

        BadDB = 14

        KeyNotFound = 15

        ReadError = 16

        WriteError = 17

        DeleteError = 18

        RegistryValueNotFound = 19

        NoDriverCallback = 20

        LastError = 20

        MoreData = 21

    End Enum

 

    Public Enum MidiCapsTechnology As Int16

        MidiPort = 1

        Synthesizer = 2

        SquareWaveSynthesizer = 3

        FMSynthesizer = 4

        MidiMapper = 5

        WaveTableSynthesizer = 6

        SoftwareSynthesizer = 7

    End Enum

 

    Public Enum MidiOutFlags As Integer

        NoCallBack = 0

        cbWindow = &H10000

        cbThread = &H20000

        cbFunction = &H30000

        cbCallBackEvent = &H50000

    End Enum

 

    ' _

    'Public Enum MidiCapsSupport As Int32

    '    Volume = &H1

    '    LRVolume = &H2

    '    Cache = &H4

    '    Stream = &H8

    'End Enum

 

    Public Enum MidiOutMessages As Integer

        momOpen = &H3C7

        momClose = &H3C8

        momDone = &H3C9

        momPositionCB = &H3CA

    End Enum

 

    Public Enum MidiOutStatus As Integer

        Closed = 0

        Open = 1

    End Enum

 

 

    Public Enum MidiNote As Byte

        C0 = 0

        Cis0 = 1

        Des0 = 1

        D0 = 2

        Dis0 = 3

        Es0 = 3

        E0 = 4

        F0 = 5

        Fis0 = 6

        Ges0 = 6

        G0 = 7

        Gis0 = 8

        As0 = 8

        A0 = 9

        Ais0 = 10

        B0 = 10

        H0 = 11

 

        C1 = 1

        Cis1 = 13

        Des1 = 13

        D1 = 14

        Dis1 = 15

        Es1 = 15

        E1 = 16

        F1 = 17

        Fis1 = 18

        Ges1 = 18

        G1 = 19

        Gis1 = 20

        As1 = 20

        A1 = 21

        Ais1 = 22

        B1 = 22

        H1 = 23

 

        C2 = 24

        Cis2 = 25

        Des2 = 25

        D2 = 26

        Dis2 = 27

        Es2 = 27

        E2 = 28

        F2 = 29

        Fis2 = 30

        Ges2 = 30

        G2 = 31

        Gis2 = 32

        As2 = 32

        A2 = 33

        Ais2 = 34

        B2 = 34

        H2 = 35

 

        C3 = 36

        Cis3 = 37

        Des3 = 37

        D3 = 38

        Dis3 = 39

        Es3 = 39

        E3 = 40

        F3 = 41

        Fis3 = 42

        Ges3 = 42

        G3 = 43

        Gis3 = 44

        As3 = 44

        A3 = 45

        Ais3 = 46

        B3 = 46

        H3 = 47

 

        C4 = 0

        Cis4 = 1

        Des4 = 1

        D4 = 2

        Dis4 = 3

        Es4 = 3

        E4 = 4

        F4 = 5

        Fis4 = 6

        Ges4 = 6

        G4 = 7

        Gis4 = 8

        As4 = 8

        A4 = 9

        Ais4 = 10

        B4 = 10

        H4 = 11

    End Enum

 

    Public Enum NRPN As Byte

        DelayBeforeLFO1Starts = 0       ' 0, 5900

        LFO1Frequency = 1                     ' 0, 127

        DelayBeforeLFO2Starts = 2       ' 0, 5900

        LFO2Frequency = 3                     ' 0, 127

        Envelope1DelayTime = 4             ' 0, 5900

        Envelope1AttackTime = 5           ' 0, 5940

        Envelope1HoldTime = 6              ' 0, 8181      

        Envelope1DecayTime = 7           ' 0, 5940

        Envelope1SustainLevel = 8        ' 0, 127

        Envelope1ReleaseTime = 9        ' 0, 5940

        Envelope2DelayTime = 10          ' 0, 5900

        Envelope2AttackTime = 11         ' 0, 5940

        Envelope2HoldTime = 12            ' 0, 8181      

        Envelope2DecayTime = 13         ' 0, 5940

        Envelope2SustainLevel = 14      ' 0, 127

        Envelope2ReleaseTime = 15     ' 0, 5940

        InitialPitch = 16                             ' -8192, 8191

        LFO1ToPitch = 17                        ' -127, 127

        LFO2ToPitch = 18                        ' -127, 127

        Envelope1ToPitch = 19               ' -127, 127

        LFO1ToVolume = 20                   ' 0, 127

        InitialFilterCutoff = 21                  ' 0 , 127

        InitialFilterResonanceCoefficient = 22  ' 0, 127

        LFO1ToFilterCutoff = 23            ' - 64, 63

        Envelope1ToFilterCutoff = 24    ' -127, 127

        ChorusEffectsSend = 25            ' 0, 255

        ReverbEffectsSend = 26            ' 0, 255

    End Enum

#End Region

 

#Region "    Structs "

 

    _

    Public Structure MidiOutParam1

        Public Value As Int32

        Public uValue As UInt32

        Public LoWord As Int16

        Public uLoWord As UInt16

        Public HiWord As Int16

        Public uHiWord As UInt16

        Friend MidiStatus As Byte

        Public MidiData1 As Byte

        Public MidiData2 As Byte

        Public MidiData3 As Byte

 

        Shared mLoMask As Byte = &HF

        Shared mHiMask As Byte = &HF0

 

        Public Property MidiCommand() As MidiCommands

            Get

                If MidiStatus < mHiMask Then

                    Return CType(MidiStatus And mHiMask, MidiCommands)

                Else

                    Return CType(MidiStatus, MidiCommands)

                End If

            End Get

            Set(ByVal value As MidiCommands)

                If value < mHiMask Then

                    MidiStatus = MidiStatus And (Not mHiMask)

                    MidiStatus = MidiStatus Or value

                Else

                    MidiStatus = value

                End If

            End Set

        End Property

 

        Public Property MidiChannel() As MidiChannels

            Get

                If MidiStatus < mHiMask Then

                    Return CType(MidiStatus And mLoMask, MidiChannels)

                Else

                    Return MidiChannels.None

                End If

            End Get

            Set(ByVal value As MidiChannels)

                If MidiStatus < mHiMask Then

                    MidiStatus = MidiStatus Or value

                End If

            End Set

        End Property

    End Structure

 

 

    _

    Public Structure MidiOutParam2

        Public Value As Int32

        Public uValue As UInt32

        Public LoWord As Int16

        Public uLoWord As UInt16

        Public HiWord As Int16

        Public uHiWord As UInt16

        Public Byte0 As Byte

        Public Byte1 As Byte

        Public Byte2 As Byte

        Public Byte3 As Byte

    End Structure

 

 

    _

    Public Structure MIDIOUTCAPS

        Public ManufacturerID As Int16

        Public ProductID As Int16

        Public DriverVersion As Int32

        _

        Public ProductName As String

        Public Technology As MidiCapsTechnology

        Public Voices As Int16

        Public Notes As Int16

        Public ChannelMask As Int16

        Public Support As SupportFlags

    End Structure

 

    _

    Private Structure MIDIHDR

        Public lpData As String

        Public dwBufferLength As Int32

        Public dwBytesRecorded As Int32

        Public dwUser As Int32

        Public dwFlags As Int32

        Public lpNext As Int32

        Public Reserved As Int32

    End Structure

 

#End Region

 

#Region "    Api-Deklarationen "

    Private Declare Auto Function midiOutCacheDrumPatches Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByVal uPatch As Int32, _

                                ByRef lpKeyArray As Int32, _

                                ByVal uFlags As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutCachePatches Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByVal uBank As Int32, _

                                ByRef lpPatchArray As Int32, _

                                ByVal uFlags As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutClose Lib "winmm.dll" _

                                (ByVal hMidiOut As IntPtr _

                                ) As Int32

 

    Private Declare Auto Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" _

                                (ByVal uDeviceID As Int32, _

                                ByRef lpCaps As MIDIOUTCAPS, _

                                ByVal uSize As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutGetID Lib "winmm.dll" _

                                (ByVal hMidiOut As IntPtr, _

                                ByRef lpDeviceID As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutGetErrorText Lib "winmm.dll" _

                                (ByVal err As Int32, _

                                ByVal lpText As String, _

                                ByVal uSize As Int32 _

                                ) As Int32

 

    Public Declare Auto Function midiOutGetNumDevs Lib "winmm.dll" () As Int32

 

 

    Private Declare Auto Function midiOutGetVolume Lib "winmm.dll" _

                                (ByVal hMidiOut As IntPtr, _

                                ByRef lpdwVolume As UInt32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutLongMsg Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByRef lpMidiOutHdr As MIDIHDR, _

                                ByVal uSize As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutMessage Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByVal msg As Int32, _

                                ByVal dw1 As Int32, _

                                ByVal dw2 As Int32 _

                                ) As Int32

 

    Private Declare Auto Function midiOutOpen Lib "winmm.dll" _

                                (ByRef lphMidiOut As IntPtr, _

                                ByVal uDeviceID As Int32, _

                                ByVal dwCallback As Int32, _

                                ByVal dwInstance As Int32, _

                                ByVal dwFlags As MidiOutFlags _

                                ) As Int32

 

    Private Declare Auto Function midiOutOpen Lib "winmm.dll" _

                            (ByRef lphMidiOut As IntPtr, _

                            ByVal uDeviceID As Int32, _

                            ByVal dwCallback As DMidiOutProc, _

                            ByVal dwInstance As Int32, _

                            ByVal dwFlags As MidiOutFlags _

                            ) As Int32

 

    Private Declare Auto Function midiOutPrepareHeader Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByRef lpMidiOutHdr As MIDIHDR, _

                                ByVal uSize As Int32 _

                                ) As MMSysErrors

 

    Private Declare Auto Function midiOutReset Lib "winmm.dll" _

                                (ByVal hMidiOut As IntPtr _

                                ) As MMSysErrors

 

    Private Declare Auto Function midiOutSetVolume Lib "winmm.dll" _

                                (ByVal uDeviceID As Int32, _

                                ByVal dwVolume As UInt32 _

                                ) As MMSysErrors

 

    Private Declare Auto Function midiOutShortMsg Lib "winmm.dll" _

                                (ByVal hMidiOut As IntPtr, _

                                ByVal dwMsg As Int32 _

                                ) As Integer

 

    Private Declare Auto Function midiOutUnprepareHeader Lib "winmm.dll" _

                                (ByVal hMidiOut As Int32, _

                                ByRef lpMidiOutHdr As MIDIHDR, _

                                ByVal uSize As Int32 _

                                ) As Int32

 

 

    Private Declare Auto Function midiConnect Lib "winmm.dll" _

                            (ByVal hmi As IntPtr, _

                            ByVal hmo As IntPtr, _

                            ByVal pReserved As Int32 _

                            ) As Int32

 

    Private Declare Auto Function midiDisconnect Lib "winmm.dll" _

                                (ByVal hmi As IntPtr, _

                                ByVal hmo As IntPtr, _

                                ByVal pReserved As Int32 _

                                ) As Int32

 

 

#End Region

 

#Region "Properties"

 

    '''

    ''' Gibt True zurück, wenn das akt. MidiOut-Gerät ein soundfontfähiges Gerät ist.

    '''

    '''

    '''

    '''

    Public ReadOnly Property IsSoundFontDevice() As Boolean

        Get

            Return mIsSoundFontDevice

        End Get

    End Property

 

    '''

    ''' Gibt die SoundFont-Geräte-ID zurück, wenn das akt. MidiOut-Gerät ein soundfontfähiges Gerät ist.

    '''

    '''

    '''

    '''

    Public ReadOnly Property SoundFontDeviceID() As Integer

        Get

            Return mSoundFontDeviceID

        End Get

    End Property

 

    Public ReadOnly Property SoundFontManager() As clsSFMan

        Get

            Return mSFMan

        End Get

    End Property

 

    '''

    ''' Liefert die Zugriffsnummer (Handle) für das akt. MidiOut-Gerät

    '''

    '''

    '''

    '''

    Public ReadOnly Property Handle() As IntPtr

        Get

            Return mHandle

        End Get

    End Property

 

    '''

    ''' Liefert die Gerätenummer (DeviceID) für das akt. MidiOut-Gerät

    '''

    '''

    '''

    '''

    Public ReadOnly Property DeviceId() As Integer

        Get

            Return mDeviceID

        End Get

    End Property

 

    '''

    ''' Ruft ab oder legt fest, ob Subs/Functions Fehlermeldungen ausgeben oder nicht.

    '''

    '''

    '''

    '''

    Public Property ShowErrorMessages() As Boolean

        Get

            Return mShowErrorMessages

        End Get

        Set(ByVal value As Boolean)

            mShowErrorMessages = value

        End Set

    End Property

 

    '''

    ''' Liefert den Zustand (geöffnet/geschlossen) des akt. MidiOut-Gerätes

    '''

    '''

    '''

    '''

    Public ReadOnly Property Status() As MidiOutStatus

        Get

            If mHandle = IntPtr.Zero Then

                Return MidiOutStatus.Closed

            Else

                Return MidiOutStatus.Open

            End If

        End Get

    End Property

 

    Public ReadOnly Property LastException() As Exception

        Get

            Return mLastException

        End Get

    End Property

 

#End Region

 

    '''

    ''' Erstellt eine neue Instanz einer Klasse clsMidiOut.

    '''

    ''' Eine im Bereich 0 bis GetNumMidiOutDevs -1 liegende MidiOut-Geräte-Id

    ''' Verweis auf eine gültige Instanz einer clsSFMan (SoundFontManager)oder Nothing

    '''

    Public Sub New(ByVal DeviceID As Integer, ByVal SFMan As clsSFMan)

        mDeviceID = DeviceID

        mSFMan = SFMan

        mCMidiOutCaps = GetMidiOutCaps(DeviceID)

        mIsSoundFontDevice = mCMidiOutCaps.IsSoundFontDevice

        mSoundFontDeviceID = mCMidiOutCaps.SFDeviceIndex

    End Sub

 

    '''

    ''' Prüft, ob das durch DevID gekennzeichnete MidiOut-Gerät soundfontfähig ist.

    '''

    ''' Eine im Bereich 0 bis GetNumMidiOutDevs -1 liegende MidiOut-Geräte-Id

    ''' Verweis auf eine gültige Instanz einer clsSFMan

    ''' Rückgabe der Soundfont-Geräte-Id bei soundfontfähigen Geräten

    ''' True: wenn das Gerät (DevID) soundfontfägig ist; andernfalls: False

    '''

    Public Shared Function CheckSFDevice(ByVal DevID As Integer, ByVal SFMan As clsSFMan, ByRef SfDevID As Integer) As Boolean

        SfDevID = -1

        If SFMan IsNot Nothing Then

            If SFMan.ClassReady Then

                Dim NumDevs As UShort

                Dim i As UShort

                If SFMan.GetNumDevs(NumDevs) Then

                    Dim MOC As MIDIOUTCAPS

                    MOC.ProductName = ""

                    For i = 0 To NumDevs - CType(1, UShort)

                        Dim DC As clsSFMan.CSFCaps = Nothing

                        If SFMan.GetDevCaps(i, DC) Then

                            If midiOutGetDevCaps(DevID, MOC, mMocLen) = 0 Then

                                If MOC.ProductName.Contains(DC.DevName) Then

                                    SfDevID = i

                                    Return True

                                End If

                            End If

                        End If

                    Next

                End If

            End If

        End If

        Return False

    End Function

 

#Region "Dispose / Finalize"

 

    Protected Overridable Sub Dispose(ByVal disposing As Boolean)

        If Not mDisposed Then

 

            If disposing Then

                ' TODO: Anderen Zustand freigeben (verwaltete Objekte).

            End If

 

            ' TODO: Eigenen Zustand freigeben (nicht verwaltete Objekte).

            ' TODO: Große Felder auf NULL festlegen.

            If mHandle <> IntPtr.Zero Then

                Dim Ret As Integer

                Ret = midiOutReset(mHandle)

      
 
 
 
 
 
 
 
 
 
         Ret = midiOutClose(mHandle)

            End If

        End If

        mDisposed = True

    End Sub

 

    Public Sub Dispose() Implements IDisposable.Dispose

        Dispose(True)

        GC.SuppressFinalize(Me)

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.