Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ouch, FoxPro let me down - duration = 0.00000
Message
From
01/01/2018 18:45:17
 
 
To
01/01/2018 18:30:25
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01656859
Message ID:
01656877
Views:
150
>on your question "But when you just let it rip the Duration is 0.00000."
>Windows media player must load the media to determine its duration and others properties.As IE it must pass the transitionnings (playstate event)
>
>On Key Label F2 wmp=Null  &&press F2 to  quit wmp
>
>Local  wmp As WindowsMediaPlayer
>wmp = Createobject("WMPlayer.OCX.7")
>With wmp
>  .url=Getfile("mp3|wav")
>  .settings.autoStart = .T.
>  .settings.Volume=80
>  .settings.setMode('loop',.F.)    &&.t. for loop
>  .Controls.Play()
>
>  Local m.xdur
>  Do While !.currentmedia.duration >0  &&the wmp must pass the transitionnings to work as expected(as IE)
>    Inkey(0.1)
>  Enddo
>  m.xdur=.currentmedia.duration
>  _Cliptext=Trans(m.xdur,"999999.99")+"  or  "+.currentmedia.DurationString
>  Messagebox("Duration="+Trans(m.xdur,"999999.99")+" sec DurationString="+.currentmedia.DurationString,0+32+4096,'in the clipboard',3000)
>
>Endwith
>Inke(m.xdur+0.5)  &&wait until the media is done.can press F2 to exit.note WMP is invisible here.
>wmp=Null
>Release wmp
>
Thanks for looking at this problem.

Again, the other OLE/COM object should work and return a non-zero duration and it does that if you step through the code in the debugger. I think that FoxPro has a problem waiting for the object to return the value when run at full speed without the debugger stepping through each line of code. I don't think your solution is viable since there are so many files to iterate through that stopping to play each one for some tiny amount of time will take a very long time.

I believe FoxPro has a problem waiting for the OLE/COM object and doevents and other things like autoyield (.f. or .t.) just don't seem to do the trick.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform