Click here to Skip to main content
15,847,583 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: All digits in string after W Pin
jschell7-Jul-23 12:49
jschell7-Jul-23 12:49 
GeneralRe: All digits in string after W Pin
Richard Deeming9-Jul-23 22:16
mveRichard Deeming9-Jul-23 22:16 
GeneralRe: All digits in string after W Pin
jschell10-Jul-23 4:34
jschell10-Jul-23 4:34 
QuestionCURL POST request in VB.NET (json) Pin
Member 118569042-Jul-23 21:02
Member 118569042-Jul-23 21:02 
AnswerRe: CURL POST request in VB.NET (json) Pin
Andre Oosthuizen3-Jul-23 1:38
mveAndre Oosthuizen3-Jul-23 1:38 
GeneralRe: CURL POST request in VB.NET (json) Pin
Member 118569043-Jul-23 23:37
Member 118569043-Jul-23 23:37 
GeneralRe: CURL POST request in VB.NET (json) Pin
Andre Oosthuizen4-Jul-23 0:22
mveAndre Oosthuizen4-Jul-23 0:22 
Questionrecord device!! Pin
Member Alienoiz19-Jun-23 7:31
Member Alienoiz19-Jun-23 7:31 
hey..me again..at least i keep the forum moving :P ...thanks for your help...i have another question sorry...
i have this code
VB.NET
<pre>Public Class SSVoiceRecordCtrl

    '-----------------------------------------------------
    '   Name    :   SoundRecording.cls
    '   Author  :   Suresh Suthar
    '
    '   Notes   :   A record class, which when turned
    '           :   into an object lets you record sound
    '           :   through mic, cd-line, etc... into a file
    '-----------------------------------------------------

    ' -=-=-=- PROPERTIES -=-=-=-
    ' FileName      Determines the name of the file used (wav only)
    ' State        The current status of the object (Read Only)
    'SoundFormat    The Formate for Recording File

    ' -=-=-=- METHODS -=-=-=-=-
    ' PauseRecord     Toggle pause the record (if you are already recording)
    ' StartRecord     Start Recording (you must have been set a good filename)
    ' StopRecord      Stop recording (and will save the sound into <filename>)

    '-------------------------------------------------------------
    ' NOTES
    ' -----
    '
    ' Before you can Start or Stop recording you must set a good
    ' filename which the class will use to save your sound into.
    '--------------------------------------------------------------

    ''>>How To Use (Sample Coding)
    ''First Add This Control To Your Project And then Named it rec
    'Try
    'If rec.State = SSVoiceRecordCtrl.SSVoiceRecordCtrl.MyState.Recording Or rec.State = SSVoiceRecordCtrl.SSVoiceRecordCtrl.MyState.Paused Then
    '     rec.CloseRecord()
    'End If
    'If rec.State = SSVoiceRecordCtrl.SSVoiceRecordCtrl.MyState.Idle Then
    '              rec.SoundFormat = SSVoiceRecordCtrl.SSVoiceRecordCtrl.SoundFormats.Mono_6kbps_8_Bit
    '              rec.FileName = "C:\Test.wav" 'Wav File Only (Extension Should Be There)
    '              rec.StartRecord()
    'End If
    'Catch ex As Exception
    '      MsgBox("Sound Recording Error : " & ex.Message & vbNewLine & "Please Contact IT Department", MsgBoxStyle.Information)
    'End Try
    ''Stop Recording And Save the File
    'rec.StopRecord
    ''>>>

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

    Dim lSamples, lRet, lBits, lChannels As Integer
    Dim iBlockAlign As Short
    Dim lBytesPerSec As Integer

    'For Images
    Dim J As Integer = 1
    Public Enum SoundFormats
        Mono_6kbps_8_Bit
        Mono_8kbps_8_Bit
        Mono_11kbps_8_Bit
        Mono_16kbps_8_Bit
        Mono_22kbps_8_Bit
        Mono_32kbps_8_Bit
        Mono_44kbps_8_Bit
        Mono_48kbps_8_Bit
        Stereo_24kbps_16_Bit
        Stereo_32kbps_16_Bit
        Stereo_44kbps_16_Bit
        Stereo_64kbps_16_Bit
        Stereo_88kbps_16_Bit
        Stereo_1288kbps_16_Bit
        Stereo_176kbps_16_Bit
        Stereo_192kbps_16_Bit
    End Enum

    Public Enum MyState
        Idle
        Recording
        Paused
    End Enum

    Private xState As MyState
    Public ReadOnly Property State() As MyState
        Get
            State = xState
        End Get
    End Property

    Private _SoundFormat As SoundFormats
    Public Property SoundFormat() As SoundFormats
        Get
            SoundFormat = _SoundFormat
        End Get
        Set(ByVal Value As SoundFormats)
            _SoundFormat = Value
        End Set
    End Property

    Private Sub GetSoundFormat()
        If _SoundFormat = SoundFormats.Mono_6kbps_8_Bit Then
            lSamples = 6000 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_8kbps_8_Bit Then
            lSamples = 8000 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_11kbps_8_Bit Then
            lSamples = 11025 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_16kbps_8_Bit Then
            lSamples = 16000 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_22kbps_8_Bit Then
            lSamples = 22050 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_32kbps_8_Bit Then
            lSamples = 32000 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_44kbps_8_Bit Then
            lSamples = 44100 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Mono_48kbps_8_Bit Then
            lSamples = 48000 : lBits = 8 : lChannels = 1
        ElseIf _SoundFormat = SoundFormats.Stereo_24kbps_16_Bit Then
            lSamples = 6000 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_32kbps_16_Bit Then
            lSamples = 8000 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_44kbps_16_Bit Then
            lSamples = 11025 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_64kbps_16_Bit Then
            lSamples = 16000 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_88kbps_16_Bit Then
            lSamples = 22050 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_1288kbps_16_Bit Then
            lSamples = 32000 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_176kbps_16_Bit Then
            lSamples = 44100 : lBits = 16 : lChannels = 2
        ElseIf _SoundFormat = SoundFormats.Stereo_192kbps_16_Bit Then
            lSamples = 48000 : lBits = 16 : lChannels = 2
        End If
        iBlockAlign = lChannels * lBits / 8
        lBytesPerSec = lSamples * iBlockAlign
    End Sub
    Private FName As String
    Public Property FileName() As String
        Get
            FileName = FName
        End Get
        Set(ByVal Value As String)
            FName = Value
        End Set
    End Property


    Public Function StartRecord() As Boolean
        Call GetSoundFormat()
        On Error GoTo ER
        If FName = "" Then GoTo ER
        Dim i As Integer
        i = mciSendString("open new type waveaudio alias capture", vbNullString, 0, 0)
        I = mciSendString("set capture samplespersec " & lSamples & " channels " & lChannels & " bitspersample " & lBits & " alignment " & iBlockAlign & " bytespersec " & lBytesPerSec, vbNullString, 0, 0)
        I = mciSendString("record capture", vbNullString, 0, 0)
        xState = MyState.Recording
        StartRecord = True
        picStatus.Image = imgList.Images(1)
        Timer1.Enabled = True
        Exit Function
