I have a strange behavior with the following case. I will try to explain it by steps, see if you have the one that does not have anything in the code that makes it not work correctly:
STEP 1. I have used this code as a basis to control OSC Server, and so make the notes sound from the tool, as well as writing them in the pattern editor:
Class "VPD_OscClient"
function VPD_OscClient:__init( osc_host, osc_port, protocol )
self._connection = nil
local client, socket_error = renoise.Socket.create_client( osc_host, osc_port, protocol )
if ( socket_error ) then
renoise.app():show_warning( "Warning: Failed to start the internal OSC client" )
self._connection = nil
else
self._connection = client
end
end
-- Trigger instrument-note
--- note_on (bool), true when note-on and false when note-off
--- instr (int), the Renoise instrument index 1-254
--- track (int), the Renoise track index
--- note (int), the desired pitch, 0-119
--- velocity (int), the desired velocity, 0-127
function VPD_OscClient:trigger_instrument( note_on, instr, track, note, velocity )
if not self._connection then
return false
end
local osc_vars = { }
osc_vars[1] = { tag = "i", value = instr }
osc_vars[2] = { tag = "i", value = track }
osc_vars[3] = { tag = "i", value = note }
local header = nil
if ( note_on ) then
header = "/renoise/trigger/note_on"
osc_vars[4] = { tag = "i", value = velocity }
else
header = "/renoise/trigger/note_off"
end
self._connection:send( renoise.Osc.Message( header, osc_vars ) )
return true
end
vpd_osc_client = VPD_OscClient( "127.0.0.1", 8000, 2 ) --the user needs to activate it! Port: 8000, Protocool: UDP (2), IP (localhost): 127.0.0.1
Then I use these lines to press and release the button:
- to pressed: vpd_osc_client:trigger_instrument( true, instrument, track, note, volume )
- to released: vpd_osc_client:trigger_instrument( false, instrument, track, note, volume )
As the code is now, it works correctly. The notes sound and they are written correctly in the pattern editor (with its volume, delay and note-OFF). Renoise does this internally.
STEP 2.The next step is to detach the instrument editor in a separate window [ALT D].Now you will have 2 separate windows.
STEP 3.Now use the code provided normally, with the button to sound the notes and write in the pattern editor.Ok, the notes sound correctly, and stop correctly. But the pattern editor does not write the notes!For some reason if the instrument editor is in a separate window, Renoise loses the ability to write the notes in the pattern editor, (they do sound, but they do not write) .
Can anyone review all this of the OSC Server code, in case there is something missing that guarantees that when the instrument editor is in a separate window, Renoise keeps recording the notes in the pattern editor?
@Danoise ,Can you help me here? Is this a Renoise problem or is there something missing in the code used related to the OSC Server that makes the writing of the notes not work because of the separate window of the instrument editor?
The objective is simple. That the OSC Server code used also allows writing notes in the pattern editor, even if the separate instrument editor window is there. It seems that being separated, it is as if it takes precedence over the pattern editor. But even by selecting the pattern editor (with the separate instrument editor window), the OSC Server code is not able to write the notes (it does sound good, but it does not write anything).
Please, could you test the OSC Server code with the instrument editor in a separate window, to see if it is possible for the pattern editor to write the notes when the trigger button is pressed? Is there any way to make it work?
I get the feeling that it is something internal to Renoise, but maybe there is some code trick of the OSC Server that guarantees that it works well in this scenario.
@Joule , have you ever been able to experiment with this?