Solved

"simple" MM api question

Posted on 1998-12-30
4
185 Views
Last Modified: 2010-05-03
I have built a Class for Multimedia which includes play pause etc.
I am having difficulty in understanding how to save a recording held in memory to disk however.

How do i use the alias to pass the recording to a file?

Many thanks for any answers in advance
0
Comment
Question by:ewocks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 40 total points
ID: 1453166
Use this commandstring: "save anyname c:\myfile.wav"; Where "anyname" is your alias, and the rest is obvious.
Of course I'm assuming you're using the mciSendStrign fucntion (Am I right?)

Here is a little example:
----------------------------
Private Declare Function mciSendString Lib "WinMM.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Dim i As Long

Private Sub cmdPlay_Click()
    i = mciSendString("play anyname from 1", 0, 0, 0)
End Sub

Private Sub cmdRec_Click()
    i = mciSendString("record anyname to 20000", 0, 0, 0)
End Sub

Private Sub cmdStop_Click()
    i = mciSendString("stop anyname", 0, 0, 0)
End Sub

Private Sub cmdSave_Click()
    i = mciSendString("save anyname c:\myfile.wav", 0, 0, 0)
End Sub

Private Sub Form_Load()
    i = mciSendString("open new type waveaudio alias anyname", 0,  0, 0)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    i = mciSendString("close anyname", 0, 0, 0)
End Sub

----------------------------

Trillo
0
 

Author Comment

by:ewocks
ID: 1453167
Hi,
I'll give you the points for wasting your time - your answer is correct (its also what I have - except I'm using a class).

The problem I have is initializing the sound card - all I get is a system message "MMSYSTEM263 "This is not a registered MCI Device" - But I can play Wav files from explorer! any idea's?

I will post this as a seperate question if you wish

Have a good NEW YEAR

paulc@nilsys.demon.co.uk
0
 

Author Comment

by:ewocks
ID: 1453168
Have solved the above problem

Enjoy the points!
0
 
LVL 2

Expert Comment

by:trillo
ID: 1453169
Happy new year you too.

Trillo.

P.S.: Good you solved the problem, but next time, if I can help you, you don't need to put your other problems in a separate question.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question