Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
24fe6c9
Started working on a startup gui class
RobinMontferme Nov 23, 2021
9cbb735
renamed file to a more appropriated name
RobinMontferme Nov 24, 2021
b256fef
basic server options control added
RobinMontferme Nov 26, 2021
469fadb
made server options display nice
RobinMontferme Nov 29, 2021
b7e4141
added button to hide advanced server parameters
RobinMontferme Nov 29, 2021
374a5be
interface for adding setup one by one is working graphically
RobinMontferme Dec 3, 2021
c688e45
made the list update correctly using the View::name field
RobinMontferme Dec 7, 2021
ce1dd0b
added basic load and save function that saves to csv format
RobinMontferme Dec 10, 2021
4ffea56
added new converting function in moscautils
RobinMontferme Dec 13, 2021
66489b9
added some config check functions
RobinMontferme Dec 20, 2021
ca6aa30
made loading and saving speaker setup possible
Jan 12, 2022
5c39dc7
Barebone Mosca now launches through the startup screen
Jan 13, 2022
2675075
added port selector list and port rescan button
Jan 18, 2022
92939a5
added ip addr and port options inputs
Jan 27, 2022
5881684
added ip support and doc
RobinMontferme Mar 22, 2022
4db434d
changed confusing attribute name in Mosca and MoscaBase. Made it poss…
RobinMontferme Mar 24, 2022
9003ae9
Emergency Backup
RobinMontferme Mar 30, 2022
d4da084
emergency update cont
RobinMontferme Apr 6, 2022
47c3eff
worked on save/load of config files
RobinMontferme Apr 7, 2022
c7782d3
release candidate
RobinMontferme May 11, 2022
b3f46a2
added a method to reconnect two device through jack
RobinMontferme May 18, 2022
e958591
refactored some code, fixed a bug in mosca source, wip for adding …
RobinMontferme May 23, 2022
420cdbb
extracted MoscaConfig from MoscaStartup'
RobinMontferme May 23, 2022
793a73d
added new converting function in moscautils
RobinMontferme Dec 13, 2021
d5911c9
added some config check functions
RobinMontferme Dec 20, 2021
1703d1e
fixed issue with sub loading at startup
RobinMontferme May 24, 2022
81cd15c
Fixed gui not closing properly using startup gui buttons
RobinMontferme May 25, 2022
00c7442
fix last rebase error
thibaudk Jul 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Classes/Mosca.sc
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ Mosca : MoscaBase
ossiaPlay.set_(false);
});

if (gui.isNil)
{ // when there is no gui, Automation callback does not work,
if (mainWindow.isNil)
{ // when there is no mainWindow, Automation callback does not work,
// so here we monitor when the transport reaches end

if (control.get.now > dur)
Expand Down
18 changes: 10 additions & 8 deletions Classes/MoscaBase.sc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MoscaBase // acts as the public interface
{
var dur, <server, <ossiaParent, gui, <tracker; // initial rguments
var dur, <server, <ossiaParent, <mainWindow, <tracker; // initial rguments
var renderer, <spat, <effects, center, <sources, srcGrp;
var convertor, virtualAmbi, needConvert = 0, needVirtualAmbi = 0;
var ossiaMasterPlay, ossiaMasterLib, ossiaTrack, dependant;
Expand Down Expand Up @@ -44,7 +44,7 @@ MoscaBase // acts as the public interface

sources.set(sources.get.add(newSource));

if (gui.notNil) { { gui.addSource(sources.get.last) }.defer };
if (mainWindow.notNil) { { mainWindow.addSource(sources.get.last) }.defer };
})
}

Expand All @@ -60,7 +60,7 @@ MoscaBase // acts as the public interface

src.free;

