Changeset 1865:80a9af2b423c in roaraudio


Ignore:
Timestamp:
05/23/09 16:05:56 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

parese status byte

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/midi.c

    r1863 r1865  
    182182   printf("%.2x=", *data); 
    183183   if ( *data & 0x80 ) { 
     184    if ( buf != NULL ) { 
     185     if ( g_midi_mess.buf == NULL ) { 
     186      g_midi_mess.buf = buf; 
     187     } else { 
     188      roar_buffer_add(g_midi_mess.buf, buf); 
     189     } 
     190     buf = NULL; 
     191    } 
     192 
    184193    need = 0; 
    185194    printf("S\n"); 
     
    188197     continue; 
    189198    } 
     199 
     200    if (*data == MIDI_TYPE_CLOCK_TICK || *data == MIDI_TYPE_CLOCK_START || *data == MIDI_TYPE_CLOCK_STOP ) { 
     201     mes->type = *data; 
     202    } else { 
     203     mes->type    = *data & 0xF0; 
     204     mes->channel = *data & 0x0F; 
     205     switch (*data & 0xF0) { 
     206      case MIDI_TYPE_NOTE_ON: 
     207      case MIDI_TYPE_NOTE_OFF: 
     208        need = 2; 
     209       break; 
     210      case MIDI_TYPE_PA: 
     211        need = 2; 
     212       break; 
     213      case MIDI_TYPE_CONTROLER: 
     214        need = 2; 
     215       break; 
     216      case MIDI_TYPE_PROGRAM: 
     217        need = 1; 
     218       break; 
     219      case MIDI_TYPE_MA: 
     220        need = 1; 
     221       break; 
     222      case MIDI_TYPE_PB: 
     223      case MIDI_TYPE_SYSEX: 
     224        need = 1; 
     225       break; 
     226     } 
     227    } 
     228 
    190229   } else { 
    191230    printf("D\n"); 
     
    197236  } 
    198237 
    199   if ( !have ) { 
     238  if ( need ) { 
     239   ROAR_ERR("midi_conv_midi2mes(*): FIXME: BUG!!! Need to restore buffer here with corrected length"); 
     240  } else if ( !have ) { 
    200241   roar_buffer_next(&(ss->buffer)); 
    201242  } 
Note: See TracChangeset for help on using the changeset viewer.