Example #1
0
void SelNextRegion(COMMAND_T*)
{
	double dCurPos, d2;
	GetSet_LoopTimeRange(false, true, &dCurPos, &d2, false);
	if (dCurPos == d2)
		dCurPos = GetCursorPosition();

	int x = 0;
	bool bReg;
	double dRegStart;
	double dRegEnd;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg && dRegStart > dCurPos)
		{
			GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
			return;
		}
	}
	// Nothing found, loop again and set to first region
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg)
		{
			GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
			return;
		}
	}
}
Example #2
0
void SelPrevRegion(COMMAND_T*)
{
	double dCurPos, d2;
	GetSet_LoopTimeRange(false, true, &dCurPos, &d2, false);
	if (dCurPos == d2)
		dCurPos = GetCursorPosition();

	int x = 0;
	bool bReg;
	double d1, dRegStart, dRegEnd;
	bool bFound = false;
	bool bRegions = false;
	while ((x = EnumProjectMarkers(x, &bReg, &d1, &d2, NULL, NULL)))
	{
		if (bReg)
		{
			bRegions = true;
			if (dCurPos > d1)
			{
				dRegStart = d1;
				dRegEnd = d2;
				bFound = true;
			}
		}
	}
	if (bFound)
		GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
	else if (bRegions)
		GetSet_LoopTimeRange(true, true, &d1, &d2, false);
}
Example #3
0
void MarkerActionTimer()
{
	static double dLastPos = 0.0;
	static double dUsualPosDelta = 0.050;
	if (g_bMAEnabled && GetPlayState() & 1)
	{
		double dPlayPos = GetPlayPosition();
		double dDelta = dPlayPos - dLastPos;
		// Ignore markers when the play state seems to have jumped forward or backwards
		if (dDelta > 0.0 && dDelta < dUsualPosDelta * 5.0)
		{
			// Quick and dirty IIR
			dUsualPosDelta = dUsualPosDelta * 0.99 + dDelta * 0.01;
			int x = 0;
			const char* cName;
			double dMarkerPos;
			// Look for markers with '!' as the first char with the right time
			while ((x = EnumProjectMarkers(x, NULL, &dMarkerPos, NULL, &cName, NULL)))
				if (dMarkerPos >= dLastPos && dMarkerPos < dPlayPos)
					RunActionMarker(cName);
		}
		dLastPos = dPlayPos;
	}
	else
		dLastPos = GetCursorPosition();
}
Example #4
0
void MarkerActionRunUnderCursor(COMMAND_T*)
{
	if (!g_bMAEnabled)
		return;

	int x = 0;
	const char* cName;
	double dMarkerPos;
	double dCurPos = GetCursorPosition();
	// Look for markers with '!' as the first char with the right time
	while ((x = EnumProjectMarkers(x, NULL, &dMarkerPos, NULL, &cName, NULL)))
		if (dMarkerPos == dCurPos)
			RunActionMarker(cName);
}
Example #5
0
void MarkerList::UpdateReaper()
{	// Function to take content of list and update Reaper environment
	// First delete all markers/regions, then regen from list
	bool bReg;
	int iID;
	while (EnumProjectMarkers(0, &bReg, NULL, NULL, NULL, &iID))
		DeleteProjectMarker(NULL, iID, bReg);

	SWS_SectionLock lock(&m_mutex);

	for (int i = 0; i < m_items.GetSize(); i++)
		m_items.Get(i)->AddToProject();

	UpdateTimeline();
}
Example #6
0
void DeleteAllMarkers()
{
	bool bReg;
	int iID;
	int x = 0, lastx = 0;
	while ((x = EnumProjectMarkers(x, &bReg, NULL, NULL, NULL, &iID)))
	{
		if (!bReg)
		{
			DeleteProjectMarker(NULL, iID, false);
			x = lastx;
		}
		lastx = x;
	}
}
Example #7
0
// Goto the end of the project, *including* perhaps marker ends
void GotoEndInclMarkers(COMMAND_T*)
{
	Main_OnCommand(40043, 0);
	int x = 0;
	double dRegStart, dRegEnd;
	bool bReg;
	double dMarkerEnd = -DBL_MAX;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg && dRegEnd > dMarkerEnd)
			dMarkerEnd = dRegEnd;
		else if (!bReg && dRegStart > dMarkerEnd)
			dMarkerEnd = dRegStart;
	}
	if (dMarkerEnd > GetCursorPosition())
		SetEditCurPos(dMarkerEnd, true, true);
}
Example #8
0
void SelNextMarkerOrRegion(COMMAND_T*)
{
	double dCurPos = GetCursorPosition();
	double dCurStart, dCurEnd, dRegStart, dRegEnd;
	GetSet_LoopTimeRange(false, false, &dCurStart, &dCurEnd, false);
	int x = 0;
	bool bReg;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		bool bSelMatches = dCurStart == dRegStart && dCurEnd == dRegEnd;
		if (dRegStart > dCurPos || (bReg && dRegStart >= dCurPos && !bSelMatches))
		{
			GetSet_LoopTimeRange(true, false, &dRegStart, bReg ? &dRegEnd : &dRegStart, false);
			SetEditCurPos(dRegStart, true, true);
			return;
		}
	}
	// Currently no wraparound, if needed add "go to first" here.
}