24 May '13 - 21:53 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: [VB6] BASS_RecordGetInputName  (Read 1856 times)
SAP_ALL
Posts: 7


« on: 1 Feb '07 - 11:05 »
Reply with quoteQuote

Hello Community,

I think (maybe there is the problem  Wink ) 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):

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 ---
Logged
BassFan
Guest
« Reply #1 on: 1 Feb '07 - 12:06 »
Reply with quoteQuote

versuch mal das

    c = 0
    Combo2.Clear
    Do Until BASS_GetDeviceDescription(c) = 0
        Combo2.AddItem VBStrFromAnsiPtr(BASS_GetDeviceDescription(c))
        c = c + 1
    Loop
    Combo2.ListIndex = 0

gruss
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #2 on: 1 Feb '07 - 15:32 »
Reply with quoteQuote

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.
Logged
SAP_ALL
Posts: 7


« Reply #3 on: 1 Feb '07 - 23:13 »
Reply with quoteQuote

@Ian,

thank you, it will work fine!

The Solution

cboSoundkarte = Combobox to select Soundcard

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 Wink

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
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines