Skip to content

Commit

Permalink
SC_USE_TCP options moved to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sonoro1234 committed Oct 3, 2019
1 parent ef4e8f2 commit 9952e9c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
15 changes: 5 additions & 10 deletions lua2SC/lua/ide/bootsc.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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 },
Expand All @@ -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()
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -171,15 +166,15 @@ 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
if not wx.wxFileName.Exists(scexe) then
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)
Expand Down
19 changes: 7 additions & 12 deletions lua2SC/lua/ide/settings.lua
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions lua2SC/lua2sc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9952e9c

Please sign in to comment.