@@ -31,6 +31,7 @@ var express = require('express'),
3131
3232app . use ( '/static' , express . static ( __dirname + '/node_modules' ) ) ;
3333app . use ( '/torsk.css' , express . static ( __dirname + '/torsk.css' ) ) ;
34+ app . use ( '/torsk.js' , express . static ( __dirname + '/torsk.js' ) ) ;
3435
3536app . get ( '/' , function ( req , res ) {
3637 res . sendFile ( __dirname + '/index.html' ) ;
@@ -41,7 +42,11 @@ app.get('/chords', function (req, res) {
4142} ) ;
4243
4344app . get ( '/drums' , function ( req , res ) {
44- res . sendFile ( __dirname + '/drums.html' ) ;
45+ res . sendFile ( __dirname + '/drums.html' ) ;
46+ } ) ;
47+
48+ app . get ( '/sequence' , function ( req , res ) {
49+ res . sendFile ( __dirname + '/sequence.html' ) ;
4550} ) ;
4651
4752io . on ( 'connection' , function ( socket ) {
@@ -60,12 +65,17 @@ io.on('connection', function (socket){
6065 shell . exec ( command , { async : true } ) ;
6166 } ) ;
6267
63- socket . on ( 'beat' , function ( msg ) {
64- var drum = drums [ msg ] ,
65- command = 'play -q ' + drum ;
68+ socket . on ( 'beat' , function ( msg ) {
69+ var drum = drums [ msg ] ,
70+ command = 'play -q ' + drum ;
6671
67- shell . exec ( command , { async : true , silent : true } ) ;
68- } ) ;
72+ shell . exec ( command , { async : true , silent : true } ) ;
73+ } ) ;
74+
75+ socket . on ( 'playSequence' , function ( msg ) {
76+ console . log ( msg ) ;
77+ // todo play sequences.
78+ } ) ;
6979
7080 socket . on ( 'disconnect' , function ( ) {
7181 console . log ( 'a user disconnected' ) ;
0 commit comments