// flags&1=incl. items, &2=incl. markers/regions, &4=incl. envelopes double SNM_GetProjectLength(int _flags) { double prjlen = 0.0, pos, end; if (_flags&2) { int x=0; bool isRgn; while ((x = EnumProjectMarkers2(NULL, x, &isRgn, &pos, &end, NULL, NULL))) { if (isRgn) { if (end > prjlen) prjlen = end; } else { if (pos > prjlen) prjlen = pos; } } } if ((_flags&1) || (_flags&4)) { double len; for (int i=0; i <= GetNumTracks(); i++) { if (MediaTrack* tr = CSurf_TrackFromID(i, false)) { int cnt= i>0 ? GetTrackNumMediaItems(tr) : 0; // skip master if (_flags&1) for (int j=0; j<cnt; j++) { if (MediaItem* item = GetTrackMediaItem(tr,j)) { pos = *(double*)GetSetMediaItemInfo(item, "D_POSITION", NULL); len = *(double*)GetSetMediaItemInfo(item, "D_LENGTH", NULL); if ((pos+len)>prjlen) prjlen = pos+len; } } cnt=CountTrackEnvelopes(tr); if (_flags&4) for (int j=0; j<cnt; j++) { if (TrackEnvelope* env = GetTrackEnvelope(tr,j)) { if (int ptcnt=CountEnvelopePoints(env)) { pos=prjlen; GetEnvelopePoint(env, ptcnt-1, &pos, NULL, NULL, NULL, NULL); if (pos>prjlen) prjlen = pos; } } } } } } return prjlen; }
"Write MRP_Array to disk as a 32 bit floating point mono wav file" ); function_entry MRP_CalculateEnvelopeHash("int", "TrackEnvelope*", "env", [](params) { TrackEnvelope* env = (TrackEnvelope*)arg[0]; if (env == nullptr) return_null; int numpoints = CountEnvelopePoints(env); size_t seed = 0; for (int i = 0; i < numpoints; ++i) { double pt_time = 0.0; double pt_val = 0.0; double pt_tension = 0.0; int pt_shape = 0; GetEnvelopePoint(env, i, &pt_time, &pt_val, &pt_shape, &pt_tension, nullptr); hash_combine(seed, pt_time); hash_combine(seed, pt_val); hash_combine(seed, pt_tension); hash_combine(seed, pt_shape); } return_int((int)seed); }, "This <i>function</i> isn't really <b>correct...</b> it calculates a 64 bit hash " "but returns it as a 32 bit int. Should reimplement this. " "Or rather, even more confusingly : The hash will be 32 bit when building " "for 32 bit architecture and 64 bit when building for 64 bit architecture! " "It comes down to how size_t is of different size between the 32 and 64 bit " "architectures." );