Setting the volume of streams and nodes

Me again :wink:

First, I wonder if there’s a way to set the volume of a stream?

Second, I’ve added this method in my copy of the SoundSystem:

     * Sets the volume of all samples attached to a given node.
     * @param node We change the volume of this nodes children.
     * @param volume The volume to set. Should be a value between 0 - 1.
    public static void setNodeVolume(int node, float volume) {
       for (int i = 0; i < nodes[node].getQuantity(); i++) {
          Sample3D sample = (Sample3D) nodes[node].getChild(i);

It feels like a good complement to the "setSampleVolume" method.

Yeah, I’m wondering about that too. Anyone? Anyone?

ok this was done :slight_smile:

I can see the setNodeVolume method but not a way to change the volume of a stream?

Aww, I’ll add it as soon as possible

Cool, thanks.

setNodeVolume didn’t quite do what I expected. Seems that it only really works on sounds currently playing on the node. That’s fine I guess, but I was wondering if we could add this to the soundManager?

    public static void setMasterVolume(int vol){


BTW, if you want to be able to change stream volume just add this to SoundSystem:

    public static void setStreamVolume(int sample, int vol){

And this to Music Stream:

    public void setVolume(int vol){
       FSound.FSOUND_SetVolume(playingChannel, vol);

There ya go.

I played a bit with Sound recently and found a volume control missing in openAL stream handling

following code is only confirmed to work in my app on my machine so please test / correct and add to cvs as you see fit…

i did:

public void setVolume(float vol)
      AL10.alSourcef(source, AL10.AL_GAIN, vol);

to private class Player in

public void setStreamVolume(int streamNumber, float vol)
        if(player!=null && streamNumber>=0 && streamNumber <= player.length)

to class StreamPlayer in

public void setVolume(int soueceNumber, float volume)
        StreamPlayer.getInstance().setStreamVolume(sourceNumber, volume);

to class MusicStream in


public static void setStreamVolume(int streamName, float vol)
        stream[streamName].setVolume(streamName, vol);   

to class SoundSystem in

i hope i didn't forget / mess up something in copy and paste process...

BTW:  Is Arman still maintaining this ? as i haven't seen something from him in a while ?


This issue is still open? At least I cannot find a volume control for streams.