|
|
|
11-29-2016, 07:21 AM
|
#1
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Action for selecting only the note under mouse cursor ?
I guess, i must be overseeing something very obvious but i just can't find an Action that does this:
In Midi Editor, when i hover my mouse over a note, the searched for Action selects that note, and only that note.
Not other notes above or beneath the pointed note, just that one note where the mouse pointer is on.
|
|
|
11-29-2016, 10:03 AM
|
#2
|
Human being with feelings
Join Date: Jul 2015
Location: Yekaterinburg, Russia
Posts: 400
|
Quote:
Originally Posted by vanhaze
I guess, i must be overseeing something very obvious but i just can't find an Action that does this:
In Midi Editor, when i hover my mouse over a note, the searched for Action selects that note, and only that note.
Not other notes above or beneath the pointed note, just that one note where the mouse pointer is on.
|
https://github.com/me2beats/rea-me2/...er%20mouse.lua
Code:
local r = reaper; local function nothing() end; local function bla() r.defer(nothing) end
take = r.MIDIEditor_GetTake(r.MIDIEditor_GetActive())
if not take then bla() return end
notes = r.MIDI_CountEvts(take)
window, segment, details = r.BR_GetMouseCursorContext()
_, noteRow = r.BR_GetMouseCursorContext_MIDI()
if noteRow == -1 then bla() return end
mouse_time = r.BR_GetMouseCursorContext_Position()
mouse_ppq_pos = r.MIDI_GetPPQPosFromProjTime(take, mouse_time)
r.Undo_BeginBlock() r.PreventUIRefresh(1)
for i = 0, notes - 1 do
_, sel, muted, start_note, end_note, chan, pitch, vel = r.MIDI_GetNote(take, i)
if start_note < mouse_ppq_pos and end_note > mouse_ppq_pos and noteRow == pitch then
if sel == false then
r.MIDI_SetNote(take, i, 1, muted, start_note, end_note, chan, pitch, vel)
end
elseif sel == true then
r.MIDI_SetNote(take, i, 0, muted, start_note, end_note, chan, pitch, vel)
end
end
r.PreventUIRefresh(-1) r.Undo_EndBlock('Select only note under mouse', 2)
|
|
|
11-29-2016, 11:18 AM
|
#3
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Many thanks for your help !
But doesn't seem to work for me ..
- I imported the script into Action List / midi editor context.
- I assigned a keyboard shortcut to it.
- I made a simple midi item in Midi Editor.
- now i place my mouse cursor on one note and hit the keyboard shortcut.
Outcome:
1) Already selected notes become deselected, but the note on which the mouse cursor is, isn't selected.
2) When no notes were selected beforehand, nothing happens when your script is executed,the note on which the mouse cursor is, isn't selected.
OSX 10.12.1
Reaper 5.30pre3.
|
|
|
05-20-2017, 02:26 PM
|
#4
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
This version should work (at least it does here):
Code:
local r = reaper; local function nothing() end; local function bla() r.defer(nothing) end
take = r.MIDIEditor_GetTake(r.MIDIEditor_GetActive())
if not take then bla() return end
notes = r.MIDI_CountEvts(take)
window, segment, details = r.BR_GetMouseCursorContext()
_, _, noteRow = r.BR_GetMouseCursorContext_MIDI() -- see http://forum.cockos.com/showpost.php?p=1749178&postcount=13
if noteRow == -1 then bla() return end
mouse_time = r.BR_GetMouseCursorContext_Position()
mouse_ppq_pos = r.MIDI_GetPPQPosFromProjTime(take, mouse_time)
r.Undo_BeginBlock() r.PreventUIRefresh(1)
for i = 0, notes - 1 do
_, sel, muted, start_note, end_note, chan, pitch, vel = r.MIDI_GetNote(take, i)
if start_note < mouse_ppq_pos and end_note > mouse_ppq_pos and noteRow == pitch then
if sel == false then
r.MIDI_SetNote(take, i, 1, muted, start_note, end_note, chan, pitch, vel)
elseif sel == true then
r.MIDI_SetNote(take, i, 0, muted, start_note, end_note, chan, pitch, vel)
end
end
end
r.PreventUIRefresh(-1) r.Undo_EndBlock('Select only note under mouse', 2)
Last edited by nofish; 05-20-2017 at 04:48 PM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:56 PM.
|