Old 02-04-2010, 10:54 PM   #1
edwar64896
Human being with feelings
 
Join Date: May 2009
Location: Melbourne, Australia
Posts: 5
Default 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
edwar64896 is offline   Reply With Quote
Old 02-05-2010, 05:14 AM   #2
MikeLacey
Human being with feelings
 
Join Date: Dec 2006
Location: UK
Posts: 762
Default

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(
 
voidproj               # only needed if calling EnumProjectMarkers2
 
int idx                  # set this to the index of the region you
                          # want to return data about
 
boolisrgn              # ignore when calling
 
doublepos              # ignore when calling
 
doublergnend           # ignore when calling
 
char** name              # ignore when calling
 
intmarkrgnindexnumber  # 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
MikeLacey is offline   Reply With Quote
Old 02-18-2010, 08:58 PM   #3
hedge
Human being with feelings
 
Join Date: Sep 2008
Posts: 4
Default

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 View Post
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(
 
voidproj               # only needed if calling EnumProjectMarkers2
 
int idx                  # set this to the index of the region you
                          # want to return data about
 
boolisrgn              # ignore when calling
 
doublepos              # ignore when calling
 
doublergnend           # ignore when calling
 
char** name              # ignore when calling
 
intmarkrgnindexnumber  # 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...
hedge is offline   Reply With Quote
Old 05-01-2016, 05:12 AM   #4
KingNothing
Human being with feelings
 
Join Date: May 2016
Posts: 7
Default

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?
KingNothing is offline   Reply With Quote
Old 05-03-2016, 09:29 AM   #5
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Look in script request sticky about #480 or so. timlloyd helped me with that once. (#487)

http://forums.cockos.com/showthread.php?p=1345827
FnA is offline   Reply With Quote
Old 05-19-2020, 05:04 AM   #6
Gass n Klang
Human being with feelings
 
Gass n Klang's Avatar
 
Join Date: Nov 2015
Location: Detmold - Germany
Posts: 651
Default

bump. Any chance to get marker names in Python?
__________________
https://gassnklang.de
Gass n Klang is offline   Reply With Quote
Old 05-19-2020, 05:22 AM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 279
Default

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..
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-19-2020, 05:40 AM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,635
Default

Quote:
Originally Posted by Gass n Klang View Post
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.
nofish is offline   Reply With Quote
Old 05-19-2020, 11:55 PM   #9
sonovice
Human being with feelings
 
Join Date: Oct 2017
Posts: 13
Default

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 View Post
In this script is a workaround using SNM_GetProjectMarkerName (in SWS):
https://forums.cockos.com/showthread...29#post1341329
For me personally, using SWS is not an option since I am developing on Linux.
sonovice is offline   Reply With Quote
Old 05-20-2020, 04:55 AM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 279
Default

There are Linux builds of SWS, afaik.They are on the pre-release downloads page of SWS.

Edit: https://www.sws-extension.org/download/pre-release/
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-20-2020, 05:39 AM   #11
sonovice
Human being with feelings
 
Join Date: Oct 2017
Posts: 13
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
There are Linux builds of SWS, afaik.They are on the pre-release downloads page of SWS.

Edit: https://www.sws-extension.org/download/pre-release/
Uh, nice to know, thanks!
sonovice is offline   Reply With Quote
Old 05-20-2020, 06:11 AM   #12
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,635
Default

Quote:
Originally Posted by sonovice View Post
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.
nofish is offline   Reply With Quote
Old 05-20-2020, 10:03 AM   #13
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 279
Default

Wrote a bugreport on that one:

https://forum.cockos.com/showthread....96#post2291096

Please chime in over there.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine 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 07:13 AM.


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