Skip to content

Commit

Permalink
groovebox updates, cmd.exe windows popup fix, preferences fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
esaruoho authored Oct 19, 2024
1 parent 8b682a1 commit 7815885
Show file tree
Hide file tree
Showing 13 changed files with 1,167 additions and 888 deletions.
58 changes: 22 additions & 36 deletions Paketti0G01_Loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,6 @@ local function find_sample_rate_index(rate)
return 1 -- default to 22050 if not found
end

local function pakettiGetXRNIDefaultPresetFiles()
local presetsFolder = "Presets/"
local files = {}
local handle = io.popen('ls "' .. presetsFolder .. '"')
if handle then
for file in handle:lines() do
if file:match("%.xrni$") then
table.insert(files, file)
end
end
handle:close()
end
return files
end

local presetFiles = pakettiGetXRNIDefaultPresetFiles()

local os_name=os.platform()
local default_executable
if os_name=="WINDOWS"then
Expand Down Expand Up @@ -185,8 +168,8 @@ preferences = renoise.Document.create("ScriptingToolPreferences") {
},

-- changes made
-- Paketti ReSpeak Segment
pakettiReSpeak = {
-- Paketti eSpeak Segment
pakettieSpeak = {
word_gap=3,
capitals=5,
pitch=35,
Expand Down Expand Up @@ -280,14 +263,17 @@ preferences = renoise.Document.create("ScriptingToolPreferences") {
Length = 64,
SetName = false,
Name = ""
}
},
pakettiDynamicViews = {
bla ="ble"
}
}

-- Assigning Preferences to renoise.tool
renoise.tool().preferences = preferences

-- Accessing Segments
ReSpeak = renoise.tool().preferences.pakettiReSpeak
eSpeak = renoise.tool().preferences.pakettieSpeak
pakettiThemeSelector = renoise.tool().preferences.pakettiThemeSelector
WipeSlices = renoise.tool().preferences.WipeSlices
AppSelection = renoise.tool().preferences.AppSelection
Expand All @@ -307,27 +293,25 @@ end
-- Call the initialization function once
initialize_filter_index()




-- Function to load preset files
local function pakettiGetXRNIDefaultPresetFiles()
local presetsFolder = "Presets/"
local files = {}
local handle = io.popen('ls "' .. presetsFolder .. '"')
if handle then
for file in handle:lines() do
if file:match("%.xrni$") then
table.insert(files, file)
end
end
handle:close()
local files = os.filenames(presetsFolder, "*.xrni")

-- Check if any presets were found
if not files or #files == 0 then
renoise.app():show_status("No .xrni preset files found in: " .. presetsFolder)
return { "<No Preset Selected>" }
end

-- Sort the files alphabetically for better user experience
table.sort(files, function(a, b) return a:lower() < b:lower() end)

-- Insert a default option at the beginning
table.insert(files, 1, "<No Preset Selected>")

return files
end

local presetFiles = pakettiGetXRNIDefaultPresetFiles()

-- Function to create horizontal rule
function horizontal_rule()
return vb:horizontal_aligner{mode="justify", width="100%", vb:space{width=2}, vb:row{height=2, width="30%", style="panel"}, vb:space{width=2}}
Expand Down Expand Up @@ -395,6 +379,8 @@ function show_paketti_preferences()
return
end

local presetFiles = pakettiGetXRNIDefaultPresetFiles()

-- Get the initial value (index) for the popup
local pakettiDefaultXRNIDisplayId = "pakettiDefaultXRNIDisplay_" .. tostring(math.random(2,30000))
local pakettiDefaultDrumkitXRNIDisplayId = "pakettiDefaultDrumkitXRNIDisplay_" .. tostring(math.random(2,30000))
Expand Down
72 changes: 35 additions & 37 deletions PakettiAudioProcessing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,41 @@ renoise.tool():add_keybinding {name = "Sample Editor:Paketti:Invert Right, Sum M
renoise.tool():add_keybinding {name = "Sample Editor:Paketti:Audio Diff", invoke = function() create_audio_diff_sample() end}
renoise.tool():add_keybinding {name = "Global:Paketti:Paketti Audio Processing Tools Dialog...", invoke = function() PakettiAudioProcessingToolsDialogShow() end}

function update_sample_details(details_text, sample_name_text)
-- If UI elements are not properly initialized, exit early
-- if not details_text or not sample_name_text then
-- print("UI elements are not initialized yet.")
-- return
-- end

local song = renoise.song()
if song then
local instrument = song.selected_instrument
if instrument then
local sample_index = song.selected_sample_index

if sample_index > 0 and sample_index <= #instrument.samples then
local sample = instrument:sample(sample_index)
if sample then
local buffer = sample.sample_buffer
if buffer and buffer.has_sample_data then
-- Update the UI elements with valid sample data
details_text.text = string.format("Details: %dHz, %dbit, %d frames",
buffer.sample_rate, buffer.bit_depth, buffer.number_of_frames)
sample_name_text.text = "Name: " .. sample.name

renoise.app():show_status("Sample details and name updated.")
return -- Exit after successful update
end
end
end
end
end

-- Fallback if no valid sample is available
details_text.text = "Details: No valid sample selected"
sample_name_text.text = "Name: No valid sample selected"
end

function PakettiStripSilence()
local song = renoise.song()
Expand Down Expand Up @@ -934,7 +969,6 @@ function PakettiStripSilence()
renoise.app():show_status("Removed Silence from beginning + end of sample at threshold " .. (threshold * 100) .. "%")
end


function PakettiMoveSilence()
local song = renoise.song()
local sample_index = song.selected_sample_index
Expand Down Expand Up @@ -1117,42 +1151,6 @@ end
renoise.tool():add_keybinding { name="Sample Editor:Paketti:Max Amp DC Offset Kick Generator", invoke=function() pakettiMaxAmplitudeDCOffsetKickCreator() end }
renoise.tool():add_menu_entry { name="Sample Editor:Paketti..:Max Amp DC Offset Kick Generator", invoke=function() pakettiMaxAmplitudeDCOffsetKickCreator() end }

function update_sample_details(details_text, sample_name_text)
-- If UI elements are not properly initialized, exit early
-- if not details_text or not sample_name_text then
-- print("UI elements are not initialized yet.")
-- return
-- end

local song = renoise.song()
if song then
local instrument = song.selected_instrument
if instrument then
local sample_index = song.selected_sample_index

if sample_index > 0 and sample_index <= #instrument.samples then
local sample = instrument:sample(sample_index)
if sample then
local buffer = sample.sample_buffer
if buffer and buffer.has_sample_data then
-- Update the UI elements with valid sample data
details_text.text = string.format("Details: %dHz, %dbit, %d frames",
buffer.sample_rate, buffer.bit_depth, buffer.number_of_frames)
sample_name_text.text = "Name: " .. sample.name

renoise.app():show_status("Sample details and name updated.")
return -- Exit after successful update
end
end
end
end
end

-- Fallback if no valid sample is available
details_text.text = "Details: No valid sample selected"
sample_name_text.text = "Name: No valid sample selected"
end

-- Function to apply the recursive DC offset correction algorithm
function remove_dc_offset_recursive()
local sample_buffer = renoise.song().selected_sample.sample_buffer
Expand Down
Loading

0 comments on commit 7815885

Please sign in to comment.