Difference between revisions of "SoundChannel"
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(21 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Supported platforms:''' android | + | <!-- GIDEROSOBJ:SoundChannel --> |
+ | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | === Description === | + | '''Inherits from:''' [[Object]]<br/> |
− | + | ||
− | The | + | ===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 | |
− | + | ||
− | <br /> | + | ===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) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === See also === | ||
+ | '''[[Sound]]'''<br/> | ||
+ | '''[[Playing_Sound_and_Music]]''' | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[SoundChannel:getPitch]] '' | + | [[SoundChannel:getPitch]] ''returns the current sound channel pitch''<br/><!--GIDEROSMTD:SoundChannel:getPitch() returns the current sound channel pitch--> |
− | [[SoundChannel:getPosition]] ''< | + | [[SoundChannel:getPosition]] ''returns the current playback position''<br/><!--GIDEROSMTD:SoundChannel:getPosition() returns the current playback position--> |
− | [[SoundChannel:getVolume]] '' | + | [[SoundChannel:getStreamId]] ''returns the channel stream id''<br/><!--GIDEROSMTD:SoundChannel:getStreamId() returns the channel stream id--> |
− | [[SoundChannel:isLooping]] '' | + | [[SoundChannel:getVolume]] ''returns the current sound channel volume''<br/><!--GIDEROSMTD:SoundChannel:getVolume() returns the current sound channel volume--> |
− | [[SoundChannel:isPaused]] '' | + | [[SoundChannel:isLooping]] ''returns the channel looping state''<br/><!--GIDEROSMTD:SoundChannel:isLooping() returns the channel looping state--> |
− | [[SoundChannel:isPlaying]] ''< | + | [[SoundChannel:isPaused]] ''returns the channel paused state''<br/><!--GIDEROSMTD:SoundChannel:isPaused() returns the channel paused state--> |
− | [[SoundChannel:setLooping]] '' | + | [[SoundChannel:isPlaying]] ''returns the sound channel playing state''<br/><!--GIDEROSMTD:SoundChannel:isPlaying() returns the sound channel playing state--> |
− | [[SoundChannel:setPaused]] '' | + | [[SoundChannel:setEffect]] ''enables sound channel effects''<br/><!--GIDEROSMTD:SoundChannel:setEffect(channel, effect, params) enables sound channel effects--> |
− | [[SoundChannel:setPitch]] '' | + | [[SoundChannel:setLooping]] ''sets the channel looping state''<br/><!--GIDEROSMTD:SoundChannel:setLooping(looping) sets the channel looping state--> |
− | [[SoundChannel:setPosition]] '' | + | [[SoundChannel:setPaused]] ''sets the channel paused state''<br/><!--GIDEROSMTD:SoundChannel:setPaused(paused) sets the channel paused state--> |
− | [[SoundChannel:setVolume]] '' | + | [[SoundChannel:setPitch]] ''sets the sound channel pitch''<br/><!--GIDEROSMTD:SoundChannel:setPitch(pitch) sets the sound channel pitch--> |
− | [[SoundChannel:setWorldPosition]] <br/> | + | [[SoundChannel:setPosition]] ''sets the current playback position''<br/><!--GIDEROSMTD:SoundChannel:setPosition(position) sets the current playback position--> |
− | [[SoundChannel:stop]] '' | + | [[SoundChannel:setVolume]] ''sets the sound channel volume''<br/><!--GIDEROSMTD:SoundChannel:setVolume(volume) sets the sound channel volume--> |
+ | [[SoundChannel:setWorldPosition]] ''sets the position of the sound in a 3D world''<br/><!--GIDEROSMTD:SoundChannel:setWorldPosition(x,y,z,vx,vy,vz) sets the position of the sound in a 3D world--> | ||
+ | [[SoundChannel:stop]] ''stops the sound playing in the channel''<br/><!--GIDEROSMTD:SoundChannel:stop() stops the sound playing in the channel--> | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
− | [[Event.COMPLETE]]<br/> | + | <!--[[Event.COMPLETE]]<br/>--> |
+ | [[SoundChannel_Event.COMPLETE]]<br/><!--GIDEROSEVT:Event.COMPLETE complete--> | ||
=== Constants === | === Constants === | ||
|} | |} | ||
+ | |||
+ | {{GIDEROS IMPORTANT LINKS}} |
Latest revision as of 14:32, 13 July 2023
Supported platforms:
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
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)
See also
MethodsSoundChannel:getPitch returns the current sound channel pitch |
EventsConstants |