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:

    Code
    <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:

Participate now!

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