|
|
|
02-04-2010, 10:54 PM
|
#1
|
Human being with feelings
Join Date: May 2009
Location: Melbourne, Australia
Posts: 12
|
EnumProjectMarkers - names?
Guys,
am kicking off a ReaScripting effort with a tool to pull out marker names. Unfortunately I am stubmling at the first hurdle, as my Perl script stubbornly refuses to relinquish the required information!
From my understanding, RPR_EnumProjectMarkers should return 7 values.
Variable 6 appears to be a char** in the prototype.
Rendering this directly in sprintf reveals a dereferenced null. (sprintf("s6=%s\n",$s6);
>>>>s6=(char**)0x0
Rendering this as a dereferenced variable gives, as you would expect, nowt.
(sprintf("s6=%s\n",${$s6});
>>>>s6=
So, please forgive the newbie question, but how exactly does one get the names of the markers and regions out of the ReaScript API? A nudge in the right direction here would be much appreciated.
Am using Activestate Perl with Reaper 3.22 on Win7-32
I am invoking the API thus:
($s1,$s2,$s3,$s4,$s5,$s6,$s7) = RPR_EnumProjectMarkers($mid,0,0,0,"",1);
Am also interested to know how the invocation parameters make a difference to the output.
cheers,
mark
|
|
|
02-05-2010, 05:14 AM
|
#2
|
Human being with feelings
Join Date: Dec 2006
Location: UK
Posts: 789
|
Hi Mark,
I don't know why you're not getting the region's name back - I'll have a think about that. While I'm thinking though, your second question.
Here's the definition from the Wiki - you'll notice by the way that there are no examples in there yet for these two functions, so they haven't been used much and I haven't used them at all yet.
Calling the function:
PHP Code:
int EnumProjectMarkers2(
void* proj # only needed if calling EnumProjectMarkers2
int idx # set this to the index of the region you
# want to return data about
bool* isrgn # ignore when calling
double* pos # ignore when calling
double* rgnend # ignore when calling
char** name # ignore when calling
int* markrgnindexnumber # ignore when calling
)
The parameters isrgn, pos, rgnend, name & markrgnindexnumber can all be ignored when calling these functions from Perl or Python using ReaScript.
Here's how I'd approach the function(s).
When these functions are called using C++ the functions return values in the parameter list - but ReaScript uses its return array to give values back to your Perl or Python script. Like this:
PHP Code:
(
$retval
$proj,
$idx,
$isrgn,
$pos,
$rgnend,
$name,
$markrgnindexnumber
) = EnumProjectMarkers2(
0, # the active project
1, # index number of the marker you want
undef, # use the undef keyword to make it obvious
undef, # that you're not specifying anything at this
undef, # point in the parameter list
undef,
undef
)
I've split the calls to EnumProjectMarkers2() over a few lines to make it easier to read, I've also missed the RPR_ from the function name as well - neither of which you can do in real life.
I'll have a go and see if I can get EnumProjectMarkers2 to play nicely...
__________________
Mike Lacey, Leicestershire, UK
|
|
|
02-18-2010, 08:58 PM
|
#3
|
Human being with feelings
Join Date: Sep 2008
Posts: 11
|
I'm a Python coder and seem to have the exact same problem of getting the marker/region name back. Any pointers? (pun intended)
Quote:
Originally Posted by MikeLacey
Hi Mark,
I don't know why you're not getting the region's name back - I'll have a think about that. While I'm thinking though, your second question.
Here's the definition from the Wiki - you'll notice by the way that there are no examples in there yet for these two functions, so they haven't been used much and I haven't used them at all yet.
Calling the function:
PHP Code:
int EnumProjectMarkers2(
void* proj # only needed if calling EnumProjectMarkers2
int idx # set this to the index of the region you
# want to return data about
bool* isrgn # ignore when calling
double* pos # ignore when calling
double* rgnend # ignore when calling
char** name # ignore when calling
int* markrgnindexnumber # ignore when calling
)
The parameters isrgn, pos, rgnend, name & markrgnindexnumber can all be ignored when calling these functions from Perl or Python using ReaScript.
Here's how I'd approach the function(s).
When these functions are called using C++ the functions return values in the parameter list - but ReaScript uses its return array to give values back to your Perl or Python script. Like this:
PHP Code:
(
$retval
$proj,
$idx,
$isrgn,
$pos,
$rgnend,
$name,
$markrgnindexnumber
) = EnumProjectMarkers2(
0, # the active project
1, # index number of the marker you want
undef, # use the undef keyword to make it obvious
undef, # that you're not specifying anything at this
undef, # point in the parameter list
undef,
undef
)
I've split the calls to EnumProjectMarkers2() over a few lines to make it easier to read, I've also missed the RPR_ from the function name as well - neither of which you can do in real life.
I'll have a go and see if I can get EnumProjectMarkers2 to play nicely...
|
|
|
|
05-01-2016, 05:12 AM
|
#4
|
Human being with feelings
Join Date: May 2016
Posts: 7
|
sorry for resurrecting this old thread, but this problem seems to still exists (for python).
Its possible to read everything but the names:
Python:
Code:
(retval, proj, index, isRgnOut, posOut, rgnEndOut, nameOut, markrgnindexnumberout) = RPR_EnumProjectMarkers2( 0,0, 0, 0, 0, 0, 0)
RPR_ShowConsoleMsg(nameOut);
nameOut is still 0.
To me that looks like a Bug. Any Ideas?
|
|
|
05-19-2020, 05:04 AM
|
#6
|
Human being with feelings
Join Date: Nov 2015
Location: Cologne
Posts: 1,636
|
bump. Any chance to get marker names in Python?
|
|
|
05-19-2020, 05:22 AM
|
#7
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
If it's still a bug, then it should be reported as such.
Can't check it myself, as I have no idea about Python at all..
|
|
|
05-19-2020, 05:40 AM
|
#8
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by Gass n Klang
bump. Any chance to get marker names in Python?
|
I tested this sometime ago and could confirm, in Python nameOut always returning 0 for RPR_EnumProjectMarkers2.
In this script is a workaround using SNM_GetProjectMarkerName (in SWS):
https://forums.cockos.com/showthread...29#post1341329
Last edited by nofish; 05-19-2020 at 05:59 AM.
|
|
|
05-19-2020, 11:55 PM
|
#9
|
Human being with feelings
Join Date: Oct 2017
Posts: 14
|
Yep, that bug still exists. The newer "GetTakeMarker()" function (not yet documented on https://www.reaper.fm/sdk/reascript/reascripthelp.html) accepts a string buffer reference and the buffer size as parameters ("nameOut" & "nameOut_sz"). I guess, that's what's needed here as well. But it would also mean to change the function parameter list which could lead to compatibility issues...
Code:
(Float retval, MediaItem_Take take, Int idx, String nameOut, Int nameOut_sz, Int colorOutOptional) = RPR_GetTakeMarker(take, idx, nameOut, nameOut_sz, colorOutOptional)
(from https://www.extremraym.com/cloud/rea...#GetTakeMarker)
EDIT:
Quote:
Originally Posted by nofish
|
For me personally, using SWS is not an option since I am developing on Linux.
|
|
|
05-20-2020, 05:39 AM
|
#11
|
Human being with feelings
Join Date: Oct 2017
Posts: 14
|
Quote:
Originally Posted by Meo-Ada Mespotine
|
Uh, nice to know, thanks!
|
|
|
05-20-2020, 06:11 AM
|
#12
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by sonovice
|
As a sidenote, I think that page hasn't been updated for quite some time now and imo Cockos should put a note there that it's outdated.
Maybe you know anyway, but the most up to date API doc you can get via letting it generate by Reaper itself (action list > ReaScript: Open reaScript documentation (html)...) also there are X-Raym's and Meo-Ada Mespotine's user made ones and more up to date than the above 'official' one.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:56 AM.
|