SoundChannel

From GiderosMobile
Revision as of 14:30, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2011.6
Inherits from: Object

Description

The SoundChannel class is used to control and monitor a playing sound.

SoundChannel Events

  • Event.COMPLETE = "complete": when the sound channel has finished playing, Event.COMPLETE event is dispatched

Example

<syntaxhighlight lang="lua"> local sound1 = Sound.new("audio/sound1.ogg") local audio1 = sound1:play() audio1:addEventListener(Event.COMPLETE, function() -- play a second audio when the first one is complete local sound2 = Sound.new("audio/sound2.ogg") local audio2 = sound2:play() end) </source>

See also

Sound
Playing_Sound_and_Music

Methods

SoundChannel:getPitch returns the current sound channel pitch
SoundChannel:getPosition returns the current playback position
SoundChannel:getStreamId returns the channel stream id
SoundChannel:getVolume returns the current sound channel volume
SoundChannel:isLooping returns the channel looping state
SoundChannel:isPaused returns the channel paused state
SoundChannel:isPlaying returns the sound channel playing state
SoundChannel:setEffect enables sound channel effects
SoundChannel:setLooping sets the channel looping state
SoundChannel:setPaused sets the channel paused state
SoundChannel:setPitch sets the sound channel pitch
SoundChannel:setPosition sets the current playback position
SoundChannel:setVolume sets the sound channel volume
SoundChannel:setWorldPosition sets the position of the sound in a 3D world
SoundChannel:stop stops the sound playing in the channel

Events

SoundChannel_Event.COMPLETE

Constants