Go Back   Cockos Incorporated Forums > Projects > Deprecated REAPER issue tracker > Open Bug

API: MIDI_GetPPQPos_StartOfMeasure and MIDI_GetPPQPos_EndOfMeasure are broken Issue Tools
issueid=5428 11-20-2014 03:15 AM
Human being with feelings
API: MIDI_GetPPQPos_StartOfMeasure and MIDI_GetPPQPos_EndOfMeasure are broken
Both function return -1 at all times

Title and summary say it all. Both function always return -1.

Please fix this, it's hard enough for us to write stuff for MIDI without appropriate API (we still have to parse MIDI editor chunk since it contains stuff not accessible through API (filter settings, grid settings, zoom info etc...), not to mention we can't know all editable and visible items in MIDI editor (without parsing every track in the project, hardly efficient)) so at least help us by making sure existing API is operational.

Thank you!

Discussion thread: http://forum.cockos.com/showthread.php?t=150278
Issue Details
Issue Type Open Bug
Project Deprecated REAPER issue tracker
Category Plugins
Status Unconfirmed
Priority 1 - Highest
Affected Version 4.73
Fixed Version (none)
Users able to reproduce bug 1
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)

11-20-2014 09:40 AM
Human being with feelings
 
Alternative solution (didn't really test it too much):

Code:
double GetStartOfMeasure (MediaItem_Take* take, double ppqPos)
{
	if (take)
	{
		int measure;
		if (TimeMap2_timeToBeats(NULL, MIDI_GetProjTimeFromPPQPos(take, ppqPos), &measure, NULL, NULL, NULL) < SNM_FUDGE_FACTOR && measure > 0)
			--measure;
		return MIDI_GetPPQPosFromProjTime(take, TimeMap2_beatsToTime(NULL, 0, &measure));
	}
	return -1;
}

double GetEndOfMeasure (MediaItem_Take* take, double ppqPos)
{
	if (take)
	{
		int measure;
		TimeMap2_timeToBeats(NULL, MIDI_GetProjTimeFromPPQPos(take, ppqPos), &measure, NULL, NULL, NULL);
		++measure;
		return MIDI_GetPPQPosFromProjTime(take, TimeMap2_beatsToTime(NULL, 0, &measure));
	}
	return -1;
}
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT -7. The time now is 03:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.