Skip to content

Commit

Permalink
ReaScript: CF_EnumMediaSourceCues() - optionally get if a source cue …
Browse files Browse the repository at this point in the history
…is a chapter marker (REAPER v6.19+)
  • Loading branch information
nofishonfriday committed Dec 24, 2020
1 parent 145a007 commit 99a0d45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ReaScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ APIdef g_apidefs[] =
{ APIFUNC(CF_SetMediaSourceOnline), "void", "PCM_source*,bool", "src,set", "Set the online/offline status of the given source (closes files when set=false).", },
{ APIFUNC(CF_GetMediaSourceMetadata), "bool", "PCM_source*,const char*,char*,int", "src,name,out,out_sz", "Get the value of the given metadata field (eg. DESC, ORIG, ORIGREF, DATE, TIME, UMI, CODINGHISTORY for BWF).", },
{ APIFUNC(CF_GetMediaSourceRPP), "bool", "PCM_source*,char*,int", "src,fnOut,fnOut_sz", "Get the project associated with this source (BWF, subproject...).", },
{ APIFUNC(CF_EnumMediaSourceCues), "int", "PCM_source*,int,double*,double*,bool*,char*,int", "src,index,timeOut,endTimeOut,isRegionOut,nameOut,nameOut_sz", "Enumerate the source's media cues. Returns the next index or 0 when finished.", },
{ APIFUNC(CF_EnumMediaSourceCues), "int", "PCM_source*,int,double*,double*,bool*,char*,int,bool*", "src,index,timeOut,endTimeOut,isRegionOut,nameOut,nameOut_sz,isChapterOutOptional", "Enumerate the source's media cues. Returns the next index or 0 when finished.", },
{ APIFUNC(CF_ExportMediaSource), "bool", "PCM_source*,const char*", "src,fn", "Export the source to the given file (MIDI only).", },

{ NULL, } // denote end of table
Expand Down
5 changes: 4 additions & 1 deletion cfillion/cfillion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ bool CF_GetMediaSourceRPP(PCM_source *source, char *buf, const int bufSize)
}

int CF_EnumMediaSourceCues(PCM_source *source, const int index, double *time,
double *endTime, bool *isRegion, char *name, const int nameSize)
double *endTime, bool *isRegion, char *name, const int nameSize, bool *isChapter)
{
if(!source)
return 0;
Expand All @@ -367,6 +367,9 @@ int CF_EnumMediaSourceCues(PCM_source *source, const int index, double *time,
if(name && cue.m_name)
snprintf(name, nameSize, "%s", cue.m_name);

if (isChapter)
*isChapter = cue.m_flags & 4;

return add ? index + add : 0;
}

Expand Down
2 changes: 1 addition & 1 deletion cfillion/cfillion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ bool CF_GetMediaSourceOnline(PCM_source *);
void CF_SetMediaSourceOnline(PCM_source *, bool set);
bool CF_GetMediaSourceMetadata(PCM_source *, const char *name, char *buf, int bufSize);
bool CF_GetMediaSourceRPP(PCM_source *source, char *buf, const int bufSize);
int CF_EnumMediaSourceCues(PCM_source *source, const int index, double *time, double *endTime, bool *isRegion, char *name, const int nameSize);
int CF_EnumMediaSourceCues(PCM_source *source, const int index, double *time, double *endTime, bool *isRegion, char *name, const int nameSize, bool *isChapter);
bool CF_ExportMediaSource(PCM_source *source, const char *file);

0 comments on commit 99a0d45

Please sign in to comment.