ER:
        StartRecord = False
        Dim SSVoiceRecordControlExec As New ArgumentException("File Name Not Specified.")
        Throw SSVoiceRecordControlExec
    End Function

    Public Function StopRecord() As Boolean
        On Error GoTo ER
        If FName = "" Then GoTo ER
        Dim i As Integer
        I = mciSendString("save capture " & FName, vbNullString, 0, 0)
        I = mciSendString("close capture", vbNullString, 0, 0)
        xState = MyState.Idle
        StopRecord = True
        picStatus.Image = imgList.Images(0)
        Timer1.Enabled = False
        Exit Function
ER:
        i = mciSendString("close capture", vbNullString, 0, 0)
        StopRecord = False
        Dim SSVoiceRecordControlExec As New ArgumentException("File Name Not Specified.")
        Throw SSVoiceRecordControlExec
    End Function

    ''Closing Recording But Not Saved
    Public Sub CloseRecord()
        Dim i As Integer
        i = mciSendString("close capture", vbNullString, 0, 0)
        xState = MyState.Idle
        picStatus.Image = imgList.Images(0)
        Timer1.Enabled = False
    End Sub

    Private Sub Class_Initialize_Renamed()
        xState = MyState.Idle
    End Sub
    Private Sub Class_Terminate_Renamed()
        StopRecord()
    End Sub
    Protected Overrides Sub Finalize()
        Class_Terminate_Renamed()
        MyBase.Finalize()
    End Sub

    Public Function PauseRecord() As Boolean
        On Error GoTo ER
        If FName = "" Then GoTo ER
        Dim RS As String
        Dim cb, I As Integer
        RS = Space(128)
        If xState = MyState.Paused Then
            I = mciSendString("record capture", vbNullString, 0, 0)
            xState = MyState.Recording
            picStatus.Image = imgList.Images(1)
            Timer1.Enabled = True
        ElseIf xState = MyState.Recording Then
            I = mciSendString("pause capture", vbNullString, 0, 0)
            xState = MyState.Paused
            picStatus.Image = imgList.Images(0)
            Timer1.Enabled = False
        End If
        PauseRecord = True
        Exit Function
