aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/core/io/osc.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/core/io/osc.js')
-rw-r--r--desktop/core/io/osc.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/desktop/core/io/osc.js b/desktop/core/io/osc.js
index 5afe920..a7561cc 100644
--- a/desktop/core/io/osc.js
+++ b/desktop/core/io/osc.js
@@ -8,7 +8,7 @@ export default function Osc (terminal) {
this.options = { default: 49162, tidalCycles: 6010, sonicPi: 4559, superCollider: 57120 }
this.start = function () {
- console.info('OSC Starting..')
+ console.info('OSC', 'Starting..')
this.setup()
this.select()
}
@@ -40,7 +40,8 @@ export default function Osc (terminal) {
}
this.select = function (port = this.options.default) {
- if (isNaN(port) || port < 1000) { console.warn('Unavailable port'); return }
+ if (parseInt(port) === this.port) { console.warn('OSC', 'Already selected'); return }
+ if (isNaN(port) || port < 1000) { console.warn('OSC', 'Unavailable port'); return }
console.info('OSC', `Selected port: ${port}`)
this.port = parseInt(port)
this.setup()
@@ -55,8 +56,10 @@ export default function Osc (terminal) {
terminal.controller.commit()
}
- this.setup = function (ip = '127.0.0.1') {
+ this.setup = function () {
+ if (!this.port) { return }
if (this.client) { this.client.close() }
- this.client = new osc.Client(ip, this.port)
+ this.client = new osc.Client(terminal.io.ip, this.port)
+ console.info('OSC', 'Started client at ' + terminal.io.ip + ':' + this.port)
}
}