Difference between revisions of "SoundChannel"

From GiderosMobile
(→‎Description: added Event.COMPLETE example code)
Line 2: Line 2:
 
<languages />
 
<languages />
 
<!-- GIDEROSOBJ:SoundChannel -->
 
<!-- GIDEROSOBJ:SoundChannel -->
'''<translate>Supported platforms</translate>:''' [[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/>
+
'''<translate>Supported platforms</translate>:''' [[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]]
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
+
'''<translate>Available since</translate>:''' Gideros 2011.6
=== <translate>Description</translate> ===
+
<br/>
<translate><br />
+
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]
The [[Special:MyLanguage/SoundChannel|SoundChannel]] class is used to control and monitor a playing sound.<br />
+
<br/>
<br />
+
 
<h3>SoundChannel Events</h3><br />
+
===<translate>Description</translate>===
<ul><br />
+
<translate>
<li>''Event.COMPLETE = "complete"'' When the sound channel has finished playing, [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.</li><br />
+
The [[Special:MyLanguage/SoundChannel|SoundChannel]] class is used to control and monitor a playing sound.
</ul><br />
+
</translate>
<br /></translate>
+
<br/>
 +
 
 +
===<translate>SoundChannel Events</translate>===
 +
<ul>
 +
<li><translate>''Event.COMPLETE = "complete"'' &nbsp; When the sound channel has finished playing, [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.</translate></li>
 +
</ul>
 +
<br/>
 +
 
 +
===<translate>Example</translate>===
 +
<source 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>
 +
<br/>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|

Revision as of 20:29, 30 May 2019


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

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)


Methods

SoundChannel:getPitch returns the current pitch of the sound channel
SoundChannel:getPosition returns the position of the current playback
SoundChannel:getVolume returns the current volume of the sound channel
SoundChannel:isLooping returns the looping state of the channel
SoundChannel:isPaused returns the paused state of the channel
SoundChannel:isPlaying returns the playing state for the sound channel
SoundChannel:setLooping sets the looping state of the channel
SoundChannel:setPaused sets the paused state of the channel
SoundChannel:setPitch sets the pitch of the sound channel
SoundChannel:setPosition sets the position of the current playback
SoundChannel:setVolume sets the volume of the sound channel
SoundChannel:setWorldPosition
SoundChannel:stop stops the sound playing in the channel

Events

Event.COMPLETE

Constants