示例#1
0
//==============================================================================
stepQuickEdit::stepQuickEdit (sklepSeqMainComponent *parent, myMidiMessage *msg)
    : typeCombo (0)
{
    addAndMakeVisible (typeCombo = new ComboBox (T("Type")));
    typeCombo->setTooltip (T("Type"));
    typeCombo->setEditableText (false);
    typeCombo->setJustificationType (Justification::centredLeft);
    typeCombo->setTextWhenNothingSelected (String::empty);
    typeCombo->setTextWhenNoChoicesAvailable (T("(no choices)"));
    typeCombo->addItem (T("Note On"), 1);
    typeCombo->addItem (T("Controller"), 2);
    typeCombo->addItem (T("SysEx"), 3);
    typeCombo->addItem (T("Program Change"), 4);
    typeCombo->addItem (T("MMC"), 5);
    typeCombo->addListener (this);


    //[UserPreSize]
	midiMessage		= msg;
	midiBuffer		= 0;

	editorComponent = 0;
	messageTypeChanged();
    //[/UserPreSize]

    setSize (128, 272);

    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}
示例#2
0
 void ConsoleGUI::onCheckBoxToggled(int state) {
   for(int i = 0; i < 5; ++i) {
     if(sender() == &buttons[i]) {
       emit messageTypeChanged(i, bool(state==2));
     }
   }
 }
示例#3
0
void stepQuickEdit::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
    //[UsercomboBoxChanged_Pre]
    //[/UsercomboBoxChanged_Pre]

    if (comboBoxThatHasChanged == typeCombo)
    {
        //[UserComboBoxCode_typeCombo] -- add your combo box handling code here..
		if (midiMessage == 0)
			return;

		switch (typeCombo->getSelectedId())
		{
			case noteOn:
				if (!midiMessage->isMulti())
				{
					if (!midiMessage->getMidiMessage())
						return;

					if (midiMessage->getMidiMessage()->isNoteOn())
					{
						midiMessage->setMidiMessage (*midiMessage->getMidiMessage());
					}
					else
					{
						midiMessage->setMidiMessage (MidiMessage::noteOn (1, 64, 1.0f));
					}
				}
				else
				{
					midiMessage->setMidiMessage (MidiMessage::noteOn (1, 64, 1.0f));
				}
				break;

			case Controller:
				if (!midiMessage->isMulti())
				{
					if (!midiMessage->getMidiMessage())
						return;

					if (midiMessage->getMidiMessage()->isController())
					{
						midiMessage->setMidiMessage (*midiMessage->getMidiMessage());
					}
					else
					{
						midiMessage->setMidiMessage (MidiMessage::controllerEvent (1, 1, 1));
					}
				}
				else
				{
					if (midiMessage->getMidiMessage()->isController())
					{
						if (!midiMessage->getMidiMessage())
							return;

						midiMessage->setMidiMessage (*midiMessage->getMidiMessage());
					}
					else
					{
						midiMessage->setMidiMessage (MidiMessage::controllerEvent (1, 1, 1));
					}
				}
				break;

			case ProgramChange:
				if (!midiMessage->getMidiMessage())
						return;

				if (midiMessage->getMidiMessage()->isProgramChange())
				{
					if (!midiMessage->getMidiMessage())
						return;

					midiMessage->setMidiMessage (*midiMessage->getMidiMessage());
				}
				else
				{
					midiMessage->setMidiMessage (MidiMessage::programChange (1, 1));
				}
				break;

			case SysEx:
				if (!midiMessage->getMidiMessage())
						return;

				if (midiMessage->getMidiMessage()->isSysEx())
				{
					if (!midiMessage->getMidiMessage())
						return;

					midiMessage->setMidiMessage (*midiMessage->getMidiMessage());
				}
				else
				{
					uint8 d[4];
					d[0] = 0xf0;
					d[1] = 0x00;
					d[2] = 0x0f;

					midiMessage->setMidiMessage (MidiMessage (d, 3, 0));
				}
				break;

			default:
				break;
		}

		messageTypeChanged();
        //[/UserComboBoxCode_typeCombo]
    }

    //[UsercomboBoxChanged_Post]
    //[/UsercomboBoxChanged_Post]
}