Esempio n. 1
0
int getMidiNumberFromModulator(CtrlrModulator *m)
{
	if (m == 0 || m->getMidiMessagePtr() == 0)
		return (-1);

	if (m->getMidiMessage().getMidiMessageArray().size() == 1)
	{
		return (getMidiNumberFromMidiMessage (m->getMidiMessage().getReference(0).m));
	}
	return (-1);
}
void CtrlrMidiInputComparatorSingle::match (const MidiMessage &m)
{
	messageContainer			= m;
	CtrlrMidiMessageType type	= midiMessageToType(m);
	int channel					= m.getChannel();
	int number					= getMidiNumberFromMidiMessage(m);

	if (cacheMatch(type, number, channel))
	{
		return;
	}

	if (type == SysEx)
	{
		matchSysEx(m);
		return;
	}

	CtrlrMidiMap &map = getMap(type);

	if (map.size() != 0)
	{
		CtrlrMidiMapIterator it = map.find (number);

		if (it != map.end())
		{
			for (int i=0; i < (*it).second.targets.size(); i++)
			{
				if (m.getChannel() == (*it).second.targets[i]->getMidiMessage().getChannel())
				{
					(*it).second.targets[i]->getProcessor().setValueFromMIDI (messageContainer);

					updateCache (type, it);
				}
			}
		}
	}
}