Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Mittwoch, 4. März 2009, 22:10

sound interface plugin (beta)

A new Sound Plugin - soundinterface.swf
  • this plugin adds functions to play and controls sounds direct from the xml.
  • only this one plugin must be loaded for all sound.
  • note - the functions are not available until the plugin was loaded use the plugin onloaded event or the preload="true" plugin setting to verify that!

Download latest plugin version:

Included in the latest krpano viewer download package


Examples:
Directional Sound


Usage:

Quellcode

1
2
3
4
5
<plugin name="soundinterface"
        url="soundinterface.swf"
        onloaded="action(preloadsounds);"
        rootpath="."
        />


Attributes:
  • onloaded
    • this action is called when the plugin was loaded and is ready for use.
    • can be used for preloading sound.
  • rootpath
    • root path of the sound files
    • relative from the xml file, default=""
    • with krpano 1.0.8 or higher it's possible to use placeholders like %SWFPATH% here
  • volume
    • set the global volume for all sounds
    • 0.0 - 1.0, default=1.0
    • can be changed dynamically via actions (set/tween/...)
  • mute
    • set the global mute for all sounds
    • true or false, default=false
    • can be changed dynamically via actions (set/switch/...)



Functions:
  • preloadsound(mp3file);
    • preloads a sound file
    • this can be used to reduce the latency when starting play
    • mp3file = the filename/path of a sound file
  • playsound(id, mp3file, loops*, oncomplete*);
    • plays a sound file
    • id = id/name of the sound (use "auto" for a automatic new id for every play)
    • mp3file = the filename/path of a sound file
    • loops = number of loops, 0=endless, default=1 (*optional)
    • oncomplete = action/event that will called on complete (*optional)
  • playsound2D(id, mp3file, volume*, pan*, loops*, oncomplete*);
    • plays a sound file with adjustable volume and panning
    • id = id/name of the sound (use "auto" for a automatic new id for every play)
    • mp3file = the filename/path of a sound file
    • volume = sound volume (0.0 - 1.0, default=1.0) (*optional)
    • pan = left/right panning (-1.0(=left) - +1.0(=right), default=0.0) (*optional)
    • loops = number of loops, 0=endless, default=1 (*optional)
    • oncomplete = action/event that will called on complete (*optional)
  • playsound3D(id, mp3file, ath, atv, range*, volume*, loops*, oncomplete*);
    • plays a directional 3D sound
    • id = id/name of the sound (use "auto" for a automatic new id for every play)
    • mp3file = the filename/path of a sound file
    • ath = horizontal sound source position (-180 .. 180°)
    • atv = vertical sound source position (-90 .. +90°)
    • range = range of sound (in degrees, default=90) (*optional)
    • volume = sound volume (0.0 - 1.0, default=1.0) (*optional)
    • loops = number of loops, 0=endless, default=1 (*optional)
    • oncomplete = action/event that will called on complete (*optional)
  • playsound3DHS(id, mp3file, hotspotname, range*, volume*, loops*, oncomplete*);
    • plays a directional 3D sound at a hotspot position
    • it follows the hotspot if the hotspot is moving
    • id = id/name of the sound (use "auto" for a automatic new id for every play)
    • mp3file = the filename/path of a sound file
    • hotspotname = name of the hotspot
    • range = range of sound (in degrees, default=90) (*optional)
    • volume = sound volume (0.0 - 1.0, default=1.0) (*optional)
    • loops = number of loops, 0=endless, default=1 (*optional)
    • oncomplete = action/event that will called on complete (*optional)
  • pausesound(id);- pauses a sound
    • id = id/name of the sound
  • resumesound(id);- resumes a paused sound
    • id = id/name of the sound
  • pausesoundtoggle(id);- pauses OR resumes a sound
    • id = id/name of the sound
  • stopsound(id);- stops playing a sound
    • id = id/name of the sound
  • stopallsounds();
    • stop all current playing sounds


XML usage example:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<plugin name=soundinterface" 
        url="plugins/soundinterface.swf" 
        rootpath="sounds/" 
        />

<hotspot name="s1" url="spot.png"
         onclick="playsound(auto,tada.mp3);"
         onover="playsound(auto,over.mp3);"
         onout="playsound(auto,out.mp3);"
         />
<hotspot name="s2" url="spot.png"
         onclick="stopallsounds();
                  loadpano(next.xml,null,MERGE,BLEND(1));
                  playsound(auto,newsound.mp3);"
         />

spacerywitualne

