Changeset 2cd18e3 in buchla-emu for emu/mid.c


Ignore:
Timestamp:
02/25/2018 03:01:24 PM (6 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
25c3737
Parents:
9ddbf3e
Message:

Initialize RtMidi device's data member.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emu/mid.c

    r9ddbf3e r2cd18e3  
    103103        (void)data;
    104104
     105        // XXX - remove length calculation once RtMidi passes the length
     106
    105107        int32_t len;
    106108
     
    165167        ver("mid init");
    166168
    167         if (mid_port < 0) {
    168                 ver("no MIDI requested");
    169                 return;
    170         }
    171 
    172169        mid_in = rtmidi_in_create_default();
     170        mid_in->data = NULL; // XXX - remove initialization once it's added to RtMidi
    173171
    174172        if (!mid_in->ok) {
     
    176174        }
    177175
    178         int32_t n_ports = (int32_t)rtmidi_get_port_count(mid_in);
     176        uint32_t n_ports = rtmidi_get_port_count(mid_in);
    179177
    180178        if (n_ports == 0) {
     
    186184
    187185        if (mid_port >= n_ports) {
    188                 fail("invalid MIDI port %d selected (%d available)", mid_port, n_ports);
    189         }
    190 
    191         const char *name = rtmidi_get_port_name(mid_in, (uint32_t)mid_port);
    192         rtmidi_open_port(mid_in, (uint32_t)mid_port, name);
     186                fail("invalid MIDI port %u selected (%u available)", mid_port, n_ports);
     187        }
     188
     189        const char *name = rtmidi_get_port_name(mid_in, mid_port);
     190        rtmidi_open_port(mid_in, mid_port, name);
    193191
    194192        if (!mid_in->ok) {
    195                 fail("error while opening MIDI port %d (%s): %s", mid_port, name, mid_in->msg);
    196         }
    197 
    198         inf("using MIDI port %d (%s)", mid_port, name);
     193                fail("error while opening MIDI port %u (%s): %s", mid_port, name, mid_in->msg);
     194        }
     195
     196        inf("using MIDI port %u (%s)", mid_port, name);
    199197
    200198        rtmidi_in_set_callback(mid_in, callback, mid_in->data);
     
    294292{
    295293        mid_in = rtmidi_in_create_default();
     294        mid_in->data = NULL; // XXX - remove initialization once it's added to RtMidi
    296295
    297296        if (!mid_in->ok) {
Note: See TracChangeset for help on using the changeset viewer.