bool CtrlrMidiInputComparatorSingle::cacheMatchSysEx ()
{
	for (int i=0; i<cacheSysEx.size(); i++)
	{
		if (compareMemory(cacheSysEx[i].key.toMemoryBlock(), messageContainer.getData()))
		{
			for (int j=0; j<cacheSysEx[i].mapData.targets.size(); j++)
			{
				cacheSysEx[i].mapData.targets[j]->getProcessor().setValueFromMIDI (messageContainer);
			}

			return (true);
		}
	}
	return (false);
}
void CtrlrMidiInputComparatorSingle::matchSysEx(const MidiMessage &m)
{
	BigInteger bi = memoryToBits(MemoryBlock(m.getRawData(), m.getRawDataSize()));

	CtrlrMultiMidiMapIterator it;

	for (it=mapSysEx.begin(); it != mapSysEx.end(); it++)
	{
		if (compareMemory ((*it).first.toMemoryBlock(), messageContainer.getData()))
		{
			for (int i=0; i < (*it).second.targets.size(); i++)
			{
				(*it).second.targets[i]->getProcessor().setValueFromMIDI (messageContainer, source);
			}

			updateCacheSysEx (it);
			break;
		}
	}
}
bool CtrlrMidiInputComparatorMulti::cacheMatch ()
{
	bool match = false;

	for (int i=0; i<cache.size(); i++)
	{
		if (compareMemory(cache[i].key.toMemoryBlock(), messageContainer.getData()))
		{
			match = true;

			for (int j=0; j<cache[i].mapData.targets.size(); j++)
			{
				cache[i].mapData.targets[j]->getProcessor().setValueFromMIDI (messageContainer);
			}

			break;
		}
	}

	return (match);
}
void CtrlrMidiInputComparatorMulti::match (const MidiMessage &m)
{
	bool match = false;
	startTimer (200);

	if (!basicMatch(m))
	{
		updateState(match);
		return;
	}

	if (cacheMatch())
	{
		updateState(match);
		return;
	}

	BigInteger bi = memoryToBits(messageContainer.getData());
	CtrlrMultiMidiMapIterator it;

	for (it=map.begin(); it != map.end(); it++)
	{
		if (compareMemory ((*it).first.toMemoryBlock(), messageContainer.getData()))
		{
			match = true;

			for (int i=0; i < (*it).second.targets.size(); i++)
			{
				(*it).second.targets[i]->getProcessor().setValueFromMIDI (messageContainer);
			}

			updateCache (it);
			break;
		}
	}
	updateState(match);
}