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.

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 157

Location: France, Montpellier

  • Send private message

1

Thursday, March 4th 2010, 11:10pm

Sound ON/OFF button with volume control

Using a part of the code from the 'slider/blending' example, i created a simple interface to control volume of sound *smile*
See the example here : http://www.maelbathfield.net/photo/krpano/sound_krpano/

The full code of this example is avialable here : http://www.maelbathfield.net/photo/krpan…code_sound2.xml

the image used here are in this file :

... but, be free to make your own ;-)

This post has been edited 4 times, last edit by "Mael B." (Jul 17th 2010, 9:59pm)


2

Friday, March 5th 2010, 6:36am

This is great, thanks Mael!

Is it possible to create a "progress slider" so a user could fast-forward or rewind to any given point in the audio?

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 157

Location: France, Montpellier

  • Send private message

3

Friday, March 5th 2010, 10:46am

With the current soundinterface.swf plugin, i don't think that make a 'progress slider' would be possible... but ask to Klaus as a new feature request *rolleyes*

wilsan

Trainee

Posts: 66

Location: Nederland

Occupation: Logistics Specialist – Planning & Logistics

  • Send private message

4

Saturday, March 6th 2010, 11:48am

This is fantastic, very useful.



thanks Mael!

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

5

Saturday, March 6th 2010, 2:04pm

This is a great stuff. Thanks to share Mael *thumbup*

6

Saturday, March 27th 2010, 4:07pm

*thumbsup* Mael!

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 157

Location: France, Montpellier

  • Send private message

7

Tuesday, March 30th 2010, 12:06am

New version of this interface ! *smile*
http://perso.numericable.fr/mael.bathfie…/index-en2.html
- The button is not a play/stop button anymore but a play/pause/resume button.
- Easier change of zorder, alpha, position and size (but relative values cannot be used) of the plugins.

xml file here : http://perso.numericable.fr/mael.bathfie…code_sound2.xml

Rodeus

Beginner

Posts: 27

Location: Russian Federation

  • Send private message

8

Monday, July 5th 2010, 7:19pm

The links are dead. Mael or somebody else! Repost links please.
Livepano.ru

Mael B.

Trainee

  • "Mael B." started this thread

Posts: 157

Location: France, Montpellier

  • Send private message

9

Tuesday, July 6th 2010, 12:15pm

The links are dead. Mael or somebody else! Repost links please.
i'll try to post new links next week... i can't do it before...

Rodeus

Beginner

Posts: 27

Location: Russian Federation

  • Send private message

11

Saturday, July 17th 2010, 11:37pm

Thx, Mael! *thumbup*
Livepano.ru

12

Sunday, August 8th 2010, 7:11pm

Hi,
do you hav a new link for the images too?
thanks
Michael

bulp

Intermediate

Posts: 390

Location: Malaysia

  • Send private message

13

Monday, August 9th 2010, 1:16pm

great.... never think of this option before...

thank you Mael B.. *smile*

14

Saturday, January 8th 2011, 6:38am

1. Run panorama, the sound is turned on.
2. How to be if the two panoramas and two sound?
How do I do? Thanks *rolleyes*

15

Friday, February 4th 2011, 7:57am

Hi,
do you hav a new link for the images too?
thanks
Michael
I'm with Michael,
The old image link is down, do you have a new link for images?
Great Plug BTW. Thanks
Tony

16

Tuesday, February 8th 2011, 12:01am

The image is in the first post. right click on the image and click "save as"

17

Friday, March 4th 2011, 12:52pm

hi

can someone please upload the .xml file

thx

18

Friday, March 4th 2011, 3:51pm

link to the xml
http://www.maelbathfield.net/photo/krpan…code_sound2.xml

and the code from the xml

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<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>

19

Tuesday, March 8th 2011, 12:37pm

This is fantastic

This plugins perfect for me

as I get the slider starts with a minimum volume of 0.1

Could create a tutorial explaining the program for this plugin

thank you very much

20

Wednesday, November 9th 2011, 3:09am

Sorry, but "NOHIDE" name in the code - what is, for that?
no plugin and no action in code (code_sound2.xml) with the same name
and I not find it in the documentation of krpano about NOHIDE......
how working that this NOHIDE in this code (http://www.maelbathfield.net/photo/krpan…code_sound2.xml)?

([align=-webkit-auto]onover="[align=-webkit-auto]set(alpha,get(alphab)); set(NOHIDE,false);)


Thanx!

This post has been edited 1 times, last edit by "Jam" (Nov 9th 2011, 4:19am)