I’m having some problems with certain notifiers, after loading another song, in my tool that runs with autostar.
I explain what happens:
- Charge a new song, song 1. The whole tool works correctly.
- Without closing the tool, charge another new song, song 2. The whole tool works correctly.Some notifier gives me a error like this:
error 1)
*** std::logic_error: 'trying to access a nil object of type 'class RenoiseSong'. the object is not or no longer available.'
*** stack traceback:
*** [C]: ?
*** [C]: in function '__index'
*** [string "do..."]:37: in function <[string "do..."]:35>
***.\tools/tool_04.lua:216: in function <.\tools/tool_04.lua:214>
This error is caused by this double function (WMP_CTRL_VEL is the id of a valuebox):
function 1, with error)
--Keyboard velocity
function wmp_velocity( song )
song = renoise.song()
local function notifier()
--if ( song.transport.keyboard_velocity_enabled == true ) then
vb.views['WMP_CTRL_VEL'].value = song.transport.keyboard_velocity
--end
end
notifier()
--song.transport.keyboard_velocity_enabled_observable:add_notifier( notifier )
song.transport.keyboard_velocity_observable:add_notifier( notifier )
end
renoise.tool().app_new_document_observable:add_notifier( wmp_velocity )
---
function wmp_keyboard_velocity( song )
song = renoise.song()
song.transport.keyboard_velocity = vb.views['WMP_CTRL_VEL'].value
end
Line 216 is :vb.views[‘WMP_CTRL_VEL’].value = song.transport.keyboard_velocity
But this other double function is exactly the same and works correctly (WMP_CTRL_OCT is the id of a valuebox):
function 2, ok!)
--Keyboard octave
function wmp_octave( song )
song = renoise.song()
local function notifier()
vb.views['WMP_CTRL_OCT'].value = song.transport.octave
end
notifier()
song.transport.octave_observable:add_notifier( notifier )
end
renoise.tool().app_new_document_observable:add_notifier( wmp_octave )
---
function wmp_keyboard_octave( song )
song = renoise.song()
song.transport.octave = vb.views['WMP_CTRL_OCT'].value
end
What is missing here to solve the error?