-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OneSmallStep 0.9.14 > 0.9.15 (#1432)
- Loading branch information
1 parent
b9fadd0
commit acb633a
Showing
11 changed files
with
253 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
MIDI Editor/talagan_OneSmallStep/classes/modules/articulations.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
-- @noindex | ||
-- @author Ben 'Talagan' Babut | ||
-- @license MIT | ||
-- @description This is part of One Small Step | ||
|
||
local MU = require "lib/MIDIUtils" | ||
local S = require "modules/settings" | ||
|
||
local TEXT_CHANNEL = 1 -- This is the one which is called "Text", I hesitate with "Program", which is 8 | ||
|
||
local function UpdateArticulationTextEventsIfNeeded(track, take) | ||
|
||
if not track or not take then | ||
return | ||
end | ||
|
||
if not S.getTrackSetting(track, "OSSArticulationManagerEnabled") then | ||
return | ||
end | ||
|
||
MU.MIDI_InitializeTake(take) | ||
MU.MIDI_OpenWriteTransaction(take) | ||
|
||
local _, nc, _, tsc = MU.MIDI_CountEvts(take) | ||
for ti = tsc, 1, -1 do | ||
local _, _, _, _, type, msg = MU.MIDI_GetTextSysexEvt(take, ti - 1) | ||
|
||
-- Avoid destroying texts from other tool/people, we're not alone here | ||
-- Beware, we use an unicode diamond char and string.sub is picky | ||
if type == TEXT_CHANNEL and string.sub(msg,1,4) == "◈ " then | ||
MU.MIDI_DeleteTextSysexEvt(take, ti - 1) | ||
end | ||
end | ||
|
||
for ni = 1, nc do | ||
local _, _, _, startppqpos, _, chan, pitch, _ = MU.MIDI_GetNote(take, ni - 1) | ||
|
||
local note_name = reaper.GetTrackMIDINoteNameEx(0, track, pitch, chan) | ||
|
||
if note_name ~= nil and note_name ~= "" then | ||
MU.MIDI_InsertTextSysexEvt(take, false, false, startppqpos, 1, "◈ " .. note_name) | ||
end | ||
end | ||
|
||
MU.MIDI_CommitWriteTransaction(take); | ||
end | ||
|
||
return { | ||
UpdateArticulationTextEventsIfNeeded= UpdateArticulationTextEventsIfNeeded | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.