Permalink
Browse files

format.openRead function

  • Loading branch information...
1 parent 6ead6df commit 8341a6841e002d5676cd5cb8ecc9fad9e3b97362 @substack committed Jul 6, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/format.cc
View
@@ -23,7 +23,7 @@ class Format : public ObjectWrap {
constructor_template->GetFunction()
);
- NODE_SET_METHOD(target, "read", Read);
+ NODE_SET_METHOD(target, "openRead", OpenRead);
}
static Handle<Value> New(const Arguments &args) {
@@ -33,10 +33,15 @@ class Format : public ObjectWrap {
return args.This();
}
- static Handle<Value> Read(const Arguments &args) {
+ static Handle<Value> OpenRead(const Arguments &args) {
HandleScope scope;
- Handle<Value> format = constructor_template->GetFunction()->New();
- return format;
+ Handle<Object> h = constructor_template->GetFunction()->New();
+ Format *obj = ObjectWrap::Unwrap<Format>(h);
+
+ String::Utf8Value path(args[0]);
+ obj->format = sox_open_read(*path, NULL, NULL, NULL);
+
+ return h;
}
};

0 comments on commit 8341a68

Please sign in to comment.