big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / easysound.as
blob2dc4374e439c48e00af32a0bad6c407a757c749f
1 /***********************************************************************
3 * Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ***********************************************************************
22 * Simple sound test. Can load (streaming or not) and start/stop.
24 * Initial author: Sandro Santilli <strk@keybit.net>
26 ***********************************************************************/
28 #include "widgets.as"
30 if ( !hasOwnProperty('url') )
32 trace("No 'url' passed in querystring, using 'easysound.mp3'");
33 url='easysound.mp3';
36 mySound = new Sound();
38 mySound.onSoundComplete = function()
40 trace("soundComplete");
43 s_load = function()
45 trace("Loading sound "+urlin.getText()+". Streaming ? "+streamingcb.checked());
46 mySound.loadSound(urlin.getText(), streamingcb.checked());
49 s_start = function()
51 var off = offIn.getText();
52 var loops = loopsIn.getText();
53 trace("Starting sound at seconds offset "+off+" with loop count "+loops);
54 mySound.start(off, loops); // <startSecs>, <nLoops>
57 s_stop = function()
59 trace("Stopping sound.");
60 mySound.stop();
63 s_getposition = function() {
64 //trace("s_getposition called, position is "+mySound.position);
65 return mySound.position+"/"+mySound.duration;
68 s_pause = function()
70 trace("Pausing sound (basically recording current position in offset and stopping.");
71 offIn.setText( mySound.position );
72 mySound.stop();
75 streamingcb = new Checkbox(_root, "Streaming");
76 urlin = new Input(_root, "URL");
77 urlin.moveTo(100, 0);
78 if ( typeof(url) == 'undefined' ) url = 'easysound.mp3';
79 urlin.setText(url);
81 offIn = new Input(_root, "Offsets seconds");
82 offIn.moveTo(0, 30);
83 offIn.setText(0);
85 loopsIn = new Input(_root, "Loops");
86 loopsIn.setText(0);
87 loopsIn.moveTo(300, 30);
89 loadbtn = new Button(_root, "Load", s_load);
90 loadbtn.moveTo(0, 60);
92 startbtn = new Button(_root, "Start", s_start);
93 startbtn.moveTo(50, 60);
96 pausbtn = new Button(_root, "Pause", s_pause);
97 pausbtn.moveTo(100, 60);
100 stopbtn = new Button(_root, "Stop", s_stop);
101 stopbtn.moveTo(100, 60);
103 infoPosition = new InfoLine(_root, "position", s_getposition);
104 infoPosition.moveTo(0, 120);