mciSendString questions 
Author Message
 mciSendString questions

Subject:  mciSendString questions

Hi there,

I am using mciSendString to play wav files and it works perfect:

Public 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

  lngReturnResult = mciSendString("close all", "", 0, 0)
  lngReturnResult = mciSendString("open """ & [wavfile] & """ alias
soundfile", "", 0, 0)
  lngReturnResult = mciSendString("play soundfile", "", 0, 0)

 I have two questions though:

* How can I determine that a sound is already playing? (I don't want a
wavfile to start playing before the previous one has finished)
* How can I determine how many (milli)seconds the current file has been
playing? (I need my program to do something at the 30th second a wavfile has
been playing)

Thanks,

Raymond



Sat, 09 Oct 2004 14:32:29 GMT  
 mciSendString questions
This has nothing to do with DirectX - a more fitting group would be
microsoft.public.vb.winapi

...however, the answer to your first question is to use something like:

nErr = mciSendString("status soundfile mode", sMsg, 255, 0)

sMsg will contain a text description of the status such as "playing",
"recording", or "stopped".

The answer to your second question is to use a timer or timing loop with a
status call to the MCI device.

More info can be found at http://www.geocities.com/smigman.geo/mci/wav.html



Quote:
> Subject:  mciSendString questions

> Hi there,

> I am using mciSendString to play wav files and it works perfect:

> Public 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

>   lngReturnResult = mciSendString("close all", "", 0, 0)
>   lngReturnResult = mciSendString("open """ & [wavfile] & """ alias
> soundfile", "", 0, 0)
>   lngReturnResult = mciSendString("play soundfile", "", 0, 0)

>  I have two questions though:

> * How can I determine that a sound is already playing? (I don't want a
> wavfile to start playing before the previous one has finished)
> * How can I determine how many (milli)seconds the current file has been
> playing? (I need my program to do something at the 30th second a wavfile
has
> been playing)

> Thanks,

> Raymond




Mon, 11 Oct 2004 07:48:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. mciSendString questions

2. mciSendString question: recording audio

3. How do I access MCISendString Function

4. callback in mciSendString - how?

5. mcisendstring not working on some mpeg files

6. Problem on mciSendString record mu-law wave

7. How to use mcisendstring for multiple CD Drives?

8. using mcisendstring to cut wav-files

9. u?ycie MCISendString

10. Use mcisendstring in VB6

11. Controlling 2nd CD-ROM drive using mciSendString?

12. API mciSendString OK in ide mode, fails as exe

 

 
Powered by phpBB® Forum Software