Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mciSendString error - I can not record, don't know why !?!

Status
Not open for further replies.

BogdanMBM

Programmer
Aug 6, 2003
213
RO
OK. Here it is:
I want to record sound for 1 second (I use timer for this). The problem I have is that mciSendString returns 295 value (captured in "i" variable) at the line with the "save" command. Anyone knows why is this happening?

Thanks!!!

Code:
Private Sub cmdRecord_Click()
    Dim i As Long, RS As String, cb As Long
    
    If cmdRecord.Caption = "Record" Then
        i = mciSendString("open new type waveaudio alias capture", RS, 128, cb)
'        i = mciSendString("set capture bitspersample 8", 0&, 0, 0)
'        i = mciSendString("set capture samplespersec 11025", 0&, 0, 0)
        ' mono (1) / stereo (2):
'        i = mciSendString("set capture channels 1", 0&, 0, 0)
        i = mciSendString("record capture", RS, 128, cb)
        t# = Timer + 1: Do Until Timer > t#: DoEvents: Loop
        cmdRecord.Caption = "Stop"
    Else
        i = mciSendString("stop capture", RS, 128, cb)
        DoEvents
[highlight #FF99FF]        
        i = mciSendString("save capture C:\Incercari\vb\Sound - wav\NewWave2.wav", RS, 128, cb)
[/highlight]
        'Debug.Print RS
        Print RS
        i = mciSendString("close capture", RS, 128, cb)
        cmdRecord.Caption = "Record"
    End If
End Sub

Hope I've been helpful,
Bogdan Muresan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top