mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Proper error messages for Audio2MIDI script
This commit is contained in:
parent
215bc64455
commit
ab68ed4131
1 changed files with 11 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ function factory () return function ()
|
||||||
local sr = Session:nominal_sample_rate ()
|
local sr = Session:nominal_sample_rate ()
|
||||||
local tm = Session:tempo_map ()
|
local tm = Session:tempo_map ()
|
||||||
local vamp = ARDOUR.LuaAPI.Vamp ("libardourvampplugins:qm-transcription", sr)
|
local vamp = ARDOUR.LuaAPI.Vamp ("libardourvampplugins:qm-transcription", sr)
|
||||||
local midi_region
|
local midi_region = nil
|
||||||
local audio_regions = {}
|
local audio_regions = {}
|
||||||
local start_time = Session:current_end_sample ()
|
local start_time = Session:current_end_sample ()
|
||||||
local end_time = Session:current_start_sample ()
|
local end_time = Session:current_start_sample ()
|
||||||
|
|
@ -41,7 +41,16 @@ function factory () return function ()
|
||||||
midi_region = r:to_midiregion()
|
midi_region = r:to_midiregion()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert (audio_regions and midi_region)
|
|
||||||
|
if #audio_regions == 0 then
|
||||||
|
LuaDialog.Message ("Polyphonic Audio to MIDI", "No source audio region(s) selected.\nAt least one audio-region to be analyzed need to be selected.", LuaDialog.MessageType.Error, LuaDialog.ButtonType.Close):run ()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not midi_region then
|
||||||
|
LuaDialog.Message ("Polyphonic Audio to MIDI", "No target MIDI region selected.\nA MIDI region, ideally empty, and extending beyond the selected audio-region(s) needs to be selected.", LuaDialog.MessageType.Error, LuaDialog.ButtonType.Close):run ()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
midi_region:set_initial_position(start_time)
|
midi_region:set_initial_position(start_time)
|
||||||
midi_region:set_length(end_time - start_time, 0)
|
midi_region:set_length(end_time - start_time, 0)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue