Class: Ray::Channel
- Inherits:
-
Object
- Object
- Ray::Channel
- Defined in:
- lib/ray/audio.rb
Overview
Represents an audio channel, where sounds are played.
Instance Method Summary collapse
-
#initialize(id) ⇒ Channel
constructor
Creates a channel.
-
#pause ⇒ Object
Pauses the channel.
-
#paused? ⇒ true, false
True if the channel is paused.
-
#play(sound, times = 1) ⇒ Object
Plays a sound on the channel.
-
#playing? ⇒ true, false
True if a sound is being played.
-
#resume ⇒ Object
Resumes from pause.
-
#stop ⇒ Object
Stops playing on the channel, without being able to resume.
Constructor Details
#initialize(id) ⇒ Channel
Creates a channel.
6 7 8 |
# File 'lib/ray/audio.rb', line 6 def initialize(id) @id = id end |
Instance Method Details
#pause ⇒ Object
Pauses the channel.
23 24 25 |
# File 'lib/ray/audio.rb', line 23 def pause Ray::Audio.pause(@id) end |
#paused? ⇒ true, false
Returns True if the channel is paused.
33 34 35 |
# File 'lib/ray/audio.rb', line 33 def paused? Ray::Audio.paused?(@id) end |
#play(sound, times = 1) ⇒ Object
Plays a sound on the channel.
13 14 15 |
# File 'lib/ray/audio.rb', line 13 def play(sound, times = 1) sound.play(@id, times) end |
#playing? ⇒ true, false
Returns True if a sound is being played.
38 39 40 |
# File 'lib/ray/audio.rb', line 38 def Ray::Audio.(@id) end |