Skip to content

Commit

Permalink
changes to canvas object for audio bands
Browse files Browse the repository at this point in the history
Discovered some kind of error with accessing the canvas 2D context, this corrects it, makes it global, probably better anyway.
  • Loading branch information
Shawn Lawson committed Feb 25, 2017
1 parent 034bcc3 commit f1e6b05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
20 changes: 12 additions & 8 deletions js/pageGlobals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


var mCanvas = null;
var mCanvas = null, aCanvas = null;
var gl = null;
var mAudioContext = null;

Expand Down Expand Up @@ -445,11 +445,15 @@ $( document ).ready(function()
}

// var k, f;
function updateFourBands()
var canv = document.getElementById('fourBands');
aCanvas = canv.getContext('2d');
aCanvas.width = 100;
aCanvas.height = 32;

function updateFourBands()
{
//todo: speed this up
var ctx = $('#fourBands')[0].getContext('2d');
ctx.clearRect ( 0 , 0 , 100, 32 );
aCanvas.clearRect ( 0 , 0 , 100, 32 );

if (!bandsOn) return;
if (!mSound) return;
Expand All @@ -465,7 +469,7 @@ $( document ).ready(function()

f *= .2; // 1/(a-0)
f *= .003921569; // 1/255
drawBandsRect(0, ctx, f);
drawBandsRect(0, aCanvas, f);
mSound.low = f;

f = 0.0;
Expand All @@ -474,7 +478,7 @@ $( document ).ready(function()

f *= .166666667; // 1/(b-a)
f *= .003921569; // 1/255
drawBandsRect(1, ctx, f);
drawBandsRect(1, aCanvas, f);
mSound.mid = f;

f = 0.0;
Expand All @@ -483,7 +487,7 @@ $( document ).ready(function()

f *= .076923077; // 1/(c-b)
f *= .003921569; // 1/255
drawBandsRect(2, ctx, f);
drawBandsRect(2, aCanvas, f);
mSound.upper = f;

f = 0.0;
Expand All @@ -492,7 +496,7 @@ $( document ).ready(function()

f *= .00204918; // 1/(d-c)
f *= .003921569; // 1/255
drawBandsRect(3, ctx, f);
drawBandsRect(3, aCanvas, f);
mSound.high = f;
}

Expand Down
6 changes: 2 additions & 4 deletions pythonBridge/SLIPtoWebSocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ def onClose(self, wasClean, code, reason):
if __name__ == '__main__':

# port = '/dev/cu.usbmodema0111'
<<<<<<< HEAD
port = '/dev/cu.usbmodem1411'
=======
port = '/dev/cu.usbmodem14141'
>>>>>>> MIDI
# port = '/dev/cu.usbmodem14141'

baudrate = 115200
SERVER_IP = '127.0.0.1'
SERVER_WS_PORT = 8000
Expand Down
Binary file modified pythonBridge/slip.pyc
Binary file not shown.
6 changes: 4 additions & 2 deletions pythonBridge/websocketUDPBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
SERVER_HTTP_RESOURCES = 'web'

# To someone/thing else
CLIENT_IP = '10.0.0.1'
CLIENT_UDP_PORT = 7500
CLIENT_IP = '192.168.7.2'
CLIENT_UDP_PORT = 7562
# CLIENT_IP = '10.0.0.1'
# CLIENT_UDP_PORT = 7500
# CLIENT_IP = '127.0.0.1'
# CLIENT_UDP_PORT = 8888

Expand Down

0 comments on commit f1e6b05

Please sign in to comment.