Beispiel #1
0
void
CDestination::Stack(
	CEvent &event,
	const CEventTask &task,
	CEventStack &stack,
	long duration)
{
	D_HOOK(("CDestination::Stack(%s, %ld)\n",
			event.NameText(), duration));

	event.stack.destination = this;

	// this does not seem to work, disable for release
//	event.stack.start -= (Latency() / 1000);
}
void
CPlaybackTaskGroup::_executeEvent(
	CEvent &ev,
	TimeState &tState)
{
	D_INTERNAL(("CPlaybackTaskGroup::_executeEvent(%s)\n",
				ev.NameText()));

	switch (ev.Command())
	{
		case EvtType_TaskMarker:
		{
			if (ev.task.taskPtr->flags & CPlaybackTask::Task_Finished)
			{
				delete ev.task.taskPtr;
				if (tasks.Empty())
				{
					BMessage message(Player_ChangeTransportState);
					be_app->PostMessage(&message);
				}
			}
			else
			{
				ev.task.taskPtr->Play();
			}
			return;
		}
		case EvtType_Interpolate:
		{
			// I was originally supposed to have executed at ev.Start() + timeStep,
			// but I may be a bit later than that -- take the difference into account.
			// Here's how much time has elapsed since I was dispatched...
			int32 elapsed = tState.time - ev.Start()
							+ ev.interpolate.timeStep;

			// If we went past the end, then clip the time.
			if ((unsigned long)elapsed > ev.interpolate.duration)
				elapsed = ev.interpolate.duration;

			CDestination *dest = ev.common.destination;
			if (dest != NULL)
			{
				if (dest->ReadLock(500))
				{
					dest->Interpolate(ev, tState.stack, system_time(),
									  elapsed);
					dest->ReadUnlock();
				}
			}
			return;
		}
	}

	CDestination *dest = ev.common.destination;
	if (dest != NULL)
	{
		if (dest->ReadLock(500))
		{
			dest->Execute(ev, system_time());
			dest->ReadUnlock();
		}
	}
}