Class: RSoxBuffer
- Inherits:
-
Object
- Object
- RSoxBuffer
- Defined in:
- ext/rsox.c
Instance Method Summary collapse
-
#[](index) ⇒ Object
{{{.
-
#at(index) ⇒ Object
{{{.
-
#buffer ⇒ Object
{{{.
-
#initialize(*args) ⇒ Object
constructor
{{{.
-
#length ⇒ Object
{{{.
-
#size ⇒ Object
{{{.
Constructor Details
#initialize(*args) ⇒ Object
{{{
330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'ext/rsox.c', line 330
VALUE rsoxbuffer_initialize(int argc, VALUE *argv, VALUE self) {/*{{{*/
sox_sample_t *buffer;
VALUE length;
int llen;
rb_scan_args(argc, argv, "01", &length);
llen = NIL_P(length) ? 2048 : NUM2INT(length);
buffer = ALLOC_N(sox_sample_t, llen);
rb_iv_set(self, "@buffer", Data_Wrap_Struct(RSoxBuffer, 0, free, buffer));
rb_iv_set(self, "@length", INT2NUM(llen));
return self;
}/
|
Instance Method Details
#[](index) ⇒ Object
{{{
345 346 347 348 349 350 351 352 353 354 |
# File 'ext/rsox.c', line 345
VALUE rsoxbuffer_at(VALUE self, VALUE index) {/*{{{*/
sox_sample_t *c_buffer;
if (index < rb_iv_get(self, "@length")) {
Data_Get_Struct(self, sox_sample_t, c_buffer);
return INT2NUM(c_buffer[NUM2INT(index)]);
}
return Qnil;
}/
|
#at(index) ⇒ Object
{{{
345 346 347 348 349 350 351 352 353 354 |
# File 'ext/rsox.c', line 345
VALUE rsoxbuffer_at(VALUE self, VALUE index) {/*{{{*/
sox_sample_t *c_buffer;
if (index < rb_iv_get(self, "@length")) {
Data_Get_Struct(self, sox_sample_t, c_buffer);
return INT2NUM(c_buffer[NUM2INT(index)]);
}
return Qnil;
}/
|
#buffer ⇒ Object
{{{
360 361 362 |
# File 'ext/rsox.c', line 360
VALUE rsoxbuffer_buffer(VALUE self) {/*{{{*/
return rb_iv_get(self, "@buffer");
}/
|
#length ⇒ Object
{{{
356 357 358 |
# File 'ext/rsox.c', line 356
VALUE rsoxbuffer_length(VALUE self) {/*{{{*/
return rb_iv_get(self, "@length");
}/
|
#size ⇒ Object
{{{
356 357 358 |
# File 'ext/rsox.c', line 356
VALUE rsoxbuffer_length(VALUE self) {/*{{{*/
return rb_iv_get(self, "@length");
}/
|