Fortgeschrittener

Beiträge: 435

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : VR solutions

  • Nachricht senden

2

Donnerstag, 5. März 2009, 12:01

This is amazing. Excellent!

Impressive. *thumbsup*
The plugin reproduces the sound beautifully.

The left channel is the right channel on our computers. We do not know, if so this has to be... and as to change this.
But...

We are delighted.

Thanks Klaus.

How to change the channels of the sound from left to right?

Pablo & Pietero
www.spacerywirtualne.pl team
Pawel & Piotr

Virtual Tour Builder new IDE with free modern templates, POI system and Livepano Assistance

HTML5-VR Audio Plugin

New Lensflare Plugin for Flash, HTML5, WebVR!

3

Donnerstag, 5. März 2009, 14:13

The left channel is the right channel on our computers. We do not know, if so this has to be... and as to change this.
But...
really? are you sure?
is the left/right channel swapped or is the orientation wrong?

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

4

Donnerstag, 5. März 2009, 17:45

I'm noticing the same thing on the sample you setup...

on buttons 1 and 3, as I move around the sound changes opposite of what I would expect.
- I click on 1 while looking directly at it - sound seems even between the two speakers
- I look to the right (which places b1 on the left of my screen) and the sound is louder from the right speaker
- look to the left (button on the right side of the screen) and the sound is louder from the left

I get the same effect with button 3 as well.

With button two... as I move to the right (b2 goes to the left) the sound gets louder on the left... which seems to be what should happen as I "turn my head".

The sound tracks button 4 just fine as well.

spacerywitualne

Fortgeschrittener

Beiträge: 435

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : VR solutions

  • Nachricht senden

5

Donnerstag, 5. März 2009, 17:55

Exactly. It is so as Graydon writes.

Can one maybe put this in xml?

We test on the new project and the sound is heard inversely.

regards *thumbsup*

Pablo & Pietero
Pawel & Piotr

Virtual Tour Builder new IDE with free modern templates, POI system and Livepano Assistance

HTML5-VR Audio Plugin

New Lensflare Plugin for Flash, HTML5, WebVR!

6

Donnerstag, 5. März 2009, 18:45

I think this could be because of the used sound samples,
this are stereo sounds with varying left/right informations, maybe this is the problem,
ideal would be mono sound samples, but I haven't found better sound samples in the
short time when making this example

swapping the left/right panning would be no problem,
I just need to be sure

7

Donnerstag, 5. März 2009, 19:11

Hi, me again
I have now made tests with mono samples and found the problem (a axis was swapped)

now it should work, I have uploaded a updated version.
(please clear browser cache before testing again)

best regards,
Klaus

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

8

Donnerstag, 5. März 2009, 19:47

works beautifully now. shouldn't you go and get some sleep now?

spacerywitualne

Fortgeschrittener

Beiträge: 435

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : VR solutions

  • Nachricht senden

9

Donnerstag, 5. März 2009, 19:54

You are great Klaus. *thumbsup*

This is it.

Pietero & Pablo
www.spacerywirtualne.pl team
Pawel & Piotr

Virtual Tour Builder new IDE with free modern templates, POI system and Livepano Assistance

HTML5-VR Audio Plugin

New Lensflare Plugin for Flash, HTML5, WebVR!

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »spacerywitualne« (6. März 2009, 11:17)


10

Freitag, 6. März 2009, 04:24

Klaus or anyone else that has directional audio in effect, would you be so kind as to share the .xml you used in your directional sound example. If I try to load the .xml of the example off the internet it gives me an error. I am have having a little issue with the syntax and would love to see the code in action.

11

Freitag, 6. März 2009, 11:33

Hi, should be working this way?
http://virtualpanorama.cz/valentine/
marty

12

Freitag, 6. März 2009, 13:36

Klaus or anyone else that has directional audio in effect, would you be so kind as to share the .xml you used in your directional sound example. If I try to load the .xml of the example off the internet it gives me an error. I am have having a little issue with the syntax and would love to see the code in action.
Hi, here is the direct link to the xml:

http://krpano.com/plugins/soundinterface/example.xml

and here is it inline: ;-)

