ruby-audio 1.6.0-x86-mingw32 → 1.6.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/rubyaudio_ext/ra_buffer.c +17 -13
- data/lib/1.8/rubyaudio_ext.so +0 -0
- data/lib/1.9/rubyaudio_ext.so +0 -0
- data/ruby-audio.gemspec +1 -1
- data/spec/buffer_spec.rb +15 -1
- metadata +3 -3
@@ -67,6 +67,7 @@ static long ra_buffer_alloc_data(RA_BUFFER *buf) {
|
|
67
67
|
break;
|
68
68
|
}
|
69
69
|
buf->data = (void*)xmalloc(size);
|
70
|
+
memset(buf->data, 0, size);
|
70
71
|
return size;
|
71
72
|
}
|
72
73
|
|
@@ -321,18 +322,21 @@ static VALUE ra_buffer_aset(VALUE self, VALUE index, VALUE val) {
|
|
321
322
|
}
|
322
323
|
|
323
324
|
static void ra_buffer_index_set(RA_BUFFER *buf, long i, VALUE val) {
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
325
|
+
if(buf->type == RA_BUFFER_TYPE_SHORT || buf->type == RA_BUFFER_TYPE_INT) {
|
326
|
+
// Convert val to an integer
|
327
|
+
VALUE int_obj = rb_Integer(val);
|
328
|
+
if(TYPE(int_obj) != T_FIXNUM) rb_raise(eRubyAudioError, "could not convert frame value to an integer");
|
329
|
+
long int_val = FIX2LONG(int_obj);
|
330
|
+
|
331
|
+
// Set it
|
332
|
+
if(buf->type == RA_BUFFER_TYPE_SHORT) ((short*)buf->data)[i] = (short)int_val;
|
333
|
+
else ((int*)buf->data)[i] = (int)int_val;
|
334
|
+
} else {
|
335
|
+
// Convert val to a float
|
336
|
+
double float_val = RFLOAT_VALUE(rb_Float(val));
|
337
|
+
|
338
|
+
// Set it
|
339
|
+
if(buf->type == RA_BUFFER_TYPE_FLOAT) ((float*)buf->data)[i] = (float)float_val;
|
340
|
+
else ((double*)buf->data)[i] = float_val;
|
337
341
|
}
|
338
342
|
}
|
data/lib/1.8/rubyaudio_ext.so
CHANGED
Binary file
|
data/lib/1.9/rubyaudio_ext.so
CHANGED
Binary file
|
data/ruby-audio.gemspec
CHANGED
data/spec/buffer_spec.rb
CHANGED
@@ -17,10 +17,24 @@ describe RubyAudio::Buffer do
|
|
17
17
|
}.should_not raise_error
|
18
18
|
end
|
19
19
|
|
20
|
-
it "should allow [] access on single channel buffers" do
|
20
|
+
it "should allow [] access on integer single channel buffers" do
|
21
21
|
buf = RubyAudio::Buffer.int(100, 1)
|
22
22
|
buf[0] = 1.3
|
23
23
|
buf[0].should == 1
|
24
|
+
|
25
|
+
buf = RubyAudio::Buffer.short(100, 1)
|
26
|
+
buf[20] = 614
|
27
|
+
buf[20].should == 614
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should allow [] access on floating point single channel buffers" do
|
31
|
+
buf = RubyAudio::Buffer.double(100, 1)
|
32
|
+
buf[30] = 1.375
|
33
|
+
buf[30].should == 1.375
|
34
|
+
|
35
|
+
buf = RubyAudio::Buffer.float(100, 1)
|
36
|
+
buf[12] = 5
|
37
|
+
buf[12].should == 5.0
|
24
38
|
end
|
25
39
|
|
26
40
|
it "should allow [] access on multi-channel buffers" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 1.6.
|
8
|
+
- 1
|
9
|
+
version: 1.6.1
|
10
10
|
platform: x86-mingw32
|
11
11
|
authors:
|
12
12
|
- Stephen Augenstein
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2012-02-28 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|