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.

1

Tuesday, August 28th 2018, 3:45pm

How to Increase filename number?

Hi,

I'd like to know if and how is possible to increment the file number to create a template that will make each scene with a different file name.

This is the scene template:

Source code

1
2
3
4
5
6
7
8
<scene name="[BASENAME]" title="[NAME]" onstart="action(startautoplay-off)"[THUMB][GPS][DEVICE]>
<events name="[NAME]_event" onxmlcomplete="set(plugin[play-button].onclick,playsound(voice001, 'audio001.mp3|audio001.ogg'); set(plugin[pause-button].visible,true))" />

		[VIEW]
		[PREVIEW]
		[IMAGE]
		[HOTSPOTS]
	</scene>



Where is voice001, audio001.mp3, audio001.ogg I want to make them voice002, audio002..... voice003, audio003... for each new scene that will be created with the "make vtour highres droplet".


In the same vtour I have these actions:


Source code

1
<action name="startautoplay-off"> stopallsounds(); set(plugin[stop-button].visible,false); set(scene[ptips-001].onstart,action(startautoplay-off););	 set(scene[ptips-002].onstart,action(startautoplay-off););	 set(scene[ptips-003].onstart,action(startautoplay-off););	 </action>



Here I'd like to change the onstart to all scenes, but the quantity of scenes will vary from tour to tour.
Is there a "change all scenes" onstart to.... function?
Or how can I generate the sequential names [scene-001], [scene-002]...... the same amount of times as the number of scenes in the tour? Again another usage that I don't know how to solve:

Source code

1
2
3
4
<action name="startautoplay-on">		stopallsounds();		set(plugin[pause-button].visible,true);
		set(scene[ptips-001].onstart,stopallsounds(); playsound(voice1, 'audio1.mp3|audio1.ogg'););		set(events[ptips-001_events].onxmlcomplete,stopallsounds());
		set(scene[ptips-002].onstart,stopallsounds(); playsound(voice2, 'audio2.mp3|audio2.ogg'););		set(events[ptips-002_events].onxmlcomplete,stopallsounds());
		set(scene[ptips-003].onstart,stopallsounds(); playsound(voice3, 'audio3.mp3|audio3.ogg'););		set(events[ptips-003_events].onxmlcomplete,stopallsounds());	</action>


I need to create the sequential changes for scenes and events. Changing also the name of the playsound and the audio files accordingly.

I don't know if the solution is pretty similar to all of them or they are totally unique and I should create different topics.
I'm sorry if it's too long! :/

I appreciate your time not only by reading, but if you can help!!

Thanks,
Daniel

This post has been edited 1 times, last edit by "dfarjoun" (Aug 28th 2018, 4:45pm)


Alexey Tkachenko

Professional

Posts: 735

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Wednesday, August 29th 2018, 11:05am

Hi)

Your task is to play different music in different scenes of the VT, right? It seems that you went the wrong way though. I would do it this way:

1. Create 'SOUND' folder inside your 'vTOUR' folder. There all sound files will be stored.
2. In the 'tour.xml' add

Source code

1
sound="NN"
where NN is the NAME of the mp3 or ogg file.

3. Create 'SOUND.XML' file and include it to the main 'tour.xml'. This XML will store all code related to sound changes.
5. Inside 'SOUND.XML' write action which handles the sound. The main logic is this:


- Read

Source code

1
sound="NN"
attribute of the currently loaded scene.

- Create "PREVIOUS_SOUND" varibale. It will contain the name of the currently played music.
- If the "PREVIOUS_SOUND" is the same as the sound parameter of the current scene, then not play the sound (because it's already playing).
- if sound of the current scene is different, then stop previous sound and star the new one.
- Update onclick event of the Sound Button to know which sound to mute or switch on.


It seems that I wrote some kind of the detailed tutorial on this: https://krpano.com/forum/wbb/index.php?p…&threadID=15886


Hope this helps
Regards,

Alexey

3

Thursday, August 30th 2018, 4:45pm

Thanks for your help, Alexey!!!

Maybe it's too advanced for me. I don't really understood that.

let's consider only the first part?

I put it to work manually, but I'd love to have my droplet to create in each scene a new file name.

<events name="[NAME]_event" onxmlcomplete="set(plugin[play-button].onclick,playsound(voice_1, 'audio1.mp3|audio1.ogg'); set(plugin[pause-button].visible,true))" />

In bold is what I need to be increased automatically for each new scene generated.

Scene 1 will have (voice_1, 'audio1.mp3|audio1.ogg')
Scene 2 will have (voice_2, 'audio2.mp3|audio2.ogg')
Scene 3 will have (voice_3, 'audio3.mp3|audio1.ogg')
....


Is this possible or not too difficult to implement?

I'm doing it manually, changing the values for every single scene generated.
But I'll have almost a thousand to do. It would be really handy to have it automatically generated.

Thanks,

Daniel

4

Friday, August 31st 2018, 7:57am

you need when you open a new scene to stop the current audio and run the corresponding new audio scene?
It seems to me easier to create an action using "for" and "scene.count" and put it in vtour.hml

Like that:

Source code

1
2
3
4
5
6
7
8
  <events name="play_sound" keep="true" onnewscene="check_scene_playsound();" />
	
  <action name="check_scene_playsound">
	for(set(i,0), i LT scene.count, inc(i),  
                 if(scene[get(xml.scene)] == scene[get(i)], 
                         playsound(voice, calc('audio' + i + '.mp3|' + 'audio' + i + '.ogg')); );	
             );
   </action>


You need to number from scratch, for example audio0.mp3 - is for the first scene

This post has been edited 15 times, last edit by "San7" (Aug 31st 2018, 12:01pm)


5

Wednesday, September 5th 2018, 2:04am

Thanks, San!

It's playing nicely automatically between the scenes.

I had to implement a few extra behaviours because I didn't like the autoplay between the scenes.

After a couple of hours it's all set now!
Maybe not the best coding, but it's working!
And far less coding than my other solution!!

Thank you so much for you help!!!!