Jump to content


Photo

renoise.tool() is a nil value


  • Please log in to reply
10 replies to this topic

#1 Neurogami

Neurogami

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 510 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 20 June 2013 - 20:05

I'm trying to add an app idle notifier in GlobalOscActions.lua.

I believe the syntax is this:


renoise.tool().app_idle_observable:add_notifier( send_current_line)

However this just gives me an error:


attempt to call field 'tool' (a nil value)

How can call 'app_idle_observable:add_notifier' in GlobalOscActions.lua?


Ideally I want to do this inside a custom OSC handler, like this:


add_global_action { 
  pattern = "/jgb/currentLineNotifier", 
  description = "JGB: Set up  a current line notifier for idle obsr,",

  arguments = { },
  handler = function()
    log:error("********************************* /jgb/currentLineNotifier **************************************")
    renoise.tool().app_idle_observable:add_notifier( send_current_line)
  end,
}

This *almost* works except for the error that comes up when calling 'renoise.tool()'.

('send_current_line' is a previously defined function.)

Any ideas?


Thanks!

#2 vV

vV

    God's or Borg's Chief and Ruler of All Species

  • Moderator
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16855 posts
  • Gender:Male
  • Location:Netherlands

Posted 20 June 2013 - 21:02

Ideally I want to do this inside a custom OSC handler, like this:


add_global_action { 
  pattern = "/jgb/currentLineNotifier", 
  description = "JGB: Set up  a current line notifier for idle obsr,",

  arguments = { },
  handler = function()
    log:error("********************************* /jgb/currentLineNotifier **************************************")
    renoise.tool().app_idle_observable:add_notifier( send_current_line)
  end,
}

This *almost* works except for the error that comes up when calling 'renoise.tool()'.

('send_current_line' is a previously defined function.)

Any ideas?


I suspect the tool api environment is not yet life when the global oscactions is being called.
Perhaps it is not being called in the active Lua thread at all...
I'm not sure the line notifier will help you in exact manners as the lua scripts are still running in the graphics thread.
Vv....


cpu Intel Core i7-4820K @3.70GHz
chipset Intel X79 chipset
mem 32 Gb 2400Mhz
os Win 7 64-bit SP1, DirectX 11
audio ESI ESP1010e - > Driver rev:2.0.6.0
video nVidia Geforce GTX780 - > Driver rev:335.23


Renoise Official Manual

#3 Neurogami

Neurogami

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 510 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 20 June 2013 - 23:33

I suspect the tool api environment is not yet life when the global oscactions is being called.
Perhaps it is not being called in the active Lua thread at all...
I'm not sure the line notifier will help you in exact manners as the lua scripts are still running in the graphics thread.


Sadness.

I was afraid this might be the case.

#4 kazakore

kazakore

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6140 posts
  • Gender:Male

Posted 21 June 2013 - 10:28

I found renoise.tool does not work when trying to use the TestPad and thus you can't run checks on it without actually creating a real Tool and running it. Not sure if that has been me always doing something wrong, or if you are already using it in a full tool and not just the testpad/terminal, but maybe the pointer is of some use...



That being the case I can also image it being not active for the call of GlobalOscActions.lua.......

Edited by kazakore, 21 June 2013 - 10:28.


#5 Neurogami

Neurogami

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 510 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 21 June 2013 - 15:46

or if you are already using it in a full tool and not just the testpad/terminal, but maybe the pointer is of some use...


That may be the issue in a nutshell. I'm not using it in a tool, I'm trying to have GlobalOscAction instantiate it's own OSC client and have it send out messages indicating the current song line number. My understanding was that I could use the app idle notification callback, but that may be a GUI-only thing.

#6 vV

vV

    God's or Borg's Chief and Ruler of All Species

  • Moderator
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16855 posts
  • Gender:Male
  • Location:Netherlands

Posted 21 June 2013 - 17:25

That may be the issue in a nutshell. I'm not using it in a tool, I'm trying to have GlobalOscAction instantiate it's own OSC client and have it send out messages indicating the current song line number. My understanding was that I could use the app idle notification callback, but that may be a GUI-only thing.


You can always create a tool that is started automatically in the background as long as you take care that you poll for an existing song prior to firing up any song-API call including notifiers to Song api related calls.
Vv....


