Permalink
Browse files

initial stub thing that links properly with libsox using node-gyp

  • Loading branch information...
0 parents commit 3fc3553c0643eef2475dd9812d71935699790439 @substack committed May 29, 2012
Showing with 70 additions and 0 deletions.
  1. +1 −0 .npmignore
  2. +9 −0 binding.gyp
  3. +36 −0 package.json
  4. +21 −0 sox.cc
  5. +3 −0 test.js
@@ -0,0 +1 @@
+*.node
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "sox",
+ "sources": [ "sox.cc" ],
+ "libraries" : [ "-lsox" ]
+ }
+ ]
+}
@@ -0,0 +1,36 @@
+{
+ "name" : "sox",
+ "version" : "0.0.0",
+ "description" : "play, record and synthesize audio with bindings for libsox",
+ "main" : "index.js",
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/substack/node-sox.git"
+ },
+ "keywords": [
+ "sox",
+ "audio",
+ "play",
+ "record",
+ "music",
+ "synth",
+ "wav",
+ "mp3",
+ "ogg"
+ ],
+ "author" : {
+ "name" : "James Halliday",
+ "email" : "mail@substack.net",
+ "url" : "http://substack.net"
+ },
+ "dependencies" : {
+ "node-gyp" : "*"
+ },
+ "license" : "MIT/X11",
+ "engine" : {
+ "node" : ">=0.6.0"
+ },
+ "scripts" : {
+ "install" : "node-gyp configure build"
+ }
+}
21 sox.cc
@@ -0,0 +1,21 @@
+#include <node.h>
+#include <v8.h>
+using namespace v8;
+
+#include <sox.h>
+
+Handle<Value> hello(const Arguments& args) {
+ HandleScope scope;
+
+ sox_format_t *sfh = sox_open_read("test.wav", NULL, NULL, NULL);
+ //sox_write(sfh, set_default_device);
+
+ return scope.Close(String::New("world"));
+}
+
+void init(Handle<Object> target) {
+ sox_format_init();
+ NODE_SET_METHOD(target, "hello", hello);
+}
+
+NODE_MODULE(sox, init);
@@ -0,0 +1,3 @@
+var sox = require('./build/Release/sox');
+console.dir(sox);
+sox.hello();

0 comments on commit 3fc3553

Please sign in to comment.