.doc/ext/beeps/file_in.cpp in beeps-0.1.32 vs .doc/ext/beeps/file_in.cpp in beeps-0.1.33
- old
+ new
@@ -1,43 +1,89 @@
-#include "beeps/ruby/processor.h"
+#include "beeps/ruby/generator.h"
+#include "beeps/ruby/processor.h"
#include "defs.h"
-RUCY_DEFINE_VALUE_FROM_TO(Beeps::FileIn)
+RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::FileIn)
#define THIS to<Beeps::FileIn*>(self)
-#define CHECK RUCY_CHECK_OBJECT(Beeps::FileIn, self)
+#define CHECK RUCY_CHECK_OBJ(Beeps::FileIn, self)
static
VALUE alloc(VALUE klass)
{
- return new_type<Beeps::FileIn>(klass);
+ return value(new Beeps::RubyProcessor<Beeps::FileIn>, klass);
}
static
-VALUE initialize(VALUE self, VALUE path)
+VALUE set_path(VALUE self, VALUE path)
{
- RUCY_CHECK_OBJ(Beeps::FileIn, self);
+ CHECK;
- *THIS = Beeps::FileIn(to<const char*>(path));
- return self;
+ 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_private_method(cFileIn, "initialize", RUBY_METHOD_FUNC(initialize), 1);
+ 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
{