You are not logged in.

1

Tuesday, July 25th 2017, 10:07am

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"
url.flash="plugins/soundinterface.swf"
url.html5="plugins/soundinterface.js"
rootpath=""
preload="true"
keep="true"
/>

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

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

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



vtourskin.xml:
<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");
pausesoundtoggle(bgsnd);
</action>

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


2

Monday, August 7th 2017, 9:27pm

Some question will not get an anwser. Perhaps no soultion possible ???

Tuur

Sage

Posts: 3,115

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

3

Monday, August 7th 2017, 11:58pm

Hi,

Fairly simple with:
<events onnewscene...
Playsound etc

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

4

Wednesday, August 9th 2017, 5:55pm

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