native_audio 0.5.5 → 0.5.7

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: 646dd4b14196feef5695e9b95a1712f876217bd360876234780ce4276ae08eee
4
+ data.tar.gz: dab8e4e10ffa4b1e0195d0d2fd94c8d4da41b33406bdbd453d347674cdf71912
5
5
  SHA512:
6
- metadata.gz: efee694d3fb6a013c92ccbfff8f89100b8b495ddc82f90c0573579006c82003f37f133ba41ec4b50116ece00bc5cd13a361fb50349864e51d0949d7e62004965
7
- data.tar.gz: d63942dfe0ceac0662af7f2ebf07f87af9d6e9f01645646598f903eddce8e2d971ba013345318204e6b49f0ce621acdc22a897dd5ae860df4de7451f9af46ade
6
+ metadata.gz: 66a2c9fd9214622524a76dc79f45ea5ef7e49a8cd4bc0c4eb2eacce63ad505b163dd94fe49856e4518746604a0cb94a1660d6515bd5f3e6ea2b27e081db16583
7
+ data.tar.gz: 18cf9f7de80f4274ee8a256f20510596692e97556be706af7c5e1d67c552d73076b99b4f0d15cf38aa6a166c81bd98a24faa5d7d916d14d5b26f7bfc13540f2a
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
@@ -83,6 +83,15 @@ module NativeAudio
83
83
  NativeAudio.audio_driver.set_pos(@channel, angle, distance)
84
84
  end
85
85
 
86
+ def set_pan(pan)
87
+ @params[:pan] = pan
88
+ NativeAudio.audio_driver.set_pan(@channel, pan)
89
+ end
90
+
91
+ def seek(seconds)
92
+ NativeAudio.audio_driver.seek(@channel, seconds)
93
+ end
94
+
86
95
  def set_volume(volume)
87
96
  @params[:volume] = volume
88
97
  NativeAudio.audio_driver.set_volume(@channel, volume)
@@ -133,6 +142,7 @@ module NativeAudio
133
142
  NativeAudio.audio_driver.set_volume(@channel, @params[:volume]) if @params.key?(:volume)
134
143
  NativeAudio.audio_driver.set_pitch(@channel, @params[:pitch]) if @params.key?(:pitch)
135
144
  NativeAudio.audio_driver.set_looping(@channel, @params[:looping]) if @params.key?(:looping)
145
+ NativeAudio.audio_driver.set_pan(@channel, @params[:pan]) if @params.key?(:pan)
136
146
  NativeAudio.audio_driver.set_pos(@channel, *@params[:pos]) if @params.key?(:pos)
137
147
 
138
148
  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.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Hatfull