You are not logged in.

Dear visitor, welcome to Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


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"

<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");


Monday, August 7th 2017, 9:27pm

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



Posts: 3,372

Location: Netherlands

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

  • Send private message


Monday, August 7th 2017, 11:58pm


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

Tuur *thumbsup*


Wednesday, August 9th 2017, 5:55pm


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