![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
MCI SendString query
Hello, and good afternoon;
I plead, May I ask for help on the subject of the MCI Device. I started a program that is an audio player for the file type *.mp3, using the MCI I have it loading a track, playing a track, pausing, resuming and stopping, also I am for now, using a scrollbar as a timing guide as to which point of the file the player is at; this works but only as I have explained and does not work in the way i would like it to. My problem lies with 'seeking' back and forth through the track. i can grab the scroller and use it to set the players place in the file (while it is playing, otherwise if you set it in the centre then play it will jump back to the start). On using the left or Right scrollbar 'buttons' however to try and 'fast-forward' or 're-wind' it simply holds the file in same place, i.e not re-winding but not letting it go any further, resulting in the audio you here repeatedly skipping back and forth over the timespan of one second or so. Could anybody give me any advice of getting the scrollbar to stay realtime with the file in play but also allow me to seek through the track either way I wish by clicking the intended direction? I am at work and do not have my code in front of me so I send all apologies if this is completely wrong, but I think the general idea is better than nothing.... sets the bars maximum to the length of the file. HScrollBar1.Value.Maximum = Val(returnData) plays file from start if loaded. retVal = mciSendString("play thesong", 0, 0, 0)I understand there is a 'seek to' command string for the MCI Device though i cant seem to set it...for example... retVal = mciSendString("seek thesong to", 0, 0, 0)I have tried setting the milliseconds all over this code but have no luck and can only presume i need some flags to acompany this procedure, setting it so general buttons could do it would be just as good. -coughs- um this got long, sorry. Thanks though, for any direction. John Wesley Hardin' p.s If i could/should or need to explain anything differently please state so.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles.. |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4
![]() |
here's an example i found, i know its a bit different than what you're working on, but you still should able to use the same concepts on yours.
Function FastForward(Spd%) Dim s As String * 40 SetFormat_milliseconds mciSendString "status cd position wait", s, Len(s), 0 CheckIfPlaying% If CheckIfPlaying = 1 Then mciSendString "play cd from " & CStr(CLng(s) + Spd), 0, 0, 0 Else mciSendString "seek cd to " & CStr(CLng(s) + Spd), 0, 0, 0 End If SetFormat_tmsf End Function Function ReWind(Spd%) Dim s As String * 40 SetFormat_milliseconds mciSendString "status cd position wait", s, Len(s), 0 CheckIfPlaying% If CheckIfPlaying = 1 Then mciSendString "play cd from " & CStr(CLng(s) - Spd), 0, 0, 0 Else mciSendString "seek cd to " & CStr(CLng(s) - Spd), 0, 0, 0 End If SetFormat_tmsf End Function Private Sub Command6_Click() Snd.ReWind Val(Text2) * 1000 End Sub Private Sub Command7_Click() Snd.FastForward Val(Text2) * 1000 End Sub source: http://cuinl.tripod.com/Tips/cdplayer.htm
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
Great Stuff melbolt, Il try putting this into action. I've found the MCI Device extremely useful for media but it can be tricky at times when these trivial situtations pop up, and the MSDN Library's information on this is scarce other than giving you the initial command.
Thanks Alot. John Wesley Hardin'
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles.. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|