Quellcode

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
<krpano>
    <display flash10="off" />
    <view fov="90" fovmin="60" fovmax="120" />

    <plugin name="soundinterface" url="soundinterface.swf" onloaded="" />

    <!-- play sound at 0/0 -->
    <hotspot name="b1" url="button1.png" ath="0"   atv="0" 
             onclick="playsound3D(s1,music1.mp3, 0,0);" />

    <!-- play sound at 90/0 - range 120 -->
    <hotspot name="b2" url="button2.png" ath="90"  atv="0" 
             onclick="playsound3D(s2,music2.mp3, 90,0, 120); " />

    <!-- play sound at hotspot positon -->
    <hotspot name="b3" url="button3.png" ath="180" atv="0" 
             onclick="playsound3DHS(s3,music3.mp3, b3);" />

    <!-- stop all other sounds, play sound at moving hotspot positon -->
    <hotspot name="b4" url="button4.png" ath="270" atv="0" 
             onclick="stopallsounds(); playsound3DHS(s4, music4.mp3, b4); tween(ath,630,20);" />

    <image>
        <sphere url="pano.jpg" />
    </image>
</krpano>

13

Samstag, 7. März 2009, 21:33

can someone tell me what is wrong with my syntax here ... the onclick stopallsound works, the action(audiooff) works but i cannot get the helicopter.mp3 or the planeidle.mp3 to play ... ? the action audiooff just disables the standard mp3 audio track that plays in the background.



<!-- directional audio -->


<hotspot name="plane"
url="hotspot_ani.swf"
ath="-187" atv="1"
visible="true" enabled="true" handcursor="true"
zorder="0"

onover=""
onhover="showtext(Click here to Start the Airplane then move left and right,largetext)"
onout=""
ondown=""
onup=""
onclick="stopallsounds(); action(audiooff); playsound3DHS(s2,planeidle.mp3,plane);"
>


</hotspot>

<hotspot name="copter"
url="hotspot_ani.swf"
ath="-27" atv="-16"
visible="true" enabled="true" handcursor="true"
zorder="0"

onover=""
onhover="showtext(Click here to Start the Helicopter then move left and right,largetext)"
onout=""
ondown=""
onup=""
onclick="stopallsounds(); action(audiooff); playsound3DHS(s3,helicopter.mp3,copter);"
>
</hotspot>

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

14

Samstag, 7. März 2009, 22:25

the only thing I noticed is that it looks like you have an extra > towards the end of the hotspot node...

Quellcode

1
2
3
 onclick="stopallsounds(); action(audiooff); playsound3DHS(s3,helicopter.mp3,copter);"
 >                         	<--- this doesn't seem to belong
 </hotspot>


Can't say if that would cause you a problem... but I've chased down some of my own errors that were caused by items like this.

15

Samstag, 7. März 2009, 23:25

"Graydon if I take that out I get an XML parser error. "

I can get the audio to play if I use just 'playsound' but soon as I add '2d, 3d or 3dhs' i get nothing no audio at all. I have tried both krpano version 1.0.7 and 1.0.8 beta 5 neither of them let me use 2d, 3d or 3dhs. This is the last piece i have to work out for my demo spin for the optional add-ins. Here is all my audio code I am hoping someone can help me with this.

<!--Audio-->
<plugin name="soundinterface" url="../plugins/soundinterface.swf"/>

<plugin name="audio2"
url="../../images/speakeryes.png"
visible="false" enabled="true" handcursor="true"
zorder="4"
alpha="1.00" blendmode="normal"
smoothing="true"
origin="centerbottom" edge=""
x="270" y="2"
width="30" height="30"
scale="1"
onloaded=""
onover="tween(plugin[audio2].width,40,distance(318,0.5),easeoutquad);tween(plugin[audio2].height,40,distance(120,0.5),easeoutquad);"
onout="tween(plugin[audio2].width,30,distance(318,0.5),easeoutquad);tween(plugin[audio2].height,30,distance(120,0.5),easeoutquad);"
onhover="showtext(Enable Audio in the Tour)"
ondown=""
onup=""
onclick="playsound(s1,music.mp3);action(audioon);tween(plugin[eq].width,100,distance(318,0.5),easeoutquad);"

/>

<plugin name="audio"
url="../../images/speakerno.png"
visible="false" enabled="true" handcursor="true"
zorder="4"
alpha="1.00" blendmode="normal"
smoothing="true"
origin="centerbottom" edge=""
x="270" y="2"
width="30" height="30"
scale="1"
onloaded=""
onover="tween(plugin[audio].width,40,distance(318,0.5),easeoutquad);tween(plugin[audio].height,40,distance(120,0.5),easeoutquad);"
onout="tween(plugin[audio].width,30,distance(318,0.5),easeoutquad);tween(plugin[audio].height,30,distance(120,0.5),easeoutquad);"
onhover="showtext(Disable Audio in the Tour)"
ondown=""
onup=""
onclick="stopsound(s1);action(audiooff);tween(plugin[eq].width,0,distance(318,0.5),easeoutquad);"
/>


