please help with MCI control 
Author Message
 please help with MCI control

Hello,

I'm currently trying to use MCI control but have encountered some
problems and
I hope someone can help me with me.

(1)
How do I know that the audio file has finished playing? For example, if
i open a waveaudio
and play it, when its finished playing, what event will be invoked?

(2)
What is Length property timescale for Sequencer (Midi) ? For wave, I've
found it is in miliseconds.
But for midi, somehow i couldn't find out the exact timescale. Can
someone help me with this?
Below is part of the code where i need the format:

<code snippet>
 If mciWave.DeviceType = "WaveAudio" Then
    msec = ((mciWave.Length) / 1000) ' i assume Length property is in
milisecond for WaveAudio
 ElseIf mciWave.DeviceType = "Sequencer" Then
    msec = ((mciWave.Length) / 10)  ' i assume Length property is in
1/10 second for Sequencer (Midi)
 End If
 lblTime = (FloorInt(msec / 60) Mod 60) & ":" & Format((msec Mod 60),
"00") 'create a timer look eg 01:32

<cut>

Public Function FloorInt(value As Single)
  Dim i As Single
  i = CInt(value)
  If i > value Then
    i = i - 1
  End If
  FloorInt = i
End Function



Sun, 29 Apr 2001 03:00:00 GMT  
 please help with MCI control

Quote:

>I'm currently trying to use MCI control but have encountered some
>problems and I hope someone can help me with me.

I've have just programmed a small MIDI player (like a thousand others), so
I've struggled with all these questions... :-)

Quote:
>How do I know that the audio file has finished playing?
>[...] when its finished playing, what event will be invoked?

There is an event called MMControl.Done. However, I never got it to work.
Instead, I use the Timer control, and with an interval of 1000 ms, I check
like this

If MMControl.Mode = mciModePlay Then
    ' is playing (move slidebar etc.)
Else If MMControl.Mode = mciModeStop And Not Stopped Then
    ' is finished (play next or something)
End If

You'll need a global variable (or perhaps a property) called Stopped
declared as boolean. Set it to true when you start to play
(MMControl.PlayClick) and false when you stop (MMControl.StopClick). The
pause command makes no impact.

Quote:
>What is Length property timescale for Sequencer (Midi) ?

Use the MMControl.Timeformat property to set this. The help says:
==============================================
Specifies the time format used to report all position information.

Syntax

[form.]MMControl.TimeFormat[ = format&]

Remarks

The following table lists the TimeFormat property settings for the
Multimedia MCI control.

Value  Setting/Time format
0 mciFormatMilliseconds
Milliseconds are stored as a 4-byte integer variable.

1 mciFormatHms
Hours, minutes, and seconds are packed into a 4-byte integer. From least
significant byte to most significant byte, the individual data values are:
Hours (least significant byte)
Minutes
Seconds
Unused (most significant byte)

2 mciFormatMsf
Minutes, seconds, and frames are packed into a 4-byte integer. From least
significant byte to most significant byte, the individual data values are:
Minutes (least significant byte)
Seconds
Frames
Unused (most significant byte)

3 mciFormatFrames
Frames are stored as a 4-byte integer variable.

4 mciFormatSmpte24
24-frame SMPTE packs the following values in a 4-byte variable from least
significant byte to most significant byte:
Hours (least significant byte)
Minutes
Seconds
Frames (most significant byte)
SMPTE (Society of Motion Picture and Television Engineers) time is an
absolute time format expressed in hours, minutes, seconds, and frames. The
standard SMPTE division types are 24, 25, and 30 frames per second.

5 mciFormatSmpte25
25-frame SMPTE packs data into the 4-byte variable in the same order as
24-frame SMPTE.

6 mciFormatSmpte30
30-frame SMPTE packs data into the 4-byte variable in the same order as
24-frame SMPTE.

7 mciFormatSmpte30Drop
30-drop-frame SMPTE packs data into the 4-byte variable in the same order as
24-frame SMPTE.

8 mciFormatBytes
Bytes are stored as a 4-byte integer variable.

9 mciFormatSamples
Samples are stored as a 4-byte integer variable.

10 mciFormatTmsf
Tracks, minutes, seconds, and frame are packed in the 4-byte variable from
least significant byte to most significant byte:
Tracks (least significant byte)
Minutes
Seconds
Frames (most significant byte)

Note   MCI uses continuous track numbering.

Note   Not all formats are supported by every device. If you try to set an
invalid format, the assignment is ignored.

[...] Properties that access or send information in the current time format
are: From, Length, Position, Start, To, TrackLength, TrackPosition.

Data Type: Long (Enumerated)
==============================================

You probably want to use format 0 which means milliseconds. Then you can
convert it like you do for waves now.

Quote:
> For wave, I've found it is in miliseconds.

I don't think that's absolutely correct. It's number of frames or so.

// Thomas Raneland



Mon, 30 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Please help with MCI control

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. Please help me with MCI Multimedia Control Error #322

4. Mute your prog (using MCI control) - how please!

5. mci help please

6. MCI and sound gurus, please help

7. Help with MCI please...

8. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

9. Need help with the MCI Control

10. Help with MCI Control Needed

11. HELP: MCI Control for VB 5 TimeFormat (CDAudio)

12. HELP with MCI control

 

 
Powered by phpBB® Forum Software