Jump to content

Recommended Posts

Posted

ola pessoal...tou aqui a tentar gravar os sons desktop....tenho aqui umas peças de codigo...mas isto nao esta a funcionar....

simplesmente grava o ficheiro wav mas sem qualquer som... ja experimentei varias opçoes nas placas e som mas nada...

isto e o que tenho pra enumerar os devices

   Dim deviceEnumerator As New MMDeviceEnumerator()
   Dim devices As New List(Of MMDevice)
   For Each device As MMDevice In deviceEnumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active)
       combo.Items.Add(device)
   Next

e isto para o start recording

 Private Sub waveIn_DataAvailable(sender As Object, e As WaveInEventArgs)
     waveFileWriter.Write(e.Buffer, 0, e.BytesRecorded)
 End Sub

 Private Sub btnrec_Click(sender As Object, e As EventArgs) Handles btnrec.Click

     If txtfile.Text = "" Or txtfdl.Text = "" Then
         MsgBox("Please Enter A Valid Folder And Filename!")
     Else

         Dim fdl = txtfdl.Text & "\"
         Dim fl = txtfile.Text & ".wav"
         waveIn = New WaveInEvent()
         waveIn.DeviceNumber = combo.SelectedIndex
         ' Default input device
         waveIn.WaveFormat = New WaveFormat(44100, 16, 2) ' Sample rate, bit depth, channels
         AddHandler waveIn.DataAvailable, AddressOf waveIn_DataAvailable
     waveFileWriter = New WaveFileWriter(fdl & fl, waveIn.WaveFormat)
     waveIn.StartRecording()
     Label1.ForeColor = Color.Red
         Label1.Text = "RECORDING..."
     End If
 End Sub

Alguma ideia? Obrigado 🙂

Duarte

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.