<action name="audioon">

set(plugin[audio2].enable,false);
set(plugin[audio2].visible,false);
set(plugin[audio].enable,true);
set(plugin[audio].visible,true);
set(plugin[eq].enable,true);
set(plugin[eq].visible,true);

</action>

<action name="audiooff">
set(plugin[audio].enable,false);
set(plugin[audio].visible,false);
set(plugin[audio2].enable,true);
set(plugin[audio2].visible,true);
set(plugin[eq].enable,false);
set(plugin[eq].visible,false);

</action>

<plugin name="eq"
url="../../images/eq.swf"
keep="true"
visible="false" enabled="false" handcursor="true"
zorder="0"
alpha="1.00" blendmode="normal"
smoothing="true"
origin="rightbottom" edge=""
x="20" y="60"
width="0" height="40"
scale="1"
onloaded=""

onhover=""
ondown=""
onup=""
onclick=""
/>

<!-- directional audio -->


<hotspot name="plane"
url="hotspot_ani.swf"
ath="-187" atv="1"
visible="true" enabled="true" handcursor="true"
zorder="0"

onover=""
onhover="showtext(Click here to Start the Airplane then move left and right,largetext)"
onout=""
ondown=""
onup=""
onclick="stopallsounds(); action(audiooff); playsound3DHS(s2,planeidle.mp3,plane);"

>

</hotspot>

<hotspot name="copter"
url="hotspot_ani.swf"
ath="-27" atv="-16"
visible="true" enabled="true" handcursor="true"
zorder="0"

onover=""
onhover="showtext(Click here to Start the Helicopter then move left and right,largetext)"
onout=""
ondown=""
onup=""
onclick="stopallsounds(); action(audiooff); playsound3DHS(s3,helicopter.mp3,copter);"
>

</hotspot>

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

16

Sonntag, 8. März 2009, 00:19

OK - I see why you get the parser error - it doesn't effect the soundinterface plugin - at least based upon my testing... but just to clariy...

you have this...

Quellcode

1
2
3
4
<hotspot name="xxx"
----
>
</hotspot>


but could also do it this way...

Quellcode

1
2
3
<hotspot name="xxx"
---
/>


but on to your sound problem...

The only other suggestion that I have is to make absolute sure you've got the latest krpano beta as well as the latest soundinterface.swf...

From what I can tell... the krpano 1.0.8 b6 build (20090302) download package does NOT have the latest soundinterface.swf which is build (05.03.2009)

You can get the latest soundinterface from one of the posts above.

Checking the versions is easy if you have the flash standalone player... just double click on the swf... plugins will show the version / build information. The krpano.swf will try to load an xml... but then just click on "o" to see what the version / build info is in the console.

I'm not a betting man... but I'd almost wager that you don't have the latest version of the soundinterface... because everything else looks fine. *smile*

17

Sonntag, 8. März 2009, 02:32

Graydon many thanks to you!!! I was banging my head against a wall all morning on this one. It was too easy to be that hard. I updated everything except the soundinterface.swf once I upgraded that things feel right into place. I have got my directional Audio to work. Thank you again.

Beiträge: 55

Wohnort: FRance

Beruf: rock clinbing, scuba diving, motorbike....

  • Nachricht senden

18

Montag, 13. April 2009, 22:12

loops # doesn't seen to work !
i've set it to 1 but it keep playing in a loop !

onclick="playsound2D(s1,zap.mp3,0.5,0,1);"

my fault ?
Pro website : www.bziegler.com
Blog : blog.bziegler.com

Beiträge: 55

Wohnort: FRance

Beruf: rock clinbing, scuba diving, motorbike....

  • Nachricht senden

19

Montag, 13. April 2009, 22:32

loops # doesn't seen to work !
i've set it to 1 but it keep playing in a loop !

onclick="playsound2D(s1,zap.mp3,0.5,0,1);"

my fault ?
Yes my fault ;)

sorry
Pro website : www.bziegler.com
Blog : blog.bziegler.com

20

Mittwoch, 15. April 2009, 20:28

Hello,

the soundinterface plugin was updated today (2009-04-15),
there was a bug with the 3D sound directions,
download from the link in the first post
(the bugfixed plugin will be also included in the next release)

best regards,
Klaus

Ähnliche Themen