if (gui.notNil) { { gui.removeSource(i) }.defer };
if (mainWindow.notNil) { { mainWindow.removeSource(i) }.defer };
})
}
}
Expand Down Expand Up @@ -416,13 +416,15 @@ MoscaBase // acts as the public interface
gui
{ | size = 800, palette = \ossia, lag = 0.05 |

if (gui.isNil)


if (mainWindow == nil)
{
gui = MoscaGUI(this, size, palette, lag);
mainWindow = MoscaGUI(this, size, palette, lag);

gui.win.onClose_({
gui.free;
gui = nil;
mainWindow.win.onClose_({
mainWindow.free;
mainWindow = nil;
});
}
}
Expand Down
208 changes: 208 additions & 0 deletions Classes/MoscaConfig.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
MoscaConfig{
//IP config
var <>servIP = "127.0.0.1";
var <>servPortRemote = 9997;
var <>servPortLocal = 9996;
//server memory parameters
var <>memSize = 16384;
var <>memBlockSize = 64;
//serv audio parameters
var <>audioChannels = 1068;
var <>audioWireBuffer = 64;
var <>audioInputs = 2;
var <>audioOutputs = 2;
//audio spatialisation parameters
var <>spatOrder = 1;
var <>spatSpeakers = nil;
var <>spatSub = nil;
var <>spatOut = 0;
var <>spatRirBank = nil;
//mosca specific
var <>moscaSources = 4;
var <>moscaDuration = 10;
var <>path = "~/.config/Mosca/";
var <>file = "config.cfg";
var <>defaultSpeakerCfgFile = "default_setup.csv";

*new{
^super.new.ctr();
}

ctr{
spatSpeakers = List[];
spatSub = List[];
}
autoConfig{
if(File.exists((path++file).standardizePath) == false){
if(File.exists(path.standardizePath)==false)
{
"No configuration directory found - creating a directory".postln;
File.mkdir(path.standardizePath);
};
"No configuration file found - creating a file".postln;
this.saveConfig();
}
{//else
"Found Configuration File. Loading".postln;
this.loadConfig();
};
}
*prReadProp{
arg reader,prop;
var res = nil;
("Reading Prop"+prop).postln;
res = reader.getLine();
if(res.contains(prop)){
res = res.split($=);
if(res.size >= 2)
{
res = res[1].stripWhiteSpace();
}
};
res.postln;
^res;
}
*prReadInteger{
arg reader,prop;
var res = MoscaConfig.prReadProp(reader,prop);
if(res==nil){
res = 0;
}
{//else
res = res.asInteger;
};
^res;
}

loadConfig{
var reader,fileSize;
var tmp;
// var l,data,currentSection; //TODO implement smarter file parsing.
// data = Dictionary();
reader = File((path++file).standardizePath,"r");
if(reader.getLine().contains("[Address]")){
servIP = MoscaConfig.prReadProp(reader,"ip");
servPortRemote = MoscaConfig.prReadInteger(reader,"remotePort");
servPortLocal = MoscaConfig.prReadInteger(reader,"localPort");
};
if(reader.getLine().contains("[Memory]")){
memSize = MoscaConfig.prReadInteger(reader,"size");
memBlockSize = MoscaConfig.prReadInteger(reader,"blockSize");
};
if(reader.getLine().contains("[Audio]"))
{
audioChannels = MoscaConfig.prReadInteger(reader,"channels");
audioWireBuffer = MoscaConfig.prReadInteger(reader,"wirebuffers");
audioInputs = MoscaConfig.prReadInteger(reader,"inputs");
audioOutputs = MoscaConfig.prReadInteger(reader,"outputs");
};
if(reader.getLine().contains("[Spatialisation]")){
spatOrder = MoscaConfig.prReadInteger(reader,"order");
defaultSpeakerCfgFile = MoscaConfig.prReadProp(reader,"speakerConfig");
this.loadSpeakerSetup(defaultSpeakerCfgFile);
spatSub = MoscaConfig.prReadProp(reader,"sub").split($\ ).collect({arg item,i;if(item.size!=0){item.asInteger};});
spatSub = spatSub.select({arg item,i; item.notNil}).asList;
spatOut = MoscaConfig.prReadInteger(reader,"out");
spatRirBank = MoscaConfig.prReadProp(reader,"rirBank");
};

if(reader.getLine().contains("[Mosca]")){
moscaSources = MoscaConfig.prReadInteger(reader,"sources");
moscaDuration = MoscaConfig.prReadInteger(reader,"duration");
};
reader.close();
}

saveConfig{
var writer;
// var listWriter = {arg a;var r = String.new.ccatList(a);r.removeAt(0);r;};
writer = File(((path++file).standardizePath),"w");
if(writer.isOpen)
{
("Saving Config to"+(path++file).standardizePath).postln;
writer.write("[Address]\n");
writer.write("ip ="+servIP++"\n");
writer.write("remotePort ="+servPortRemote++"\n");
writer.write("localPort ="+servPortLocal++"\n");
writer.write("[Memory]\n");
writer.write("size ="+memSize++"\n");
writer.write("blockSize ="+memBlockSize++"\n");
writer.write("[Audio]\n");
writer.write("channels ="+audioChannels+"\n");
writer.write("wireBuffers ="+audioWireBuffer++"\n");
writer.write("inputs ="+audioInputs++"\n");
writer.write("outputs ="+audioOutputs++"\n");
writer.write("[Spatialisation]\n");
writer.write("order ="+spatOrder++"\n");
writer.write("speakerConfig ="+(path++defaultSpeakerCfgFile).standardizePath++"\n");
if(spatSpeakers.size > 0){
this.saveSpeakerSetup();
};
writer.write("sub ="+String.new.scatList(spatSub).stripWhiteSpace()++"\n");
writer.write("out ="+spatOut++"\n");
writer.write("rirBank = "+spatRirBank++"\n");
writer.write("[Mosca]\n");
writer.write("sources ="+moscaSources++"\n");
writer.write("duration ="+moscaDuration++"\n");
writer.close();
}
{
("Error: Can't create configuration file at "+((path++file).standardizePath)).postln;
};
}
saveSpeakerSetup{
arg path = path++defaultSpeakerCfgFile;
var file,data;
var idx = 0;
var parsingError = false;
"Saving Speaker Configuration File".postln;
if(spatSpeakers.size != 0){
file = CSVFileWriter(path);
spatSpeakers.do{
arg row;
file.writeLine(row);
};
file.close();
"Speaker Configuration File saved".postln;
}
{
parsingError = true;
"Speaker Setup is empty! Cancelling save".postln;
}
^parsingError;
}
loadSpeakerSetup{
arg path = path++defaultSpeakerCfgFile;
var file,data;
var idx = 0;
var parsingError = false;
var newData = List[];
file = CSVFileReader.read(path);
data = file.collect(_.collect(_.interpret));
while{((idx < data.size) && (parsingError.not)) && (true)}
{
if(data[idx].size != 3)
{
parsingError = true;
}
{//else
newData.add(data[idx]);
idx = idx + 1;
};
};

if(parsingError){
"Error During Parsing".postln;
}{
"Loading Speaker Configuration File".postln;
//if load is okay then replace current setup values and update view as well
("new data List").postln;
newData.postcs;
spatSpeakers = newData;
};
^parsingError.not;
}



}
2 changes: 1 addition & 1 deletion Classes/MoscaSource.sc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ MoscaSource[]
this.runTrigger();
};

if (external.value) { args = args ++ [\busini, busInd.value] };
if (external.value) { args = args ++ [\busini, busInd.value] -1};

curentSpat = spatType;

Expand Down
Loading