When you open a file as a Sound, it loads the ENTIRE file, this is why your 
program locks up. When
you open a file as a Movie, QuickTime reads it in small chunks as it needs to 
while the movie is
playing. 

Unfortunately, MoviePlayer is a control and so it needs to be placed in a 
window somewhere. Sound
can only be played faceless, but it's very in-efficient. Unless one-time disk 
hit is very
important, I'd use a MoviePlay control to play audio as it has less loadtime 
and lower memory
requirements.

That while loop you are using is a little silly. It's eating up alot of CPU 
time just to check if
the user pressed a couple keys. I'd suggest you simply use a "Stop" button in a 
window. Along with
using the MoviePlay control, this will make the program much more efficient. 
When you are done
with the movie you simply set the MoviePlayer's movie to nil, ex: mp.movie=nil

Hope that helps clarify things,
~ Tomis


--- Emile Schwarz <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> REALbasic 5.5.5 (temporary)
> Mac OS X 10.3.9
> 
> 
> The following code returns 7 seconds of wasted time (watch the code below); 
> WHY ?
> 
> On the other hand, using a MoviePlayer, there is no latency (wasted) time, 
> but 
> how do I cancel the song (the MoviePlayer is not visible)...
> 
>    Dim mp3Song   As Sound
>    Dim tickStart As Double
>    Dim tickEnd   As Double
> 
>    tickStart = Ticks
>    mp3Song = targetSndFI.OpenAsSound
> 
>    mp3Song.Play
>    tickEnd = Ticks
> 
>    MsgBox "Latency: " + Str((tickEnd - tickStart) \ 60)
> 
>    While mp3Song.isPlaying
>      If UserCancelled Then mp3Song.Stop
>    Wend
> 
> 
> Am I right / wrong / beside my shoes ?
> 
> 
> Emile
> 
> 
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> 
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to