Example #1
0
// return a bitmask: &SNM_MARKER_MASK: marker update, &SNM_REGION_MASK: region update
int UpdateMarkerRegionCache()
{
	int updateFlags=0;
	int i=0, x=0, num, col; double pos, rgnend; const char* name; bool isRgn;

	// added/updated markers/regions?
	while ((x = EnumProjectMarkers3(NULL, x, &isRgn, &pos, &rgnend, &name, &num, &col)))
	{
		MarkerRegion* m = g_mkrRgnCache.Get(i);
		if (!m || (m && !m->Compare(isRgn, pos, rgnend, name, num, col)))
		{
			if (m) g_mkrRgnCache.Delete(i, true);
			g_mkrRgnCache.Insert(i, new MarkerRegion(isRgn, pos, rgnend, name, num, col));
			updateFlags |= (isRgn ? SNM_REGION_MASK : SNM_MARKER_MASK);
		}
		i++;
	}
	// removed markers/regions?
	for (int j=g_mkrRgnCache.GetSize()-1; j>=i; j--) {
		if (MarkerRegion* m = g_mkrRgnCache.Get(j))
			updateFlags |= (m->IsRegion() ? SNM_REGION_MASK : SNM_MARKER_MASK);
		g_mkrRgnCache.Delete(j, true);
	}
	// project time mode update?
	static int sPrevTimemode = *(int*)GetConfigVar("projtimemode");
	if (updateFlags != (SNM_MARKER_MASK|SNM_REGION_MASK))
		if (int* timemode = (int*)GetConfigVar("projtimemode"))
			if (*timemode != sPrevTimemode) {
				sPrevTimemode = *timemode;
				return SNM_MARKER_MASK|SNM_REGION_MASK;
			}
	return updateFlags;
}
Example #2
0
bool OscInit(OscHandler* osc)
{
  KillOscThread();
  if (s_osc_handlers.Find(osc) < 0)
  {
    // insert at the top, so new listeners will block existing handlers
    s_osc_handlers.Insert(0, osc);
  }

  StartOscThread();
  return true;
}