Author Topic: [VB6] BASS_RecordGetInputName  (Read 2494 times)

SAP_ALL

  • Posts: 7
[VB6] BASS_RecordGetInputName
« on: 1 Feb '07 - 11:05 »
Hello Community,

I think (maybe there is the problem  ;) ) I have a simple problem.

I need two Comboboxes, one with all available soundcards that have a option to record anything.
The second Combo will display all record inputs (Line, Microphone, ...) from the first selection.

I build a Sub to show all Devices (from the multi example):

Code: [Select]
Public Sub SelectDevice()
    Dim c As Integer
    frmMain.cboSoundkarte.Clear

    c = 1      ' Device 1 = 1. verfügbare Device
    While BASS_GetDeviceDescription(c)
        frmMain.cboSoundkarte.AddItem VBStrFromAnsiPtr(BASS_GetDeviceDescription(c))
        c = c + 1
    Wend

End Sub

But, my internal soundcard will make two soundcards: one for output (soundmax 0) and one for input (soundmax 1). Soundmax 1 will not displayes in combo 1.

Whatever, is it possible to select only the name of device, they have a record input and select after all available inputs?

Maybe with a little source?

Thx.

Michael

-- sorry for my bad english ---

BassFan

  • Guest
Re: [VB6] BASS_RecordGetInputName
« Reply #1 on: 1 Feb '07 - 12:06 »
versuch mal das

Code: [Select]
    c = 0
    Combo2.Clear
    Do Until BASS_GetDeviceDescription(c) = 0
        Combo2.AddItem VBStrFromAnsiPtr(BASS_GetDeviceDescription(c))
        c = c + 1
    Loop
    Combo2.ListIndex = 0

gruss

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: [VB6] BASS_RecordGetInputName
« Reply #2 on: 1 Feb '07 - 15:32 »
For a recording device list, you should use BASS_RecordGetDeviceDescription instead of BASS_GetDeviceDescription. To get a list of available inputs on a recording device, see the RECTEST example.

SAP_ALL

  • Posts: 7
Re: [VB6] BASS_RecordGetInputName
« Reply #3 on: 1 Feb '07 - 23:13 »
@Ian,

thank you, it will work fine!

The Solution

cboSoundkarte = Combobox to select Soundcard

Code: [Select]
Private Sub cboSoundkarte_Click()
Dim c As Integer

Device = CLng(cboSoundkarte.ItemData(cboSoundkarte.ListIndex))

'Bass - Bibliothek kurz inizialisieren, um weitere Daten zu erhalten
'...aber vorher ggf. alte Instanzen freigeben!

Call BASS_RecordFree
Call BASS_Free

If (BASS_RecordInit(Device) = 0) Or (BASS_Init(-1, 44100, 0, Me.hwnd, 0) = 0) Then
    Call MsgBox("Die ausgewählte Soundkarte kann nicht abgefragt werden." & vbCrLf & "Bitte installiere einen (wenn vorhanden) aktuellen Treiber oder prüfe die Systemeinstellungen.", vbCritical, "Fehler")
Else
        cboInput.Clear
        While BASS_RecordGetInputName(c)
            cboInput.AddItem VBStrFromAnsiPtr(BASS_RecordGetInputName(c))
            If (BASS_RecordGetInput(c) And BASS_INPUT_OFF) = 0 Then
                cboInput.ListIndex = c
                Device = c
            End If
            c = c + 1
        Wend
       
End If
End Sub

cboInput are the Inputs ;)

Code: [Select]
Private Sub cboInput_Click()
    If (input_ > -1) Then
        input_ = cboInput.ListIndex

        Dim i As Integer
        For i = 0 To cboInput.ListCount - 1
            Call BASS_RecordSetInput(i, BASS_INPUT_OFF)
        Next i
       
        Call BASS_RecordSetInput(Device, BASS_INPUT_ON)
       
        'Mal hören, was gerade ankommt und ggf. Pegelanzeige aktualisieren
       
        If (chan) Then
            Call BASS_StreamFree(chan)
            chan = 0
        End If
       
        RChan = BASS_RecordStart(44100, 2, BASS_RECORD_PAUSE, AddressOf RecordingCallback, 0)
       
        If (RChan = 0) Then
          Call MsgBox("Kann den ausgewählten Aufnahmekanal nicht inizialisieren.", vbCritical, "Fehler")
          Exit Sub
        End If
       
        Call BASS_ChannelPlay(RChan, BASSTRUE) 'True = Abspielen; False = Stille
       
    End If
End Sub