Class: RSoxFormat

Inherits:
Object
  • Object
show all
Defined in:
ext/rsox.c

Instance Method Summary collapse

Instance Method Details

#encodingObject

{{{



204
205
206
207
208
209
210
# File 'ext/rsox.c', line 204

VALUE rsoxformat_encoding(VALUE self) {/*{{{*/
  sox_format_t *c_format;

  Data_Get_Struct(self, sox_format_t, c_format);

  return Data_Wrap_Struct(RSoxEncoding, 0, 0, &c_format->encoding);
}/

#filenameObject

{{{



212
213
214
215
216
217
218
# File 'ext/rsox.c', line 212

VALUE rsoxformat_filename(VALUE self) {/*{{{*/
  sox_format_t *c_format;

  Data_Get_Struct(self, sox_format_t, c_format);

  return rb_str_new2(c_format->filename);
}/

#read(buffer) ⇒ Object

{{{



220
221
222
223
224
225
226
227
228
# File 'ext/rsox.c', line 220

VALUE rsoxformat_read(VALUE self, VALUE buffer) {/*{{{*/
  sox_format_t *c_format;
  sox_sample_t *c_buffer;

  Data_Get_Struct(self,   sox_format_t, c_format);
  Data_Get_Struct(rb_iv_get(buffer, "@buffer"), sox_sample_t, c_buffer);

  return INT2NUM(sox_read(c_format, c_buffer, NUM2INT(rb_iv_get(buffer, "@length"))));
}/

#seek(offset, whence) ⇒ Object

{{{



241
242
243
244
245
246
247
# File 'ext/rsox.c', line 241

VALUE rsoxformat_seek(VALUE self, VALUE offset, VALUE whence){/*{{{*/
  sox_format_t *c_format;

  Data_Get_Struct(self, sox_format_t, c_format);

  return INT2NUM(sox_seek(c_format, NUM2LONG(offset), NUM2INT(whence)));
}/

#signalObject

{{{



117
118
119
120
121
122
123
124
# File 'ext/rsox.c', line 117

VALUE rsoxformat_signal(VALUE self) {/*{{{*/
  sox_format_t     *c_format;
  sox_signalinfo_t *c_info;

  Data_Get_Struct(self, sox_format_t, c_format);

  return Data_Wrap_Struct(RSoxSignal, 0, 0, &c_format->signal);
}/

#write(buffer, length) ⇒ Object

{{{



230
231
232
233
234
235
236
237
238
239
# File 'ext/rsox.c', line 230

VALUE rsoxformat_write(VALUE self, VALUE buffer, VALUE length) {/*{{{*/
  sox_format_t *c_format;
  sox_sample_t *c_buffer;
  int write_len = NUM2INT(length == Qnil ? rb_iv_get(buffer, "@length") : length);

  Data_Get_Struct(self,   sox_format_t, c_format);
  Data_Get_Struct(rb_iv_get(buffer, "@buffer"), sox_sample_t, c_buffer);

  return INT2NUM(sox_write(c_format, c_buffer, write_len));
}/