Пример #1
0
void Mouse_Left_Midi_Ed(void)
{
    if(userscreen == USER_SCREEN_SETUP_MIDI)
    {
        // Save the data
        if(zcheckMouse(749, (Cur_Height - 142), 34, 16))
        {
            if(File_Exist_Req("%s"SLASH"%s.pmi", Dir_MidiCfg, Midi_Name))
            {
                Display_Requester(&Overwrite_Requester, GUI_CMD_SAVE_MIDI_CFG);
            }
            else
            {
                gui_action = GUI_CMD_SAVE_MIDI_CFG;
            }
        }

        // Start midi name input
        if(zcheckMouse(583, (Cur_Height - 142), 164, 16) && snamesel == INPUT_NONE)
        {
            snamesel = INPUT_MIDI_NAME;
            strcpy(cur_input_name, Midi_Name);
            namesize = 0;
            sprintf(Midi_Name, "");
            teac = UPDATE_MIDI_ED_CHANGE_NAME;
            gui_action = GUI_CMD_UPDATE_MIDI_ED;
        }

#if !defined(__NO_MIDI__)
        // Previous midi in device
        if(zcheckMouse(70, (Cur_Height - 134), 16, 16))
        {
            c_midiin--;
            gui_action = GUI_CMD_UPDATE_MIDI_ED;
            midiin_changed = 1;
            teac = UPDATE_MIDI_ED_SEL_IN;
        }
        // Next midi in device
        if(zcheckMouse(114, (Cur_Height - 134), 16, 16))
        {
            c_midiin++;
            gui_action = GUI_CMD_UPDATE_MIDI_ED;
            midiin_changed = 1;
            teac = UPDATE_MIDI_ED_SEL_IN;
        }

        // Previous midi out device
        if(zcheckMouse(70, (Cur_Height - 117), 16, 16))
        {
            c_midiout--;
            gui_action = GUI_CMD_UPDATE_MIDI_ED;
            midiout_changed = TRUE;
            teac = UPDATE_MIDI_ED_SEL_OUT;
        }
        // Next midi out device
        if(zcheckMouse(114, (Cur_Height - 117), 16, 16))
        {
            c_midiout++;
            gui_action = GUI_CMD_UPDATE_MIDI_ED;
            midiout_changed = TRUE;
            teac = UPDATE_MIDI_ED_SEL_OUT;
        }
#endif

        // Midi track notes off
#if !defined(__NO_MIDI__)
        if(zcheckMouse(12, (Cur_Height - 99), 82, 16) == 1 && c_midiout != -1)
        {
            Midi_NoteOff(Track_Under_Caret, -1);
            int i;
            for(i = 0; i < MAX_POLYPHONY; i++)
            {
                Midi_Current_Notes[CHAN_MIDI_PRG[Track_Under_Caret]][i] = 0;
            }
            gui_action = GUI_CMD_MIDI_NOTE_OFF_1_TRACK;
        }
#endif

        // All Midi notes off
#if !defined(__NO_MIDI__)
        if(zcheckMouse(12, (Cur_Height - 81), 82, 16) == 1 && c_midiout != -1)
        {
            Midi_AllNotesOff();
            gui_action = GUI_CMD_MIDI_NOTE_OFF_ALL_TRACKS;
        }
#endif

        Mod_Midi_Automation_Value(1);
    }
}
Пример #2
0
/*
 * OnCommand()
 */
void m_OnCommand(HWND setupDlg, int cmdID, HWND control, UINT notify)
{
    MMRESULT error;

    switch (cmdID) {
        case IDC_MIDI_TEST_BTN:
            if (Midi_NoteOn(m_midi, 60, 100) == MMSYSERR_NOERROR) {
                SleepEx(500, FALSE);
                Midi_NoteOff(m_midi, 60);
                SleepEx(50, FALSE);
            }
            break;
        case IDOK:
            /*
             * Copy the port names into the MIDI structure.  The combo boxes
             * need to be set again in case a midi open error occurred and
             * wound up disabling one of the ports.
             */
            ComboBox_SetCurSel(m_inPortCbo, m_midi->inPort + 1);
            ComboBox_SetCurSel(m_outPortCbo, m_midi->outPort + 1);
            ComboBox_SetCurSel(m_masterInPortCbo, m_midi->masterInPort + 1);
            ComboBox_GetText(m_inPortCbo, m_midi->inPortName
                    , MIDI_PORT_NAME_MAX);
            ComboBox_GetText(m_outPortCbo, m_midi->outPortName
                    , MIDI_PORT_NAME_MAX);
            ComboBox_GetText(m_masterInPortCbo, m_midi->masterInPortName
                    , MIDI_PORT_NAME_MAX);
            /*
             * Fall through.
             */
        case IDCANCEL:
            /*
             * Close the midi setup dialog.
             */
            EndDialog(setupDlg, cmdID == IDOK);
            break;
        case IDC_MIDI_IN_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the midi in port.
                 */
                if (m_midi->midiIn) {
                    Midi_InClose(m_midi);
                }
                /*
                 * Get the port information from the in port combo box.
                 */
                m_midi->inPort = ComboBox_GetCurSel(m_inPortCbo) - 1;
                /*
                 * Disable/enable the channel combo box if the port is
                 * disabled/enabled.
                 */
                EnableWindow(m_inChannelCbo, m_midi->inPort == -1 ? FALSE
                        : TRUE);
                /*
                 * Reopen the midi in port with the new setting.
                 */
                if (error = Midi_InOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiIn, error);
                    m_midi->inPort = -1;
                    ComboBox_SetCurSel(m_inPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_OUT_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the midi out port.
                 */
                if (m_midi->midiOut) {
                    Midi_OutClose(m_midi);
                }
                /*
                 * Get the output port from the out port combo box.
                 */
                m_midi->outPort = ComboBox_GetCurSel(m_outPortCbo) - 1;
                /*
                 * Disable/enable the output channel depending on the output
                 * port.
                 */
                EnableWindow(m_outChannelCbo, m_midi->outPort == -1 ? FALSE
                        : TRUE);
                /*
                 * Reopen the output port with the new setting.
                 */
                if (error = Midi_OutOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiOut, error);
                    m_midi->outPort = -1;
                    ComboBox_SetCurSel(m_outPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_MASTER_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the master controller port.
                 */
                if (m_midi->midiMasterIn) {
                    Midi_MasterInClose(m_midi);
                }
                /*
                 * Get the new master controller port from the combo box.
                 */
                m_midi->masterInPort = ComboBox_GetCurSel(m_masterInPortCbo)
                    - 1;
                /*
                 * Open the master controller port with the new setting.
                 */
                if (error = Midi_MasterInOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiMasterIn
                            , error);
                    m_midi->masterInPort = -1;
                    ComboBox_SetCurSel(m_masterInPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_IN_CHANNEL_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Store the midi in channel in the midi structure as the user
                 * changes it.
                 */
                m_midi->inChannel = ComboBox_GetCurSel(m_inChannelCbo);
            }
            break;
        case IDC_MIDI_OUT_CHANNEL_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Store the midi out channel in the midi structure as the user
                 * changes it.
                 */
                m_midi->outChannel = ComboBox_GetCurSel(m_outChannelCbo);
            }
            break;
    }
}