Documentation

WHAT WE GOT

AABB
Physics Environment

Animation
Actions & Animations

Array
Support Classes

Audio
Sounds & Music

Audio Effect
Sounds & Music

Background Audio
Sounds & Music

Bezier
Actions & Animations

Blink
Actions & Animations

Body
Physics Environment

Callback
Actions & Animations

Chain Shape
Physics Environment

Circle Shape
Physics Environment

Color
Support Classes

Delay
Actions & Animations

Device
Support Classes

Director
Essentials

Ease
Actions & Animations

Edge Shape
Physics Environment

Event
Support Classes

Fade
Actions & Animations

Filter
Physics Environment

Fixture
Physics Environment

Jump
Actions & Animations

Label
User Interface

Layer
Essentials

Layer Color
Essentials

Liquid
Actions & Animations

Mass Data
Physics Environment

Menu
User Interface

Menu Image
User Interface

Menu Label
User Interface

Move
Actions & Animations

Numeric
Support Clases

Object Layer
Tiled Maps

Physics Sprite
Physics Environment

Place
Actions & Animations

Point
Support Classes

Polygon Shape
Physics Environment

Repeat
Actions & Animations

Rotate
Actions & Animations

Scale
Actions & Animations

Scene
Essentials

Screen
Support Classes

Sequence
Actions & Animations

Shape
Physics Environment

Shuffle
Actions & Animations

Size
Support Classes

Skew
Actions & Animations

Spawn
Actions & Animations

Split
Actions & Animations

Sprite
Essentials

Sprite Batch
Essentials

Sprite Frame Cache
Essentials

Tile Layer
Tiled Maps

Tile Map
Tiled Maps

Tile Set
Tiled Maps

Tint
Actions & Animations

Touch
Support Classes

Turn
Actions & Animations

Twirl
Actions & Animations

Visibility
Actions & Animations

Wave
Actions & Animations

Wiggle
Actions & Animations

World
Physics Environment

SOUNDS & MUSIC

Audio Effect

Provides the reproduction of audio effects for Game Events. The Audio Files are loaded using an event key, which later will be used to play the audio effect. It is recommended to use 16-bit mono wave files for uncompressed audio and IMA4 for lossy compressed audio, but MP3 is also supported.

Although the AudioEffect class has its own stop and volume functionality, it can be overridden using the mute and enable methods of the Audio Module.

New

Returns a new instance of the AudioEffect class:

audio_effect = AudioEfect.new

Add

Loads a new audio file with its event key:

audio_effect.add(:light_speed_jump, 'light_speed_jump.caf')

[]

Gets the audio related to the event key:

audio_effect[:light_speed_jump]

[]=

Loads a new audio file with its event key:

audio_effect[:light_speed_jump] = 'light_speed_jump.caf'
More intel!

The []= and add method are equivalent.

Play

Starts the Audio Effect playback and returns the playback identifier:

playback_identifier = audio_effect.play :light_speed_jump

Options:

pitch: - Float - 0.5 - 2.0 - Default: 1.0
The Audio Effect reproduction speed.

pan: - Float - -1.0 - 1.0 - Default: 0.0
Play back the effect on the Left or Right channel. Please note that this option only works on mono audio files.

gain: - Float 0.0 - 1.0 - Default: 1.0
Attenuation or Amplification of the audio playback.

Stop

Stops the Audio Effect reproduction based on the playback identifier:

audio_effect.stop playback_identifier

Remove

Unloads the audio file assigned to the event key:

audio_effect.remove : light_speed_jump

Volume

Gets and Sets the playback volume:

audio_effect.volume = 0.5

p "The effect volume is: #{audio_effect.volume}"
More intel!

The playback volume range starts in 0.0 and ends in 1.0.