Old 09-14-2014, 06:09 AM   #1
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default Obtaining and using media item and take GUIDs

There's an API function to get the Track GUID and a function to get a Take from a Take GUID, but is there a way to get the Item and Take GUIDs and the Item number from an Item GUID at all please?

By GUID I'm meaning the ID number stored in the RPP file, the Item and Take numbers returned in EEL change each time a project is loaded and I can't reference an item across project loads without these.

Many thanks.
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-16-2014, 10:30 AM   #2
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Can anyone offer any assistance here at all please? I need the means to access a MediaItemTake GUID from its pointer to ensure I'm dealing with the same take across project loads.

REAPER generates new and different item and take pointers on each load of a project. I can't progress any further without this function. There seems to be a lot of "Do not use this function in ReaScript"/ Beyond here lie monsters talk in the Wiki.

Anybody please?


>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-17-2014, 01:21 AM   #3
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by planetnine View Post
I need the means to access a MediaItemTake GUID from its pointer to ensure I'm dealing with the same take across project loads.
>

For some reason, there isn't a function in ReaScript API to get a takeGUID from a take pointer. We would need something like:

GetSetMediaItemTakeInfo_String(take, "GUID", #retguid, 0);



...but again, there's a REAPER API function to get/set it:


http://wiki.cockos.com/wiki/index.ph...iaItemTakeInfo
Code:
GetSetMediaItemTakeInfo()

void * GetSetMediaItemTakeInfo(MediaItem_Take *tk, const char *parmname, void *setNewValue)
get (or set) different take parameters
"P_TRACK" : pointer to MediaTrack (read-only)
"P_ITEM" : pointer to MediaItem (read-only)
"P_NAME" : char * to take name
"P_SOURCE" : PCM_source *. Note that if setting this, you should first retrieve the old source, set the new, THEN delete the old.
"D_STARTOFFS" : double *, start offset in take of item
"D_VOL" : double *, take volume
"D_PAN" : double *, take pan
"D_PANLAW" : double *, take pan law (-1.0=default, 0.5=-6dB, 1.0=+0dB, etc)
"D_PLAYRATE" : double *, take play rate (1.0=normal, 2.0=doublespeed, etc)
"D_PITCH" : double *, take pitch adjust (in semitones, 0.0=normal, +12 = one octave up, etc)
"B_PPITCH", bool *, "preserve pitch when changing rate"
"I_CHANMODE", int *, channel mode (0=normal, 1=revstereo, 2=downmix, 3=l, 4=r)
"I_PITCHMODE", int *, pitch shifter mode, -1=proj default, otherwise high word=shifter low word = parameter
"GUID" : GUID * : 16-byte GUID, can query or update
spk77 is offline   Reply With Quote
Old 09-17-2014, 03:06 AM   #4
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Thanks spk, that should do it.

I'm glad you found this, the parameter listing isn't in the REAPER-generated API listing.

Back to work now...



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-17-2014, 03:18 AM   #5
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by planetnine View Post
Thanks spk, that should do it.

I'm glad you found this, the parameter listing isn't in the REAPER-generated API listing.

Back to work now...



>
Oh, I meant that there isn't a ReaScript API (EEL/Python) function to get the takeGUID, but there is a Reaper API (C++) function to get takeGUIDs. So, someone at Cockos should first make it available for EEL/Python also. Sorry, it's sometimes hard to explain in English
spk77 is offline   Reply With Quote
Old 09-17-2014, 04:22 AM   #6
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Heyup spk, it's: GetSetMediaItemTakeInfo_String(MediaItem_Take* tk, "parmname", #stringNeedBig, bool setnewvalue)

That caught me out, as expected with the lack of EEL/Python function, REAPER was throwing back "undefined" with GetSetMediaItemTakeInfo, but using "GUID" as the parameter name works, or at least I'm getting a constant 16-byte string of something...


>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-17-2014, 05:33 AM   #7
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

...which I don't seem to be able to do anything with.


The string is not readable with "GetMediaItemTakeByGUID" and the stringToGuid and guidToString functions won't convert it to something useful.

I want to store the reference to a take in some way that survives the project being reloaded. Using the take GUID seems to be the answer, but I think I'm working with an incomplete set of tools here.


Ok devs, I'm close to giving up, what am I missing here please..?


>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-17-2014, 01:40 PM   #8
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Heh, a bit convoluted, but I've cracked it


- Get the 16-byte string from GetSetMediaItemTakeInfo_String
- Take the value of each character and turn it into a hex string (eg 3A)
- Reorder the bytes to 04,03,02,01, 06,05, 08,07, 09,10, 11,12,13,14,15,16
- Put hyphens in the gaps and enclose it with {braces}

This can then be stored as a readable string (like in RPP files) for any subsequent file load, when...


...bung this string at GetMediaItemTakeByGUID for the take pointer and GetMediItemTake_Item for the item pointer.

That was hard work, can we document it ? (esp the byte order and the format)


Justin will come along now and show me a two-line method



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-17-2014, 02:08 PM   #9
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by planetnine View Post
Heh, a bit convoluted, but I've cracked it


- Get the 16-byte string from GetSetMediaItemTakeInfo_String
- Take the value of each character and turn it into a hex string (eg 3A)
- Reorder the bytes to 04,03,02,01, 06,05, 08,07, 09,10, 11,12,13,14,15,16
- Put hyphens in the gaps and enclose it with {braces}

This can then be stored as a readable string (like in RPP files) for any subsequent file load, when...


...bung this string at GetMediaItemTakeByGUID for the take pointer and GetMediItemTake_Item for the item pointer.

That was hard work, can we document it ? (esp the byte order and the format)


Justin will come along now and show me a two-line method



>
Well that wasn't very easy!

(How the h... did you solve the "byte order" -thing...I can't understand )
spk77 is offline   Reply With Quote
Old 09-17-2014, 03:34 PM   #10
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Quote:
Originally Posted by spk77 View Post
Well that wasn't very easy!

(How the h... did you solve the "byte order" -thing...I can't understand )

The same way that you solve problems like this -I loaded the project file into NP++ and identified the items and takes, and I had a script give me space delimited hex strings as I selected the takes and I looked for patterns.

The end of the GUID is 1:1 mapping and quite easy to spot, but the first eight are inverted-order in groups of 4, 2 and 2. Once I found that mapping and a few other inspections confirmed it, it was just a dozen or so lines to pick the bytes out and append them to the new GUID string in the correct order, curly bracket at each end and hyphens where they're needed. I copied the format in the RPP files as the GetMediaItemTakeByGUID didn't accept it otherwise.

It was tedious and it's taken me a few days, but I should have some example code posted shortly once I've applied it and tidied it up.



Thanks for your help as usual spk, I wouldn't have got this moving without your input.

Was it you that wrote the NP++ EEL2 language config? If so I can't thank you enough for your work (I have converted it to white background). I'd have gone insane without it to highlight function name mis-spellings and bracket pairing/folding issues.

Need some sleep now, I'll continue with this code again tomorrow.



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-19-2014, 08:12 AM   #11
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by planetnine View Post
The same way that you solve problems like this -I loaded the project file into NP++ and identified the items and takes, and I had a script give me space delimited hex strings as I selected the takes and I looked for patterns.

The end of the GUID is 1:1 mapping and quite easy to spot, but the first eight are inverted-order in groups of 4, 2 and 2. Once I found that mapping and a few other inspections confirmed it, it was just a dozen or so lines to pick the bytes out and append them to the new GUID string in the correct order, curly bracket at each end and hyphens where they're needed. I copied the format in the RPP files as the GetMediaItemTakeByGUID didn't accept it otherwise.

It was tedious and it's taken me a few days, but I should have some example code posted shortly once I've applied it and tidied it up.



Thanks for your help as usual spk, I wouldn't have got this moving without your input.

Was it you that wrote the NP++ EEL2 language config? If so I can't thank you enough for your work (I have converted it to white background). I'd have gone insane without it to highlight function name mis-spellings and bracket pairing/folding issues.

Need some sleep now, I'll continue with this code again tomorrow.



>
NP++ EEL2 language config is based on Tale's "JSFX dark" language file. I just copied the function names from the auto-generated help file, added them as keywords, did some string replacing etc.

Planetnine, if you have time, could you please test if this function name completion for EEL2 file works on your computer?

https://stash.reaper.fm/21843/EEL2.xml

It's not a language file (it has the same name as the language file I posted before). It should be placed into Notepad++\plugins\APIs\ (f.ex C:\Program Files\Notepad++\plugins\APIs\EEL2.xml)



"Parameter hints" and "function description" are also possible - that would need a parser, no one is going to get/write all descriptions manually from the auto-generated help file

Note:
Only AddProjectMarker has "function name completion", "parameter hinting" + "function description" (see the lines 7-14 in the file I posted)






EDIT:
I think that there has to be a user defined language named "EEL2" to make this work. (or the file I posted has to be renamed)

line 126 in my userDefineLang.xml (C:\Documents and Settings\Omistaja\Application Data\Notepad++\userDefineLang.xml)


Last edited by spk77; 09-19-2014 at 08:45 AM.
spk77 is offline   Reply With Quote
Old 09-19-2014, 02:32 PM   #12
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Only just seen this spk, I'll have a go tomorrow on the laptop


>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-20-2014, 10:13 AM   #13
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

I had to enable a few things in NP++ Prefs to get this going, but I have the funcion names coming up and I get the "hint" for "AddProjectMarker" as soon as I open the parameter brackets.

This could be very useful if the effort could be put in to input all the information. How many functions in EEL2 plus the API, do you reckon?

I'll start looking under the bonnet at what you've done tonight if I get the time



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-20-2014, 10:23 AM   #14
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by planetnine View Post
How many functions in EEL2 plus the API, do you reckon?
587. I just prepared something similar for ReaSyntax but it will also fills in the parameters (something I dearly missed from Visual Studio)
Will push it soon.
Breeder is offline   Reply With Quote
Old 09-20-2014, 12:26 PM   #15
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Quote:
Originally Posted by Breeder View Post
587. I just prepared something similar for ReaSyntax but it will also fills in the parameters (something I dearly missed from Visual Studio)
Will push it soon.

587 -I'm guessing it was a bit of a job then. What other fields did you include? Do you have the list in a format that could be useful to spk at all please Breeder?

When he said we needed a parser I thought "yes, it might save a couple of hours typing", but that would send people a bit loopy.

What is it you've done then? It all seems to have gone a bit quiet with Jeffos in the dev team now, I bet you don't have a lot of spare time now.


Edit: I've just seen it. I've been using NP++ for EEL, I'll have to try it...



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 09-20-2014, 12:41 PM   #16
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Autocomplete file looks like this (first two functions):

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
  <AutoComplete>
    <Environment ignoreCase="no" startFunc="(" stopFunc=")" paramSeparator="," terminal=";" additionalWordChar = ""/>
    
    <KeyWord name="AddMediaItemToTrack" func="yes">
      <Overload retVal="MediaItem*" descr="Creates a new media item." >
        <Param name="MediaTrack* tr" />
      </Overload>
    </KeyWord>
    
    <KeyWord name="AddProjectMarker" func="yes">
      <Overload retVal="int" descr="Returns the index of the created marker/region, or -1 on failure.&#x0a;&#x0a;Supply wantidx>=0 if you want a particular index number,&#x0a;but you'll get a different index number a region and wantidx is already in use." >
        <Param name="ReaProject* proj" />
        <Param name="bool isrgn" />
        <Param name="&quot;name&quot;" />
        <Param name="int wantidx" />
      </Overload>
    </KeyWord>
  
  </AutoComplete>
</NotepadPlus>
spk77 is offline   Reply With Quote
Old 09-26-2014, 12:16 PM   #17
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by planetnine View Post
587 -I'm guessing it was a bit of a job then. What other fields did you include? Do you have the list in a format that could be useful to spk at all please Breeder?
A bit of regex and some multiple cursors fun was all it took

You can find all the lists here (look for sublime-completions files):
https://github.com/Breeder/ReaSyntax
Breeder is offline   Reply With Quote
Old 11-18-2014, 11:54 PM   #18
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

planetnine, I think you forgot to post the function oh well, guess I gotta create it from scratch!


found the problem! i needed to add "02" inbetween each %X, or else zeros during the conversion would be removed. If you put just "2" then zeros become spaces.
Code:
function GetMediaItemTakeGUID(take) local(guid)
(
  GetSetMediaItemTakeInfo_String(take, "GUID", guid, 0);
  sprintf(#,"{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X02%02X}",
    str_getchar(guid, 3 ),
    str_getchar(guid, 2 ),
    str_getchar(guid, 1 ),
    str_getchar(guid, 0 ),
    str_getchar(guid, 5 ),
    str_getchar(guid, 4 ),
    str_getchar(guid, 7 ),
    str_getchar(guid, 6 ),
    str_getchar(guid, 8 ),
    str_getchar(guid, 9 ),
    str_getchar(guid, 10),
    str_getchar(guid, 11),
    str_getchar(guid, 12),
    str_getchar(guid, 13),
    str_getchar(guid, 14),
    str_getchar(guid, 15)
  );  
);

item = GetSelectedMediaItem(0, 0);
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 0)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 1)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 2)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 3)));
ShowConsoleMsg("\n");

