From 3415ffa52d0e3a9f42b9fe7ee807ebd860926b27 Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 6 Jul 2016 19:31:10 +0200 Subject: classes/Bowelyzer.sc: Adding OSCdefs for saving and loading of configuration file. --- classes/Bowelyzer.sc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index cafaf00..4c4f079 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -170,25 +170,39 @@ Bowelyzer{ srcID: hub.local ); - // listen for port messages to change OSC ports + // listen for message to save configuration to current file OSCdef.newMatching( key: \save, func: {|msg, time, addr, recvPort| var path = msg[1]; postln("Received: "++msg); - //TODO: implement save (write to file) in BowelyzerConfig + config.writeConfigurationFile; }, path: "/save", srcID: hub.local ); - // listen for port messages to change OSC ports + // listen for message to save configuration to current file + OSCdef.newMatching( + key: \saveas, + func: {|msg, time, addr, recvPort| + var name = msg[0], + fileName = msg[1]; + postln("Received: "++msg); + config.writeConfigurationFile(fileName); + }, + path: "/saveas", + srcID: hub.local + ); + + // listen for messages to load configuration from file OSCdef.newMatching( key: \load, func: {|msg, time, addr, recvPort| - var path = msg[1]; + var name = msg[0], + fileName = msg[1]; postln("Received: "++msg); - //TODO: use BowelyzerConfig readFromConfigurationFile + config.writeConfigurationFile(fileName); //TODO: destroy current GUI elements //TODO: load channels, etc. }, -- cgit v1.2.3-70-g09d2