void MIDIInput::customEvent(QEvent* event) { if (event->type() == MIDIInputEvent::eventType) { MIDIInputEvent* e = static_cast<MIDIInputEvent*> (event); int index; Q_ASSERT(event != NULL); index = m_devices.indexOf(e->m_device); if (index != -1) { emit valueChanged(this, t_input(index), e->m_channel, e->m_value); event->accept(); } } }
main () /* test case */ { struct ECB ecb; COUNT lines, columns; CODE type, term, code; TEXT string[STRINGSIZ+1]; TEXT *str; t_init(&lines, &columns, &type); t_clear(); printf("lines, columns, type = %d, %d, %d\n", lines, columns, type); t_output(10, 30, "line 10, column 30"); t_write("\nnon-CRT write to next line\n", T_STDCC); t_input(20, 10, string, &term); printf("Terminator = %s\n", (term == T_CR) ? "(return)" : "(escape)"); t_highlight (string); t_output(22, 10, string); /* echo */ t_lclear (22, 15); /* clear original except 5 character */ t_write ("hit left, right, up, down, GOLD, or any key"); code = t_gettok (); if (code == T_LEFT) str = "LEFT"; else if (code == T_RIGHT) str = "RIGHT"; else if (code == T_UP) str = "UP"; else if (code == T_DOWN) str = "DOWN"; else if (code == T_GOLD) str = "GOLD"; else if (code == T_UNKNOWN) str = "UNKNOWN"; else { string[0] = code; string[1] = EOS; str = string; } t_write (str, T_STDCC); for (;;) { t_bell(); /* bell every time controlc hit */ t_write(" ", T_STDCC); /* flush */ t_attn(&ecb); while (!e_occur(&ecb)) /* loop till event */ ; } exit (); }