You are not logged in.

1

Sunday, May 3rd 2009, 4:03am

Combobox - selected item value?

Hi!
I am trying to costruct mediaplayer for my panos. Would like to allow changing background music. Used combobox for music selection, and direct sellection works.

Source code

1
2
3
4
5
    <action name="setupitems">
        removeall();
        additem(Subirana - Point of no return, playsound(s1,pnr.mp3, 0,0); );
        additem(Silence - Realite, playsound(s1,02.mp3, 0,0); );
    </action>


But now my mute/play button started to be a problem.

Disabling sound is not a problem, but reenabling it is...

Here is my play button action:

Source code

1
<plugin name="soundon"  url="btn_audioon.png"  visible="false" align="bottom" edge="center" y="40" x="+120" blendmode="screen" onhover="showtext(Włącz dźwięk);"      onover="set(blendmode,add);"  onout="set(blendmode,screen);" onclick="playsound(s1,pnr.mp3, 0,0); set(plugin[soundoff].visible,true); set(plugin[soundon].visible,false);" />	


It plays arbitrary file, but I would like to play what is selected in combobox.
Is it possible to access/execute actions assigned to actually selected combobox from within xml?

Whole project you can see here: http://www.fototv.pl/newsy/wydarzenia/za…lektrownia.html

Hmmm, will think about using stack.

Regards

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

2

Sunday, May 3rd 2009, 5:09am

I think the problem is here...

Source code

1
2
        ...playsound(s1,pnr.mp3, 0,0);
...playsound(s1,02.mp3, 0,0);


... in that you've used the same ID for both mp3 files... perhaps it's causing some confusion?

