Changeset 2457:e4d8b23c44b3 in roaraudio
- Timestamp:
- 08/21/09 05:25:44 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/ssynth.c
r2453 r2457 90 90 } 91 91 92 int ssynth_note_new(struct roar_note_octave * note, char vv) { 93 int i; 94 95 for (i = 0; i < SSYNTH_NOTES_MAX; i++) { 96 if ( g_ssynth.notes[i].stage == SSYNTH_STAGE_UNUSED ) { 97 // TODO: do some error checking here 98 g_ssynth.notes[i].vv_down = vv; 99 memcpy(&(g_ssynth.notes[i].note), note, sizeof(struct roar_note_octave)); 100 roar_synth_init(&(g_ssynth.notes[i].synth), &(g_ssynth.notes[i].note), g_sa->rate); 101 ssynth_note_set_stage(i, SSYNTH_STAGE_KEYSTROKE); 102 return i; 103 } 104 } 105 106 return -1; 107 } 108 109 int ssynth_note_free(int id) { 110 g_ssynth.notes[id].stage = SSYNTH_STAGE_UNUSED; 111 return 0; 112 } 113 114 int ssynth_note_find(struct roar_note_octave * note) { 115 return -1; 116 } 117 118 int ssynth_note_set_stage(int id, int stage) { 119 int r = -1; 120 121 switch (stage) { 122 case SSYNTH_STAGE_UNUSED: 123 r = ssynth_note_free(id); 124 break; 125 case SSYNTH_STAGE_KEYSTROKE: 126 r = roar_fader_init(&(g_ssynth.notes[id].fader), ssynth_polys[SSYNTH_POLY_KEYDOWN], SSYNTH_POLY_COEFF); 127 break; 128 case SSYNTH_STAGE_MIDSECTION: 129 r = 0; 130 break; 131 case SSYNTH_STAGE_KEYRELEASE: 132 r = roar_fader_init(&(g_ssynth.notes[id].fader), ssynth_polys[SSYNTH_POLY_KEYUP], SSYNTH_POLY_COEFF); 133 break; 134 } 135 136 if ( r == 0 ) 137 g_ssynth.notes[id].stage = stage; 138 139 return r; 140 } 141 92 142 //ll
Note: See TracChangeset
for help on using the changeset viewer.