Changeset 370:925790633b2a in roaraudio for libroardsp
- Timestamp:
- 08/03/08 14:49:05 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/midi.c
r369 r370 117 117 } 118 118 119 120 int roar_midi_play_note (struct roar_stream * stream, struct roar_note_octave * note, float len) { 121 return -1; 122 } 123 124 int roar_midi_basic_init (struct roar_midi_basic_state * state) { 125 if (!state) 126 return -1; 127 128 state->len.mul = 1; 129 state->len.div = 60; 130 131 state->note.note = ROAR_MIDI_NOTE_NONE; 132 state->note.octave = 0; 133 134 return 0; 135 } 136 137 int roar_midi_basic_play (struct roar_stream * stream, struct roar_midi_basic_state * state, char * notes) { 138 struct roar_midi_basic_state is; 139 char cn[ROAR_MIDI_MAX_NOTENAME_LEN+1] = {0}; 140 int i; 141 int have = 0; 142 struct roar_note_octave * n; 143 144 if ( !notes ) 145 return -1; 146 147 if ( state == NULL ) { 148 state = &is; 149 roar_midi_basic_init(state); 150 } 151 152 n = &(state->note); 153 154 for (; *notes != 0; notes++) { 155 if ( *notes == '>' ) { 156 n->octave++; 157 } else if ( *notes == '<' ) { 158 n->octave--; 159 } else if ( *notes != ' ' ) { 160 have++; 161 } 162 163 if (have) { 164 roar_midi_play_note(stream, n, 60 * state->len.mul / state->len.div); 165 have = 0; 166 } 167 } 168 169 return 0; 170 } 171 119 172 //ll
Note: See TracChangeset
for help on using the changeset viewer.