@namrekka
I haven't tried it out yet but I see, although it is from the winmm.dll, I see that it does not use mciSendString explicitly so I am wondering if it has the same return messages as mciSendString API. I have a current project that is using mciSendString and in the code it returns info that I need to perform a certain feature as it is playing a sound file.
Here is a code snippet from that project that I require:
And in the Class Module I have:Code:Dim Multimedia As MMedia Dim sngLength As Single ' ' Private Sub Timer1_Timer() Dim sngPosition As Single Dim sngPercent As Single Dim intX As Integer sngPosition = Multimedia.Position Label1.Caption = "Status: " & Multimedia.Status sngPercent = sngPosition / sngLength intX = (PicChannel.ScaleWidth - Screen.TwipsPerPixelX) * sngPercent L = Pic1Left + intX W = Pic1Width - intX Picture1.Move L, Picture1.Top, W, Picture1.Height ' ' ' End Sub
The value controls the movement of a vertical bar moving left to right across a picturebox which is representing the amount of playing time that has elapsed. So far the only API that has made it possible for me to get a precise timing on the playing time is the mciSendString. How can I use your code to get the same results?Code:' ' 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 ' ' Public Sub mmPlay() ' Plays the currently open file from the current position Dim lngReturn As Long ' Hold the value returned by the mciSendString command ' If there is no file open then exit the sub If strAlias = "" Then Exit Sub End If If blnWait Then lngReturn = mciSendString("Play " & strAlias & " wait", "", 0, 0) Else lngReturn = mciSendString("Play " & strAlias, "", 0, 0) End If End Sub ' ' Public Property Get Position() As Single ' Returns the current position in the file Dim lngReturn As Long ' Hold the value returned by the mciSendString Dim intLength As Integer Dim strPosition As String * 255 ' Holds the returned length from the mci ' status call ' Exit the property if there is no file open If strAlias = "" Then Exit Property End If ' Get the position and return lngReturn = mciSendString("Status " & strAlias & " position", strPosition, 255, 0) intLength = InStr(strPosition, Chr(0)) Position = Val(Left(strPosition, intLength - 1)) End Property ' '
As I looked through the code I fail to see where/how it plays sounds and how it gets the sound to play from a buffer. Isn't there a commands like wavOutPlay, waveOutStop, etc




Reply With Quote