Re: [Flashcoders] Controllingt he volume of multiple sound objects at the same time

2007-07-06 Thread R�kos Attila

Sound objects associated with the same movie clip share their
properties (volume, etc.), so if you change the volume through one of
them, the change will be reflected by others, too. That is because in
fact sound properties belong to movie clips and not the Sound objects,
and Sound objects only reflect the sound settings of the associated movie
clip.

  Attila

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:[EMAIL PROTECTED] [EMAIL PROTECTED]
To:  flashcoders@chattyfig.figleaf.com flashcoders@chattyfig.figleaf.com
Date:Friday, July 6, 2007, 4:44:25 PM
Subject: [Flashcoders] Controllingt he volume of multiple sound objects at the 
same time
--===--

Hey there. I am trying to control the volume of a number of sound objects that 
have their own individual volume levels. I want to be able to mute them or 
allow them to play at the volume that has been set for them. I was thinking 
that I could do this by storing the values in arrays and then looping through 
these each time the sound is muted/unmuted but I am sure there must be an 
easier way. 
Any suggestsions v gratefully received :)

Here is what I have so far:
var sound1:Sound = new Sound(this);
sound1.setVolume(60);
var sound2:Sound = new Sound(this);
sound2.setVolume(20);

sound1.loadSound('an.mp3', false);
sound2.loadSound('another.mp3', false);

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Controllingt he volume of multiple sound objects at the same time

2007-07-06 Thread gluedanny
That is just what i am lookig for eka thanks so much :)
Enjoy yr weekend!
Danny


Hello :)


in my opensource framework (VEGAS) i use a SoundLibrary class to manage my
sounds...

http://svn.riaforge.org/vegas/AS2/trunk/src/andromeda/media/SoundLibrary.as

Exemple :

{{{

import andromeda.media.SoundLibrary ;

var lib:SoundLibrary = new SoundLibrary() ;

lib.addSound( sound_1 ) ; // sound in the library with the link sound_1
lib.addSound( sound_2 ) ; // sound in the library with the link sound_2
lib.addSounds( [sound_3, sound_4] ) ; // add an Array of sounds in
the library

lib.loadSound( my_sound.mp3, sound5 ) ;
lib.loadSound( sound6.mp3 ) ; // add the external sound and auto
create the 'sound6' id of the sound in the library


lib.setVolume( 50 ) ; // all sounds in the library changes the volume.

lib.getSound(sound2).setVolume( 40 ) ; // change the volume of the
'sound2' Sound reference in the library.

}}}

This class inherit the SoundModel class :
http://svn.riaforge.org/vegas/AS2/trunk/src/andromeda/media/SoundModel.as

You can use an MVC pattern with this library with a global event flow etc..

This class is really easy to use :) Use the addSound or the addSounds ou the
loadSound methods to register your local or external sounds..

You can find the VEGAS project page in Google Code :
http://code.google.com/p/vegas/
You can find the tutorial to install VEGAS :
http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN

You can find the documentation of my framework :
http://vegas.ekameleon.net/docs
You can find the SoundLibrary reference :
http://vegas.ekameleon.net/docs/andromeda/media/SoundLibrary.html
You can find the SoundModel reference :
http://vegas.ekameleon.net/docs/andromeda/media/SoundModel.html

You can see my AS2 opensource template AST'r .. in the sources of the
project you can see my personal usage of my Framework.. in this context i
use an external file of config to defines all sounds and i load an external
sound to shared the sounds of the the application

http://code.google.com/p/astr/

EKA+ :)

2007/7/6, Rákos Attila [EMAIL PROTECTED]:


Sound objects associated with the same movie clip share their
properties (volume, etc.), so if you change the volume through one of
them, the change will be reflected by others, too. That is because in
fact sound properties belong to movie clips and not the Sound objects,
and Sound objects only reflect the sound settings of the associated movie
clip.

  Attila


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:[EMAIL PROTECTED] [EMAIL PROTECTED]
To:  flashcoders@chattyfig.figleaf.com 
flashcoders@chattyfig.figleaf.com
Date:Friday, July 6, 2007, 4:44:25 PM
Subject: [Flashcoders] Controllingt he volume of multiple sound objects at
the same time

--===--

Hey there. I am trying to control the volume of a number of sound objects
that have their own individual volume levels. I want to be able to mute them
or allow them to play at the volume that has been set for them. I was
thinking that I could do this by storing the values in arrays and then
looping through these each time the sound is muted/unmuted but I am sure
there must be an easier way.
Any suggestsions v gratefully received :)

Here is what I have so far:
var sound1:Sound = new Sound(this);
sound1.setVolume(60);
var sound2:Sound = new Sound(this);
sound2.setVolume(20);

sound1.loadSound('an.mp3', false);
sound2.loadSound('another.mp3', false);

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Controllingt he volume of multiple sound objects at the same time

2007-07-06 Thread eka

Hello :)

in my opensource framework (VEGAS) i use a SoundLibrary class to manage my
sounds...

http://svn.riaforge.org/vegas/AS2/trunk/src/andromeda/media/SoundLibrary.as

Exemple :

