You are not logged in.

Dear visitor, welcome to krpano.com 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.

Run

Beginner

  • "Run" started this thread

Posts: 41

Location: maryland. USA

Occupation: Photographer

  • Send private message

1

Thursday, March 8th 2012, 7:35pm

Turning sound off on scene exit?

I have the following sound code for a hotspot inside a scene for my tour, although I have the keep=false set the sound continues to play even when a new scene has been loaded. The audio is specific to only one scene.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	<!-- Beginning of Sound Code-->
		<plugin name="soundinterface" url="soundinterface.swf" rootpath="%CURRENTXML%" preload="true" keep="false"/>
	
	
	<!-- a button to mute/unmute the sound -->
	<plugin name="snd" url="soundonoff.png" align="leftbottom" x="10" y="10" alpha="0.25" scale="1.0" 
		    onover="tween(alpha,1);" 
		    onout="tween(alpha,0.25);" 
	        crop="0|0|50|50"
			onclick="switch(soundinterface.mute); switch(crop, 0|0|50|50, 0|50|50|50);" />


	<!-- play sound at 0/0 -->
	<hotspot name="b1" url="headset.png" ath="18"   atv="45" scale="0.3" zoom="true"
		         alpha="0.6"
				 onover="tween(alpha,1);tween(scale,.6);"
		         onout="tween(alpha,0.6);tween(scale,0.3);"
				 onclick="playsound3D(s1,Audio32.mp3, 0,0);set(autorotate.enabled,false)" />
				 
				 <!-- End of sound code-->


if this is not the correct way to stop a sound when leaving a scene please let me know what to do.

Thank you in advance.

Rick

2

Friday, March 9th 2012, 8:25am

Hi,

there are several possibilities:

  1. call stopsound(name) to stop the sound before calling the loadpano/loadscene actions

  2. call stopallsounds() to all sounds before calling the loadpano/loadscene actions

  3. use a global onremovepano event and call there stopallsounds() , e.g.

    Source code

    1
    
    <events onremovepano="stopallsounds()" />


  4. use a scene local onremovepano event and call there stopallsounds() or stopsound(name) , e.g.

    Source code

    1
    2
    3
    4
    5
    
    <scene ...>
    ...
    <events name="sceneevents" onremovepano="stopsound(snd);" />
    ...
    </scene>


btw - keep="false" can't and shouldn't be used for the soundinterface plugin - the sound-'interface' plugin only adds new actions for playing sound, but not the sounds itself,

best regards,
Klaus

Run

Beginner

  • "Run" started this thread

Posts: 41

Location: maryland. USA

Occupation: Photographer

  • Send private message

3

Friday, March 9th 2012, 8:44am

Klaus,

Thank you very much, I was so hung up on getting the keep= working I didn't even check the stop sound actions. Sorry major brain fart. Thank you very much for the help.

Rick