Multiple Sounds

version 3 by Massimo Stella

  • Home page
  • Beginning
  • Next



  • Documentation


    After having declared the name of an audio file, like indicated in the IF7 main documentation:

        Sound of frogs is the file "Frogs.ogg".

    We can choose how to reproduce it, on the background channel or on the foreground one:

        play the sound of frogs in background;
        play the sound of frogs in foreground;

    Starting from Version 3, Multiple Sounds supports more than 2 audio channels, however the extra ones have to be declared inside the IF7 game code. Use the 'create' commands to establish any desired extra channels BEFORE you try to play any sounds on those! A good time to do it is when play begins:

        When play begins:
            create the midground channel;
            create the midground 1 channel;
            create the midground 2 channel;
            play the sound of frogs in midground;

    The enumeration distinguishes the various midground channels created by the author. Please bear in mind that the midground and the midground 0 are the same channel. Currently Multiple Sounds has 4 midground channels {0,1,2,3}, implemented by Wade Clarke, however with minimal interventions the user can create additional channels. The number of effectively well functioning audio channels depends on the interpreter used and may greatly vary. Almost surely the three background, midground and foreground channels should be enough for most of the IF works.

    Sometimes a continuous loop might be useful:

        play the sound of frogs in background with loop;
        play the sound of frogs in foreground with loop;
        play the sound of frogs in midground with loop;

    Also the repetition of a specific audio file for N times is supported:

        play the sound of frogs in background for 5 times;
        play the sound of sea in foreground for 10 times;
        play the sound of sea in midground 2 for 25 times;
        
    Glulx allows to play multiple sounds at the same time, provided they are reproduced on different channels:

        play the sound of frogs in background;
        play the sound of fifths in foreground;
        play the sound of air in midground 1;

    To stop an audio file:

        stop the foreground sound;
        stop the midground 2 sound;
        stop the background sound;

    To modify volume from a minimum level of 0 (silence) to a maximum level of 5 (full volume):

        set the foreground volume to 2;
        set the background volume to 1;
        set the midground volume to 4;
        
    To modify the volume from a minimum level of 0 (silence) to a maximum level of 65536 (full volume) use instead the raw volume option:

        set the raw foreground volume to 10000;
        set the raw midground volume to 2000;
        set the raw background volume to 3500.