ER:
        PauseRecord = False
        Dim SSVoiceRecordControlExec As New ArgumentException("File Name Not Specified.")
        Throw SSVoiceRecordControlExec
    End Function

    Private Sub SSVoiceRecordCtrl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        picStatus.Image = imgList.Images(0)
    End Sub

    Private Sub picStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picStatus.DoubleClick
        System.Diagnostics.Process.Start("SNDVOL32.EXE")
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If J = 1 Then
            picStatus.Image = imgList.Images(J)
            J += 1
        Else
            picStatus.Image = imgList.Images(J)
            J = 1
        End If
    End Sub
End Class


i understand the code by i do not see where to change the sound source for ex. to line in...
they say this
Notes   :   A record class, which when turned
   '           :   into an object lets you record sound
   '           :   through mic, cd-line, etc... into a file

AnswerRe: record device!! Pin
Richard MacCutchan19-Jun-23 7:50
mveRichard MacCutchan19-Jun-23 7:50 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 8:08
Member Alienoiz19-Jun-23 8:08 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 9:30
Member Alienoiz19-Jun-23 9:30 
GeneralRe: record device!! Pin
Richard MacCutchan19-Jun-23 10:12
mveRichard MacCutchan19-Jun-23 10:12 
GeneralRe: record device!! Pin
Member Alienoiz19-Jun-23 10:34
Member Alienoiz19-Jun-23 10:34 
AnswerRe: record device!! Pin
Ralf Meier20-Jun-23 5:05
professionalRalf Meier20-Jun-23 5:05 
QuestionListbox Highlight color! Pin
Member Alienoiz18-Jun-23 6:26
Member Alienoiz18-Jun-23 6:26 
AnswerRe: Listbox Highlight color! Pin
Richard MacCutchan18-Jun-23 6:40
mveRichard MacCutchan18-Jun-23 6:40 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 7:00
Member Alienoiz18-Jun-23 7:00 
GeneralRe: Listbox Highlight color! Pin
Richard MacCutchan18-Jun-23 7:39
mveRichard MacCutchan18-Jun-23 7:39 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 7:49
Member Alienoiz18-Jun-23 7:49 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 8:08
Member Alienoiz18-Jun-23 8:08 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 8:47
Member Alienoiz18-Jun-23 8:47 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz18-Jun-23 9:41
Member Alienoiz18-Jun-23 9:41 
GeneralRe: Listbox Highlight color! Pin
Richard MacCutchan18-Jun-23 22:39
mveRichard MacCutchan18-Jun-23 22:39 
GeneralRe: Listbox Highlight color! Pin
Member Alienoiz19-Jun-23 1:46
Member Alienoiz19-Jun-23 1:46 
GeneralRe: Listbox Highlight color! Pin
Richard MacCutchan19-Jun-23 1:50
mveRichard MacCutchan19-Jun-23 1:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.