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.

panoyun

Beginner

  • "panoyun" started this thread

Posts: 10

Location: Somalia

  • Send private message

1

Sunday, December 8th 2019, 7:23pm

Sound help

How does the sound name auto control parameters?

playsound (auto, music.mp3, false, 1);

set (sound [????]. onplay, 'trace ("!");');

sound [? ? ? ] .onplay How to get the name?
*confused* *confused* *confused* *confused*

2

Sunday, December 8th 2019, 7:36pm

with action script you cant know the name if you use auto.
so better use a name

playsound(rocknroll, music.mp3, false, 1);
set(sound[rocknroll].onplay, 'trace ("!");');

panoyun

Beginner

  • "panoyun" started this thread

Posts: 10

Location: Somalia

  • Send private message

3

Sunday, December 8th 2019, 7:58pm

When having used 'auto' as name for a new sound, then there will be also a global variable named autosound that refers to that last created sound object.


https://krpano.com/plugins/soundinterface/#soundobject


?????? *confused* *confused* *confused* *confused*

I don't understand what he means
And after the sound is played, it ca n’t be played anymore, no sound name can be found.

4

Sunday, December 8th 2019, 8:26pm

playsound(auto, music.mp3, false, 1);
trace('autosound=', autosound);
set(sound[get(autosound)].onplay, 'trace ("!");');

read the documentation:
https://krpano.com/plugins/soundinterface/#soundobject

panoyun

Beginner

  • "panoyun" started this thread

Posts: 10

Location: Somalia

  • Send private message

5

Monday, December 9th 2019, 7:52am

playsound(auto,music.mp3,false,1);
trace('autosound =',autosound);



INFO: autosound=[object Object]



No effect, no control

*confused* *confused* *confused* *confused* *confused* *confused*



WARNING: Unknown action: sound[get(autosound)].toggle

6

Monday, December 9th 2019, 9:58am

well, if autosound is not a string (the name) but an object, what could it be ?
always read the docs, they are very exact !
(i didnt do that, first *rolleyes* )

" there will be also a global variable named autosound that refers to that last created sound object. "

so...
playsound(auto,music.mp3,false,1);
trace('last name = ',autosound.name);
autosound.play(); // play later

of course autosound gets overwritten if you create another sound with auto
so it would be wise to backup the sound object for later use

playsound(auto,music.mp3,false,1);
copy(mysound, autosound);
trace('mysound name = ',mysound.name);
mysound.play(); // play later

but why not simple use your own name anyway?
playsound(mysound,music.mp3,false,1);
sound[mysound].play(); // play later

panoyun

Beginner

  • "panoyun" started this thread

Posts: 10

Location: Somalia

  • Send private message

7

Monday, December 9th 2019, 1:18pm

Thank you very much for your kind help
Because I want to understand how auto works
I'll test your code later
thank you

*love* *love* *love* *love*