Results 1 to 2 of 2

Thread: Changing file name within API call

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    2
    Hi
    I use the following code to record MIC input to WAV file :


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


    Private Sub cmdRecord_Click()
    Dim i As Long

    i = mciSendString("open new Type waveaudio Alias capture", 0&, 0, 0)
    i = mciSendString("set capture bitspersample 8", 0&, 0, 0)
    i = mciSendString("set capture samplespersec 11025", 0&, 0, 0)
    i = mciSendString("set capture channels 1", 0&, 0, 0)
    i = mciSendString("record capture", 0&, 0, 0)

    End Sub

    Private Sub cmdStopRecord_Click()
    Dim i As Long

    i = mciSendString("stop capture", 0&, 0, 0)
    i = mciSendString("save capture c:\NewWave.wav", 0&, 0, 0)
    i = mciSendString("close capture", 0&, 0, 0)
    End Sub
    -------------------------------------------------------------
    My quastion is :
    How can I change the name of the file according to input from the user
    I tried to create FileName veriable (string) and to change to :

    FileName = "abc.wav"
    ("save capture FileName", 0&, 0, 0)

    But it only crears new WAV file name FileName.
    Any Idea ?

    Thanks
    Eran


  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Originally posted by eran114
    Private Declare Function mciSendString Lib "winmm.dll" Alias _
    "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
    lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal _
    hwndCallback As Long) As Long


    Private Sub cmdRecord_Click()
    Dim i As Long

    i = mciSendString("open new Type waveaudio Alias capture", 0&, 0, 0)
    i = mciSendString("set capture bitspersample 8", 0&, 0, 0)
    i = mciSendString("set capture samplespersec 11025", 0&, 0, 0)
    i = mciSendString("set capture channels 1", 0&, 0, 0)
    i = mciSendString("record capture", 0&, 0, 0)

    End Sub

    Private Sub cmdStopRecord_Click()
    Dim i As Long

    i = mciSendString("stop capture", 0&, 0, 0)
    i = mciSendString("save capture c:\NewWave.wav", 0&, 0, 0)
    i = mciSendString("close capture", 0&, 0, 0)
    End Sub
    Do this:
    Dim MyWavFile as String
    MyWavFile = "c:\sound.wav"
    then change:
    i = mciSendString("save capture c:\NewWave.wav", 0&, 0, 0)
    to:
    i = mciSendString("save capture" & MyWavFile, 0&, 0, 0)

    Good luck,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width