Quote:
Originally Posted by old content
possible output:
Code:
{9AC7F430-98B4-4053-ACC7-3C1B8B6A4BEB}
{D9AF89BE-E817-4C83-862C-804B3F6EDBF}
{7F9567D4-ECA9-40B4-B050-D5F065FA21E3}
{70B2633E-6A48-46C2-80AD-B3439041E37A}
wait what? something is wrong.............wtf
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 11-19-2014 at 08:38 PM.
Argitoth is offline   Reply With Quote
Old 11-19-2014, 09:40 AM   #19
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

alright screw all this **** I'm doing string functions!

Code:
function substrcmp(needle,haystack,offset) local(lenN) (
  strcmp(needle,strcpy_substr(#, haystack, offset, strlen(needle))) == 0 ? 1 : 0;
);
function findstrpos(needle,haystack,offset,ntimes) local(i found len) (
  found=0;
  i=offset;
  len = strlen(haystack);
  while(i < len && found < ntimes) (
    substrcmp(needle,haystack,i) ? found +=1;
    i+=1;
  );
  i;
);
function GetTakeGUID(take) local(n i found item XML output s1 s2 s3 substr start end) (
  XML=0; s1=1; s2=2; s3=3; GUID=4; substr=5;
  GetSetItemState(GetMediaItemTake_Item(take), XML);
  len = strlen(XML);
  n = GetMediaItemTakeInfo_Value(take, "IP_TAKENUMBER");
  n == 0 ? (
    match("%s\n%SGUID %S\n%s",XML,s1,s2,GUID,s3)
  ):(
    start = findstrpos(">\nTAKE",XML,0,n);
    end = findstrpos(">\nTAKE",XML,start,1);
    strcpy_substr(substr, XML, start, end-start);
    match("%s\n%SGUID %S\n%s",substr,s1,s2,GUID,s3);
  );
  GUID;
);

item = GetSelectedMediaItem(0, 0);
i=0;
loop(CountTakes(item),i+=1;
  ShowConsoleMsg( sprintf(#,"%s\n", GetTakeGUID(GetTake(item, 0))) );
);
possible output
Code:
{D0F3D408-517E-4515-B41E-B43158BF15BD}
{6C89189E-2278-4C54-B1E3-76DA66D13D56}
{096F6BD1-E0C5-447D-A306-E7A68B85795B}
{D0F3D408-517E-4515-B41E-B43158BF15BD}
THERE! JEEZ.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 11-19-2014, 03:53 PM   #20
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

Argitoth, have a look in this "Item Marker Tool" script for the methods I used: https://stash.reaper.fm/v/22302/PL9-I...s%20beta07.eel


The functions read_mkr_header(), store header() and especially hex_vers_guid() will show you the methods I used.



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 11-19-2014, 04:33 PM   #21
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

hey planetnine, thanks! I looked at your code, the only difference is I was using format "%X" while you were using "%02X".

I fixed and updated my code, check it out! It's a lot more compact. nudge nudge
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 11-19-2014 at 04:39 PM.
Argitoth is offline   Reply With Quote
Old 10-18-2016, 10:48 AM   #22
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Quote:
Originally Posted by Argitoth View Post
planetnine, I think you forgot to post the function oh well, guess I gotta create it from scratch!


found the problem! i needed to add "02" inbetween each %X, or else zeros during the conversion would be removed. If you put just "2" then zeros become spaces.
Code:
function GetMediaItemTakeGUID(take) local(guid)
(
  GetSetMediaItemTakeInfo_String(take, "GUID", guid, 0);
  sprintf(#,"{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X02%02X}",
    str_getchar(guid, 3 ),
    str_getchar(guid, 2 ),
    str_getchar(guid, 1 ),
    str_getchar(guid, 0 ),
    str_getchar(guid, 5 ),
    str_getchar(guid, 4 ),
    str_getchar(guid, 7 ),
    str_getchar(guid, 6 ),
    str_getchar(guid, 8 ),
    str_getchar(guid, 9 ),
    str_getchar(guid, 10),
    str_getchar(guid, 11),
    str_getchar(guid, 12),
    str_getchar(guid, 13),
    str_getchar(guid, 14),
    str_getchar(guid, 15)
  );  
);

item = GetSelectedMediaItem(0, 0);
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 0)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 1)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 2)));
ShowConsoleMsg("\n");
ShowConsoleMsg(GetMediaItemTakeGUID(GetTake(item, 3)));
ShowConsoleMsg("\n");