cpu Intel Core i7-4820K @3.70GHz
chipset Intel X79 chipset
mem 32 Gb 2400Mhz
os Win 7 64-bit SP1, DirectX 11
audio ESI ESP1010e - > Driver rev:2.0.6.0
video nVidia Geforce GTX780 - > Driver rev:335.23


Renoise Official Manual

#7 Neurogami

Neurogami

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 510 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 21 June 2013 - 18:12

You can always create a tool that is started automatically in the background as long as you take care that you poll for an existing song prior to firing up any song-API call including notifiers to Song api related calls.


As a work around I added a track for the sole purpose of sending MIDI notes to indicate song location. I'd prefer to not have to recreate this for every song where I want to get tracking messages, but if I cannot output this info via OSC then maybe my next best choice is to write a tool that automatically appends a timing message track.

The upside is that the MIDI messages are going to be more accurate than the OSC send using app idle. The downside is that I have to have something running that will convert that MIDI to OSC. (I've already solved that.)

#8 taktik

taktik

    Renoise Developer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 15040 posts
  • Gender:Male
  • Location:Berlin, Germany
  • Interests:füße waschen

Posted 21 June 2013 - 21:43

I found renoise.tool does not work when trying to use the TestPad and thus you can't run checks on it without actually creating a real Tool and running it. Not sure if that has been me always doing something wrong, or if you are already using it in a full tool and not just the testpad/terminal, but maybe the pointer is of some use...


Yes, renoise.tool() is only valid, well, in a XRNX tool. The testpad.lua or terminal is not running in a tool, neither is the GlobalOscMessages.lua script.

As a work around I added a track for the sole purpose of sending MIDI notes to indicate song location. I'd prefer to not have to recreate this for every song where I want to get tracking messages, but if I cannot output this info via OSC then maybe my next best choice is to write a tool that automatically appends a timing message track.

The upside is that the MIDI messages are going to be more accurate than the OSC send using app idle. The downside is that I have to have something running that will convert that MIDI to OSC. (I've already solved that.)


You can create your own OSC server in a tool too, so you don't have to modify GlobalOscActions.lua.

See https://code.google....nippets/Osc.lua for more info.

#9 Neurogami

Neurogami

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 510 posts
  • Gender:Male
  • Location:Scottsdale AZ
  • Interests:Art, music, technology

Posted 22 June 2013 - 00:05

You can create your own OSC server in a tool too, so you don't have to modify GlobalOscActions.lua.


I've added a number of custom OSC handlers, some which send back info. Can a custom tool add OSC handlers as well (that are handled by the default Renoise OSC server), or does that have to happen in GlobalOscActions?

It would be easier to manage if I could avid munging the global file. It's not a big deal (since updates are relatively infrequent), but it would make it way easier to distribute useful new OSC handlers that added to what was already in Renoise.

#10 vV

vV

    God's or Borg's Chief and Ruler of All Species

  • Moderator
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16855 posts
  • Gender:Male
  • Location:Netherlands

Posted 22 June 2013 - 08:24

I've added a number of custom OSC handlers, some which send back info. Can a custom tool add OSC handlers as well (that are handled by the default Renoise OSC server), or does that have to happen in GlobalOscActions?


You could also embed a small client function that connects to Renoise its OSC server, so all the messages you receive on your own server are ported directly to the OSC server. And if a notifier action happens, you can send back the remote client connected to your server, a specific event. I think that this OSC proxy is the easiest solution where you can intervene in certain events.
Vv....


cpu Intel Core i7-4820K @3.70GHz
chipset Intel X79 chipset
mem 32 Gb 2400Mhz
os Win 7 64-bit SP1, DirectX 11
audio ESI ESP1010e - > Driver rev:2.0.6.0
video nVidia Geforce GTX780 - > Driver rev:335.23


Renoise Official Manual

#11 taktik

taktik

    Renoise Developer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 15040 posts
  • Gender:Male
  • Location:Berlin, Germany
  • Interests:füße waschen

Posted 24 June 2013 - 08:55

Can a custom tool add OSC handlers as well (that are handled by the default Renoise OSC server), or does that have to happen in GlobalOscActions?


No, they can't. But this indeed would make sense.

Depending on how complex the tasks are, you probably could also use:

/renoise/evaluate(string)
Evaluate a custom Lua expression (e.g. renoise.song().transport.bpm = 234).