{{{

import andromeda.media.SoundLibrary ;

var lib:SoundLibrary = new SoundLibrary() ;

lib.addSound( sound_1 ) ; // sound in the library with the link sound_1
lib.addSound( sound_2 ) ; // sound in the library with the link sound_2
lib.addSounds( [sound_3, sound_4] ) ; // add an Array of sounds in
the library

lib.loadSound( my_sound.mp3, sound5 ) ;
lib.loadSound( sound6.mp3 ) ; // add the external sound and auto
create the 'sound6' id of the sound in the library


lib.setVolume( 50 ) ; // all sounds in the library changes the volume.

lib.getSound(sound2).setVolume( 40 ) ; // change the volume of the
'sound2' Sound reference in the library.

}}}

This class inherit the SoundModel class :
http://svn.riaforge.org/vegas/AS2/trunk/src/andromeda/media/SoundModel.as

You can use an MVC pattern with this library with a global event flow etc..

This class is really easy to use :) Use the addSound or the addSounds ou the
loadSound methods to register your local or external sounds..

You can find the VEGAS project page in Google Code :
http://code.google.com/p/vegas/
You can find the tutorial to install VEGAS :
http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN

You can find the documentation of my framework :
http://vegas.ekameleon.net/docs
You can find the SoundLibrary reference :
http://vegas.ekameleon.net/docs/andromeda/media/SoundLibrary.html
You can find the SoundModel reference :
http://vegas.ekameleon.net/docs/andromeda/media/SoundModel.html

You can see my AS2 opensource template AST'r .. in the sources of the
project you can see my personal usage of my Framework.. in this context i
use an external file of config to defines all sounds and i load an external
sound to shared the sounds of the the application

http://code.google.com/p/astr/

EKA+ :)

2007/7/6, Rákos Attila [EMAIL PROTECTED]:



Sound objects associated with the same movie clip share their
properties (volume, etc.), so if you change the volume through one of
them, the change will be reflected by others, too. That is because in
fact sound properties belong to movie clips and not the Sound objects,
and Sound objects only reflect the sound settings of the associated movie
clip.

  Attila


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:[EMAIL PROTECTED] [EMAIL PROTECTED]
To:  flashcoders@chattyfig.figleaf.com 
flashcoders@chattyfig.figleaf.com
Date:Friday, July 6, 2007, 4:44:25 PM
Subject: [Flashcoders] Controllingt he volume of multiple sound objects at
the same time

--===--

Hey there. I am trying to control the volume of a number of sound objects
that have their own individual volume levels. I want to be able to mute them
or allow them to play at the volume that has been set for them. I was
thinking that I could do this by storing the values in arrays and then
looping through these each time the sound is muted/unmuted but I am sure
there must be an easier way.
Any suggestsions v gratefully received :)

Here is what I have so far:
var sound1:Sound = new Sound(this);
sound1.setVolume(60);
var sound2:Sound = new Sound(this);
sound2.setVolume(20);

sound1.loadSound('an.mp3', false);
sound2.loadSound('another.mp3', false);

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Re: [Flashcoders] Controllingt he volume of multiple sound objects at the same time

2007-07-06 Thread Marc Hoffman
Yes, but he has created a separate Sound object for each sound 
(sound1 and sound2), so he's fine in that respect.


What would make this simpler, however, is to write a function that 
creates the sound objects based on the array, while also storing the 
initial volume for each sound. Here's an UNTESTED example:


// build the array based on linked sounds in the library (catMeow etc.):
var theSounds: Array = [catMeow , dogBark , alienScream , doorCreak]
// create a parallel array of sound levels for each sound:
var theVolumes: Array = [50,65,90,5];
// create a sound object for each array element:
for (i=0; itheSounds.length; i++){
// create the sound object and attach the sound:
this [theSounds[i] + SoundObject'] = new Sound();
this [theSounds[i] + SoundObject'].attachSound (this [theSounds[i]);
// create a variable to store the initial volume for each sound:
this [theSounds[i] + SoundObject'].initVolume = theVolumes[i];
// set the volume for this sound:
this [theSounds[i] + SoundObject'].setVolume(this 
[theSounds[i] + SoundObject'].initVolume);

}

Where sound name is the name of the sound object:
To play a sound, just use (sound name).start.
To mute it, use (sound name).setVolume(0);
To restore the volume, use (sound name.setVolume(sound 
name.initVolume). You could construct a function for this where the 
only arg would be the sound name.


HTH

Marc Hoffman



At 08:33 AM 7/6/2007, you wrote:


Sound objects associated with the same movie clip share their
properties (volume, etc.), so if you change the volume through one of
them, the change will be reflected by others, too. That is because in
fact sound properties belong to movie clips and not the Sound objects,
and Sound objects only reflect the sound settings of the associated movie
clip.

  Attila

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:[EMAIL PROTECTED] [EMAIL PROTECTED]
To:  flashcoders@chattyfig.figleaf.com flashcoders@chattyfig.figleaf.com
Date:Friday, July 6, 2007, 4:44:25 PM
Subject: [Flashcoders] Controllingt he volume of multiple sound 
objects at the same time

--===--

Hey there. I am trying to control the volume of a number of sound 
objects that have their own individual volume levels. I want to be 
able to mute them or allow them to play at the volume that has been 
set for them. I was thinking that I could do this by storing the 
values in arrays and then looping through these each time the sound 
is muted/unmuted but I am sure there must be an easier way.

Any suggestsions v gratefully received :)

Here is what I have so far:
var sound1:Sound = new Sound(this);
sound1.setVolume(60);
var sound2:Sound = new Sound(this);
sound2.setVolume(20);

sound1.loadSound('an.mp3', false);
sound2.loadSound('another.mp3', false);



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com