Hoe to manage sound in multiple scenes

  • Perhaps someone can help me with my sound topic?
    In a scene1 a sound1 is played and in another scene2 another sound2 is played.
    I did this by editing my xml-project-file.I
    n the vtourskin.xml file I added a button to allow th euser to switch the sound on and off.

    I would like to change that: If the user switches the sound off, it should stay off in all scenes,
    unless the user switches the sound on again.

    Example: scene1 is shown and sound1 is played. The user hits the button and the sound1 one stops playing.
    If the user switches to scene2 now, the sound2 will start to play. This should not happen.
    In this case sound2 should play only if the user hits the button to listen to the sound.

    Here is how I did it:
    Project Xml-project-file:
    <!-- load the soundinterface plugin -->
    <plugin name="soundinterface"

    <scene name="scene1 ........
    <!-- start playing the sound -->
    <events name="currentpano"
    onnewpano="playsound(bgsnd, 'sound1.mp3|sound1.ogg', 0); skin_startesound();""

    <scene name="scene2" title.......

    <!-- start playing the sound -->
    <events name="currentpano"
    onnewpano="playsound(bgsnd, 'sound2.mp3|sound2.ogg', 0); skin_startsound();" />

    <layer name="skin_btn_sound" style="skin_base|skin_glow|btn_tooltip" btn_tooltip="Sound on/off"
    crop="64|1024|64|64" align="center" x="160" y="0" scale="0.6" onclick="skin_changesound();" />

    <action name="skin_changesound">
    switch(layer[skin_btn_sound].crop, "0|1024|64|64", "64|1024|64|64");

    <action name="skin_startsound">
    set(layer[skin_btn_sound].crop, "64|1024|64|64");

  • Hi,

    Fairly simple with:
    Playsound etc

    Tuur *thumbsup*

    Then on every new scene the sound is played. But the sound should only be played if the useer did not switch off the sound before; even if that was done in a previous scene.
    Logicaly I need something like: onnewsceene if the sound is still wanted; then play the sound. Elso do not play the sound. It is just that I do not know how to handle that

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!