Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osc: provide mechanism for emitting initialisation commands #106

Open
OddBloke opened this issue Dec 20, 2021 · 2 comments
Open

osc: provide mechanism for emitting initialisation commands #106

OddBloke opened this issue Dec 20, 2021 · 2 comments
Assignees
Labels
backend Backend issues question

Comments

@OddBloke
Copy link

I'm currently working on an integration with REAPER which has some global configuration options that can be set via OSC. I would like to emit these commands once immediately after the OSC backend's connection is initialised (and, ideally, as they should only need that single invocation, never again).

Currently, I have to map an input to this setting, and remember to set that input correctly before my integration will work as expected.

@OddBloke
Copy link
Author

A generic mechanism for this could be to enable configuring a Python function as an init hook, and have that emit all the setup events I would need. So something like this could work for my use case:

def init_hook():
   midimonster.output("setup_1", 1)
[python py1]
module = my_module
init-hook = my_module.init_hook

[map]
py1.setup_1 > my_osc./device/track/follows/last_touched

@cbdevnet
Copy link
Owner

Hi @OddBloke, thanks for your in-depth report! Both programming backends (lua and python) support initially setting channels at load time by directly calling the respective output(channel, value) API in the global scope.

For example, in Python you could (as a minimized example) do

import midimonster

midimonster.output("test", 1.0)

This will output 1.0 on the test channel once the translation is starting up. You could also replace that by a call to an init_hook function :)

Hope this helps!

@cbdevnet cbdevnet self-assigned this Dec 20, 2021
@cbdevnet cbdevnet added question backend Backend issues labels Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend issues question
Projects
None yet
Development

No branches or pull requests

2 participants