Changeset 2cd18e3 in buchla-emu


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.

Location:
emu
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • emu/all.h

    r9ddbf3e r2cd18e3  
    3131#include <SDL2/SDL_ttf.h>
    3232
    33 // work around RtMidi's C++-isms
     33// XXX - work around RtMidi's C++-isms; remove when fixed in RtMidi
    3434
    3535#pragma GCC diagnostic push
     
    7676extern const char *font;
    7777
    78 extern int32_t mid_port;
     78extern uint32_t mid_port;
    7979
    8080extern SDL_atomic_t run;
  • emu/main.c

    r9ddbf3e r2cd18e3  
    4343const char *font = "ttf/vera-sans-mono.ttf";
    4444
    45 int32_t mid_port = -1;
     45uint32_t mid_port = 0;
    4646
    4747SDL_atomic_t run;
     
    160160                        }
    161161
    162                         mid_port = (int32_t)tmp;
     162                        mid_port = (uint32_t)tmp;
    163163                        continue;
    164164                }
  • 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.