Difference between revisions of "SoundChannel"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<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/>
+
'''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/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
+
'''Inherits from:''' [[Object]]<br/>
  
===<translate>Description</translate>===
+
===Description===
 
The '''SoundChannel''' class is used to control and monitor a playing sound.
 
The '''SoundChannel''' class is used to control and monitor a playing sound.
  
===<translate>SoundChannel Events</translate>===
+
===SoundChannel Events===
<ul>
+
*''Event.COMPLETE = "complete"'': when the sound channel has finished playing, [[Event.COMPLETE]] event is dispatched
<li><translate>''Event.COMPLETE = "complete"'' When the sound channel has finished playing, [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.</translate></li>
 
</ul>
 
  
===<translate>Example</translate>===
+
===Example===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local sound1 = Sound.new("audio/sound1.ogg")
 
local sound1 = Sound.new("audio/sound1.ogg")
 
local audio1 = sound1:play()
 
local audio1 = sound1:play()
Line 23: Line 20:
 
local audio2 = sound2:play()
 
local audio2 = sound2:play()
 
end)
 
end)
</source>
+
</syntaxhighlight>
 +
 
 +
=== See also ===
 +
'''[[Sound]]'''<br/>
 +
'''[[Playing_Sound_and_Music]]'''
  
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/SoundChannel:getPitch|SoundChannel:getPitch]] ''<translate>returns the current pitch of the sound channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:getPitch() returns the current pitch of the sound channel -->
+
[[SoundChannel:getPitch]] ''returns the current sound channel pitch''<br/><!--GIDEROSMTD:SoundChannel:getPitch() returns the current sound channel pitch-->
[[Special:MyLanguage/SoundChannel:getPosition|SoundChannel:getPosition]] ''<translate>returns the position of the current playback</translate>''<br/><!-- GIDEROSMTD:SoundChannel:getPosition() returns the position of the current playback -->
+
[[SoundChannel:getPosition]] ''returns the current playback position''<br/><!--GIDEROSMTD:SoundChannel:getPosition() returns the current playback position-->
[[Special:MyLanguage/SoundChannel:getVolume|SoundChannel:getVolume]] ''<translate>returns the current volume of the sound channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:getVolume() returns the current volume of the sound channel -->
+
[[SoundChannel:getStreamId]] ''returns the channel stream id''<br/><!--GIDEROSMTD:SoundChannel:getStreamId() returns the channel stream id-->
[[Special:MyLanguage/SoundChannel:isLooping|SoundChannel:isLooping]] ''<translate>returns the looping state of the channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:isLooping() returns the looping state of the channel -->
+
[[SoundChannel:getVolume]] ''returns the current sound channel volume''<br/><!--GIDEROSMTD:SoundChannel:getVolume() returns the current sound channel volume-->
[[Special:MyLanguage/SoundChannel:isPaused|SoundChannel:isPaused]] ''<translate>returns the paused state of the channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:isPaused() returns the paused state of the channel -->
+
[[SoundChannel:isLooping]] ''returns the channel looping state''<br/><!--GIDEROSMTD:SoundChannel:isLooping() returns the channel looping state-->
[[Special:MyLanguage/SoundChannel:isPlaying|SoundChannel:isPlaying]] ''<translate>returns the playing state for the sound channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:isPlaying() returns the playing state for the sound channel -->
+
[[SoundChannel:isPaused]] ''returns the channel paused state''<br/><!--GIDEROSMTD:SoundChannel:isPaused() returns the channel paused state-->
[[Special:MyLanguage/SoundChannel:setLooping|SoundChannel:setLooping]] ''<translate>sets the looping state of the channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:setLooping(looping) sets the looping state of the channel -->
+
[[SoundChannel:isPlaying]] ''returns the sound channel playing state''<br/><!--GIDEROSMTD:SoundChannel:isPlaying() returns the sound channel playing state-->
[[Special:MyLanguage/SoundChannel:setPaused|SoundChannel:setPaused]] ''<translate>sets the paused state of the channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:setPaused(paused) sets the paused state of the channel -->
+
[[SoundChannel:setEffect]] ''enables sound channel effects''<br/><!--GIDEROSMTD:SoundChannel:setEffect(channel, effect, params) enables sound channel effects-->
[[Special:MyLanguage/SoundChannel:setPitch|SoundChannel:setPitch]] ''<translate>sets the pitch of the sound channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:setPitch(pitch) sets the pitch of the sound channel -->
+
[[SoundChannel:setLooping]] ''sets the channel looping state''<br/><!--GIDEROSMTD:SoundChannel:setLooping(looping) sets the channel looping state-->
[[Special:MyLanguage/SoundChannel:setPosition|SoundChannel:setPosition]] ''<translate>sets the position of the current playback</translate>''<br/><!-- GIDEROSMTD:SoundChannel:setPosition(position) sets the position of the current playback -->
+
[[SoundChannel:setPaused]] ''sets the channel paused state''<br/><!--GIDEROSMTD:SoundChannel:setPaused(paused) sets the channel paused state-->
[[Special:MyLanguage/SoundChannel:setVolume|SoundChannel:setVolume]] ''<translate>sets the volume of the sound channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:setVolume(volume) sets the volume of the sound channel -->
+
[[SoundChannel:setPitch]] ''sets the sound channel pitch''<br/><!--GIDEROSMTD:SoundChannel:setPitch(pitch) sets the sound channel pitch-->
[[Special:MyLanguage/SoundChannel:setWorldPosition|SoundChannel:setWorldPosition]] <br/><!-- GIDEROSMTD:SoundChannel:setWorldPosition(x,y,z,vx,vy,vz) -->
+
[[SoundChannel:setPosition]] ''sets the current playback position''<br/><!--GIDEROSMTD:SoundChannel:setPosition(position) sets the current playback position-->
[[Special:MyLanguage/SoundChannel:stop|SoundChannel:stop]] ''<translate>stops the sound playing in the channel</translate>''<br/><!-- GIDEROSMTD:SoundChannel:stop() stops the sound playing in the channel -->
+
[[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;"|
=== <translate>Events</translate> ===
+
=== Events ===
[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/><!-- GIDEROSEVT:Event.COMPLETE complete-->
+
<!--[[Event.COMPLETE]]<br/>-->
=== <translate>Constants</translate> ===
+
[[SoundChannel_Event.COMPLETE]]<br/><!--GIDEROSEVT:Event.COMPLETE complete-->
 +
=== Constants ===
 
|}
 
|}
 +
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 14:32, 13 July 2023

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)

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