Class: NativeAudio::AudioSource
- Inherits:
-
Object
- Object
- NativeAudio::AudioSource
- Defined in:
- lib/native_audio.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(clip) ⇒ AudioSource
constructor
A new instance of AudioSource.
- #pause ⇒ Object
- #play ⇒ Object
- #resume ⇒ Object
- #set_pos(angle, distance) ⇒ Object
- #set_volume(volume) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(clip) ⇒ AudioSource
Returns a new instance of AudioSource.
16 17 18 19 20 |
# File 'lib/native_audio.rb', line 16 def initialize(clip) @clip = clip @channel = AudioSource.channels.count AudioSource.channels << self end |
Class Method Details
.channels ⇒ Object
46 47 48 |
# File 'lib/native_audio.rb', line 46 def self.channels @channels ||= [] end |
Instance Method Details
#play ⇒ Object
22 23 24 |
# File 'lib/native_audio.rb', line 22 def play Audio.play(@channel, @clip.clip) end |
#resume ⇒ Object
34 35 36 |
# File 'lib/native_audio.rb', line 34 def resume Audio.resume(@channel) end |
#set_pos(angle, distance) ⇒ Object
38 39 40 |
# File 'lib/native_audio.rb', line 38 def set_pos(angle, distance) Audio.set_pos(@channel, angle, distance) end |
#set_volume(volume) ⇒ Object
42 43 44 |
# File 'lib/native_audio.rb', line 42 def set_volume(volume) Audio.set_volume(@channel, volume) end |