(reference info: http://www.krpano.com/forum/wbb/index.ph…ad&threadID=374 )

Also, I don't think you need to include the last 0 in the sequence (ID, file, looping, oncomplete) as both looping and oncomplete are optional.

------------

If that doesn't fix it... then you may have to look at setting up the combobox to assign a value to a variable based upon which selection is made... and then use a sequence of if's to determine which actual mp3 to play.

There's a similar example on the forum showing how to load different images / panos based upon a sequence of if's to check the variable... but I'm not finding it right now.

bulp

Intermediate

Posts: 390

Location: Malaysia

  • Send private message

3

Sunday, May 3rd 2009, 5:21am

hello radioerawan... bro.. your resolution setting at the minimal? lower than 16? the image rendering not that smooth.. im also use sphere, but the image size for my pano is about lower than 2Mb and bigger than 1.5Mb with the image dimension 6324 x 3162...

so certain zoom are not that worst..

4

Sunday, May 3rd 2009, 2:13pm

I think the problem is here...


Source code

1
2



...playsound(s1,pnr.mp3, 0,0);
...playsound(s1,02.mp3, 0,0);



... in that you've used the same ID for both mp3 files... perhaps it's causing some confusion?

(reference info: http://www.krpano.com/forum/wbb/index.ph…ad&threadID=374 )

Also, I don't think you need to include the last 0 in the sequence (ID, file, looping, oncomplete) as both looping and oncomplete are optional.

------------

If that doesn't fix it... then you may have to look at setting up the combobox to assign a value to a variable based upon which selection is made... and then use a sequence of if's to determine which actual mp3 to play.

There's a similar example on the forum showing how to load different images / panos based upon a sequence of if's to check the variable... but I'm not finding it right now.


As I understand ID is for "track/channel". I need one channel/track at a time, and need one ID (to be able to control its loudness and play/stop). In such way, will not disable environmental sound - which would like to use in future (without using stopallsounds). Music plays without problems now. Just would like to have little more advanced music on/off option. Now every time music is stopped, it has to start from first track. Would like to start from what was selected in combobox.
So - once again - would like to read selected state of combobox to be able to palysound (anyid, combobox-selectedstate).
Loop is set to 0 (to do looping).

Regards

5

Sunday, May 3rd 2009, 2:27pm

hello radioerawan... bro.. your resolution setting at the minimal? lower than 16? the image rendering not that smooth.. im also use sphere, but the image size for my pano is about lower than 2Mb and bigger than 1.5Mb with the image dimension 6324 x 3162...

so certain zoom are not that worst..

It is offtopic, but 30 panos x 6000x3000 px in good quality would kill my server. Now I am using 4500x2250 sources px with quality set to 70 in PS - Save for web. It is still 70 megabytes of data for 30 panos. Count it against 10.000+ visits to this project only I had last week. It is 700 GB of transfer to handle. In 6000 px version it should be doubled. User experience would fail and I am not sure, it would be good for Lost power plant.

Regards

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

6

Sunday, May 3rd 2009, 8:47pm

http://www.krpano.com/forum/wbb/index.ph…D=2075#post2075

that post that might help.


If you setup your combobox...

Source code

1
2
3
4
5
<action name="setupitems">
removeall();
additem(Subirana - Point of no return, set(var_sound,1); );
additem(Silence - Realite, set(var_sound,2); );
    </action>


and then do something like...

Source code

1
2
3
4
5
6
7
<action name="startsong">
  <!-- depending on the "var_sound" variable play a song -->
  if(var_sound == 1, playsound(s1,first.mp3, 0,0) );
  if(var_sound== 2, playsound(s1,sec.mp3, 0,0) );
  if(var_sound== 3, playsound(s1,thrd.mp3, 0,0) );
  if(var_sound== 4, playsound(s1,etc.mp3, 0,0) );
</action>


... for your play sound button.

Good luck.

7

Sunday, May 3rd 2009, 11:39pm

Hmm, have seen also "switch" in 1.0.8 teaser, but it is beta version. Have been trying to run panos in 1.0.8 but context menu works at random order.
So, is "if" statement available for stable 1.0.7?
Can I define variable this way: set(var_my_foo,anything_here)?

Sorry for my newbie questions, just purchased krpano and I am learning how can use it.

Source code

1
2
3
4
5
6
7
8
9
<action name="setupitems">
removeall();
additem(Subirana - Point of no return, set(var_sound,music1.mp3); );
additem(Silence - Realite, set(var_sound,music2.mp3); );
    </action>
<action name="startsong">
  <!-- depending on the "var_sound" variable play a song -->
   playsound(s1,var_sound, 0,0) );
</action>

Should work then, but have seen in documentation that variables are only predefined with plugins...

Regards

8

Monday, May 4th 2009, 3:18am

Have managed it all. Now have player with playlist and sound on/off option
If you find any better solution, would be nice to hear. Had to use currentpano variable - var_sound returned errors.
Here goes code:

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
100
101
102
103
104
105
    <plugin name="combobox"
            url="%SWFPATH%/plugins/combobox.swf" 
            align="leftbottom" 
            x="30" 
            y="30" 
            width="180"
            keep="true"
            onloaded="action(setupitems);"
            />
    
    <action name="setupitems">
       removeall();
        plugin[combobox].removeall();
        plugin[combobox].additem(01 Subirana Point of no return, set(currentpano,1); action(playsounds));
        plugin[combobox].additem(02 Subirana Pyraminx, set(currentpano,2); action(playsounds));
        plugin[combobox].additem(03 Silence Realite, set(currentpano,3); action(playsounds));		
		plugin[combobox].additem(04 Silence Stop, set(currentpano,4); action(playsounds));		
		plugin[combobox].additem(05 Silence Larmes, set(currentpano,5); action(playsounds));
        plugin[combobox].additem(06 Zeropage Void Sensor, set(currentpano,6); action(playsounds));
		plugin[combobox].additem(07 Zeropage Clear View On Tempel 1, set(currentpano,7); action(playsounds));
		plugin[combobox].additem(08 Zeropage Ambient Voyager, set(currentpano,8); action(playsounds));
    </action>

<!-- music -->	         
<plugin name="soundinterface" url="plugins/soundinterface.swf" rootpath="." onloaded="set(currentpano,1); action(setupitems2)" />
			
<!-- sound buttons -->

<plugin name="soundoff"  url="btn_audioof.png"  align="bottom" edge="center" y="40" x="+120" blendmode="screen" onhover="showtext(Mute);"      onover="set(blendmode,add);"  onout="set(blendmode,screen);" onclick="stopsound(s1); set(plugin[soundoff].visible,false); set(plugin[soundon].visible,true); set(plugin[combobox].visible,false);" />
	
<plugin name="soundon"  url="btn_audioon.png"  visible="false" align="bottom" edge="center" y="40" x="+120" blendmode="screen" onhover="showtext(Enable sounds);"      onover="set(blendmode,add);"  onout="set(blendmode,screen);" onclick="action(setupitems2); set(plugin[soundoff].visible,true); set(plugin[soundon].visible,false); set(plugin[combobox].visible,true); action(setupitems2);" />	

    <!-- actions -->
    
   <action name="setupitems2">
        plugin[combobox].removeall();
        plugin[combobox].additem(01 Subirana Point of no return, set(currentpano,1); action(playsounds));
        plugin[combobox].additem(02 Subirana Pyraminx, set(currentpano,2); action(playsounds));
        plugin[combobox].additem(03 Silence Realite, set(currentpano,3); action(playsounds));		
	plugin[combobox].additem(04 Silence Stop, set(currentpano,4); action(playsounds));		
	plugin[combobox].additem(05 Silence Larmes, set(currentpano,5); action(playsounds));
        plugin[combobox].additem(06 Zeropage Void Sensor, set(currentpano,6); action(playsounds));
	plugin[combobox].additem(07 Zeropage Clear View On Tempel 1, set(currentpano,7); action(playsounds));
	plugin[combobox].additem(08 Zeropage Ambient Voyager, set(currentpano,8); action(playsounds));
	action(playsounds);
    </action>			 
	
<action name="playsubirana">
    	playsound(s1,pnr.mp3, 1, set(currentpano,2); action(setupitems2););
		set(currentpano,1);
		plugin[combobox].selectitem(01 Subirana Point of no return);		
</action>

<action name="playsubirana2">
    	playsound(s1,pmx.mp3, 1, set(currentpano,3); action(setupitems2););
		set(currentpano,2);
		plugin[combobox].selectitem(02 Subirana Pyraminx);		
</action>

<action name="playsilence">
    	playsound(s1,02.mp3, 1, set(currentpano,4); action(setupitems2););
		set(currentpano,3);
		plugin[combobox].selectitem(03 Silence Realite);		
</action>

<action name="playsilence2">
    	playsound(s1,03.mp3, 1, set(currentpano,5); action(setupitems2););
		set(currentpano,4);
		plugin[combobox].selectitem(04 Silence Stop);		
</action>

<action name="playsilence3">
    	playsound(s1,07.mp3, 1, set(currentpano,6); action(setupitems2););
		set(currentpano,5);
		plugin[combobox].selectitem(05 Silence Larmes);		
</action>

<action name="playzero">
    	playsound(s1,z03.mp3, 1, set(currentpano,7); action(setupitems2););
		set(currentpano,6);
		plugin[combobox].selectitem(06 Zeropage Void Sensor);		
</action>

<action name="playzero2">
    	playsound(s1,z04.mp3, 1, set(currentpano,8); action(setupitems2););
		set(currentpano,7);
		plugin[combobox].selectitem(07 Zeropage Clear View On Tempel 1);		
</action>

<action name="playzero3">
    	playsound(s1,z01.mp3, 1, set(currentpano,1); action(setupitems2););
		set(currentpano,8);
		plugin[combobox].selectitem(08 Zeropage Ambient Voyager);		
</action>
	
<action name="playsounds">
     	if(currentpano == 1,action(playsubirana));
     	if(currentpano == 2,action(playsubirana2));		
     	if(currentpano == 3,action(playsilence));
     	if(currentpano == 4,action(playsilence2));		
     	if(currentpano == 5,action(playsilence3));				
     	if(currentpano == 6,action(playzero));						
     	if(currentpano == 7,action(playzero2));						
     	if(currentpano == 8,action(playzero3));								
</action>


Not nice, but works! Just one glitch - had to use 1.0.8 beta.

Regards

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

9

Tuesday, May 5th 2009, 6:58am

glad you got something that works.

sorry about "var_sound" not working... maybe the underscore _ isn't a good thing to use ?

If having "currentpano" is confusing due to it's implied reference to an image... maybe "currentsound" in it's place would work?

There's bound to be some way to clean the code up some... I'll try to take a look over the next couple of days and let you know if I have any flashes of brilliance *g*

Similar threads