Changeset 1880:ebb1117d8189 in roaraudio
- Timestamp:
- 05/23/09 19:02:14 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/midi.h
r1854 r1880 77 77 //int roar_midi_free_no (struct roar_note_octave * note); 78 78 79 int roar_midi_note_from_midiid(struct roar_note_octave * note, unsigned char midiid); 80 79 81 int roar_midi_find_octave (char * note); 80 82 int roar_midi_add_octave (struct roar_note_octave * note); -
libroardsp/midi.c
r1854 r1880 86 86 } 87 87 88 int roar_midi_note_from_midiid(struct roar_note_octave * note, unsigned char midiid) { 89 int oct; 90 91 if ( note == NULL || midiid > 127 ) 92 return -1; 93 94 memset(note, 0, sizeof(struct roar_note_octave)); 95 96 note->octave = ((int) midiid/12) - 5; 97 note->note = roar_midi_midi2note((midiid % 12) + 60); 98 99 oct = 1 << abs(note->octave); 100 101 note->freq = roar_midi_note2freq(note->note); 102 103 if ( note->octave < 0 ) { 104 note->freq /= oct; 105 } else { 106 note->freq *= oct; 107 } 108 109 return 0; 110 } 111 88 112 int roar_midi_find_octave (char * note); 89 113 int roar_midi_add_octave (struct roar_note_octave * note) {
Note: See TracChangeset
for help on using the changeset viewer.