<krpano version="1.0.8" >

	<textstyle name="DEFAULT" font="Arial" fontsize="10" border="false" background="false" textcolor="0xFFFFFF" effect="glow(0x000000,0.7,4,2);dropshadow(2,45,0x000000,3,1);" />

 <view hlookat="90" vlookat="0" maxpixelzoom="1.0" fovmax="110"  />
  <preview type="CUBESTRIP" url="preview.jpg" />


<!-- Change only paramaters of this style to change position and size of sound buttons -->
<!-- DO NOT use relative(%) size and/or position --> <!-- align="right" NOT ACCEPTED -->
<style name="button" url="boutons_son.png" zorder="1" alpha="0.9" align="leftbottom"  x="100" y="10" width="25" height="prop" />

<plugin name="sound_off" style="button" keep="true" crop="150|0|50|80" edge="leftbottom" visible="false" onhover="showtext(Pause sound)" onover="set(alpha,get(alphab)); set(NOHIDE,false); set(plugin[slider_bg].visible,true); tween(plugin[slider_bg].alpha,get(alphab),0.1);" onout="set(alpha,get(style[button].alpha)); delayedcall(0.1, if(NOHIDE== false, tween(plugin[slider_bg].alpha,0,0.2);)); " onclick="pausesound1()" onloaded="setbuttonandslider();" />
<plugin name="sound_on" style="button" keep="true" crop="0|0|50|80" edge="leftbottom" visible="true" onhover="showtext(Play sound)" onover="set(alpha,get(alphab));" onout="set(alpha,get(style[button].alpha));" onclick="playsound1()"/>

<!-- Change url of the soundinterface plugin and name/url of mp3 file to play -->
<plugin name="soundinterface" 
        url="../plugins/soundinterface.swf" 
		    keep="true"
		    preload="true"
		    rootpath=""
		    volume="1"
		    onloaded="preloadsound(mp3filetoplay.mp3);"  />
                                              
 <!-- Change name/url of mp3 file to play -->
<action name="playsound1">
stopallsounds(); set(VM,1); 
set(plugin[sound_on].visible,false);
set(plugin[sound_off].visible,true); 
playsound(sound1,mp3filetoplay.mp3,1,set(plugin[sound_on].visible,true);set(plugin[sound_off].visible,false);set(plugin[sound_on].onhover,showtext(Play sound));set(plugin[sound_on].onclick,playsound1();); tween(plugin[slider_bg].alpha,0,0.2,null, set(plugin[slider_bg].visible,false);););  
</action>	
 
   <action name="setbuttonandslider">
  mul(alphaa,get(style[button].alpha),2); div(alphab,get(style[button].alpha),1.5); set(plugin[slider_grip].alpha,get(alphaa)); div(alphac,get(alphaa),3);
  set(plugin[slider_bg].align,get(style[button].align));  set(plugin[slider_bg].edge,get(plugin[sound_off].edge));  set(plugin[slider_bg].zorder,get(style[button].zorder)); 
  add(Bx,get(style[button].x),get(style[button].width)); add(Sx,Bx,5); set(plugin[slider_bg].x,get(Sx)); set(plugin[slider_bg].y,get(style[button].y)); mul(Sw,get(style[button].width),5); set(plugin[slider_bg].width,get(Sw)); set(plugin[slider_bg].height,get(style[button].height));
  mul(Gx,get(plugin[slider_bg].width),0.89); set(plugin[slider_grip].x,get(Gx));
  </action>	

<action name="resumesound1">
set(plugin[sound_on].visible,false); set(plugin[sound_off].visible,true);  resumesound(sound1); tween(soundinterface.volume,get(VM),1,easeInQuint);  
</action>	

<action name="pausesound1">
set(plugin[sound_off].visible,false); set(plugin[slider_bg].visible,false); set(plugin[sound_on].visible,true); set(plugin[sound_on].onhover,showtext(Resume sound)); set(plugin[sound_on].onclick,resumesound1();); tween(soundinterface.volume,0,1,easeOutQuint, pausesound(sound1) );   
</action>

	
<!-- volume slider -->	
	<plugin name="slider_bg"   url="boutons_son.png" crop="201|0|270|80" zorder="" keep="true" align="" edge="" width="" height="" x="" y="" visible="false" handcursor="false" alpha="0" onhover="showtext(Volume control)" onover="set(NOHIDE,true); set(plugin[slider_bg].visible,true); tween(plugin[slider_bg].alpha,get(alphab),0.1); set(plugin[sound_off].alpha,get(alphab));" onout="set(NOHIDE,false); tween(plugin[slider_bg].alpha,0,0.2); set(plugin[sound_off].alpha,get(style[button].alpha));" />
	<plugin name="slider_grip" url="boutons_son.png" crop="470|0|25|80" zorder="10" keep="true" align="lefttop" edge="lefttop" parent="slider_bg" width="10%" height="110%" x="" y="0" ondown="startdragingslider();" onup="stopdragingslider();" />

  <textstyle name="invisiblestyle" font="Arial" fontsize="1" border="false" background="false" textcolor="0x000000" effect="" />
	<action name="startdragingslider">
		set(plugin[slider_grip].alpha,get(alphac));
		set(plugin[slider_grip].onhover,showtext(-,invisiblestyle));
    set(plugin[slider_grip].backup_align, get(plugin[slider_grip].align));
		set(plugin[slider_grip].backup_edge,  get(plugin[slider_grip].edge));
		plugin[slider_grip].changeorigin(lefttop,lefttop);
		sub(mouse_x_offset, plugin[slider_grip].x, mouse.x);
		sub(mouse_y_offset, plugin[slider_grip].y, mouse.y);
		set(image_dragging,true);
		dragslider();
	</action>

	<action name="stopdragingslider">
		set(image_dragging, false); set(plugin[slider_grip].alpha,get(alphaa)); set(plugin[slider_grip].onhover,);
	</action>

	<action name="dragslider">
		if(image_dragging,
			add(xpos, mouse.x, mouse_x_offset);
			mul(xmax, plugin[slider_bg].width,0.9);
			if(xpos LT 0, set(xpos,0));
			if(xpos GT xmax, copy(xpos,xmax));
			copy(plugin[slider_grip].x, xpos);

			<!-- VM = 0.0 ... 1.0 -->
			div(VM, xpos, xmax);
			setvolume(get(VM));
			
			if(VM == 0, set(plugin[sound_off].crop,0|0|50|80););
			if(VM GT 0.15, set(plugin[sound_off].crop,50|0|50|80););
			if(VM GT 0.4, set(plugin[sound_off].crop,100|0|50|80););
			if(VM GT 0.7, set(plugin[sound_off].crop,150|0|50|80););
			
			delayedcall(0.01, dragslider() );
		  ,
			plugin[slider_grip].changeorigin(get(plugin[slider_grip].backup_align), get(plugin[slider_grip].backup_edge));
		  );
	</action>
	
	  	<action name="setvolume">
		  set(soundinterface.volume,%1)
	     </action>



</krpano>

