Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 23rd, 2006, 9:00 AM   #1
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
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..
john Wesley is offline   Reply With Quote
Old Jun 23rd, 2006, 11:29 AM   #2
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4 melbolt is on a distinguished road
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
melbolt is offline   Reply With Quote
Old Jun 24th, 2006, 11:26 AM   #3
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
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..
john Wesley is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC