I haven't checked if this actually works...
But something along these lines would get you the project's items' lengths and active take names...
Code:
void DoDumpItemDurationsandActiveTakeNames()
{
MediaTrack* TheTrack;
MediaItem* CurItem;
MediaItem_Take* CurTake;
int numItems=0;
char TempString[500];
for (int i=0;i<GetNumTracks();i++)
{
TheTrack= CSurf_TrackFromID(i+1,FALSE); // we get the pointer/handle to track using the CSurf API, i+1 comes from 0 being the master track, we don't expect items there
numItems=GetTrackNumMediaItems(TheTrack);
for (int j=0;j<numItems;j++)
{
CurItem = GetTrackMediaItem(TheTrack,j);
if (GetMediaItemNumTakes(CurItem)>0) // empty items don't have any takes, so following code could maybe crash without checking there are takes
{
CurTake=GetMediaItemTake(CurItem,-1); // -1 gets the active take
double ItemLength=*(double*)GetSetMediaItemInfo(CurItem,"D_LENGTH",NULL);
char *TakeName=(char*)GetSetMediaItemTakeInfo(CurTake,"P_NAME",NULL);
// format some kind of text output
sprintf(TempString,"Track %d item number %d active take has name %s and length %f",i+1,j+1,TakeName,ItemLength);
// we are super lazy and just output to the debug viewer
OutputDebugString(TempString);
}
}
}
}