Difference between revisions of "SoundChannel"

From GiderosMobile
Line 40: Line 40:
 
[[SoundChannel:setPosition]] ''sets the position of the current playback''<br/><!--GIDEROSMTD:SoundChannel:setPosition(position) sets the position of the current playback-->
 
[[SoundChannel:setPosition]] ''sets the position of the current playback''<br/><!--GIDEROSMTD:SoundChannel:setPosition(position) sets the position of the current playback-->
 
[[SoundChannel:setVolume]] ''sets the volume of the sound channel''<br/><!--GIDEROSMTD:SoundChannel:setVolume(volume) sets the volume of the sound channel-->
 
[[SoundChannel:setVolume]] ''sets the volume of the sound channel''<br/><!--GIDEROSMTD:SoundChannel:setVolume(volume) sets the volume of the sound channel-->
[[SoundChannel:setWorldPosition]] '''''wip'''''<br/><!--GIDEROSMTD:SoundChannel:setWorldPosition(x,y,z,vx,vy,vz) wip-->
+
[[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-->
 
[[SoundChannel:stop]] ''stops the sound playing in the channel''<br/><!--GIDEROSMTD:SoundChannel:stop() stops the sound playing in the channel-->
  

Revision as of 09:02, 12 March 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

Playing_Sound_and_Music

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:setEffect enables effects on 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 sets the position of the sound in a 3D world
SoundChannel:stop stops the sound playing in the channel

Events

SoundChannel_Event.COMPLETE

Constants