first osc msg tests
This commit is contained in:
parent
3d4268fce0
commit
e65f266aca
@ -1,6 +1,7 @@
|
|||||||
const { app, BrowserWindow, webFrame, Menu } = require('electron')
|
const { app, BrowserWindow, webFrame, Menu } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
|
const osc = require('osc')
|
||||||
const shell = require('electron').shell
|
const shell = require('electron').shell
|
||||||
|
|
||||||
let isShown = true
|
let isShown = true
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
|
"install": "electron-rebuild",
|
||||||
"clean": "rm -r ~/Desktop/Ronin-darwin-x64/ ; rm -r ~/Desktop/Ronin-linux-x64/ ; rm -r ~/Desktop/Ronin-win32-x64/ ; echo 'cleaned build location'",
|
"clean": "rm -r ~/Desktop/Ronin-darwin-x64/ ; rm -r ~/Desktop/Ronin-linux-x64/ ; rm -r ~/Desktop/Ronin-win32-x64/ ; echo 'cleaned build location'",
|
||||||
"build_osx": "electron-packager . Ronin --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.icns ; echo 'Built for OSX'",
|
"build_osx": "electron-packager . Ronin --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.icns ; echo 'Built for OSX'",
|
||||||
"build_linux": "electron-packager . Ronin --platform=linux --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'",
|
"build_linux": "electron-packager . Ronin --platform=linux --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'",
|
||||||
@ -16,8 +17,12 @@
|
|||||||
"push_status": "~/butler status hundredrabbits/ronin",
|
"push_status": "~/butler status hundredrabbits/ronin",
|
||||||
"push": "npm run build ; npm run push_theme ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run push_status"
|
"push": "npm run build ; npm run push_theme ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run push_status"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"osc": "^2.3.1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^5.0.6",
|
"electron": "^5.0.6",
|
||||||
"electron-packager": "^13.1.1"
|
"electron-packager": "^13.1.1",
|
||||||
|
"electron-rebuild": "^1.8.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,4 +374,11 @@ function Library (ronin) {
|
|||||||
console.log(`time taken: ${Date.now() - start}ms`)
|
console.log(`time taken: ${Date.now() - start}ms`)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// osc
|
||||||
|
|
||||||
|
this.osc = () => { // Returns a rect of the frame.
|
||||||
|
return ronin.getOsc()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const osc = require('osc')
|
||||||
|
|
||||||
function Ronin () {
|
function Ronin () {
|
||||||
const defaultTheme = {
|
const defaultTheme = {
|
||||||
background: '#111',
|
background: '#111',
|
||||||
@ -20,6 +22,7 @@ function Ronin () {
|
|||||||
this.surface = new Surface(this)
|
this.surface = new Surface(this)
|
||||||
this.library = new Library(this)
|
this.library = new Library(this)
|
||||||
|
|
||||||
|
this.oscMsg = {}
|
||||||
// Parameters
|
// Parameters
|
||||||
|
|
||||||
this.always = false
|
this.always = false
|
||||||
@ -43,9 +46,31 @@ function Ronin () {
|
|||||||
this.source.start()
|
this.source.start()
|
||||||
this.commander.start()
|
this.commander.start()
|
||||||
this.surface.start()
|
this.surface.start()
|
||||||
|
|
||||||
|
var udpPort = new osc.UDPPort({
|
||||||
|
localAddress: "0.0.0.0",
|
||||||
|
localPort: 57121,
|
||||||
|
metadata: true
|
||||||
|
});
|
||||||
|
|
||||||
|
udpPort.on("message", this.onOscMsg)
|
||||||
|
|
||||||
|
udpPort.open();
|
||||||
|
this.log("started")
|
||||||
|
|
||||||
console.log('Ronin', 'Started')
|
console.log('Ronin', 'Started')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onOscMsg = (oscMsg, timeTag, info) => {
|
||||||
|
this.oscMsg = oscMsg;
|
||||||
|
console.log("An OSC message just arrived!", oscMsg)
|
||||||
|
this.log("Remote info is: ", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getOsc = function() {
|
||||||
|
return this.oscMsg;
|
||||||
|
}
|
||||||
|
|
||||||
this.reset = function () {
|
this.reset = function () {
|
||||||
this.theme.reset()
|
this.theme.reset()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user