#include "beeps/ruby/generator.h" #include "beeps/ruby/processor.h" #include "defs.h" RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::FileIn) #define THIS to(self) #define CHECK RUCY_CHECK_OBJ(Beeps::FileIn, self) static VALUE alloc(VALUE klass) { return value(new Beeps::RubyProcessor, klass); } static VALUE set_path(VALUE self, VALUE path) { CHECK; THIS->set_path(path.c_str()); return path; } static VALUE get_path(VALUE self) { CHECK; return value(THIS->path()); } static VALUE get_sample_rate(VALUE self) { CHECK; return value(THIS->sample_rate()); } static VALUE get_nchannels(VALUE self) { CHECK; return value(THIS->nchannels()); } static VALUE get_nsamples(VALUE self) { CHECK; return value(THIS->nsamples()); } static VALUE get_seconds(VALUE self) { CHECK; return value(THIS->seconds()); } static Class cFileIn; void Init_beeps_file_in () { Module mBeeps = rb_define_module("Beeps"); cFileIn = mBeeps.define_class("FileIn", Beeps::processor_class()); rb_define_alloc_func(cFileIn, alloc); rb_define_method(cFileIn, "path=", RUBY_METHOD_FUNC(set_path), 1); rb_define_method(cFileIn, "path", RUBY_METHOD_FUNC(get_path), 0); rb_define_method(cFileIn, "sample_rate", RUBY_METHOD_FUNC(get_sample_rate), 0); rb_define_method(cFileIn, "nchannels", RUBY_METHOD_FUNC(get_nchannels), 0); rb_define_method(cFileIn, "nsamples", RUBY_METHOD_FUNC(get_nsamples), 0); rb_define_method(cFileIn, "seconds", RUBY_METHOD_FUNC(get_seconds), 0); } namespace Beeps { Class file_in_class () { return cFileIn; } }// Beeps