building an audio player

Ban Nguyen bann at sunncomm.com
Tue Jul 12 14:05:33 EDT 2005


-----Original Message-----
From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Klaus Major
Sent: Tuesday, July 12, 2005 10:54 AM
To: How to use Revolution
Subject: Re: building an audio player

Xin chào Ban,

> Xin chào Klaus,
>
> I am new to Revolution.  I am building an audio player.  So far I  
> got the play, stop, next, previous buttons work
>
> Do you have any idea to do the pause button and I want to use the  
> slider to control the audio id user want to play fast or play back  
> (you know what I mean)

you mean the user clicks (and holds the mouse!) on the fastforward  
button
and the sound plays very fast, until the user releases the mouse again?

Hint:
To be able to control the sound like you want to, you must use a  
"player" object!
If you just use "play ac xyz" then you do not have much control over  
the playback!
No fast forward/backward etc...

In that case i use a button (2 buttons, on for forward and one for  
backwards)
with this script, this is the fastforward button:

on mousedown
    set the playrate of player "your audio playername here" to 2
   ## plays double speed...
   ## This is the "normal" behaviour of such a button, i think ;-)
end mousedown

on mouseup
     set the playrate of player "your audio playername here" to 1
end mouseup

on mouserelease
   set the playrate of player "your audio playername here" to 1
end mouserelease


That's all :-)
...
set the playrate of ... to -2
...

In the fast backward button.

> I want to have a volume control to control the sound

Simply use a "slider", vertical of horizontal.

Set the startvalue to 0
The endvalue to 100

And put this into the script of the slider:

on scrollbardrag t_value
    set the playloudness of player "your audio playername here" to  
t_value
end scrollbardrag

Done :-)

The message "scrollbardrag" is being sent to Revolution continuously
while the user drags the slider. The message can have 1 parameter,
the current value of the slider, so this script will work in realtime.

Hope this helps.

> BTW I am using the scrolling list field to list the audio files and  
> let user click on each song....it works
>
> Please help
> Thank you

Không có chi. (I just love Google ;-)

Regards


------------->


I used the "player" object but it did not work. How can I have a list of songs in there?

I want to use the slider to control the song forward and backward and use another slider to make the volume

Is there anyway to do that?

Thank you very much for your help
Ban

---------------->



More information about the use-livecode mailing list