Changeset 2469:e9f81bfa4020 in roaraudio
- Timestamp:
- 08/22/09 02:34:25 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/ssynth.h
r2467 r2469 53 53 int stage; 54 54 char vv_down, vv_up; 55 struct roar_note_octave note;56 struct roar_synth_state synth;57 struct roar_fader_state fader;58 struct roar_buffer buf;55 struct roar_note_octave note; 56 struct roar_synth_state synth; 57 struct roar_fader_state fader; 58 struct roar_buffer * buf; 59 59 } notes[SSYNTH_NOTES_MAX]; 60 60 } g_ssynth; -
roard/ssynth.c
r2468 r2469 84 84 85 85 int ssynth_free (void) { 86 int i; 87 86 88 if ( !ssynth_conf.enable ) 87 89 return 0; 88 90 91 for (i = 0; i < SSYNTH_NOTES_MAX; i++) { 92 if ( g_ssynth.notes[i].buf != NULL ) { 93 roar_buffer_free(g_ssynth.notes[i].buf); 94 g_ssynth.notes[i].buf = NULL; 95 } 96 } 97 89 98 return streams_delete(g_ssynth.stream); 90 99 } 91 100 92 101 int ssynth_update (void) { 102 struct roar_stream_server * ss; 103 struct roar_stream * s; 104 struct roar_buffer * buf; 105 size_t buflen; 106 size_t needlen; 107 int i; 108 109 if ( !ssynth_conf.enable ) 110 return 0; 111 112 if ( streams_get(g_ssynth.stream, &ss) == -1 ) { 113 return -1; 114 } 115 116 s = ROAR_STREAM(ss); 117 118 needlen = ROAR_OUTPUT_CALC_OUTBUFSIZE(&(s->info)); 119 120 for (i = 0; i < SSYNTH_NOTES_MAX; i++) { 121 if ( g_ssynth.notes[i].stage != SSYNTH_STAGE_UNUSED ) { 122 if ( g_ssynth.notes[i].buf == NULL ) { 123 if ( roar_buffer_new(&buf, needlen) == -1 ) 124 continue; 125 126 g_ssynth.notes[i].buf = buf; 127 } else { 128 buf = g_ssynth.notes[i].buf; 129 130 if ( roar_buffer_get_len(buf, &buflen) == -1 ) 131 continue; 132 133 if ( buflen < needlen ) { 134 if ( roar_buffer_set_len(buf, needlen) == -1 ) 135 continue; 136 } 137 } 138 } 139 } 140 93 141 return -1; 94 142 }
Note: See TracChangeset
for help on using the changeset viewer.