Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 02-06-2017, 01:05 PM   #1
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default [SOLVED] OSC message receive but not apply

Hi folks !

[EDIT]
ok, so, years after but still can help people passing by, at least in reaper 6.26, to use midi editor with OSC you have to set your OSC client (lemur, touchosc, etc..) to /midiaction/action-number and not just /action/action-number ....

For example, show velocity lane in midi editor which action number is 40237 in MIDI editor action list (not in main action list), you have to set your OSC client to send /midiaction/40237 instead of the traditionnal /action/40237

Hope it can helps...
[/EDIT]


Ok, so, here is the context :
Reaper 5.33 and Lemur as osc controller.

so, for my needs, I want that every notes/CC entered into every items will be on chan 16.

So i've created a custom action for MIDI editor window so I can easily apply chan 16 to every notes/CC in the opened item.

here is the custom action :
-Select all CC events
-Edit: Set events to channel 16
-Unselect all CC events

This custom action works well if I try to apply from the action list. I select the action and click run, and it works !

BUT

If I set this action to my OSC controller, action is received (I use preferences > Control/OSC/Web > and click my controller then listen to the input. I receive the action in this format :
/action [s] "_0bd801c69af30e48a67f239d630ddbce"

and nothing happens. action isn't apply to the item opened in the MIDI editor. So, I wonder if it's because it's in the MIDI editor ??

Every other actions from my OSC controller (Lemur) works pretty well

I don't know how to investigate futher in this error and i'd really appreciate any kind of help

Last edited by daeavelwyn; 04-08-2021 at 07:11 PM. Reason: solved
daeavelwyn is offline   Reply With Quote
Old 02-10-2017, 07:09 AM   #2
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default stil no ideas ?

up ! Please
daeavelwyn is offline   Reply With Quote
Old 02-10-2017, 07:31 AM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Off the top of my head, try sending "/action/str" with the string parameter instead, or "/action/_0bd801c69af30e48a67f239d630ddbce" directly
Justin is offline   Reply With Quote
Old 02-10-2017, 08:17 AM   #4
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

Wooh...damned God is answering me ;-)

Ok, so here is 3 gif from my setup where you will see what I get more precisely following your instructions.

http://imgur.com/a/sesYH

I have to precise this happens only with MIDI Editor, same kind af OSC messages perfectly works with main window
daeavelwyn is offline   Reply With Quote
Old 02-14-2017, 05:02 AM   #5
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

Up !! If someone could just indicate me how to get a better understanding of the problem
daeavelwyn is offline   Reply With Quote
Old 02-22-2017, 10:58 AM   #6
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

So I'm trying to investigate futher on this issue but can't succeed in having a good debugging method.

I can't understand some behaviours.

1-For example, I double click on a midi item, it opens midi editor.
I load the action list, search for "select all events", found the action, but I can't click on run ! => http://imgur.com/a/Rskkq

2- Sometimes I can run actions, but they don't apply :-/

3- Sometimes it works ....

Any documentations on this ? please !
daeavelwyn is offline   Reply With Quote
Old 05-22-2017, 04:09 PM   #7
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

Same problem as explain here : http://forum.cockos.com/showthread.php?t=188474

It seems it deals with MIDI editor window focus, but can't find a usable solution :-/
daeavelwyn is offline   Reply With Quote
Old 05-22-2017, 10:25 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Quote:
Originally Posted by daeavelwyn View Post
I have to precise this happens only with MIDI Editor, same kind af OSC messages perfectly works with main window
Do you Midi editor receives specific OSC messages at all ?

-Michael
mschnell is online now   Reply With Quote
Old 05-23-2017, 04:45 AM   #9
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

Hi mschnell,

MIDI editor receives messages sometimes, it depends how the focus is.

First of all, my custom action :
Custom: Set all MIDI event to chan 16
Edit: Select all events
Edit: Set events to channel 16
Edit: Unselect all

