Skip to content

Commit

Permalink
Fixing fresh install issues
Browse files Browse the repository at this point in the history
  • Loading branch information
subvertnormality committed May 14, 2024
1 parent e7925fb commit 6004958
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# 0.5 - Beta
# 0.5.1

* Fixing issue where certain files would not initialise properly on fresh install
* Fixing issue when assigning midi devices when no midi output devices are configured in Norns

# 0.5.0 - Beta

_Breaking update. Please backup and remove your .pset and .ptn data files from previous versions._

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ For _Mosaic_ to do anything, you must have a device assigned to a channel. Devic

##### MIDI Sound Sources

In Mosaic, a device can be either an internal Norns sound engine powered by [n.b.](https://github.com/sixolet/nb/tree/main), or a representation of a MIDI device within your workspace. Devices are assigned per scene and maintain their settings consistently across all song sequences.
In Mosaic, a device can be either an internal Norns sound engine powered by [n.b.](https://github.com/sixolet/nb/tree/main), or a representation of a MIDI device within your workspace. Devices are assigned per scene and maintain their settings consistently across all song sequences. To utilise MIDI sound sources, you must have a MIDI output device configured in Norns.

If your device has an associated configuration file, such as those available for Elektron -takt devices, the device's name will be displayed, allowing you to select parameters directly without needing to know the MIDI CC numbers. If no such configuration exists, you can still use the CC device, but you will need to manually look up and input CC numbers.

Expand Down
9 changes: 9 additions & 0 deletions lib/midi_controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,13 @@ function midi_controller.panic()
chord_number = 0
end

function midi_controller.midi_devices_connected()
for id = 1, #midi.vports do
if midi_devices[id].device ~= nil then
return true
end
end
return false
end

return midi_controller
24 changes: 16 additions & 8 deletions lib/pages/channel_edit_page_ui_controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local dial = include("mosaic/lib/ui_components/dial")
local control_scroll_selector = include("mosaic/lib/ui_components/control_scroll_selector")
local list_selector = include("mosaic/lib/ui_components/list_selector")
local value_selector = include("mosaic/lib/ui_components/value_selector")
local midi_controller = include("mosaic/lib/midi_controller")

local musicutil = require("musicutil")
local param_manager = include("mosaic/lib/param_manager")
Expand Down Expand Up @@ -239,7 +240,7 @@ local channel_edit_page =
local channel = program.get_selected_channel()
local device = fn.get_by_id(device_map.get_devices(), device_map_vertical_scroll_selector:get_selected_item().id)
if (device.type == "midi") then
if (device.default_midi_device == nil) then
if (device.default_midi_device == nil and midi_controller.midi_devices_connected()) then
midi_device_vertical_scroll_selector:draw()
end
if (device.default_midi_channel == nil) then
Expand Down Expand Up @@ -443,9 +444,16 @@ function channel_edit_page_ui_controller.update_channel_config()
local midi_channel = midi_channel_vertical_scroll_selector:get_selected_item()
local device_m = device_map_vertical_scroll_selector:get_selected_item()

program.get().devices[channel.number].midi_device = midi_device.value
program.get().devices[channel.number].midi_channel = midi_channel.value
program.get().devices[channel.number].device_map = device_m.id
if midi_device == nil then
if device_m.type == "midi" then
tooltip:error("No midi devices connected")
return
end
end

program.get().devices[channel.number].midi_device = midi_device and midi_device.value or nil
program.get().devices[channel.number].midi_channel = midi_device and midi_channel.value or nil
program.get().devices[channel.number].device_map = device_m and device_m.id or nil

local device = device_map.get_device(program.get().devices[channel.number].device_map)
if device.default_midi_channel ~= nil then
Expand Down Expand Up @@ -955,7 +963,7 @@ function channel_edit_page_ui_controller.enc(n, d)
local device =
fn.get_by_id(device_map.get_devices(), device_map_vertical_scroll_selector:get_selected_item().id)
if midi_channel_vertical_scroll_selector:is_selected() then
if (device.default_midi_device == nil) then
if (device.default_midi_device == nil and midi_controller.midi_devices_connected()) then
midi_channel_vertical_scroll_selector:deselect()
midi_device_vertical_scroll_selector:select()
end
Expand All @@ -964,7 +972,7 @@ function channel_edit_page_ui_controller.enc(n, d)
device_map_vertical_scroll_selector:deselect()
midi_channel_vertical_scroll_selector:select()
else
if (device.default_midi_device == nil) then
if (device.default_midi_device == nil and midi_controller.midi_devices_connected()) then
device_map_vertical_scroll_selector:deselect()
midi_device_vertical_scroll_selector:select()
end
Expand Down Expand Up @@ -1021,10 +1029,10 @@ function channel_edit_page_ui_controller.enc(n, d)
local device =
fn.get_by_id(device_map.get_devices(), device_map_vertical_scroll_selector:get_selected_item().id)
if midi_device_vertical_scroll_selector:is_selected() then
if (device.default_midi_channel == nil) then
if (device.default_midi_channel == nil and midi_controller.midi_devices_connected()) then
midi_device_vertical_scroll_selector:deselect()
midi_channel_vertical_scroll_selector:select()
elseif (device.default_midi_device == nil) then
elseif (device.default_midi_device == nil and midi_controller.midi_devices_connected()) then
midi_device_vertical_scroll_selector:deselect()
device_map_vertical_scroll_selector:select()
end
Expand Down
19 changes: 18 additions & 1 deletion lib/ui_components/tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local fn = include("mosaic/lib/functions")

tooltip.text = false
tooltip.metros = {}
tooltip.error_flag = false

function tooltip:draw()
if tooltip.text then
Expand All @@ -17,9 +18,10 @@ end
local function remove_tip()
tooltip.text = false
fn.dirty_screen(true)
tooltip.error_flag = false
end

function tooltip:show(text)
function tooltip:do_tip(text)
-- Stop any existing metro and remove it from the table
for i, m in ipairs(tooltip.metros) do
m:stop()
Expand All @@ -39,4 +41,19 @@ function tooltip:show(text)
table.insert(tooltip.metros, m)
end

function tooltip:error(text)
tooltip.error_flag = true
tooltip:do_tip(text)
end

function tooltip:show(text)

if tooltip.error_flag then
return
end

tooltip:do_tip(text)

end

return tooltip

0 comments on commit 6004958

Please sign in to comment.