Changeset 1858:a519d0669921 in roaraudio for roard/midi.c


Ignore:
Timestamp:
05/23/09 12:29:47 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

buffer midi_in data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/midi.c

    r1855 r1858  
    6363 struct roar_stream        *   s; 
    6464 struct roar_stream_server *  ss; 
     65 struct roar_buffer        *   b; 
     66 char                      * buf; 
     67 ssize_t                     len; 
    6568 
    6669 if ( g_streams[id] == NULL ) 
     
    7376 if ( s->dir == ROAR_DIR_BRIDGE ) 
    7477  return midi_check_bridge(id); 
     78 
     79 switch (s->info.codec) { 
     80  case ROAR_CODEC_MIDI: 
     81   break; 
     82  default: 
     83    streams_delete(id); 
     84    return -1; 
     85 } 
     86 
     87 if ( roar_buffer_new(&b, MIDI_READ_SIZE) == -1 ) { 
     88  ROAR_ERR("midi_check_stream(*): Can not alloc buffer space!"); 
     89  ROAR_DBG("midi_check_stream(*) = -1"); 
     90  return -1; 
     91 } 
     92 
     93 roar_buffer_get_data(b, (void **)&buf); 
     94 
     95 if ( (len = stream_vio_s_read(ss, buf, MIDI_READ_SIZE)) < 1 ) { 
     96  streams_delete(id); 
     97  return -1; 
     98 } 
     99 
     100 roar_buffer_set_len(b, len); 
     101 
     102  if ( stream_add_buffer(id, b) == -1 ) { 
     103   roar_buffer_free(b); 
     104   streams_delete(id); 
     105   return -1; 
     106  } 
     107 
     108 switch (s->info.codec) { 
     109  case ROAR_CODEC_MIDI: 
     110    return midi_conv_midi2mes(id); 
     111   break; 
     112  default: 
     113    streams_delete(id); 
     114    return -1; 
     115 } 
     116 
     117 return 0; 
     118} 
     119 
     120int midi_send_stream   (int id) { 
     121 struct roar_stream        *   s; 
     122 struct roar_stream_server *  ss; 
     123 
     124 if ( g_streams[id] == NULL ) 
     125  return -1; 
     126 
     127 ROAR_DBG("midi_send_stream(id=%i) = ?", id); 
     128 
     129 s = ROAR_STREAM(ss = g_streams[id]); 
    75130 
    76131 switch (s->info.codec) { 
     
    83138} 
    84139 
    85 int midi_send_stream   (int id) { 
    86  struct roar_stream        *   s; 
    87  struct roar_stream_server *  ss; 
    88  
    89  if ( g_streams[id] == NULL ) 
    90   return -1; 
    91  
    92  ROAR_DBG("midi_send_stream(id=%i) = ?", id); 
    93  
    94  s = ROAR_STREAM(ss = g_streams[id]); 
    95  
    96  switch (s->info.codec) { 
    97   default: 
    98     streams_delete(id); 
    99     return -1; 
    100  } 
    101  
    102  return 0; 
     140int midi_conv_midi2mes (int id) { 
     141 return -1; 
     142} 
     143 
     144int midi_conv_mes2midi (int id) { 
     145 return -1; 
    103146} 
    104147 
Note: See TracChangeset for help on using the changeset viewer.