So here are the steps to reproduce you can show in the gif here http://imgur.com/a/lRA7P:
1- open a midi item in IDI Editor with datas on chan 16 (brown color) and datas on chan 1 (blue, ModWheel from my midi keyboard).

2-As you can see, "Run" button is active and I should be able to apply my acustom action to the midi Editor, but clicking on it just doesn't work. Moreover, if I click another action, the "Run" button turns grey and I can't use action.

3- To get the action work, I have to select "Main" on right top corner, then select "MIDI Editor", and now, the custom action applies to my open MIDI item.

So, I understand it deals with focus about MIDI item, but can't figure how to set this behaviour correctly.

Is it a bug or a feature ?

Can someone indicate me the right way to set all MIDI events of an item to chan 16 ?
daeavelwyn is offline   Reply With Quote
Old 08-11-2017, 05:06 PM   #10
daeavelwyn
Human being with feelings
 
daeavelwyn's Avatar
 
Join Date: Dec 2014
Posts: 597
Default

So, here is a lua script that solve the problem. Not mine, it's a Jilansader one, found here : https://forum.cockos.com/showthread....15%2C+-1-16%29.

Code:
-- Change the channel of all notes and CCs in all selected items to specified channel

newChannel = 15 -- Channel to which events should be changed (0-15, NOT 1-16).


---------------
notationReplacementText = string.format("NOTE %i ", newChannel) -- Will be used to replace channel info in REAPER's notation events

-- First, loop through all selected items
for i = 0, reaper.CountSelectedMediaItems(0)-1 do
    item = reaper.GetSelectedMediaItem(0, i)
    
    -- Loop through all takes within each selected item
    for t = 0, reaper.CountTakes(item)-1 do
        take = reaper.GetTake(item, t)
        if reaper.TakeIsMIDI(take) then
        
            -- Use the new Get/SetAllEvts functions to directly (and quickly) edit the MIDI data
            gotAllOK, MIDIstring = reaper.MIDI_GetAllEvts(take, "")
            if gotAllOK then
            
                local tableEvents = {} -- MIDI events will temporarily be stored in this table until they are concatenated into a string again
                local t = 1 -- Index inside tableEvents
                local MIDIlen = MIDIstring:len()
                local positionInString = 1 -- Position inside MIDIstring while parsing
                local offset, flags, msg
                -- Now parse through all events in the MIDI string, one-by-one
                -- (Excluding the final 12 bytes, which provides REAPER's All-notes-off end-of-take message)
                while positionInString < MIDIlen-12 do 
                    offset, flags, msg, positionInString = string.unpack("i4Bs4", MIDIstring, positionInString)
                    local msg1 = msg:byte(1) -- The first byte contains the event type and channel
                    if msg1 then -- If empty event that simply changes PPQ position, msg1 will be nil
                        if msg1>>4 ~= 0xF then -- First nybble gives event type; exclude text/sysex messages, which do not carry channel info
                            msg = string.char(((msg1 & 0xF0) | newChannel)) .. msg:sub(2) -- 2nd nybble gives channel
                        elseif msg1 == 0xFF then -- REAPER's notation events also refer to the note channel
                            msg = msg:gsub("NOTE %d+ ", notationReplacementText, 1)
                        end                    
                    end
                    tableEvents[t] = string.pack("i4Bs4", offset, flags, msg)
                    t = t + 1
                end
                
                -- This script does not change the order of events, so no need to call MIDI_Sort before updating take MIDI
                reaper.MIDI_SetAllEvts(take, table.concat(tableEvents) .. MIDIstring:sub(-12))
                
            end -- if gotAllOK
        end -- if reaper.TakeIsMIDI(take)
    end
end

reaper.Undo_OnStateChange("Set channel of all MIDI in selected items")
It doesn't really solve the problem, i'd like to use other actions to manage MIDI editor but still can't, due to lost of focus issue.

Last edited by daeavelwyn; 08-12-2017 at 05:44 AM.
daeavelwyn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.