This actually doesn't work properly - needs a very small change.

You have to tell str_getchar that the character is unsigned with " 'cu' ".

(oh and there was a typo there too )

Code:
function GetMediaItemTakeGUID(take,stringout) local(guid) //Thanks to Argitoth and Planetnine!!
(
  GetSetMediaItemTakeInfo_String(take, "GUID", #GUID, 0);
  sprintf(stringout,"{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
    str_getchar(#guid, 3 , 'cu'),
    str_getchar(#guid, 2 , 'cu'),
    str_getchar(#guid, 1 , 'cu'),
    str_getchar(#guid, 0 , 'cu'),
    str_getchar(#guid, 5 , 'cu'),
    str_getchar(#guid, 4 , 'cu'),
    str_getchar(#guid, 7 , 'cu'),
    str_getchar(#guid, 6 , 'cu'),
    str_getchar(#guid, 8 , 'cu'),
    str_getchar(#guid, 9 , 'cu'),
    str_getchar(#guid, 10, 'cu'),
    str_getchar(#guid, 11, 'cu'),
    str_getchar(#guid, 12, 'cu'),
    str_getchar(#guid, 13, 'cu'),
    str_getchar(#guid, 14, 'cu'),
    str_getchar(#guid, 15, 'cu')
  );
   
);


*hmmm. I'm getting a bug with the above function. it works (by working I mean matching Breeders API function exactly) 99% of the time. It just randomly fails on certain takes. Or, so far, exactly 1 take. quite weird.

Really trying to make my script not have any dependencies on the end user having sws installed.

Last edited by James HE; 10-18-2016 at 01:34 PM.
James HE is offline   Reply With Quote
Old 10-18-2016, 04:01 PM   #23
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,926
Default

James, work your way up the thread and find the link I gave Argitoth for the code I use for this. It works for me, can't remember if I tried his version, it's a while ago



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is online now   Reply With Quote
Old 10-18-2016, 06:25 PM   #24
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Quote:
Originally Posted by planetnine View Post
James, work your way up the thread and find the link I gave Argitoth for the code I use for this. It works for me, can't remember if I tried his version, it's a while ago



>

Yeah - that's where I got the clue that str_getchar needed to look for unsigned characters.

If I "clear" the #GUID string with #GUID=""; at the beginning of the function, I do not get that error, So all is well! One of those EEL oddities I guess.
James HE 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:29 AM.


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