Changeset 1858:a519d0669921 in roaraudio
- Timestamp:
- 05/23/09 12:29:47 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/midi.h
r1855 r1858 57 57 58 58 #define MIDI_MES_BUFSIZE 4 59 #define MIDI_READ_SIZE 256 /* this should be big enoth in both cfreq=20..100Hz mode */ 59 60 60 61 #define MIDI_MFLAG_FREE_DP (1<<0) … … 89 90 } g_midi_clock; 90 91 92 93 // general midi interface: 91 94 int midi_init (void); 92 95 int midi_free (void); … … 95 98 int midi_reinit(void); 96 99 100 // streams: 97 101 int midi_check_stream (int id); 98 102 int midi_send_stream (int id); 99 103 104 int midi_conv_midi2mes (int id); 105 int midi_conv_mes2midi (int id); 106 107 // bridges: 100 108 int midi_check_bridge (int id); 101 109 110 // clock: 102 111 int midi_clock_init (void); 103 112 int midi_clock_set_bph (uint_least32_t bph); -
roard/midi.c
r1855 r1858 63 63 struct roar_stream * s; 64 64 struct roar_stream_server * ss; 65 struct roar_buffer * b; 66 char * buf; 67 ssize_t len; 65 68 66 69 if ( g_streams[id] == NULL ) … … 73 76 if ( s->dir == ROAR_DIR_BRIDGE ) 74 77 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 120 int 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]); 75 130 76 131 switch (s->info.codec) { … … 83 138 } 84 139 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; 140 int midi_conv_midi2mes (int id) { 141 return -1; 142 } 143 144 int midi_conv_mes2midi (int id) { 145 return -1; 103 146 } 104 147
Note: See TracChangeset
for help on using the changeset viewer.