diff --git a/lua2SC/lua/ide/bootsc.lua b/lua2SC/lua/ide/bootsc.lua index 2cbd353..ea76e42 100644 --- a/lua2SC/lua/ide/bootsc.lua +++ b/lua2SC/lua/ide/bootsc.lua @@ -1,7 +1,6 @@ local ID_DUMPTREE = NewID() local ID_DUMPOSC = NewID() local ID_BOOTSC = NewID() - local ID_BOOTSC_tcp = NewID() local ID_BOOTSC_internal = NewID() local ID_QUITSC = NewID() local ID_AUTODETECTSC = NewID() @@ -13,7 +12,6 @@ function InitSCMenu() { ID_DUMPTREE, "Dump SC Tree", "Dumps SC Tree in SC console" }, { ID_DUMPOSC, "Dump OSC", "Dumps OSC" , wx.wxITEM_CHECK }, { ID_BOOTSC, "Boot SC", "Boots SC" }, - { ID_BOOTSC_tcp, "Boot SC TCP", "Boots SC TCP" }, { ID_BOOTSC_internal, "Boot SC internal", "Boots SC internal" }, { ID_QUITSC, "Quit SC", "Quits SC" }, { ID_AUTODETECTSC, "Autodetect SC", "Autodetect SC", wx.wxITEM_CHECK }, @@ -33,7 +31,9 @@ function InitSCMenu() function(event) if event:IsChecked() then if not IDESCSERVER.inited then - IDESCSERVER:init("tcp",file_settings:load_table("settings"),mainlinda) + local options = file_settings:load_table("settings") + local typeserver = (options.SC_USE_TCP==1) and "tcp" or "udp" + IDESCSERVER:init(typeserver,options,mainlinda) end --udpsclinda:send("Detect",1) --IDESCSERVER:sync() @@ -46,7 +46,6 @@ function InitSCMenu() end end) frame:Connect(ID_BOOTSC, wx.wxEVT_COMMAND_MENU_SELECTED,function() return BootSC(false) end) - frame:Connect(ID_BOOTSC_tcp, wx.wxEVT_COMMAND_MENU_SELECTED,function() return BootSC(true) end) frame:Connect(ID_BOOTSC_internal, wx.wxEVT_COMMAND_MENU_SELECTED,function() menuBar:Check(ID_AUTODETECTSC, false) local this_file_settings = file_settings:load_table("settings") @@ -97,10 +96,6 @@ function InitSCMenu() function (event) event:Enable(IDESCSERVER.inited==nil) end) - frame:Connect(ID_BOOTSC_tcp, wx.wxEVT_UPDATE_UI, - function (event) - event:Enable(IDESCSERVER.inited==nil) - end) frame:Connect(ID_BOOTSC_internal, wx.wxEVT_UPDATE_UI, function (event) event:Enable(jit and IDESCSERVER.inited==nil) @@ -171,7 +166,7 @@ function SCProcess_Loop(cmd,bootedlinda) return true end require"lanesutils" -function BootSC(use_tcp) +function BootSC() menuBar:Check(ID_AUTODETECTSC, false) local this_file_settings = file_settings:load_table("settings") local scexe = this_file_settings.SCpath @@ -179,7 +174,7 @@ function BootSC(use_tcp) thread_error_print("Cannot boot",scexe,"does not exist.") return end - + local use_tcp = this_file_settings.SC_USE_TCP==1 local path = wx.wxFileName.SplitPath(this_file_settings.SCpath) wx.wxSetWorkingDirectory(path) wx.wxSetEnv("SC_SYSAPPSUP_PATH",path) diff --git a/lua2SC/lua/ide/settings.lua b/lua2SC/lua/ide/settings.lua index 71ad722..4c1460f 100644 --- a/lua2SC/lua/ide/settings.lua +++ b/lua2SC/lua/ide/settings.lua @@ -1,16 +1,6 @@ local is_windows = package.config:sub(1,1) == '\\' Settings={ ---[[ - options={ - midiin={}, - midiout={}, - SCpath="", - SC_SYNTHDEF_PATH="default", - SC_PLUGIN_PATH={"default"}, - SC_UDP_PORT=57110, - SC_AUDIO_DEVICE="" - }, - --]] + ID_CANCEL_BUTTON=NewID(), ID_SAVE_BUTTON=NewID(), ID_RESET_MIDI_BUTTON=NewID(), @@ -89,9 +79,13 @@ function Settings:Create(parent) grid_sizer:SetVGap(2) local row=0 - grid_sizer:Add(wx.wxStaticText(this, wx.wxID_ANY,"Sc Synth udp port:"),wx.wxGBPosition(row,0)) + grid_sizer:Add(wx.wxStaticText(this, wx.wxID_ANY,"Sc port:"),wx.wxGBPosition(row,0)) local udpTC = wx.wxTextCtrl(this, wx.wxID_ANY,tostring(self.options.SC_UDP_PORT)) grid_sizer:Add(udpTC,wx.wxGBPosition(row,1)) + + local useTCP = wx.wxCheckBox(this, wx.wxID_ANY,"use TCP") + useTCP:SetValue(self.options.SC_USE_TCP == 1) + grid_sizer:Add(useTCP,wx.wxGBPosition(row,2)) row = row + 1 grid_sizer:Add(wx.wxStaticText(this, wx.wxID_ANY,"Buffer size:"),wx.wxGBPosition(row,0)) @@ -297,6 +291,7 @@ function Settings:Create(parent) self.options.SC_BUFFER_SIZE= bsizeTC:GetValue() self.options.SC_SAMPLERATE= samprTC:GetValue() self.options.SC_SYSTEM_CLOCK = useclockC:IsChecked() and 1 or 0 + self.options.SC_USE_TCP = useTCP:IsChecked() and 1 or 0 self.options.SC_AUDIO_DEVICE=Au_Dev_TC:GetValue() self.options.SC_NOUTS = tonumber(noutCH:GetValue()) self.options.SC_NINS = tonumber(ninCH:GetValue()) diff --git a/lua2SC/lua2sc.lua b/lua2SC/lua2sc.lua index dbb893e..47efbee 100644 --- a/lua2SC/lua2sc.lua +++ b/lua2SC/lua2sc.lua @@ -93,6 +93,7 @@ settings_defaults = { SC_SYNTHDEF_PATH="SuperCollider/synthdefs/", SC_PLUGIN_PATH={"SuperCollider/sc3-plugins","SuperCollider/Myplugins"}, SC_UDP_PORT=57110, + SC_USE_TCP=1, SC_SYSTEM_CLOCK=1, SC_AUDIO_DEVICE="", SC_BUFFER_SIZE = -1,