native_audio 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0471808989066a6a5e16fac518a5eddb94e8cc3cbe541b40d18a4d2244a17186'
4
- data.tar.gz: 956461d3e0fc7214338b46f1a2cfe17ec6f947b8aebf379123bdfc1ff1c38550
3
+ metadata.gz: 64a48d1c26dbc98e6b0231d7ccc72455ad5ee487141ce0dd9eb170ee43b47976
4
+ data.tar.gz: 7962a4fd132fa2fe79e1f33eb87b7c06595a6cf8405850dd983b45ba9f2c596b
5
5
  SHA512:
6
- metadata.gz: efee694d3fb6a013c92ccbfff8f89100b8b495ddc82f90c0573579006c82003f37f133ba41ec4b50116ece00bc5cd13a361fb50349864e51d0949d7e62004965
7
- data.tar.gz: d63942dfe0ceac0662af7f2ebf07f87af9d6e9f01645646598f903eddce8e2d971ba013345318204e6b49f0ce621acdc22a897dd5ae860df4de7451f9af46ade
6
+ metadata.gz: 3098316f693c450a8f0300f157964a7ddce5f9f1320bafd0447ce1e8707a568e48604fb2c10d5bcb8e1349dc7dca7db419757b9dc91c69f29b6e24e64103fd14
7
+ data.tar.gz: 96ae5fd5579fb9132f2a428688453cc9885cd5bfc86edbe3a546e1ed50e8f06ec4fbd251dbfb6dfb58b1e484b7e51294b47bec4812c9938b3b62160425111e3f
data/ext/audio/audio.c CHANGED
@@ -425,6 +425,34 @@ VALUE audio_set_pos(VALUE self, VALUE channel_id, VALUE angle, VALUE distance)
425
425
  return Qnil;
426
426
  }
427
427
 
428
+ VALUE audio_set_pan(VALUE self, VALUE channel_id, VALUE pan)
429
+ {
430
+ int channel = NUM2INT(channel_id);
431
+ float p = (float)NUM2DBL(pan);
432
+
433
+ if (channel < 0 || channel >= MAX_CHANNELS || channels[channel] == NULL) {
434
+ return Qnil;
435
+ }
436
+
437
+ ma_sound_set_pan(channels[channel], p);
438
+
439
+ return Qnil;
440
+ }
441
+
442
+ VALUE audio_seek(VALUE self, VALUE channel_id, VALUE seconds)
443
+ {
444
+ int channel = NUM2INT(channel_id);
445
+ float s = (float)NUM2DBL(seconds);
446
+
447
+ if (channel < 0 || channel >= MAX_CHANNELS || channels[channel] == NULL) {
448
+ return Qnil;
449
+ }
450
+
451
+ ma_sound_seek_to_second(channels[channel], s);
452
+
453
+ return Qnil;
454
+ }
455
+
428
456
  VALUE audio_set_looping(VALUE self, VALUE channel_id, VALUE looping)
429
457
  {
430
458
  int channel = NUM2INT(channel_id);
@@ -609,7 +637,9 @@ void Init_audio(void)
609
637
  rb_define_singleton_method(mAudio, "set_volume", audio_set_volume, 2);
610
638
  rb_define_singleton_method(mAudio, "set_pitch", audio_set_pitch, 2);
611
639
  rb_define_singleton_method(mAudio, "set_pos", audio_set_pos, 3);
640
+ rb_define_singleton_method(mAudio, "set_pan", audio_set_pan, 2);
612
641
  rb_define_singleton_method(mAudio, "set_looping", audio_set_looping, 2);
642
+ rb_define_singleton_method(mAudio, "seek", audio_seek, 2);
613
643
 
614
644
  // Delay taps
615
645
  rb_define_singleton_method(mAudio, "add_delay_tap", audio_add_delay_tap, 3);
data/lib/dummy_audio.rb CHANGED
@@ -49,6 +49,14 @@ module DummyAudio
49
49
  nil
50
50
  end
51
51
 
52
+ def self.set_pan(channel, pan)
53
+ nil
54
+ end
55
+
56
+ def self.seek(channel, seconds)
57
+ nil
58
+ end
59
+
52
60
  def self.set_looping(channel, looping)
53
61
  nil
54
62
  end
data/lib/native_audio.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative './audio'
4
4
  require_relative './dummy_audio'
5
5
 
6
+ puts "[NativeAudio] Loading local development version"
6
7
  Audio.init unless ENV['DUMMY_AUDIO_BACKEND'] == 'true'
7
8
 
8
9
  module NativeAudio
@@ -83,6 +84,15 @@ module NativeAudio
83
84
  NativeAudio.audio_driver.set_pos(@channel, angle, distance)
84
85
  end
85
86
 
87
+ def set_pan(pan)
88
+ @params[:pan] = pan
89
+ NativeAudio.audio_driver.set_pan(@channel, pan)
90
+ end
91
+
92
+ def seek(seconds)
93
+ NativeAudio.audio_driver.seek(@channel, seconds)
94
+ end
95
+
86
96
  def set_volume(volume)
87
97
  @params[:volume] = volume
88
98
  NativeAudio.audio_driver.set_volume(@channel, volume)
@@ -133,6 +143,7 @@ module NativeAudio
133
143
  NativeAudio.audio_driver.set_volume(@channel, @params[:volume]) if @params.key?(:volume)
134
144
  NativeAudio.audio_driver.set_pitch(@channel, @params[:pitch]) if @params.key?(:pitch)
135
145
  NativeAudio.audio_driver.set_looping(@channel, @params[:looping]) if @params.key?(:looping)
146
+ NativeAudio.audio_driver.set_pan(@channel, @params[:pan]) if @params.key?(:pan)
136
147
  NativeAudio.audio_driver.set_pos(@channel, *@params[:pos]) if @params.key?(:pos)
137
148
 
138
149
  if @params.key?(:reverb)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: native_audio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Hatfull