• dear forummembers


    we are expanding our archaeological tours with audio support.

    the simplest solution seems to be to use playsound_at_hotspot.

    Code
    <action name="playsoundat">	playsound_at_hotspot(bw,'%HTMLPATH%/a.files/audio/brockenweg.mp3', hotspot[xt360],true,1,30, )	</action>

    so far this works .

    now we try to pause the audio sequence ,when the hotspot gets out of the predefined field (30° in our case)

    and of course the audio sequence should continue playing when the hotspot comes back into focus.


    does anyone have an idea how this could work


    wbr klaus

  • dear kme

    i know this treat.
    that was the first thing we tried.
    unfortunately we doesn't get it to work. sound actions like play- resume- and pause seems to generate an extreme sound level and noise
    this is our code

    Code
    <events name="check_viewathotspot" keep="true" onviewchanged="hotspots_fade_in_out()"/> <action name="hotspots_fade_in_out"> for(set(i,0), i LT hotspot.count, inc(i), getlooktodistance(d,hotspot[get(i)].ath,0); if(d LT 30, resumesound(ufer),pausesound(ufer))) </action>


    Code
    <hotspot name="xtUfer" type="text"html="Pause▐▐"css="color:#fff;font-size:14px;"padding="10" bgcolor="0x0A9393"roundedge="20" zorder="2" width="" height="40"ath="10" atv="0"onloaded="" onclick="togglesound(ufer);switch(html,Play ▶,Pause▐▐ )" />


    and

    Code
    <action name="playsoundat"> playsound_at_hotspot(ufer,'skin/brockenweg.mp3', hotspot[xtUfer],true,1,30, ) </action>


    wbr klaus

  • About the volume and noise:

    In your code you have

    Code
    for(set(i,0), i LT hotspot.count, inc(i)

    How many hotspots do you have? Because for each hotspot in the scene, you will start resuming/resuming the same (ufer) sound based on their visiblity. So if you have many hotspots around the scene, they will be fighting for resuming/pausing the sound multiple times...

    kme

  • dear kme and forum.

    to make sure that we didn't include any syntax errors in our new project , i created a completely reduced panorama audio example and attached it as a rar file.

    this is what happens when calling "audioactions" via getlooktodistance!

    if anyone is interested, here is the link to our current project.(entering audioguidet tour with the right sidebar ore audiobutton in the hamburger menue)

    https://360.tirol

  • Hi Niko,

    A few things I notice in your sample project:

    1) the play/stop will never work -> the hotspot you are using to stop/play is in view and as a result when the sound is stopped, it will get resumed immediately (because in the onviewchange() will check if hte hotspot is visible and if so, will resume play)
    I would suggest to put the play/stop in a seperate hotspot than the one you need to play the audio from (so one hotspot that is the start/stop button and another hotspot that is the source for the audio).

    2) i see in your tour you have many hotspots. and in the code you have:
    for(set(i,0), i LT hotspot.count, inc(i),

    So every time you drag your screen around, it will check the position of ALL hotspots (not only the hotspot where the sound is coming from) and will then pause/resume the sound multiple times (as many times as you have hotspots in your scene)

    I would suggest to not check ALL the hotspots, but only the hotspot where the audio needs to be playing.

    3) I ran your sample project, and even with only 1 hotspot in the scene, I hear the audio play multiple times when i turn around... so weird...

    As a test, i added "<view hlookat="180"></view>" and then no double audio was present. So maybe it is a timing issue (sound resuming while not yet properly initialized/loaded).

    I need to do some more testing on why that could be the case... coming back!

  • After some testing, I'm pretty convinced there is a bug with the sound interface.

    When you call any sound action (for example resumesound()) too fast after playsound_at_hotspot(), the reference to the sound is created/duplicated. If you call many actions before the playsound_at_hotspot() is completed, MANY sounds will be created/playing, causing high volume/cracking. As your tour is doing that (because it has it in onframechanged()), you have a big chance of encountering this.

    Edit: the above is not true, and only this one is the cause:
    Also, I noticed that if you call playsound_at_hotspot() on startup, that routine is not completed until the user has done any interaction within the panorama.

    I will make a seperate example for the bug report so klaus can further investigate.

    As for a workaround/solution:

    a) we should not use onviewchanged(): the resume/pause of the sounds is too fast and done before the playsound_at_hotspot() is fully completed. It is also a possible performance issue.

    Instead, I suggest to use a "delayedcall" after the initializing the playsound_at_hotspot, and then repeating the delayedcall in the called routine. it will thus run every X seconds instead of every view change (much more performant).

    b) we should not call the playsound_at_hotspot() on startup, but move it to a location with user interaction (a button onclick is perfect).

    I have attached your project with these changes.

    Note: the suggestions I did in my previous post still apply and I did not make changes to accomodate for this


    Maybe other members of the forum see a better way of doing this, but I hope this already helps you further for your project. Let us know if you have further questions.

  • Bug replication:

    https://krpano.kri-soft.be/examples/soundbug/

    Just load the pano and click the button or drag the pano around.

    Basically, when calling resumesound or any other sound action when there was no user interaction yet, multiple sound references will be created and when the user finally interacts with the panorama, ALL are played (LOUD !!! *cry* *cry* *cry* )

  • first of all thank you very much for your support.
    I'll go through the whole audio control again.
    I will consider what is absolutely important to me and what is not.

    greetings from tirol
    nico

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!