Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

format.openRead function

  • Loading branch information...
commit 8341a6841e002d5676cd5cb8ecc9fad9e3b97362 1 parent 6ead6df
@substack authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/format.cc
View
13 src/format.cc
@@ -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;
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.