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

Reply
 
Thread Tools Display Modes
Old 05-14-2019, 12:15 PM   #1
Burtan
Human being with feelings
 
Join Date: Jan 2013
Location: Bochum, Germany
Posts: 103
Default Reaper C++ API - hookcommand2 wrong values

Hi,
when using the api function hookcommand2 from reaper_plugin_functions.h with OSC, wrong values are returned.

This is the documentation:
// val/valhw are used for actions learned with MIDI/OSC.
// val = [0..127] and valhw = -1 for MIDI CC,
// valhw >=0 for MIDI pitch or OSC with value = (valhw|val<<7)/16383.0,
// NON_API: bool onAction(KbdSectionInfo *sec, int command, int val, int valhw, int relmode, HWND hwnd);

However, when sending float values via OSC, only values from 0 to 1 are correctly transmitted using the formula above. Integer values via OSC are returning 0 for all int parameters of the function.
Burtan is offline   Reply With Quote
Old 05-15-2019, 07:33 PM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Only float parameters are currently supported for action parameters triggered via OSC... and yeah 0..1 is the valid range.
Justin is offline   Reply With Quote
Old 11-24-2019, 06:49 AM   #3
Burtan
Human being with feelings
 
Join Date: Jan 2013
Location: Bochum, Germany
Posts: 103
Default

Somehow, actions triggered by OSC do not call hookcommand2 anymore. Any ideas?
Burtan is offline   Reply With Quote
Old 12-01-2019, 03:44 AM   #4
Burtan
Human being with feelings
 
Join Date: Jan 2013
Location: Bochum, Germany
Posts: 103
Default

Ok, I got the reason.

hookcommand2 is only called when you registered the actions cmd id with your extension via

Code:
        custom_action_register_t s;
        s.idStr = name;
        s.name = desc;
        s.uniqueSectionId = 0;
        m_reg.accel.cmd = plugin_register("custom_action", (void*)&s);
plugin_register could really need some better documentation
Burtan 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 09:52 PM.


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