View Single Post
Old 12-29-2009, 12:58 PM   #15
Human being with feelings
Join Date: Dec 2006
Location: UK
Posts: 762

Originally Posted by fingers
My request is for a mechanism similar to the way you write c++ dlls, but for reascript. I would like to have a function RPR_GetFunc which given the function name would return a function pointer. That way I can write modules in python which can access reaper plugin functions without having a huge callback class in the main script. Ideally, all I'd have to pass is a reference to RPR_GetFunc and the modules can get the plugin functions themselves, by calling 'DeleteTrack = RPR_GetFunc("DeleteTrack")' etc.
This sounds tempting. Given the address of a REAPER function, from GetFunc(), you could wrap it in an FFI call and have a much more Python-ish or Perl-ish version of ReaScript, probably The implementation of ReaScript would then be in Perl or Python modules. You'd be able to write things like this:
PHP Code:
use RPR;   # the standard RPR_* API calls, wrapped using FFI
use MyRPRLib# a set of amazingly cool library objects & routines.

my $Proj $MyRPRLib::CurrentProj();
my $it $Proj -> SelectedItems(FIRST_SEL);
my $pan_env $it -> GetEnvByName('PAN');
s/\w1\./2./mg =~ $pan_env -> Chunk();      # Move all of the env points from the 2nd second to the 3rd second.

foreach $note ($it -> MIDINotes){
$note -> velocity *= 0.99;      # decrease the velocity of each MIDI note in the item by 1%
$note -> pitch ++;              # increase pitch of each MIDI note in the item by 1 semitone

Mike Lacey, Leicestershire, UK

Last edited by MikeLacey; 12-29-2009 at 01:14 PM.
MikeLacey is offline   Reply With Quote