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 +4 -4
- data/ext/audio/audio.c +30 -0
- data/lib/dummy_audio.rb +8 -0
- data/lib/native_audio.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 646dd4b14196feef5695e9b95a1712f876217bd360876234780ce4276ae08eee
|
|
4
|
+
data.tar.gz: dab8e4e10ffa4b1e0195d0d2fd94c8d4da41b33406bdbd453d347674cdf71912
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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)
|