Ejemplo n.º 1
0
int rtmidi_out_send_message (RtMidiOutPtr device, const unsigned char *message, int length)
{
#if defined(__NO_EXCEPTIONS__)
    RtMidiOut* rtm = (RtMidiOut*) device->ptr;
    rtm->resetError();
    rtm->sendMessage (message, length);
    if (rtm->isError()) {
        device->ok  = false;
        device->msg = rtm->getError().what ();
        return -1;
    }
    return 0;
#else
    try {
        ((RtMidiOut*) device->ptr)->sendMessage (message, length);
        return 0;
    }
    catch (const RtMidiError & err) {
        device->ok  = false;
        device->msg = err.what ();
        return -1;
    }
    catch (...) {
        device->ok  = false;
        device->msg = "Unknown error";
        return -1;
    }
#endif
}
Ejemplo n.º 2
0
enum RtMidiApi rtmidi_out_get_current_api (RtMidiPtr device)
{
#if defined(__NO_EXCEPTIONS__)
    RtMidiOut* rtm = (RtMidiOut*) device->ptr;
    rtm->resetError();
    RtMidiApi curApi = (RtMidiApi) rtm->getCurrentApi ();
    if (rtm->isError()) {
        device->ok  = false;
        device->msg = rtm->getError().what ();
        return RT_MIDI_API_UNSPECIFIED;
    }
    return curApi;
#else
    try {
        return (RtMidiApi) ((RtMidiOut*) device->ptr)->getCurrentApi ();

    } catch (const RtMidiError & err) {
        device->ok  = false;
        device->msg = err.what ();

        return RT_MIDI_API_UNSPECIFIED;
    }
#endif
}