Revision | 01e80eb8d3fe7e78aa45722c4c911c914f717881 (tree) |
---|---|
Zeit | 2019-07-25 16:49:14 |
Autor | Starg <starg@user...> |
Commiter | Starg |
Import unkotim227
@@ -96,8 +96,8 @@ extern int seq_quit; | ||
96 | 96 | |
97 | 97 | static int ctl_open(int using_stdin, int using_stdout); |
98 | 98 | static void ctl_close(void); |
99 | -static int ctl_read(int32 *valp); | |
100 | -static int cmsg(int type, int verbosity_level, char *fmt, ...); | |
99 | +static int ctl_read(ptr_size_t *valp); | |
100 | +static int cmsg(int type, int verbosity_level, const char *fmt, ...); | |
101 | 101 | static void ctl_event(CtlEvent *e); |
102 | 102 | static int ctl_pass_playing_list(int n, char *args[]); |
103 | 103 |
@@ -135,27 +135,29 @@ static FILE *outfp; | ||
135 | 135 | |
136 | 136 | static int ctl_open(int using_stdin, int using_stdout) |
137 | 137 | { |
138 | - ctl.opened = 1; | |
139 | - ctl.flags &= ~(CTLF_LIST_RANDOM|CTLF_LIST_SORT); | |
140 | - if (using_stdout) | |
141 | - outfp = stderr; | |
142 | - else | |
143 | - outfp = stdout; | |
144 | - return 0; | |
138 | + rtsyn_pm_setup(); | |
139 | + | |
140 | + ctl.opened = 1; | |
141 | + ctl.flags &= ~(CTLF_LIST_RANDOM | CTLF_LIST_SORT); | |
142 | + if (using_stdout) | |
143 | + outfp = stderr; | |
144 | + else | |
145 | + outfp = stdout; | |
146 | + return 0; | |
145 | 147 | } |
146 | 148 | |
147 | 149 | static void ctl_close(void) |
148 | 150 | { |
149 | - fflush(outfp); | |
150 | - if(seq_quit==0){ | |
151 | - rtsyn_synth_stop(); | |
152 | - rtsyn_close(); | |
153 | - seq_quit=~0; | |
154 | - } | |
155 | - ctl.opened=0; | |
151 | + fflush(outfp); | |
152 | + if (seq_quit == 0) { | |
153 | + rtsyn_synth_stop(); | |
154 | + rtsyn_close(); | |
155 | + seq_quit = ~0; | |
156 | + } | |
157 | + ctl.opened = 0; | |
156 | 158 | } |
157 | 159 | |
158 | -static int ctl_read(int32 *valp) | |
160 | +static int ctl_read(ptr_size_t *valp) | |
159 | 161 | { |
160 | 162 | return RC_NONE; |
161 | 163 | } |
@@ -164,50 +166,47 @@ static int ctl_read(int32 *valp) | ||
164 | 166 | extern void PutsConsoleWnd(const char *str); |
165 | 167 | extern int ConsoleWndFlag; |
166 | 168 | #endif |
167 | -static int cmsg(int type, int verbosity_level, char *fmt, ...) | |
169 | +static int cmsg(int type, int verbosity_level, const char *fmt, ...) | |
168 | 170 | { |
169 | 171 | #ifndef IA_W32G_SYN |
172 | + va_list ap; | |
170 | 173 | |
171 | - va_list ap; | |
172 | - | |
173 | - if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && | |
174 | - ctl.verbosity<verbosity_level) | |
175 | - return 0; | |
176 | - va_start(ap, fmt); | |
177 | - if(type == CMSG_WARNING || type == CMSG_ERROR || type == CMSG_FATAL) | |
178 | - dumb_error_count++; | |
179 | - if (!ctl.opened) | |
180 | - { | |
181 | - vfprintf(stderr, fmt, ap); | |
182 | - fputs(NLS, stderr); | |
174 | + if ((type == CMSG_TEXT || type == CMSG_INFO || type == CMSG_WARNING) && | |
175 | + ctl.verbosity < verbosity_level) | |
176 | + return 0; | |
177 | + va_start(ap, fmt); | |
178 | + if (type == CMSG_WARNING || type == CMSG_ERROR || type == CMSG_FATAL) | |
179 | + dumb_error_count++; | |
180 | + if (!ctl.opened) { | |
181 | + vfprintf(stderr, fmt, ap); | |
182 | + fputs(NLS, stderr); | |
183 | 183 | } |
184 | - else | |
185 | - { | |
186 | - vfprintf(outfp, fmt, ap); | |
187 | - fputs(NLS, outfp); | |
188 | - fflush(outfp); | |
184 | + else { | |
185 | + vfprintf(outfp, fmt, ap); | |
186 | + fputs(NLS, outfp); | |
187 | + fflush(outfp); | |
189 | 188 | } |
190 | - va_end(ap); | |
191 | - | |
192 | -#else | |
193 | - if ( !ConsoleWndFlag ) return 0; | |
194 | - { | |
195 | - char buffer[1024]; | |
196 | - va_list ap; | |
197 | - va_start(ap, fmt); | |
198 | - vsnprintf(buffer, sizeof(buffer), fmt, ap); | |
199 | 189 | va_end(ap); |
190 | +#else | |
191 | + if (!ConsoleWndFlag) return 0; | |
200 | 192 | |
201 | - if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && | |
202 | - ctl.verbosity<verbosity_level) | |
203 | - return 0; | |
204 | -// if(type == CMSG_FATAL) | |
205 | -// w32g_msg_box(buffer, "TiMidity Error", MB_OK); | |
206 | - PutsConsoleWnd(buffer); | |
207 | - PutsConsoleWnd("\n"); | |
208 | - return 0; | |
209 | - } | |
210 | -#endif | |
193 | + { | |
194 | + char buffer[1024]; | |
195 | + va_list ap; | |
196 | + va_start(ap, fmt); | |
197 | + vsnprintf(buffer, sizeof(buffer), fmt, ap); | |
198 | + va_end(ap); | |
199 | + | |
200 | + if ((type == CMSG_TEXT || type == CMSG_INFO || type == CMSG_WARNING) && | |
201 | + ctl.verbosity < verbosity_level) | |
202 | + return 0; | |
203 | +// if (type == CMSG_FATAL) | |
204 | +// w32g_msg_box(buffer, "TiMidity Error", MB_OK); | |
205 | + PutsConsoleWnd(buffer); | |
206 | + PutsConsoleWnd("\n"); | |
207 | + return 0; | |
208 | + } | |
209 | +#endif /* !IA_W32G_SYN */ | |
211 | 210 | |
212 | 211 | return 0; |
213 | 212 | } |
@@ -218,206 +217,221 @@ static void ctl_event(CtlEvent *e) | ||
218 | 217 | |
219 | 218 | static void doit(void); |
220 | 219 | |
221 | -#ifdef IA_W32G_SYN | |
222 | -extern void w32g_syn_doit(void); | |
223 | -extern int w32g_syn_ctl_pass_playing_list(int n_, char *args_[]); | |
224 | - | |
225 | - | |
226 | -static int ctl_pass_playing_list(int n, char *args[]) | |
227 | -{ | |
228 | - return w32g_syn_ctl_pass_playing_list ( n, args ); | |
229 | -} | |
230 | -#endif | |
231 | - | |
232 | 220 | #ifndef IA_W32G_SYN |
233 | 221 | static int ctl_pass_playing_list(int n, char *args[]) |
234 | 222 | #else |
235 | 223 | // 0: OK, 2: Require to reset. |
236 | -static int ctl_pass_playing_list2(int n, char *args[]) | |
224 | +int ctl_pass_playing_list2(int n, char *args[]) | |
237 | 225 | #endif |
238 | 226 | { |
239 | - int i, j,devnum,devok; | |
240 | - unsigned int port=0 ; | |
241 | - int started; | |
242 | - char cbuf[80]; | |
227 | + int i, j, devnum, devok; | |
228 | + unsigned int port = 0; | |
229 | + int started; | |
230 | + char cbuf[80]; | |
243 | 231 | #if defined(__W32__) && defined(FORCE_TIME_PERIOD) |
244 | - TIMECAPS tcaps; | |
232 | + TIMECAPS tcaps; | |
245 | 233 | #endif /* __W32__ && FORCE_TIME_PERIOD */ |
246 | 234 | |
247 | -rtsyn_get_port_list(); | |
235 | + rtsyn_get_port_list(); | |
248 | 236 | |
249 | 237 | #ifndef IA_W32G_SYN |
250 | - if(n > MAX_PORT ){ | |
251 | - printf( "Usage: timidity -iW [Midi interface No s]\n"); | |
252 | - return 1; | |
253 | - } | |
238 | + if (n > MAX_PORT) { | |
239 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
240 | + "Usage: timidity -i%c [Midi interface No s]" NLS, ctl.id_character); | |
241 | + return 1; | |
242 | + } | |
254 | 243 | #endif |
255 | 244 | |
256 | - if(n>0){ | |
257 | - port=0; | |
258 | - while(port<n && n!=0){ | |
259 | - if( (portID[port] = atoi(args[port]))==0 ){ | |
260 | - n=0; | |
261 | - }else{ | |
262 | - devok=0; | |
263 | - for(i=0;i<rtsyn_nportlist;i++){ | |
264 | - sscanf( rtsyn_portlist[i],"%d:%s",&devnum,cbuf); | |
265 | - if(devnum==portID[port]) devok=1; | |
266 | - } | |
267 | - if(devok==0){ | |
268 | - n=0; | |
245 | + if (rtsyn_nportlist == 0) { | |
246 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
247 | + "Opening Device drivers:" "MIDI IN device is not found" NLS); | |
248 | + return 2; | |
249 | + } | |
250 | + | |
251 | + if (n > 0) { | |
252 | + port = 0; | |
253 | + while (port < n && n != 0) { | |
254 | + if ((portID[port] = atoi(args[port])) == 0) { | |
255 | + n = 0; | |
256 | + } else { | |
257 | + devok = 0; | |
258 | + for (i = 0; i < rtsyn_nportlist; i++) { | |
259 | + sscanf(rtsyn_portlist[i], "%d:%s", &devnum, cbuf); | |
260 | + if (devnum == portID[port]) devok = 1; | |
261 | + } | |
262 | + if (devok == 0) { | |
263 | + n = 0; | |
269 | 264 | #ifdef IA_W32G_SYN |
270 | - { | |
271 | - char buff[1024]; | |
272 | - sprintf ( buff, "MIDI IN Device ID %d is not available. So set a proper ID for the MIDI port %d and restart.", portID[port], port ); | |
273 | - MessageBox ( NULL, buff, "Error", MB_OK ); | |
274 | - return 2; | |
275 | - } | |
265 | + { | |
266 | + char buff[1024]; | |
267 | + sprintf(buff, "MIDI IN Device ID %d is not available. So set a proper ID for the MIDI port %d and restart.", portID[port], port); | |
268 | + MessageBoxA(NULL, buff, "Error", MB_OK); | |
269 | + return 2; | |
270 | + } | |
276 | 271 | #endif |
277 | - } | |
278 | - } | |
279 | - port++; | |
280 | - } | |
281 | - } | |
282 | - if(n==0){ | |
283 | - rtsyn_portnumber=0; | |
284 | - }else{ | |
285 | - rtsyn_portnumber=port; | |
286 | - } | |
272 | + } | |
273 | + } | |
274 | + port++; | |
275 | + } | |
276 | + } | |
277 | + if (n == 0) { | |
278 | + rtsyn_portnumber = 0; | |
279 | + } else { | |
280 | + rtsyn_portnumber = port; | |
281 | + } | |
287 | 282 | |
288 | 283 | #if !defined(IA_W32G_SYN) && !defined(USE_GTK_GUI) |
289 | - if(n==0){ | |
290 | - char cbuf[80]; | |
291 | - printf("Whow many ports do you use?(max %d)\n",MAX_PORT); | |
292 | - do{ | |
293 | - if (0==scanf("%u",&rtsyn_portnumber)) scanf("%s",cbuf); | |
294 | - }while(rtsyn_portnumber == 0 ||rtsyn_portnumber > MAX_PORT); | |
295 | - printf("\n"); | |
296 | - printf("Opening Device drivers:"); | |
297 | - printf("Available Midi Input devices:\n"); | |
298 | - | |
299 | - for(i=0;i<rtsyn_nportlist;i++){ | |
300 | - printf("%s\n",rtsyn_portlist[i]); | |
301 | - } | |
302 | - for(port=0;port<rtsyn_portnumber;port++){ | |
303 | - printf("Keyin Input Device Number of port%d\n",port+1); | |
304 | - do{ | |
305 | - devok=0; | |
306 | - if (0==scanf("%u",&portID[port])) scanf("%s",cbuf); | |
307 | - for(i=0;i<rtsyn_nportlist;i++){ | |
308 | - sscanf( rtsyn_portlist[i],"%d:%s",&devnum,cbuf); | |
309 | - if(devnum==portID[port]) devok=1; | |
310 | - } | |
311 | - }while(devok==0); | |
312 | - printf("\n"); | |
313 | - } | |
314 | - } | |
284 | + if (n == 0) { | |
285 | + char cbuf[MAX_RTSYN_PORTLIST_LEN + 8], fmt[64]; | |
286 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
287 | + "Whow many ports do you use?(max %d)" NLS, MAX_PORT); | |
288 | + do { | |
289 | + snprintf(fmt, sizeof(fmt), "%%.%ds", MAX_RTSYN_PORTLIST_LEN - 1); | |
290 | + if (0 == scanf("%u", &rtsyn_portnumber)) { scanf(fmt, cbuf); } | |
291 | + } while (intr == 0 && | |
292 | + (rtsyn_portnumber == 0 || rtsyn_portnumber > MAX_PORT)); | |
293 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
294 | + "\nOpening Device drivers:" "Available Midi Input devices:" "%d" NLS, rtsyn_nportlist); | |
295 | + | |
296 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
297 | + "NUM:NAME"); | |
298 | + for (i = 0; i < rtsyn_nportlist; i++) { | |
299 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
300 | + "%s", rtsyn_portlist[i]); | |
301 | + } | |
302 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
303 | + ""); | |
304 | + | |
305 | + for (port = 0; port < rtsyn_portnumber; port++) { | |
306 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
307 | + "Keyin Input Device Number of port%d", port + 1); | |
308 | + do { | |
309 | + devok = 0; | |
310 | + snprintf(fmt, sizeof(fmt), "%%.%ds", MAX_RTSYN_PORTLIST_LEN - 1); | |
311 | + if (0 == scanf("%u", &portID[port])) { scanf(fmt, cbuf); } | |
312 | + for (i = 0; intr == 0 && i < rtsyn_nportlist; i++) { | |
313 | + snprintf(fmt, sizeof(fmt), "%%d:%%.%ds", MAX_RTSYN_PORTLIST_LEN - 1); | |
314 | + sscanf(rtsyn_portlist[i], fmt, &devnum, cbuf); | |
315 | + if (devnum == portID[port]) devok = 1; | |
316 | + } | |
317 | + } while (devok == 0); | |
318 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
319 | + ""); | |
320 | + } | |
321 | + } | |
315 | 322 | #endif |
316 | 323 | |
317 | - for(port=0;port<rtsyn_portnumber;port++){ | |
318 | - portID[port]=portID[port]-1; | |
319 | - } | |
320 | - | |
324 | + for (port = 0; port < rtsyn_portnumber; port++) { | |
325 | + portID[port] = portID[port] - 1; | |
326 | + } | |
321 | 327 | |
322 | 328 | #if !defined(IA_W32G_SYN) && !defined(USE_GTK_GUI) |
323 | - printf("TiMidity starting in PortMIDI Synthesizer mode\n"); | |
324 | - printf("Usage: timidity -iP [Midi interface No]\n"); | |
325 | - printf("\n"); | |
326 | - printf("N (Normal mode) M(GM mode) S(GS mode) X(XG mode) \n"); | |
327 | - printf("(Only in Normal mode, Mode can be changed by MIDI data)\n"); | |
328 | - printf("m(GM reset) s(GS reset) x(XG reset)\n"); | |
329 | - printf("\n"); | |
330 | - printf("Press 'q' key to stop\n"); | |
329 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
330 | + "TiMidity starting in PortMIDI Synthesizer mode"); | |
331 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
332 | + "Usage: timidity -i%c [Midi interface No]" NLS, ctl.id_character); | |
333 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, "c(Reset)"); | |
334 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
335 | + "N(Normal mode) M(GM mode) S(GS mode) X(XG mode) G(GM2 mode) D(SD mode) K(KG mode) J(CM mode)"); | |
336 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
337 | + "(Only in Normal mode, Mode can be changed by MIDI data)"); | |
338 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
339 | + "m(GM reset) s(GS reset) x(XG reset) g(GM2 reset) d(SD reset) k(KG reset) j(CM reset)" NLS); | |
340 | + ctl.cmsg(CMSG_WARNING, VERB_NORMAL, | |
341 | + "Press 'q' key to stop"); | |
331 | 342 | #endif |
332 | 343 | |
333 | - rtsyn_init(); | |
344 | + rtsyn_init(); | |
334 | 345 | |
335 | -#ifdef USE_GTK_GUI | |
336 | - twgtk_main(); | |
337 | -#else | |
338 | 346 | #if defined(__W32__) && defined(FORCE_TIME_PERIOD) |
339 | - if (timeGetDevCaps(&tcaps, sizeof(TIMECAPS)) != TIMERR_NOERROR) | |
340 | - tcaps.wPeriodMin = 10; | |
341 | - timeBeginPeriod(tcaps.wPeriodMin); | |
347 | + if (timeGetDevCaps(&tcaps, sizeof(TIMECAPS)) != TIMERR_NOERROR) | |
348 | + tcaps.wPeriodMin = 10; | |
349 | + timeBeginPeriod(tcaps.wPeriodMin); | |
342 | 350 | #endif /* __W32__ && FORCE_TIME_PERIOD */ |
351 | + | |
352 | +#ifdef USE_GTK_GUI | |
353 | + twgtk_main(); | |
354 | +#else | |
343 | 355 | #ifdef IA_W32G_SYN |
344 | - if(0!=rtsyn_synth_start()){ | |
345 | - seq_quit=0; | |
346 | - while(seq_quit==0) { | |
347 | - w32g_syn_doit(); | |
348 | - } | |
349 | - rtsyn_synth_stop(); | |
350 | - } | |
356 | + if (0 != rtsyn_synth_start()) { | |
357 | + seq_quit = 0; | |
358 | + while (seq_quit == 0) { | |
359 | + w32g_syn_doit(); | |
360 | + } | |
361 | + rtsyn_synth_stop(); | |
362 | + } | |
351 | 363 | #else |
352 | - if(0!=rtsyn_synth_start()){ | |
353 | - seq_quit=0; | |
354 | - while(seq_quit==0) { | |
355 | - doit(); | |
356 | - } | |
357 | - rtsyn_synth_stop(); | |
358 | - } | |
364 | + if (0 != rtsyn_synth_start()) { | |
365 | + seq_quit = 0; | |
366 | + while (seq_quit == 0) { | |
367 | + doit(); | |
368 | + } | |
369 | + rtsyn_synth_stop(); | |
370 | + } | |
359 | 371 | #endif /* IA_W32G_SYN */ |
372 | +#endif /* USE_GTK_GUI */ | |
373 | + | |
360 | 374 | #if defined(__W32__) && defined(FORCE_TIME_PERIOD) |
361 | - timeEndPeriod(tcaps.wPeriodMin); | |
375 | + timeEndPeriod(tcaps.wPeriodMin); | |
362 | 376 | #endif /* __W32__ && FORCE_TIME_PERIOD */ |
363 | -#endif /* USE_GTK_GUI */ | |
364 | - rtsyn_close(); | |
377 | + rtsyn_close(); | |
365 | 378 | |
366 | - return 0; | |
379 | + return 0; | |
367 | 380 | } |
368 | 381 | |
369 | 382 | |
370 | 383 | #ifndef IA_W32G_SYN |
371 | 384 | |
372 | - | |
373 | 385 | #ifndef __W32__ |
374 | -static void init_keybord(void){ | |
375 | - tcgetattr(0,&initial_settings); | |
376 | - tcgetattr(0,&new_settings); | |
377 | - new_settings.c_lflag &= ~ICANON; | |
378 | - new_settings.c_lflag &= ~ECHO; | |
379 | - new_settings.c_lflag &= ~ISIG; | |
380 | - new_settings.c_cc[VMIN] = 1; | |
381 | - new_settings.c_cc[VTIME] = 0; | |
382 | - tcsetattr(0, TCSANOW, &new_settings); | |
386 | +static void init_keybord(void) | |
387 | +{ | |
388 | + tcgetattr(0, &initial_settings); | |
389 | + tcgetattr(0, &new_settings); | |
390 | + new_settings.c_lflag &= ~ICANON; | |
391 | + new_settings.c_lflag &= ~ECHO; | |
392 | + new_settings.c_lflag &= ~ISIG; | |
393 | + new_settings.c_cc[VMIN] = 1; | |
394 | + new_settings.c_cc[VTIME] = 0; | |
395 | + tcsetattr(0, TCSANOW, &new_settings); | |
383 | 396 | } |
384 | 397 | |
385 | -static void close_keybord(void){ | |
386 | - tcsetattr(0, TCSANOW, &initial_settings); | |
398 | +static void close_keybord(void) | |
399 | +{ | |
400 | + tcsetattr(0, TCSANOW, &initial_settings); | |
387 | 401 | } |
388 | 402 | |
389 | -static int kbhit(void){ | |
390 | - char ch; | |
391 | - int nread; | |
392 | - | |
393 | - if(peek_character != -1) | |
394 | - return 1; | |
395 | - new_settings.c_cc[VMIN]=0; | |
396 | - tcsetattr(0,TCSANOW, &new_settings); | |
397 | - nread = read(0, &ch, 1); | |
398 | - new_settings.c_cc[VMIN]=1; | |
399 | - tcsetattr(0,TCSANOW, &new_settings); | |
400 | - | |
401 | - if(nread == 1) { | |
402 | - peek_character = ch; | |
403 | - return 1; | |
404 | - } | |
405 | - return 0; | |
403 | +static int kbhit(void) | |
404 | +{ | |
405 | + char ch; | |
406 | + int nread; | |
407 | + | |
408 | + if (peek_character != -1) | |
409 | + return 1; | |
410 | + new_settings.c_cc[VMIN] = 0; | |
411 | + tcsetattr(0, TCSANOW, &new_settings); | |
412 | + nread = read(0, &ch, 1); | |
413 | + new_settings.c_cc[VMIN] = 1; | |
414 | + tcsetattr(0, TCSANOW, &new_settings); | |
415 | + | |
416 | + if (nread == 1) { | |
417 | + peek_character = ch; | |
418 | + return 1; | |
419 | + } | |
420 | + return 0; | |
406 | 421 | } |
407 | 422 | |
408 | - | |
409 | -static char readch(void){ | |
410 | - char ch; | |
411 | - if(peek_character != -1){ | |
412 | - ch = peek_character; | |
413 | - peek_character = -1; | |
414 | - return ch; | |
415 | - } | |
416 | - read(0,&ch,1); | |
417 | - return ch; | |
423 | +static char readch(void) | |
424 | +{ | |
425 | + char ch; | |
426 | + if (peek_character != -1) { | |
427 | + ch = peek_character; | |
428 | + peek_character = -1; | |
429 | + return ch; | |
430 | + } | |
431 | + read(0, &ch, 1); | |
432 | + return ch; | |
418 | 433 | } |
419 | -#endif | |
420 | - | |
434 | +#endif /* !__W32__ */ | |
421 | 435 | |
422 | 436 | static void doit(void) |
423 | 437 | { |
@@ -109,7 +109,7 @@ static double active_sensing_time = 0; | ||
109 | 109 | |
110 | 110 | /* |
111 | 111 | #define EX_RESET_NO 7 |
112 | -static char sysex_resets[EX_RESET_NO][11]={ | |
112 | +static uint8 sysex_resets[EX_RESET_NO][11]={ | |
113 | 113 | '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', |
114 | 114 | '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', |
115 | 115 | '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00', |
@@ -120,7 +120,7 @@ static char sysex_resets[EX_RESET_NO][11]={ | ||
120 | 120 | */ |
121 | 121 | /* |
122 | 122 | #define EX_RESET_NO 9 |
123 | -static char sysex_resets[EX_RESET_NO][11]={ | |
123 | +static uint8 sysex_resets[EX_RESET_NO][11]={ | |
124 | 124 | '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off |
125 | 125 | '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', //gm1 |
126 | 126 | '\xf0','\x7e','\x7f','\x09','\x02','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off |
@@ -611,7 +611,7 @@ int rtsyn_play_one_data (int port, uint32 dwParam1, double event_time) | ||
611 | 611 | #if 0 |
612 | 612 | if ((dwParam1 & 0x000000ff) == 0xf1) |
613 | 613 | //MIDI Time Code Qtr. Frame (not need) |
614 | - printf("MIDI Time Code Qtr\n"); | |
614 | + ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "MIDI Time Code Qtr"); | |
615 | 615 | if ((dwParam1 & 0x000000ff) == 0xf3) |
616 | 616 | //Song Select(Song #) (not need) |
617 | 617 | #endif |
@@ -629,19 +629,19 @@ int rtsyn_play_one_data (int port, uint32 dwParam1, double event_time) | ||
629 | 629 | #if 0 |
630 | 630 | if ((dwParam1 & 0x000000ff) == 0xf8) |
631 | 631 | //Timing Clock (not need) |
632 | - printf("Timing Clock\n"); | |
632 | + ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "Timing Clock"); | |
633 | 633 | if ((dwParam1&0x000000ff)==0xfa) |
634 | - //Start | |
634 | + {}//Start | |
635 | 635 | if ((dwParam1 & 0x000000ff) == 0xfb) |
636 | - //Continue | |
636 | + {}//Continue | |
637 | 637 | if ((dwParam1 & 0x000000ff) == 0xfc) { |
638 | 638 | //Stop |
639 | - printf("Stop\n"); | |
639 | + ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "Stop"); | |
640 | 640 | } |
641 | 641 | #endif |
642 | 642 | if ((dwParam1 & 0x000000ff) == 0xfe) { |
643 | 643 | //Active Sensing |
644 | -// printf("Active Sensing\n"); | |
644 | +// ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "Active Sensing"); | |
645 | 645 | active_sensing_flag = ~0; |
646 | 646 | active_sensing_time = get_current_calender_time(); |
647 | 647 | } |
@@ -650,12 +650,12 @@ int rtsyn_play_one_data (int port, uint32 dwParam1, double event_time) | ||
650 | 650 | if(rtsyn_sample_time_mode == 1){ |
651 | 651 | rtsyn_tmr_reset(); |
652 | 652 | }else{ |
653 | - //printf("System Reset\n"); | |
653 | + //ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "System Reset"); | |
654 | 654 | } |
655 | 655 | } |
656 | 656 | break; |
657 | 657 | default: |
658 | -// printf("Unsup/ed event %d\n", aevp->type); | |
658 | +// ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY, "Unsupported event %d", aevp->type); | |
659 | 659 | break; |
660 | 660 | } |
661 | 661 | if (ev.type != ME_NONE) { |
@@ -669,7 +669,7 @@ int rtsyn_play_one_data (int port, uint32 dwParam1, double event_time) | ||
669 | 669 | } |
670 | 670 | |
671 | 671 | |
672 | -void rtsyn_play_one_sysex (uint8 *sysexbuffer, int exlen, double event_time ) | |
672 | +void rtsyn_play_one_sysex(uint8 *sysexbuffer, int exlen, double event_time ) | |
673 | 673 | { |
674 | 674 | int i, j, chk, ne; |
675 | 675 | MidiEvent ev; |
@@ -47,7 +47,8 @@ d0|vt100|vt100-am|vt100am|Digital VT100:\ | ||
47 | 47 | |
48 | 48 | void vt100_init_screen(void) |
49 | 49 | { |
50 | - vt100_reset_attr(); | |
50 | + fputs("\033[?1049h", stdout); | |
51 | + vt100_reset_attr(); | |
51 | 52 | fputs("\033[H\033[J", stdout); |
52 | 53 | } |
53 | 54 |
@@ -59,7 +60,13 @@ void vt100_refresh(void) | ||
59 | 60 | |
60 | 61 | void vt100_clrtoeol(void) |
61 | 62 | { |
62 | - fputs("\033[K", stdout); | |
63 | + fputs("\033[K", stdout); | |
64 | +} | |
65 | + | |
66 | +void vt100_free_screen(void) | |
67 | +{ | |
68 | + fputs("\033[?1049l", stdout); | |
69 | + fputs("\033[H\033[J", stdout); | |
63 | 70 | } |
64 | 71 | |
65 | 72 | void vt100_move(int row, int col) |
@@ -91,6 +98,7 @@ void vt100_reset_attr(void) | ||
91 | 98 | void vt100_init_screen(void) { } |
92 | 99 | void vt100_refresh(void) { fflush(stdout); } |
93 | 100 | void vt100_clrtoeol(void) { } |
101 | +void vt100_free_screen(void) { } | |
94 | 102 | void vt100_move(int row, int col) { } |
95 | 103 | void vt100_set_attr(int attr) { } |
96 | 104 | void vt100_reset_attr(void) { } |
@@ -32,6 +32,7 @@ | ||
32 | 32 | extern void vt100_init_screen(void); |
33 | 33 | extern void vt100_refresh(void); |
34 | 34 | extern void vt100_clrtoeol(void); |
35 | +extern void vt100_free_screen(void); | |
35 | 36 | extern void vt100_move(int row, int col); |
36 | 37 | extern void vt100_set_attr(int attr); |
37 | 38 | extern void vt100_reset_attr(void); |
@@ -30,11 +30,6 @@ | ||
30 | 30 | #include <stdarg.h> |
31 | 31 | #include <ctype.h> |
32 | 32 | #include <sys/types.h> |
33 | -#ifndef NO_STRING_H | |
34 | -#include <string.h> | |
35 | -#else | |
36 | -#include <strings.h> | |
37 | -#endif | |
38 | 33 | |
39 | 34 | #ifdef HAVE_UNISTD_H |
40 | 35 | #include <unistd.h> |
@@ -130,7 +125,7 @@ static void ctl_reset(void); | ||
130 | 125 | static int ctl_open(int using_stdin, int using_stdout); |
131 | 126 | static void ctl_close(void); |
132 | 127 | static int ctl_read(ptr_size_t *valp); |
133 | -static int32 ctl_write(const uint8 *valp, int32 size); | |
128 | +static int32 ctl_write(const uint8 *valp, size_t size); | |
134 | 129 | static int cmsg(int type, int verbosity_level, const char *fmt, ...); |
135 | 130 | static void ctl_event(CtlEvent *e); |
136 | 131 |
@@ -615,6 +610,7 @@ static void ctl_close(void) | ||
615 | 610 | { |
616 | 611 | ctl.opened = 0; |
617 | 612 | vt100_move(24, 0); |
613 | + vt100_free_screen(); | |
618 | 614 | vt100_refresh(); |
619 | 615 | } |
620 | 616 |
@@ -68,7 +68,7 @@ extern void MPanelReset(void); | ||
68 | 68 | extern void MPanelUpdate(void); |
69 | 69 | extern void MPanelUpdateAll(void); |
70 | 70 | extern void MPanelPaint(void); |
71 | -extern int is_directory(char *path); | |
71 | +extern int is_directory(const char *path); | |
72 | 72 | extern int directory_form(char *buffer); |
73 | 73 | extern int TracerWndDrawSkip; |
74 | 74 |
@@ -268,15 +268,13 @@ long SetValue(int32 value, int32 min, int32 max) | ||
268 | 268 | return v; |
269 | 269 | } |
270 | 270 | |
271 | -int w32gSecondTiMidity(int opt, int argc, char **argv); | |
271 | +int w32gSecondTiMidity(int opt, int argc, char **argv, int nfiles, char **files); | |
272 | 272 | int w32gSecondTiMidityExit(void); |
273 | 273 | int SecondMode = 1; |
274 | 274 | |
275 | 275 | void FirstLoadIniFile(void); |
276 | 276 | |
277 | -#if (defined(IA_W32GUI) || defined(IA_W32G_SYN)) && \ | |
278 | - (!defined(__GNUC__) || /* _MSC_VER, _BORLANDC_, __WATCOMC__ */ \ | |
279 | - (defined(__GNUC__) && defined(SUPPORT_WINMAIN))) | |
277 | +#if (defined(__W32G__) && !defined(TWSYNG32)) && !defined(WIN32GCC) | |
280 | 278 | extern void CmdLineToArgv(LPSTR lpCmdLine, int *argc, CHAR ***argv); |
281 | 279 | extern int win_main(int argc, char **argv); /* timidity.c */ |
282 | 280 | int WINAPI |
@@ -291,7 +289,7 @@ LPSTR lpCmdLine, int nCmdShow) | ||
291 | 289 | static int first = 0; |
292 | 290 | |
293 | 291 | Sleep(100); // Restartで前プロセスの終了待機 |
294 | -#ifdef _CRTDBG_MAP_ALLOC | |
292 | +#ifdef TIMIDITY_LEAK_CHECK | |
295 | 293 | _CrtSetDbgFlag(CRTDEBUGFLAGS); |
296 | 294 | #endif |
297 | 295 | CmdLineToArgv(lpCmdLine,&argc,&argv); |
@@ -334,7 +332,7 @@ LPSTR lpCmdLine, int nCmdShow) | ||
334 | 332 | return errcode; |
335 | 333 | #endif |
336 | 334 | } |
337 | -#endif /* __W32G__ && SUPPORT_WINMAIN */ | |
335 | +#endif /* (__W32G__ && !TWSYNG32) && !WIN32GCC */ | |
338 | 336 | |
339 | 337 | // *************************************************************************** |
340 | 338 | // System Function |
@@ -5118,23 +5116,25 @@ static char *DlgFileOpen(HWND hwnd, const char *title, const char *filter, const | ||
5118 | 5116 | static void DlgMidiFileOpen(HWND hwnd) |
5119 | 5117 | { |
5120 | 5118 | char *dir, *file; |
5121 | - const char *filter; | |
5122 | - const char *filter_en = "timidity file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi;*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni;*.lzh;*.zip;*.gz;*.pls;*.m3u;*.asx\0" | |
5123 | - "midi file\0*.mid;*.midi;*.smf;*.rmi\0" | |
5124 | - "rcp file\0*.rcp;*.r36;*.g18;*.g36\0" | |
5125 | - "mod file\0*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni\0" | |
5126 | - "archive file\0*.lzh;*.zip;*.gz\0" | |
5127 | - "playlist file\0*.pls;*.m3u;*.asx\0" | |
5128 | - "all files\0*.*\0" | |
5129 | - "\0\0"; | |
5130 | - const char *filter_jp = "Timidity サポート済みファイル\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi;*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni;*.lzh;*.zip;*.gz;*.pls;*.m3u;*.asx\0" | |
5131 | - "SMF/RMID (*.mid;*.midi;*.smf;*.rmi)\0*.mid;*.midi;*.smf;*.rmi\0" | |
5132 | - "RCP (*.rcp;*.r36;*.g18;*.g36)\0*.rcp;*.r36;*.g18;*.g36\0" | |
5133 | - "MOD (*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni)\0*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni\0" | |
5134 | - "圧縮済みアーカイブ (*.lzh;*.zip;*.gz)\0*.lzh;*.zip;*.gz\0" | |
5135 | - "プレイリストファイル (*.pls;*.m3u;*.asx)\0*.pls;*.m3u;*.asx\0" | |
5136 | - "すべてのファイル (*.*)\0*.*\0" | |
5137 | - "\0\0"; | |
5119 | + const char *filter, | |
5120 | + filter_en[] = "timidity file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi;*.mld;*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni;*.lzh;*.zip;*.gz;*.pls;*.m3u;*.asx\0" | |
5121 | + "midi file\0*.mid;*.midi;*.smf;*.rmi\0" | |
5122 | + "rcp file\0*.rcp;*.r36;*.g18;*.g36\0" | |
5123 | + "mfi file\0*.mld\0" | |
5124 | + "mod file\0*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni\0" | |
5125 | + "archive file\0*.lzh;*.zip;*.gz\0" | |
5126 | + "playlist file\0*.pls;*.m3u;*.asx\0" | |
5127 | + "all files\0*.*\0" | |
5128 | + "\0\0", | |
5129 | + filter_jp[] = "Timidity サポート済みファイル\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi;*.mld;*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni;*.lzh;*.zip;*.gz;*.pls;*.m3u;*.asx\0" | |
5130 | + "SMF/RMID (*.mid;*.midi;*.smf;*.rmi)\0*.mid;*.midi;*.smf;*.rmi\0" | |
5131 | + "RCP (*.rcp;*.r36;*.g18;*.g36)\0*.rcp;*.r36;*.g18;*.g36\0" | |
5132 | + "MFi (*.mld)\0*.mld\0" | |
5133 | + "MOD (*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni)\0*.mod;*.xm;*.s3m;*.it;*.669;*.amf;*.dsm;*.far;*.gdm;*.imf;*.med;*.mtm;*.stm;*.stx;*.ult;*.uni\0" | |
5134 | + "圧縮済みアーカイブ (*.lzh;*.zip;*.gz)\0*.lzh;*.zip;*.gz\0" | |
5135 | + "プレイリストファイル (*.pls;*.m3u;*.asx)\0*.pls;*.m3u;*.asx\0" | |
5136 | + "すべてのファイル (*.*)\0*.*\0" | |
5137 | + "\0\0"; | |
5138 | 5138 | |
5139 | 5139 | if ( PlayerLanguage == LANGUAGE_JAPANESE ) |
5140 | 5140 | filter = filter_jp; |
@@ -278,6 +278,11 @@ static int w32_reset_exe_directory(void) | ||
278 | 278 | #endif |
279 | 279 | #endif |
280 | 280 | |
281 | +#define MAX_CFG_HISTORY 10 | |
282 | + | |
283 | +static void LoadCfgHistoryINI(HWND hwnd, int cb_id); | |
284 | +static void SaveCfgHistoryINI(HWND hwnd, int cb_id); | |
285 | +static void AddCurrentTextToCfgHistory(HWND hwnd, int cb_id); | |
281 | 286 | |
282 | 287 | extern int waveConfigDialog(void); |
283 | 288 | #ifdef AU_W32 |
@@ -392,8 +397,8 @@ static pref_page_t pref_pages_en[] = { | ||
392 | 397 | { 3, TEXT("Output"), (HWND)NULL, IDD_PREF_TIMIDITY3_EN, (DLGPROC) PrefTiMidity3DialogProc, 0 }, |
393 | 398 | { 4, TEXT("sf_ini1"), (HWND)NULL, IDD_PREF_SFINI1_EN, (DLGPROC) PrefSFINI1DialogProc, 0 }, |
394 | 399 | { 5, TEXT("sf_ini2"), (HWND)NULL, IDD_PREF_SFINI2_EN, (DLGPROC) PrefSFINI2DialogProc, 0 }, |
395 | - { 6, TEXT("Custom1"), (HWND)NULL, IDD_PREF_CUSTOM1, (DLGPROC) PrefCustom1DialogProc, 0 }, | |
396 | - { 7, TEXT("Custom2"), (HWND)NULL, IDD_PREF_CUSTOM2, (DLGPROC) PrefCustom2DialogProc, 0 }, | |
400 | + { 6, TEXT("Custom1"), (HWND)NULL, IDD_PREF_CUSTOM1_EN, (DLGPROC) PrefCustom1DialogProc, 0 }, | |
401 | + { 7, TEXT("Custom2"), (HWND)NULL, IDD_PREF_CUSTOM2_EN, (DLGPROC) PrefCustom2DialogProc, 0 }, | |
397 | 402 | { 8, TEXT("InternalSynth"), (HWND)NULL, IDD_PREF_INT_SYNTH_EN, (DLGPROC) PrefIntSynthDialogProc, 0 }, |
398 | 403 | #else |
399 | 404 | { 0, TEXT("Player"), (HWND)NULL, IDD_PREF_PLAYER_EN, (DLGPROC) PrefPlayerDialogProc, 0 }, |
@@ -402,8 +407,8 @@ static pref_page_t pref_pages_en[] = { | ||
402 | 407 | { 3, TEXT("Output"), (HWND)NULL, IDD_PREF_TIMIDITY3_EN, (DLGPROC) PrefTiMidity3DialogProc, 0 }, |
403 | 408 | { 4, TEXT("sf_ini1"), (HWND)NULL, IDD_PREF_SFINI1_EN, (DLGPROC) PrefSFINI1DialogProc, 0 }, |
404 | 409 | { 5, TEXT("sf_ini2"), (HWND)NULL, IDD_PREF_SFINI2_EN, (DLGPROC) PrefSFINI2DialogProc, 0 }, |
405 | - { 6, TEXT("custom1"), (HWND)NULL, IDD_PREF_CUSTOM1, (DLGPROC) PrefCustom1DialogProc, 0 }, | |
406 | - { 7, TEXT("custom2"), (HWND)NULL, IDD_PREF_CUSTOM2, (DLGPROC) PrefCustom2DialogProc, 0 }, | |
410 | + { 6, TEXT("custom1"), (HWND)NULL, IDD_PREF_CUSTOM1_EN, (DLGPROC) PrefCustom1DialogProc, 0 }, | |
411 | + { 7, TEXT("custom2"), (HWND)NULL, IDD_PREF_CUSTOM2_EN, (DLGPROC) PrefCustom2DialogProc, 0 }, | |
407 | 412 | { 8, TEXT("InternalSynth"), (HWND)NULL, IDD_PREF_INT_SYNTH_EN, (DLGPROC) PrefIntSynthDialogProc, 0 }, |
408 | 413 | #endif |
409 | 414 | }; |
@@ -553,7 +558,10 @@ static void PrefWndDelayLoad(void) | ||
553 | 558 | |
554 | 559 | void PrefWndCreate(HWND hwnd, UINT cid) |
555 | 560 | { |
556 | - UINT page = cid ? PrefSearchPageFromCID(cid) : PrefInitialPage; | |
561 | + UINT page; | |
562 | + | |
563 | + CurrentPlayerLanguage = PlayerLanguage; | |
564 | + page = cid ? PrefSearchPageFromCID(cid) : PrefInitialPage; | |
557 | 565 | |
558 | 566 | VOLATILE_TOUCH(PrefWndDoing); |
559 | 567 | if (PrefWndDoing) |
@@ -562,7 +570,6 @@ void PrefWndCreate(HWND hwnd, UINT cid) | ||
562 | 570 | PrefWndSetOK = 1; |
563 | 571 | |
564 | 572 | PrefInitialPage = page; |
565 | - CurrentPlayerLanguage = PlayerLanguage; | |
566 | 573 | #if defined(KBTIM_SETUP) || defined(WINDRV_SETUP) |
567 | 574 | switch(CurrentPlayerLanguage) { |
568 | 575 | case LANGUAGE_JAPANESE: |
@@ -1354,16 +1361,18 @@ PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1354 | 1361 | DI_DISABLE(IDC_CHECKBOX_LOOP_CC2); |
1355 | 1362 | DI_DISABLE(IDC_EDIT_LOOP_REPEAT); |
1356 | 1363 | #endif |
1357 | - | |
1364 | + | |
1358 | 1365 | if (!sp_temp->ConfigFile[0]) { |
1359 | 1366 | strcpy(sp_temp->ConfigFile, ConfigFile); |
1360 | 1367 | } |
1361 | - EB_SETTEXTA(IDC_EDIT_CONFIG_FILE, sp_temp->ConfigFile); | |
1362 | - tmp = SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1363 | - SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, EM_SETSEL, (WPARAM) tmp, (LPARAM) tmp); // A/W | |
1368 | + EB_SETTEXTA(IDC_COMBO_CONFIG_FILE, sp_temp->ConfigFile); | |
1369 | + tmp = SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1370 | + SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, CB_SETEDITSEL, 0, MAKELPARAM(tmp, tmp)); // A/W | |
1364 | 1371 | safe_free(CurrentConfigFile); |
1365 | 1372 | CurrentConfigFile = safe_strdup(sp_temp->ConfigFile); |
1366 | 1373 | |
1374 | + LoadCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1375 | + | |
1367 | 1376 | switch (CurrentPlayerLanguage) { |
1368 | 1377 | case LANGUAGE_ENGLISH: |
1369 | 1378 | CheckRadioButton(hwnd, IDC_RADIOBUTTON_JAPANESE, IDC_RADIOBUTTON_ENGLISH, |
@@ -1467,13 +1476,15 @@ PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1467 | 1476 | case IDC_BUTTON_CONFIG_FILE: { |
1468 | 1477 | char filename[FILEPATH_MAX]; |
1469 | 1478 | filename[0] = '\0'; |
1470 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1479 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1471 | 1480 | if (!DlgOpenConfigFile(filename, hwnd)) |
1472 | 1481 | if (filename[0] != '\0') { |
1473 | - EB_SETTEXTA(IDC_EDIT_CONFIG_FILE, filename); | |
1474 | - tmp = SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1475 | - SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, EM_SETSEL, (WPARAM) tmp, (LPARAM) tmp); // A/W | |
1476 | - } | |
1482 | + EB_SETTEXTA(IDC_COMBO_CONFIG_FILE, filename); | |
1483 | + tmp = SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1484 | + SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, CB_SETEDITSEL, 0, MAKELPARAM(tmp, tmp)); // A/W | |
1485 | + AddCurrentTextToCfgHistory(hwnd, IDC_COMBO_CONFIG_FILE); | |
1486 | + SaveCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1487 | + } | |
1477 | 1488 | break; } |
1478 | 1489 | |
1479 | 1490 | case IDC_BUTTON_CFG_EDIT: { |
@@ -1488,7 +1499,7 @@ PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1488 | 1499 | } |
1489 | 1500 | |
1490 | 1501 | filename[0] = '\0'; |
1491 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1502 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1492 | 1503 | |
1493 | 1504 | w32_reset_exe_directory(); |
1494 | 1505 |
@@ -1553,8 +1564,10 @@ PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1553 | 1564 | |
1554 | 1565 | if (initflag) |
1555 | 1566 | break; |
1556 | - | |
1557 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, sp_temp->ConfigFile, FILEPATH_MAX - 1); | |
1567 | + | |
1568 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, sp_temp->ConfigFile, FILEPATH_MAX - 1); | |
1569 | + AddCurrentTextToCfgHistory(hwnd, IDC_COMBO_CONFIG_FILE); | |
1570 | + SaveCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1558 | 1571 | |
1559 | 1572 | if (CH_GET(IDC_RADIOBUTTON_ENGLISH)) |
1560 | 1573 | sp_temp->PlayerLanguage = LANGUAGE_ENGLISH; |
@@ -1731,17 +1744,18 @@ PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1731 | 1744 | switch (uMess){ |
1732 | 1745 | case WM_INITDIALOG: |
1733 | 1746 | if (hFixedPointFont != NULL) |
1734 | - SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, WM_SETFONT, (WPARAM) hFixedPointFont, MAKELPARAM(TRUE, 0)); | |
1747 | + SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, WM_SETFONT, (WPARAM) hFixedPointFont, MAKELPARAM(TRUE, 0)); | |
1735 | 1748 | |
1736 | 1749 | |
1737 | 1750 | if (!sp_temp->ConfigFile[0]) { |
1738 | 1751 | strcpy(sp_temp->ConfigFile, ConfigFile); |
1739 | 1752 | } |
1740 | - EB_SETTEXTA(IDC_EDIT_CONFIG_FILE, sp_temp->ConfigFile); | |
1741 | - tmp = SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1742 | - SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, EM_SETSEL, (WPARAM) tmp, (LPARAM) tmp); // A/W | |
1753 | + EB_SETTEXTA(IDC_COMBO_CONFIG_FILE, sp_temp->ConfigFile); | |
1754 | + tmp = SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1755 | + SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, CB_SETEDITSEL, 0, MAKELPARAM(tmp, tmp)); // A/W | |
1743 | 1756 | safe_free(CurrentConfigFile); |
1744 | 1757 | CurrentConfigFile = safe_strdup(sp_temp->ConfigFile); |
1758 | + LoadCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1745 | 1759 | |
1746 | 1760 | #if defined(WINDRV_SETUP) |
1747 | 1761 | DI_DISABLE(IDC_BUTTON_CFG_RELOAD); |
@@ -1892,13 +1906,15 @@ PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1892 | 1906 | case IDC_BUTTON_CONFIG_FILE: { |
1893 | 1907 | char filename[FILEPATH_MAX]; |
1894 | 1908 | filename[0] = '\0'; |
1895 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1909 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1896 | 1910 | if (!DlgOpenConfigFile(filename, hwnd)) |
1897 | 1911 | if (filename[0] != '\0') { |
1898 | - EB_SETTEXTA(IDC_EDIT_CONFIG_FILE, filename); // A | |
1899 | - tmp = SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1900 | - SendDlgItemMessage(hwnd, IDC_EDIT_CONFIG_FILE, EM_SETSEL, (WPARAM) tmp, (LPARAM) tmp); // A/W | |
1901 | - } | |
1912 | + EB_SETTEXTA(IDC_COMBO_CONFIG_FILE, filename); // A | |
1913 | + tmp = SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, WM_GETTEXTLENGTH, 0, 0); // A/W | |
1914 | + SendDlgItemMessage(hwnd, IDC_COMBO_CONFIG_FILE, CB_SETEDITSEL, 0, MAKELPARAM(tmp, tmp)); // A/W | |
1915 | + AddCurrentTextToCfgHistory(hwnd, IDC_COMBO_CONFIG_FILE); | |
1916 | + SaveCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1917 | + } | |
1902 | 1918 | break; } |
1903 | 1919 | case IDC_BUTTON_CFG_EDIT: { |
1904 | 1920 | char filename[FILEPATH_MAX]; |
@@ -1912,7 +1928,7 @@ PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1912 | 1928 | } |
1913 | 1929 | |
1914 | 1930 | filename[0] = '\0'; |
1915 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1931 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, filename, FILEPATH_MAX - 1); | |
1916 | 1932 | |
1917 | 1933 | w32_reset_exe_directory(); |
1918 | 1934 |
@@ -1956,8 +1972,11 @@ PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) | ||
1956 | 1972 | case WM_MYSAVE: |
1957 | 1973 | if (initflag) |
1958 | 1974 | break; |
1975 | + | |
1976 | + EB_GETTEXTA(IDC_COMBO_CONFIG_FILE, sp_temp->ConfigFile, FILEPATH_MAX - 1); | |
1977 | + AddCurrentTextToCfgHistory(hwnd, IDC_COMBO_CONFIG_FILE); | |
1978 | + SaveCfgHistoryINI(hwnd, IDC_COMBO_CONFIG_FILE); | |
1959 | 1979 | |
1960 | - EB_GETTEXTA(IDC_EDIT_CONFIG_FILE, sp_temp->ConfigFile, FILEPATH_MAX - 1); | |
1961 | 1980 | if (CH_GET(IDC_RADIOBUTTON_ENGLISH)) { |
1962 | 1981 | sp_temp->PlayerLanguage = LANGUAGE_ENGLISH; |
1963 | 1982 | } else if (CH_GET(IDC_RADIOBUTTON_JAPANESE)) { |
@@ -5883,12 +5902,12 @@ static int DlgOpenConfigFile(char *Filename, HWND hwnd) | ||
5883 | 5902 | dir[FILEPATH_MAX]; |
5884 | 5903 | int i, res; |
5885 | 5904 | const char *filter, |
5886 | - filter_en[] = "All Supported file (*.cfg;*.config;*.sf2;*.sf3)\0*.cfg;*.config;*.sf2;*.sf3\0" | |
5905 | + filter_en[] = "All Supported files (*.cfg;*.config;*.sf2;*.sf3)\0*.cfg;*.config;*.sf2;*.sf3\0" | |
5887 | 5906 | "SoundFont file (*.sf2)\0*.sf2;*.sf3\0" |
5888 | 5907 | "Config file (*.cfg;*.config)\0*.cfg;*.config\0" |
5889 | 5908 | "All files (*.*)\0*.*\0" |
5890 | 5909 | "\0\0", |
5891 | - filter_jp[] = "すべての対応ファイル (*.cfg;*.config;*.sf2;*.sf2)\0*.cfg;*.config;*.sf2;*.sf3\0" | |
5910 | + filter_jp[] = "すべての対応ファイル (*.cfg;*.config;*.sf2;*.sf3)\0*.cfg;*.config;*.sf2;*.sf3\0" | |
5892 | 5911 | "SoundFont ファイル (*.sf2)\0*.sf2;*.sf3\0" |
5893 | 5912 | "Config ファイル (*.cfg;*.config)\0*.cfg;*.config\0" |
5894 | 5913 | "すべてのファイル (*.*)\0*.*\0" |
@@ -6097,6 +6116,76 @@ int w32g_gogo_id3_tag_dialog(void) | ||
6097 | 6116 | return 0; |
6098 | 6117 | } |
6099 | 6118 | |
6119 | +static void LoadCfgHistoryINI(HWND hwnd, int cb_id) | |
6120 | +{ | |
6121 | + TCHAR buffer1[FILEPATH_MAX + 1] = {0}; | |
6122 | + TCHAR buffer2[FILEPATH_MAX + 1] = {0}; | |
6123 | + LPCTSTR inifile = timidity_history_inifile; | |
6124 | + int count = GetPrivateProfileInt(_T("cfg"), _T("count"), 0, inifile); | |
6125 | + int i; | |
6126 | + | |
6127 | + // remove old items | |
6128 | + for (i = SendDlgItemMessage(hwnd, cb_id, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) { | |
6129 | + SendDlgItemMessage(hwnd, cb_id, CB_DELETESTRING, i, 0); | |
6130 | + } | |
6131 | + | |
6132 | + if (count > MAX_CFG_HISTORY) | |
6133 | + count = MAX_CFG_HISTORY; | |
6134 | + | |
6135 | + for (i = 0; i < count; i++) { | |
6136 | + _sntprintf(buffer1, FILEPATH_MAX, _T("item%02d"), i); | |
6137 | + GetPrivateProfileString(_T("cfg"), buffer1, _T(""), buffer2, FILEPATH_MAX, inifile); | |
6138 | + | |
6139 | + if (buffer2[0] != _T('\0')) { | |
6140 | + CB_INSSTR(cb_id, buffer2); | |
6141 | + } | |
6142 | + } | |
6143 | +} | |
6144 | + | |
6145 | +static void SaveCfgHistoryINI(HWND hwnd, int cb_id) | |
6146 | +{ | |
6147 | + TCHAR buffer1[FILEPATH_MAX + 1] = {0}; | |
6148 | + TCHAR buffer2[FILEPATH_MAX + 1] = {0}; | |
6149 | + LPCTSTR inifile = timidity_history_inifile; | |
6150 | + int count = SendDlgItemMessage(hwnd, cb_id, CB_GETCOUNT, 0, 0); | |
6151 | + int i; | |
6152 | + DWORD e; | |
6153 | + | |
6154 | + _sntprintf(buffer1, FILEPATH_MAX, _T("%d"), count); | |
6155 | + SetLastError(0); | |
6156 | + WritePrivateProfileString(_T("cfg"), _T("count"), buffer1, inifile); | |
6157 | + | |
6158 | + e = GetLastError(); | |
6159 | + | |
6160 | + for (i = 0; i < count; i++) { | |
6161 | + _sntprintf(buffer1, FILEPATH_MAX, _T("item%02d"), i); | |
6162 | + | |
6163 | + if (SendDlgItemMessage(hwnd, cb_id, CB_GETLBTEXTLEN, i, 0) < FILEPATH_MAX) { | |
6164 | + SendDlgItemMessage(hwnd, cb_id, CB_GETLBTEXT, i, (LPARAM)buffer2); | |
6165 | + WritePrivateProfileString(_T("cfg"), buffer1, buffer2, inifile); | |
6166 | + } | |
6167 | + } | |
6168 | + | |
6169 | + WritePrivateProfileString(NULL, NULL, NULL, inifile); // flush | |
6170 | +} | |
6171 | + | |
6172 | +static void AddCurrentTextToCfgHistory(HWND hwnd, int cb_id) | |
6173 | +{ | |
6174 | + TCHAR buffer[FILEPATH_MAX + 1] = {0}; | |
6175 | + int index; | |
6176 | + | |
6177 | + EB_GETTEXT(cb_id, buffer, FILEPATH_MAX); | |
6178 | + | |
6179 | + index = SendDlgItemMessage(hwnd, cb_id, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); | |
6180 | + | |
6181 | + if (index != CB_ERR) | |
6182 | + SendDlgItemMessage(hwnd, cb_id, CB_DELETESTRING, index, 0); | |
6183 | + | |
6184 | + SendDlgItemMessage(hwnd, cb_id, CB_INSERTSTRING, 0, buffer); | |
6185 | + SendDlgItemMessage(hwnd, cb_id, CB_DELETESTRING, MAX_CFG_HISTORY, 0); | |
6186 | + EB_SETTEXT(cb_id, buffer); | |
6187 | +} | |
6188 | + | |
6100 | 6189 | |
6101 | 6190 | // |
6102 | 6191 | // |
@@ -8218,13 +8307,6 @@ static const TCHAR *cb_info_IDC_COMBO_PA_WASAPI_STREAM_CATEGORY[] = { | ||
8218 | 8307 | TEXT("Media"), |
8219 | 8308 | }; |
8220 | 8309 | |
8221 | -#define cb_num_IDC_COMBO_PA_WASAPI_STREAM_OPTION 3 | |
8222 | -static const TCHAR *cb_info_IDC_COMBO_PA_WASAPI_STREAM_OPTION[] = { | |
8223 | - TEXT("None"), | |
8224 | - TEXT("Raw"), | |
8225 | - TEXT("MatchFormat"), | |
8226 | -}; | |
8227 | - | |
8228 | 8310 | |
8229 | 8311 | LRESULT WINAPI portaudioConfigDialogProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) |
8230 | 8312 | { |
@@ -8267,21 +8349,20 @@ LRESULT WINAPI portaudioConfigDialogProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM | ||
8267 | 8349 | DI_DISABLE(IDC_COMBO_PA_WASAPI_STREAM_CATEGORY); |
8268 | 8350 | } |
8269 | 8351 | // WASAPI StreamOption |
8270 | - if(winver >= 6) // win10 | |
8271 | - max = cb_num_IDC_COMBO_PA_WASAPI_STREAM_OPTION; | |
8272 | - else if(winver >= 4) // win8.1 | |
8273 | - max = 2; | |
8274 | - else | |
8275 | - max = 1; | |
8276 | - for (i = 0; i < max; i++) | |
8277 | - CB_INSSTR(IDC_COMBO_PA_WASAPI_STREAM_OPTION, cb_info_IDC_COMBO_PA_WASAPI_STREAM_OPTION[i]); | |
8278 | - if(winver >= 6){ // win10 | |
8279 | - CB_SET(IDC_COMBO_PA_WASAPI_STREAM_OPTION, (st_temp->pa_wasapi_stream_option)); | |
8280 | - }else if(winver >= 4){ // win8.1 | |
8281 | - CB_SET(IDC_COMBO_PA_WASAPI_STREAM_OPTION, (st_temp->pa_wasapi_stream_option >= 2 ? 0 : st_temp->pa_wasapi_stream_option)); | |
8282 | - }else{ | |
8283 | - CB_SET(IDC_COMBO_PA_WASAPI_STREAM_OPTION, 0); | |
8284 | - DI_DISABLE(IDC_COMBO_PA_WASAPI_STREAM_OPTION); | |
8352 | + if (winver >= 6) { // win10 | |
8353 | + SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_RAW, BM_SETCHECK, (st_temp->pa_wasapi_stream_option & 1) ? BST_CHECKED : BST_UNCHECKED, 0); | |
8354 | + SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_MATCH_FORMAT, BM_SETCHECK, (st_temp->pa_wasapi_stream_option & 2) ? BST_CHECKED : BST_UNCHECKED, 0); | |
8355 | + SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_AMBISONICS, BM_SETCHECK, (st_temp->pa_wasapi_stream_option & 4) ? BST_CHECKED : BST_UNCHECKED, 0); | |
8356 | + } | |
8357 | + else if (winver >= 4) { // win8.1 | |
8358 | + SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_RAW, BM_SETCHECK, (st_temp->pa_wasapi_stream_option & 1) ? BST_CHECKED : BST_UNCHECKED, 0); | |
8359 | + DI_DISABLE(IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_MATCH_FORMAT); | |
8360 | + DI_DISABLE(IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_AMBISONICS); | |
8361 | + } | |
8362 | + else { | |
8363 | + DI_DISABLE(IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_RAW); | |
8364 | + DI_DISABLE(IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_MATCH_FORMAT); | |
8365 | + DI_DISABLE(IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_AMBISONICS); | |
8285 | 8366 | } |
8286 | 8367 | |
8287 | 8368 |
@@ -8449,7 +8530,13 @@ LRESULT WINAPI portaudioConfigDialogProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM | ||
8449 | 8530 | // WASAPI StreamCategory |
8450 | 8531 | st_temp->pa_wasapi_stream_category = CB_GET(IDC_COMBO_PA_WASAPI_STREAM_CATEGORY); |
8451 | 8532 | // WASAPI StreamOption |
8452 | - st_temp->pa_wasapi_stream_option = CB_GET(IDC_COMBO_PA_WASAPI_STREAM_OPTION); | |
8533 | + st_temp->pa_wasapi_stream_option = 0; | |
8534 | + if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_RAW, BM_GETCHECK, 0, 0)) | |
8535 | + st_temp->pa_wasapi_stream_option |= 1; | |
8536 | + if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_MATCH_FORMAT, BM_GETCHECK, 0, 0)) | |
8537 | + st_temp->pa_wasapi_stream_option |= 2; | |
8538 | + if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PA_WASAPI_STREAM_OPTIONS_AMBISONICS, BM_GETCHECK, 0, 0)) | |
8539 | + st_temp->pa_wasapi_stream_option |= 4; | |
8453 | 8540 | |
8454 | 8541 | EndDialog(hwnd,TRUE); |
8455 | 8542 | break; |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /* |
2 | 2 | TiMidity++ -- MIDI to WAVE converter and player |
3 | - Copyright (C) 1999-2018 Masanao Izumo <iz@onicos.co.jp> | |
3 | + Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp> | |
4 | 4 | Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi> |
5 | 5 | |
6 | 6 | This program is free software; you can redistribute it and/or modify |
@@ -22,17 +22,16 @@ | ||
22 | 22 | #define __W32G2_PREF_H__ |
23 | 23 | |
24 | 24 | |
25 | -extern void tmdy_free_config(void); | |
26 | -extern void timidity_start_initialize(void); | |
25 | +extern void tmdy_free_config(void); | |
26 | +extern void timidity_start_initialize(void); | |
27 | 27 | extern int read_config_file(char *name, int self, int allow_missing_file); |
28 | 28 | |
29 | 29 | extern volatile int PrefWndDoing; |
30 | 30 | void PrefWndCreate(HWND hwnd, UINT cid); |
31 | 31 | |
32 | - | |
33 | 32 | typedef struct wave_ConfigDialogInfo_t { |
34 | - char optIDC_EDIT_RIFFWAVE_UPDATE_STEP[1024 + 1]; | |
35 | - int optIDC_CHECKBOX_RIFFWAVE_EXTENSIBLE; | |
33 | + char optIDC_EDIT_RIFFWAVE_UPDATE_STEP[1024 + 1]; | |
34 | + int optIDC_CHECKBOX_RIFFWAVE_EXTENSIBLE; | |
36 | 35 | } wave_ConfigDialogInfo_t; |
37 | 36 | |
38 | 37 | extern int wave_ConfigDialogInfoInit(void); |
@@ -40,49 +39,50 @@ extern int wave_ConfigDialogInfoApply(void); | ||
40 | 39 | extern int wave_ConfigDialogInfoSaveINI(void); |
41 | 40 | extern int wave_ConfigDialogInfoLoadINI(void); |
42 | 41 | |
42 | +extern int waveConfigDialog(void); | |
43 | 43 | |
44 | 44 | #ifdef AU_GOGO |
45 | 45 | |
46 | 46 | // ダイアログの情報をほとんどそのまま保存する。 |
47 | 47 | // コンボボックスについては Index は無意味なので値を保存する。 |
48 | 48 | typedef struct gogo_ConfigDialogInfo_t_ { |
49 | - int optIDC_CHECK_DEFAULT; | |
50 | - int optIDC_CHECK_COMMANDLINE_OPTS; | |
51 | - char optIDC_EDIT_COMMANDLINE_OPTION[1024+1]; | |
52 | - int optIDC_CHECK_OUTPUT_FORMAT; | |
53 | - int optIDC_COMBO_OUTPUT_FORMAT; | |
54 | - int optIDC_CHECK_MPEG1AUDIOBITRATE; | |
55 | - int optIDC_COMBO_MPEG1_AUDIO_BITRATE; | |
56 | - int optIDC_CHECK_MPEG2AUDIOBITRATE; | |
57 | - int optIDC_COMBO_MPEG2_AUDIO_BITRATE; | |
58 | - int optIDC_CHECK_ENHANCED_LOW_PASS_FILTER; | |
59 | - char optIDC_EDIT_LPF_PARA1[4+1]; | |
60 | - char optIDC_EDIT_LPF_PARA2[4+1]; | |
61 | - int optIDC_CHECK_ENCODE_MODE; | |
62 | - int optIDC_COMBO_ENCODE_MODE; | |
63 | - int optIDC_CHECK_EMPHASIS_TYPE; | |
64 | - int optIDC_COMBO_EMPHASIS_TYPE; | |
65 | - int optIDC_CHECK_OUTFREQ; | |
66 | - char optIDC_EDIT_OUTFREQ[6+1]; | |
67 | - int optIDC_CHECK_MSTHRESHOLD; | |
68 | - char optIDC_EDIT_MSTHRESHOLD_THRESHOLD[4+1]; | |
69 | - char optIDC_EDIT_MSTHRESHOLD_MSPOWER[4+1]; | |
70 | - int optIDC_CHECK_USE_CPU_OPTS; | |
71 | - int optIDC_CHECK_CPUMMX; | |
72 | - int optIDC_CHECK_CPUSSE; | |
73 | - int optIDC_CHECK_CPU3DNOW; | |
74 | - int optIDC_CHECK_CPUE3DNOW; | |
75 | - int optIDC_CHECK_CPUCMOV; | |
76 | - int optIDC_CHECK_CPUEMMX; | |
77 | - int optIDC_CHECK_CPUSSE2; | |
78 | - int optIDC_CHECK_VBR; | |
79 | - int optIDC_COMBO_VBR; | |
80 | - int optIDC_CHECK_VBR_BITRATE; | |
81 | - int optIDC_COMBO_VBR_BITRATE_LOW; | |
82 | - int optIDC_COMBO_VBR_BITRATE_HIGH; | |
83 | - int optIDC_CHECK_USEPSY; | |
84 | - int optIDC_CHECK_VERIFY; | |
85 | - int optIDC_CHECK_16KHZ_LOW_PASS_FILTER; | |
49 | + int optIDC_CHECK_DEFAULT; | |
50 | + int optIDC_CHECK_COMMANDLINE_OPTS; | |
51 | + char optIDC_EDIT_COMMANDLINE_OPTION[1024+1]; | |
52 | + int optIDC_CHECK_OUTPUT_FORMAT; | |
53 | + int optIDC_COMBO_OUTPUT_FORMAT; | |
54 | + int optIDC_CHECK_MPEG1AUDIOBITRATE; | |
55 | + int optIDC_COMBO_MPEG1_AUDIO_BITRATE; | |
56 | + int optIDC_CHECK_MPEG2AUDIOBITRATE; | |
57 | + int optIDC_COMBO_MPEG2_AUDIO_BITRATE; | |
58 | + int optIDC_CHECK_ENHANCED_LOW_PASS_FILTER; | |
59 | + char optIDC_EDIT_LPF_PARA1[4+1]; | |
60 | + char optIDC_EDIT_LPF_PARA2[4+1]; | |
61 | + int optIDC_CHECK_ENCODE_MODE; | |
62 | + int optIDC_COMBO_ENCODE_MODE; | |
63 | + int optIDC_CHECK_EMPHASIS_TYPE; | |
64 | + int optIDC_COMBO_EMPHASIS_TYPE; | |
65 | + int optIDC_CHECK_OUTFREQ; | |
66 | + char optIDC_EDIT_OUTFREQ[6+1]; | |
67 | + int optIDC_CHECK_MSTHRESHOLD; | |
68 | + char optIDC_EDIT_MSTHRESHOLD_THRESHOLD[4+1]; | |
69 | + char optIDC_EDIT_MSTHRESHOLD_MSPOWER[4+1]; | |
70 | + int optIDC_CHECK_USE_CPU_OPTS; | |
71 | + int optIDC_CHECK_CPUMMX; | |
72 | + int optIDC_CHECK_CPUSSE; | |
73 | + int optIDC_CHECK_CPU3DNOW; | |
74 | + int optIDC_CHECK_CPUE3DNOW; | |
75 | + int optIDC_CHECK_CPUCMOV; | |
76 | + int optIDC_CHECK_CPUEMMX; | |
77 | + int optIDC_CHECK_CPUSSE2; | |
78 | + int optIDC_CHECK_VBR; | |
79 | + int optIDC_COMBO_VBR; | |
80 | + int optIDC_CHECK_VBR_BITRATE; | |
81 | + int optIDC_COMBO_VBR_BITRATE_LOW; | |
82 | + int optIDC_COMBO_VBR_BITRATE_HIGH; | |
83 | + int optIDC_CHECK_USEPSY; | |
84 | + int optIDC_CHECK_VERIFY; | |
85 | + int optIDC_CHECK_16KHZ_LOW_PASS_FILTER; | |
86 | 86 | } gogo_ConfigDialogInfo_t; |
87 | 87 | |
88 | 88 | extern volatile gogo_ConfigDialogInfo_t gogo_ConfigDialogInfo; |
@@ -98,12 +98,12 @@ extern int gogo_ConfigDialogInfoLoadINI(void); | ||
98 | 98 | #ifdef AU_VORBIS |
99 | 99 | |
100 | 100 | typedef struct vorbis_ConfigDialogInfo_t_ { |
101 | - int optIDC_CHECK_DEFAULT; | |
102 | - int optIDC_COMBO_MODE; | |
103 | - int optIDC_CHECK_USE_TAG; | |
104 | - char optIDC_EDIT1[256]; | |
105 | - char optIDC_EDIT2[256]; | |
106 | - char optIDC_EDIT3[256]; | |
101 | + int optIDC_CHECK_DEFAULT; | |
102 | + int optIDC_COMBO_MODE; | |
103 | + int optIDC_CHECK_USE_TAG; | |
104 | + char optIDC_EDIT1[256]; | |
105 | + char optIDC_EDIT2[256]; | |
106 | + char optIDC_EDIT3[256]; | |
107 | 107 | } vorbis_ConfigDialogInfo_t; |
108 | 108 | |
109 | 109 | extern int vorbis_ConfigDialogInfoInit(void); |
@@ -117,7 +117,7 @@ extern int vorbis_ConfigDialogInfoLoadINI(void); | ||
117 | 117 | #ifdef AU_LAME |
118 | 118 | |
119 | 119 | typedef struct lame_ConfigDialogInfo_t_ { |
120 | - int optIDC_LAME_CBPRESET; | |
120 | + int optIDC_LAME_CBPRESET; | |
121 | 121 | } lame_ConfigDialogInfo_t; |
122 | 122 | |
123 | 123 | extern int lame_encode_preset; |
@@ -133,8 +133,8 @@ extern int lame_ConfigDialogInfoLoadINI(void); | ||
133 | 133 | #ifdef AU_FLAC |
134 | 134 | |
135 | 135 | typedef struct flac_ConfigDialogInfo_t_ { |
136 | - int optIDC_COMBO_ENCODE_MODE; | |
137 | - int optIDC_CHECKBOX_OGGFLAC_CONTAINER; | |
136 | + int optIDC_COMBO_ENCODE_MODE; | |
137 | + int optIDC_CHECKBOX_OGGFLAC_CONTAINER; | |
138 | 138 | } flac_ConfigDialogInfo_t; |
139 | 139 | |
140 | 140 | extern int flac_ConfigDialogInfoInit(void); |
@@ -148,6 +148,7 @@ extern int flac_ConfigDialogInfoLoadINI(void); | ||
148 | 148 | #ifdef AU_OPUS |
149 | 149 | |
150 | 150 | typedef struct opus_ConfigDialogInfo_t_ { |
151 | + char unused; | |
151 | 152 | } opus_ConfigDialogInfo_t; |
152 | 153 | |
153 | 154 | extern int opus_ConfigDialogInfoInit(void); |
@@ -161,6 +162,7 @@ extern int opus_ConfigDialogInfoLoadINI(void); | ||
161 | 162 | #ifdef AU_SPEEX |
162 | 163 | |
163 | 164 | typedef struct speex_ConfigDialogInfo_t_ { |
165 | + char unused; | |
164 | 166 | } speex_ConfigDialogInfo_t; |
165 | 167 | |
166 | 168 | extern int speex_ConfigDialogInfoInit(void); |
@@ -170,7 +170,7 @@ | ||
170 | 170 | <ExceptionHandling> |
171 | 171 | </ExceptionHandling> |
172 | 172 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
173 | - <StructMemberAlignment>8Bytes</StructMemberAlignment> | |
173 | + <StructMemberAlignment>16Bytes</StructMemberAlignment> | |
174 | 174 | <BufferSecurityCheck>false</BufferSecurityCheck> |
175 | 175 | <FunctionLevelLinking>true</FunctionLevelLinking> |
176 | 176 | <PrecompiledHeaderFile>..\config.h</PrecompiledHeaderFile> |
@@ -2,6 +2,7 @@ | ||
2 | 2 | add_definitions( |
3 | 3 | -DCFG_FOR_SF |
4 | 4 | -DSF2VIEWER_GUI |
5 | + -DENABLE_DLS | |
5 | 6 | ) |
6 | 7 | |
7 | 8 | add_executable( |
@@ -10,55 +11,20 @@ add_executable( | ||
10 | 11 | mysndfont.c |
11 | 12 | OpenDlg.cpp |
12 | 13 | sfview_main.cpp |
13 | - ../interface/dumb_c.c | |
14 | - ../timidity/common.c | |
15 | - ../timidity/controls.c | |
16 | - ../timidity/envelope.c | |
17 | - ../timidity/filter.c | |
18 | - ../timidity/freq.c | |
19 | - ../timidity/instrum.c | |
20 | - ../timidity/int_synth.c | |
21 | - ../timidity/mt19937ar.c | |
14 | + ../timidity/dls.cpp | |
22 | 15 | ../timidity/myini.c |
23 | - ../timidity/quantity.c | |
24 | - ../timidity/resample.c | |
25 | - ../timidity/sbkconv.c | |
26 | - ../timidity/sffile.c | |
27 | - ../timidity/sfitem.c | |
28 | - ../timidity/smplfile.c | |
29 | - ../timidity/tables.c | |
30 | - ../timidity/version.c | |
31 | 16 | |
32 | 17 | OpenDlg.h |
33 | 18 | resource.h |
34 | - ../libarc/arc.h | |
35 | - ../timidity/common.h | |
36 | - ../timidity/controls.h | |
37 | - ../timidity/envelope.h | |
38 | - ../timidity/filter.h | |
39 | - ../timidity/instrum.h | |
40 | - ../timidity/int_synth.h | |
41 | - ../timidity/mt19937ar.h | |
19 | + ../timidity/dls.h | |
42 | 20 | ../timidity/myini.h |
43 | - ../timidity/output.h | |
44 | - ../timidity/playmidi.h | |
45 | - ../timidity/quantity.h | |
46 | - ../timidity/readmidi.h | |
47 | - ../timidity/resample.h | |
48 | - ../timidity/sffile.h | |
49 | - ../timidity/sfitem.h | |
50 | - ../timidity/sflayer.h | |
51 | - ../timidity/tables.h | |
52 | - ../timidity/timidity.h | |
53 | - ../timidity/wrd.h | |
54 | - ../utils/mblock.h | |
55 | - ../utils/support.h | |
56 | 21 | |
57 | 22 | sfview_dlg.rc |
58 | 23 | |
24 | + $<TARGET_OBJECTS:timidity_cfgforsf> | |
59 | 25 | $<TARGET_OBJECTS:libarc> |
60 | 26 | $<TARGET_OBJECTS:utils> |
61 | 27 | ) |
62 | 28 | |
63 | 29 | add_dependencies(sfviewer UpdateTim41Version) |
64 | -target_link_libraries(sfviewer comctl32 shlwapi winmm ws2_32) | |
30 | +target_link_libraries(sfviewer comctl32 shlwapi ws2_32) |
@@ -5,8 +5,14 @@ | ||
5 | 5 | #pragma warning(disable:4133) |
6 | 6 | #pragma warning(disable:4028) |
7 | 7 | #define main _dummy_main |
8 | +#include <windows.h> | |
8 | 9 | #include "sndfont.c" |
9 | 10 | #include "myini.h" |
11 | + | |
12 | +#ifdef ENABLE_DLS | |
13 | +#include "dls.h" | |
14 | +#endif | |
15 | + | |
10 | 16 | #pragma warning(pop) |
11 | 17 | |
12 | 18 | void sfgui_str_free(void **p) |
@@ -21,8 +27,23 @@ void sfgui_str_free(void **p) | ||
21 | 27 | #include <shlwapi.h> |
22 | 28 | #include "resource.h" |
23 | 29 | |
24 | -void InsertInst(int bank, int preset, const char *str, const char *sfname); | |
25 | -void InsertDrum(int bank, int preset, int note, const char *str, const char *sfname); | |
30 | +void InsertInst(BOOL dls, int bank, int preset, const char *str, const char *sfname); | |
31 | +void InsertDrum(BOOL dls, int bank, int preset, int note, const char *str, const char *sfname); | |
32 | + | |
33 | +BOOL IsDLSFile(LPCSTR filename) | |
34 | +{ | |
35 | + struct timidity_file *tf = open_file(filename, 1, OF_NORMAL); | |
36 | + char buf[12]; | |
37 | + BOOL isDLS = FALSE; | |
38 | + | |
39 | + if (tf_read(buf, 1, 12, tf) == 12 && memcmp(&buf[0], "RIFF", 4) == 0 && memcmp(&buf[8], "DLS ", 4) == 0) { | |
40 | + isDLS = TRUE; | |
41 | + } | |
42 | + | |
43 | + close_file(tf); | |
44 | + return isDLS; | |
45 | +} | |
46 | + | |
26 | 47 | void CreateSoundFontTree(HWND hDlg, LPCSTR x_sf_filename_) |
27 | 48 | { |
28 | 49 | HWND hTree = GetDlgItem(hDlg, IDC_TREE1); |
@@ -38,10 +59,6 @@ void CreateSoundFontTree(HWND hDlg, LPCSTR x_sf_filename_) | ||
38 | 59 | |
39 | 60 | //TreeView_DeleteAllItems(hTree); |
40 | 61 | |
41 | - if (_stricmp(PathFindExtension(x_sf_filename_), ".sf2")) { | |
42 | - return; | |
43 | - } | |
44 | - | |
45 | 62 | for (x_bank = 0; x_bank <= 127; x_bank++) { |
46 | 63 | for (x_preset = 0; x_preset <= 127; x_preset++) { |
47 | 64 | x_cfg_info.m_str[x_bank][x_preset] = NULL; |
@@ -99,126 +116,190 @@ void CreateSoundFontTree(HWND hDlg, LPCSTR x_sf_filename_) | ||
99 | 116 | init_bend_coarse(); |
100 | 117 | initialize_resampler_coeffs(); |
101 | 118 | control_ratio = play_mode->rate / CONTROLS_PER_SECOND; |
102 | - sf = new_soundfont(x_sf_file_name); | |
103 | - sf->next = NULL; | |
104 | - sf->def_order = 2; | |
105 | - sfrecs = sf; | |
106 | - x_cfg_info_init(); | |
107 | - init_sf(sf); | |
108 | - if (x_sort) { | |
109 | - for (x_bank = 0; x_bank <= 127; x_bank++) { | |
110 | - flag = 0; | |
111 | - | |
112 | - for (x_preset = 0; x_preset <= 127; x_preset++) { | |
113 | - if (x_cfg_info.m_bank[x_bank][x_preset] >= 0 && x_cfg_info.m_preset[x_bank][x_preset] >= 0) { | |
114 | - flag = 1; | |
115 | - } | |
116 | - } | |
117 | - if (!flag) | |
118 | - continue; | |
119 | - if (!initial) { | |
120 | - initial = 1; | |
121 | - } | |
122 | 119 | |
123 | - // insert bank | |
124 | - tv.hInsertAfter = TVI_LAST; | |
125 | - tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
126 | - tv.hParent = hBank; | |
127 | - sprintf(str_, "Bank %03d", x_bank); | |
128 | - tv.item.pszText = str_; | |
129 | - tv.item.iImage = 0; | |
130 | - tv.item.iSelectedImage = 1; | |
131 | - hBankSub = TreeView_InsertItem(hTree, &tv); | |
120 | + if (IsDLSFile(x_sf_filename_)) { | |
121 | +#ifdef ENABLE_DLS | |
122 | + DLSCollectionInfo *list = get_dls_instrument_list(x_sf_filename_); | |
123 | + if (list) { | |
124 | + for (int i = 0; i < list->bank_count; i++) { | |
125 | + DLSBankInfo *b = &list->banks[i]; | |
132 | 126 | |
133 | - for (x_preset = 0; x_preset <= 127; x_preset++) { | |
134 | - if (x_cfg_info.m_bank[x_bank][x_preset] >= 0 && x_cfg_info.m_preset[x_bank][x_preset] >= 0) { | |
135 | - | |
136 | - // insert bank | |
137 | 127 | tv.hInsertAfter = TVI_LAST; |
138 | 128 | tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; |
139 | - tv.hParent = hBankSub; | |
129 | + tv.hParent = hBank; | |
130 | + sprintf(str_, "Bank %03u", b->bank); | |
131 | + tv.item.pszText = str_; | |
132 | + tv.item.iImage = 0; | |
133 | + tv.item.iSelectedImage = 1; | |
134 | + hBankSub = TreeView_InsertItem(hTree, &tv); | |
135 | + | |
136 | + for (int j = 0; j < b->program_count; j++) { | |
137 | + DLSProgramInfo *p = &b->programs[j]; | |
138 | + | |
139 | + tv.hInsertAfter = TVI_LAST; | |
140 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
141 | + tv.hParent = hBankSub; | |
142 | + sprintf(str_, "%03u:%03u %s", b->bank, p->program, p->name); | |
143 | + tv.item.pszText = str_; | |
144 | + tv.item.iImage = 2; | |
145 | + tv.item.iSelectedImage = 3; | |
146 | + TreeView_InsertItem(hTree, &tv); | |
147 | + | |
148 | + InsertInst(TRUE, b->bank, p->program, p->name, x_sf_filename_); | |
149 | + } | |
150 | + } | |
140 | 151 | |
141 | - pname_ =sf_preset_name[x_bank][x_preset]; | |
142 | -// if (x_cfg_info.m_rom[x_bank][x_preset]) | |
143 | -// sprintf(str_, "%03d:%03d[ROM] %s\0\0", x_bank, x_preset, pname_); | |
144 | -// else | |
145 | - sprintf(str_, "%03d:%03d %s\0\0", x_bank, x_preset, pname_); | |
152 | + for (int i = 0; i < list->drumset_count; i++) { | |
153 | + DLSDrumsetInfo *d = &list->drumsets[i]; | |
146 | 154 | |
155 | + tv.hInsertAfter = TVI_LAST; | |
156 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
157 | + tv.hParent = hDrum; | |
158 | + sprintf(str_, "Drumset %03u (%s)", d->program, d->name); | |
147 | 159 | tv.item.pszText = str_; |
148 | - tv.item.cchTextMax = strlen(str_); | |
149 | - tv.item.iImage = 2; | |
150 | - tv.item.iSelectedImage = 3; | |
151 | - TreeView_InsertItem(hTree, &tv); | |
152 | - | |
153 | - InsertInst(x_bank, x_preset, pname_, x_sf_filename_); | |
160 | + tv.item.iImage = 0; | |
161 | + tv.item.iSelectedImage = 1; | |
162 | + hDrumSub = TreeView_InsertItem(hTree, &tv); | |
163 | + | |
164 | + for (int j = 0; j < d->note_count; j++) { | |
165 | + tv.hInsertAfter = TVI_LAST; | |
166 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
167 | + tv.hParent = hDrumSub; | |
168 | + sprintf(str_, "%03u:%03u", d->program, d->notes[j]); | |
169 | + tv.item.pszText = str_; | |
170 | + tv.item.iImage = 2; | |
171 | + tv.item.iSelectedImage = 3; | |
172 | + TreeView_InsertItem(hTree, &tv); | |
173 | + | |
174 | + InsertDrum(TRUE, 128, d->program, d->notes[j], "", x_sf_filename_); | |
175 | + } | |
154 | 176 | } |
155 | 177 | |
178 | + free_dls_instrument_list(list); | |
156 | 179 | } |
157 | - } | |
158 | - for (x_preset = 0; x_preset <= 127; x_preset++) { | |
159 | - flag = 0; | |
160 | - for (x_keynote = 0; x_keynote <= 127; x_keynote++) { | |
161 | - if (x_cfg_info.d_preset[x_preset][x_keynote] >= 0 && x_cfg_info.d_keynote[x_preset][x_keynote] >= 0) { | |
162 | - flag = 1; | |
163 | - } | |
164 | - } | |
165 | - if (!flag) | |
166 | - continue; | |
167 | - if (!initial) { | |
168 | - initial = 1; | |
169 | -// fprintf(x_out, "drumset %d\n", x_preset); | |
170 | - } else { | |
171 | -// fprintf(x_out, "\ndrumset %d\n", x_preset); | |
172 | - } | |
173 | - | |
174 | - // insert bank | |
175 | - tv.hInsertAfter = TVI_LAST; | |
176 | - tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
177 | - tv.hParent = hDrum; | |
178 | - sprintf(str_, "Drumset %03d (%s)", x_preset, sf_preset_name[128][x_preset]); | |
179 | - tv.item.pszText = str_; | |
180 | - tv.item.iImage = 0; | |
181 | - tv.item.iSelectedImage = 1; | |
182 | - hDrumSub = TreeView_InsertItem(hTree, &tv); | |
183 | - | |
184 | - for (x_keynote = 0; x_keynote <= 127; x_keynote++) { | |
185 | - if (x_cfg_info.d_preset[x_preset][x_keynote] >= 0 && x_cfg_info.d_keynote[x_preset][x_keynote] >= 0) { | |
180 | +#endif | |
181 | + } else { | |
182 | + sf = new_soundfont(x_sf_file_name); | |
183 | + sf->next = NULL; | |
184 | + sf->def_order = 2; | |
185 | + sfrecs = sf; | |
186 | + x_cfg_info_init(); | |
187 | + init_sf(sf); | |
188 | + if (x_sort) { | |
189 | + for (x_bank = 0; x_bank <= 127; x_bank++) { | |
190 | + flag = 0; | |
191 | + | |
192 | + for (x_preset = 0; x_preset <= 127; x_preset++) { | |
193 | + if (x_cfg_info.m_bank[x_bank][x_preset] >= 0 && x_cfg_info.m_preset[x_bank][x_preset] >= 0) { | |
194 | + flag = 1; | |
195 | + } | |
196 | + } | |
197 | + if (!flag) | |
198 | + continue; | |
199 | + if (!initial) { | |
200 | + initial = 1; | |
201 | + } | |
186 | 202 | |
187 | 203 | // insert bank |
188 | 204 | tv.hInsertAfter = TVI_LAST; |
189 | 205 | tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; |
190 | - tv.hParent = hDrumSub; | |
191 | - | |
192 | - pname_b_ = strtok(x_cfg_info.d_str[x_preset][x_keynote], "#"); | |
193 | - if (pname_b_) { | |
194 | - if ((pname_ = strstr(pname_b_, ":")) == NULL) | |
195 | - pname_ = pname_b_; | |
196 | - else pname_ = ""; | |
197 | - } else pname_ = ""; | |
198 | - | |
199 | -// if (x_cfg_info.d_rom[x_preset][x_keynote]) | |
200 | -// sprintf(str_, "Bank%03d Note%03d[ROM] %s\0\0", x_preset, x_keynote, pname_); | |
201 | -// else | |
202 | - sprintf(str_, "%03d:%03d %s\0\0", x_preset, x_keynote, pname_); | |
206 | + tv.hParent = hBank; | |
207 | + sprintf(str_, "Bank %03d", x_bank); | |
208 | + tv.item.pszText = str_; | |
209 | + tv.item.iImage = 0; | |
210 | + tv.item.iSelectedImage = 1; | |
211 | + hBankSub = TreeView_InsertItem(hTree, &tv); | |
212 | + | |
213 | + for (x_preset = 0; x_preset <= 127; x_preset++) { | |
214 | + if (x_cfg_info.m_bank[x_bank][x_preset] >= 0 && x_cfg_info.m_preset[x_bank][x_preset] >= 0) { | |
215 | + | |
216 | + // insert bank | |
217 | + tv.hInsertAfter = TVI_LAST; | |
218 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
219 | + tv.hParent = hBankSub; | |
220 | + | |
221 | + pname_ =sf_preset_name[x_bank][x_preset]; | |
222 | + // if (x_cfg_info.m_rom[x_bank][x_preset]) | |
223 | + // sprintf(str_, "%03d:%03d[ROM] %s\0\0", x_bank, x_preset, pname_); | |
224 | + // else | |
225 | + sprintf(str_, "%03d:%03d %s\0\0", x_bank, x_preset, pname_); | |
226 | + | |
227 | + tv.item.pszText = str_; | |
228 | + tv.item.cchTextMax = strlen(str_); | |
229 | + tv.item.iImage = 2; | |
230 | + tv.item.iSelectedImage = 3; | |
231 | + TreeView_InsertItem(hTree, &tv); | |
232 | + | |
233 | + InsertInst(FALSE, x_bank, x_preset, pname_, x_sf_filename_); | |
234 | + } | |
235 | + | |
236 | + } | |
237 | + } | |
238 | + for (x_preset = 0; x_preset <= 127; x_preset++) { | |
239 | + flag = 0; | |
240 | + for (x_keynote = 0; x_keynote <= 127; x_keynote++) { | |
241 | + if (x_cfg_info.d_preset[x_preset][x_keynote] >= 0 && x_cfg_info.d_keynote[x_preset][x_keynote] >= 0) { | |
242 | + flag = 1; | |
243 | + } | |
244 | + } | |
245 | + if (!flag) | |
246 | + continue; | |
247 | + if (!initial) { | |
248 | + initial = 1; | |
249 | + // fprintf(x_out, "drumset %d\n", x_preset); | |
250 | + } else { | |
251 | + // fprintf(x_out, "\ndrumset %d\n", x_preset); | |
252 | + } | |
203 | 253 | |
254 | + // insert bank | |
255 | + tv.hInsertAfter = TVI_LAST; | |
256 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
257 | + tv.hParent = hDrum; | |
258 | + sprintf(str_, "Drumset %03d (%s)", x_preset, sf_preset_name[128][x_preset]); | |
204 | 259 | tv.item.pszText = str_; |
205 | - tv.item.cchTextMax = strlen(str_); | |
206 | - tv.item.iImage = 2; | |
207 | - tv.item.iSelectedImage = 3; | |
208 | - TreeView_InsertItem(hTree, &tv); | |
209 | - InsertDrum(128, x_preset, x_keynote, pname_, x_sf_filename_); | |
260 | + tv.item.iImage = 0; | |
261 | + tv.item.iSelectedImage = 1; | |
262 | + hDrumSub = TreeView_InsertItem(hTree, &tv); | |
263 | + | |
264 | + for (x_keynote = 0; x_keynote <= 127; x_keynote++) { | |
265 | + if (x_cfg_info.d_preset[x_preset][x_keynote] >= 0 && x_cfg_info.d_keynote[x_preset][x_keynote] >= 0) { | |
266 | + | |
267 | + // insert bank | |
268 | + tv.hInsertAfter = TVI_LAST; | |
269 | + tv.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; | |
270 | + tv.hParent = hDrumSub; | |
271 | + | |
272 | + pname_b_ = strtok(x_cfg_info.d_str[x_preset][x_keynote], "#"); | |
273 | + if (pname_b_) { | |
274 | + if ((pname_ = strstr(pname_b_, ":")) == NULL) | |
275 | + pname_ = pname_b_; | |
276 | + else pname_ = ""; | |
277 | + } else pname_ = ""; | |
278 | + | |
279 | + // if (x_cfg_info.d_rom[x_preset][x_keynote]) | |
280 | + // sprintf(str_, "Bank%03d Note%03d[ROM] %s\0\0", x_preset, x_keynote, pname_); | |
281 | + // else | |
282 | + sprintf(str_, "%03d:%03d %s\0\0", x_preset, x_keynote, pname_); | |
283 | + | |
284 | + tv.item.pszText = str_; | |
285 | + tv.item.cchTextMax = strlen(str_); | |
286 | + tv.item.iImage = 2; | |
287 | + tv.item.iSelectedImage = 3; | |
288 | + TreeView_InsertItem(hTree, &tv); | |
289 | + InsertDrum(FALSE, 128, x_preset, x_keynote, pname_, x_sf_filename_); | |
290 | + } | |
291 | + } | |
210 | 292 | } |
211 | 293 | } |
212 | - } | |
213 | - } | |
214 | 294 | |
215 | - for (x_bank = 0; x_bank <= 127; x_bank++) { | |
216 | - for (x_preset = 0; x_preset <= 127; x_preset++) { | |
217 | - sfgui_str_free(&x_cfg_info.m_str[x_bank][x_preset]); | |
218 | - sfgui_str_free(&x_cfg_info.d_str[x_bank][x_preset]); | |
295 | + for (x_bank = 0; x_bank <= 127; x_bank++) { | |
296 | + for (x_preset = 0; x_preset <= 127; x_preset++) { | |
297 | + sfgui_str_free(&x_cfg_info.m_str[x_bank][x_preset]); | |
298 | + sfgui_str_free(&x_cfg_info.d_str[x_bank][x_preset]); | |
299 | + } | |
219 | 300 | } |
301 | + end_soundfont(sf); | |
220 | 302 | } |
221 | - end_soundfont(sf); | |
222 | 303 | |
223 | 304 | TreeView_Expand(hTree, hSF2, TVE_EXPAND); |
224 | 305 | TreeView_Expand(hTree, hBank, TVE_EXPAND); |
@@ -8,8 +8,8 @@ | ||
8 | 8 | #define IDB_BITMAP1 104 |
9 | 9 | #define IDB_TREEICON 104 |
10 | 10 | #define IDC_TREE1 1001 |
11 | -#define IDC_EDIT1 1002 | |
12 | 11 | #define IDC_EDSFNAME 1002 |
12 | +#define IDC_EDSFLABEL 1003 | |
13 | 13 | #define ID_FILE_OPENSOUNDFONT 40001 |
14 | 14 | #define ID_FILE_QUIT 40002 |
15 | 15 | #define ID_FILE_SAVETIMIDITYCONFIGFILE 40003 |
@@ -22,14 +22,15 @@ | ||
22 | 22 | #define IDM_OPT_APPEND_COMMENT 40010 |
23 | 23 | #define IDM_OPT_APPEND_FSPACES 40011 |
24 | 24 | #define IDM_OPT_KEEP_FULLPATH 40012 |
25 | +#define IDM_OPT_PREPEND_BASEDIR 40013 | |
25 | 26 | |
26 | 27 | // Next default values for new objects |
27 | 28 | // |
28 | 29 | #ifdef APSTUDIO_INVOKED |
29 | 30 | #ifndef APSTUDIO_READONLY_SYMBOLS |
30 | 31 | #define _APS_NEXT_RESOURCE_VALUE 105 |
31 | -#define _APS_NEXT_COMMAND_VALUE 40013 | |
32 | -#define _APS_NEXT_CONTROL_VALUE 1003 | |
32 | +#define _APS_NEXT_COMMAND_VALUE 40014 | |
33 | +#define _APS_NEXT_CONTROL_VALUE 1004 | |
33 | 34 | #define _APS_NEXT_SYMED_VALUE 101 |
34 | 35 | #endif |
35 | 36 | #endif |
@@ -23,11 +23,12 @@ BEGIN | ||
23 | 23 | MENUITEM "Append first spaces(&P)", IDM_OPT_APPEND_FSPACES |
24 | 24 | MENUITEM SEPARATOR |
25 | 25 | MENUITEM "Keep original full-path(&K)", IDM_OPT_KEEP_FULLPATH |
26 | + MENUITEM "Prepend ""dir ${basedir}""(&D)", IDM_OPT_PREPEND_BASEDIR | |
26 | 27 | END |
27 | 28 | END |
28 | 29 | |
29 | 30 | 101 DIALOGEX 0, 0, 255, 195 |
30 | -STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | |
31 | +STYLE WS_OVERLAPPEDWINDOW | |
31 | 32 | EXSTYLE WS_EX_ACCEPTFILES |
32 | 33 | CAPTION "Soundfont Viewer 1.01" |
33 | 34 | MENU IDR_MENU1 |
@@ -35,7 +36,7 @@ LANGUAGE LANG_JAPANESE, 0x1 | ||
35 | 36 | FONT 9, "MS UI Gothic", FW_NORMAL, 0, 128 |
36 | 37 | BEGIN |
37 | 38 | CONTROL "", IDC_TREE1, WC_TREEVIEW, WS_TABSTOP | WS_HSCROLL | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 0, 0, 255, 182 |
38 | - LTEXT "Soundfont Path", -1, 0, 183, 56, 12, SS_LEFT | |
39 | + LTEXT "Soundfont Path", IDC_EDSFLABEL, 0, 183, 56, 12, SS_LEFT | |
39 | 40 | EDITTEXT IDC_EDSFNAME, 57, 183, 198, 12, NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY |
40 | 41 | END |
41 | 42 |
@@ -3,6 +3,7 @@ | ||
3 | 3 | #define _CRT_SECURE_NO_WARNINGS |
4 | 4 | #pragma warning(disable:4530) // アンワインド セマンティクスが無効 |
5 | 5 | #include <windows.h> |
6 | +#include <windowsx.h> | |
6 | 7 | #include <commctrl.h> |
7 | 8 | #include "resource.h" |
8 | 9 | #pragma comment(lib, "shlwapi.lib") |
@@ -17,6 +18,7 @@ extern "C" { | ||
17 | 18 | #include <string> |
18 | 19 | struct sfvSFInst |
19 | 20 | { |
21 | + BOOL dls; | |
20 | 22 | unsigned char bank; |
21 | 23 | unsigned char preset; |
22 | 24 | std::string str; |
@@ -25,6 +27,7 @@ struct sfvSFInst | ||
25 | 27 | std::map< int, std::map< int, sfvSFInst > > g_sfInst; |
26 | 28 | struct sfvSFDrum |
27 | 29 | { |
30 | + BOOL dls; | |
28 | 31 | unsigned char bank; |
29 | 32 | unsigned char preset; |
30 | 33 | unsigned char note; |
@@ -33,12 +36,13 @@ struct sfvSFDrum | ||
33 | 36 | }; |
34 | 37 | std::map< int, std::map< int, sfvSFDrum > > g_sfDrum; |
35 | 38 | |
36 | -extern "C" void InsertInst(int bank, int preset, char *str, const char *sfname) | |
39 | +extern "C" void InsertInst(BOOL dls, int bank, int preset, char *str, const char *sfname) | |
37 | 40 | { |
38 | 41 | std::map< int, std::map< int, sfvSFInst > >::iterator it = g_sfInst.find(bank); |
39 | 42 | if (it != g_sfInst.end()) { |
40 | 43 | |
41 | 44 | sfvSFInst newdata; |
45 | + newdata.dls = dls; | |
42 | 46 | newdata.bank = bank; |
43 | 47 | newdata.preset = preset; |
44 | 48 | newdata.str = sfname; |
@@ -52,16 +56,17 @@ extern "C" void InsertInst(int bank, int preset, char *str, const char *sfname) | ||
52 | 56 | } |
53 | 57 | } else { |
54 | 58 | g_sfInst.insert(std::make_pair(bank, std::map< int, sfvSFInst >())); |
55 | - InsertInst(bank, preset, str, sfname); | |
59 | + InsertInst(dls, bank, preset, str, sfname); | |
56 | 60 | } |
57 | 61 | } |
58 | 62 | |
59 | -extern "C" void InsertDrum(int bank, int preset, int note, const char *str, const char *sfname) | |
63 | +extern "C" void InsertDrum(BOOL dls, int bank, int preset, int note, const char *str, const char *sfname) | |
60 | 64 | { |
61 | 65 | std::map< int, std::map< int, sfvSFDrum > >::iterator it = g_sfDrum.find(preset); |
62 | 66 | if (it != g_sfDrum.end()) { |
63 | 67 | |
64 | 68 | sfvSFDrum newdata; |
69 | + newdata.dls = dls; | |
65 | 70 | newdata.bank = bank; |
66 | 71 | newdata.preset = preset; |
67 | 72 | newdata.note = note; |
@@ -76,19 +81,21 @@ extern "C" void InsertDrum(int bank, int preset, int note, const char *str, cons | ||
76 | 81 | } |
77 | 82 | } else { |
78 | 83 | g_sfDrum.insert(std::make_pair(preset, std::map< int, sfvSFDrum >())); |
79 | - InsertDrum(bank, preset, note, str, sfname); | |
84 | + InsertDrum(dls, bank, preset, note, str, sfname); | |
80 | 85 | } |
81 | 86 | } |
82 | 87 | |
83 | -void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outComment, int outSpace, int keepFullPath) | |
88 | +void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outComment, int outSpace, int keepFullPath, int prependBaseDir) | |
84 | 89 | { |
85 | 90 | FILE *fp = fopen(outFileName, "w"); |
91 | + if (!outListEnable && prependBaseDir) | |
92 | + fprintf(fp, "\ndir \"${basedir}\"\n"); | |
86 | 93 | for (std::map< int, std::map< int, sfvSFInst > >::iterator it = g_sfInst.begin(); it != g_sfInst.end(); ++it) { |
87 | - if (outListEnable) | |
88 | - fprintf(fp, "bank %d\n", (*it).first); | |
89 | - else | |
90 | - fprintf(fp, "bank %d\n", (*it).first); | |
94 | + if (!outListEnable) | |
95 | + fprintf(fp, "\n"); | |
96 | + fprintf(fp, "bank %d\n", (*it).first); | |
91 | 97 | for (std::map< int, sfvSFInst >::iterator itc = (*it).second.begin(); itc != (*it).second.end(); ++itc) { |
98 | + BOOL dls = (*itc).second.dls; | |
92 | 99 | const char *file = (*itc).second.str.c_str(); |
93 | 100 | const int program = (*itc).first; |
94 | 101 | const int bank = (*itc).second.bank; |
@@ -102,22 +109,22 @@ void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outCommen | ||
102 | 109 | fprintf(fp, "%03d:%03d %s (%s)\n", bank, preset, comment, file); |
103 | 110 | else { |
104 | 111 | if (strstr(file, " ")) |
105 | - fprintf(fp, "%d %%font \"%s\" %d %d", program, file, bank, preset); | |
112 | + fprintf(fp, "%d %s \"%s\" %d %d", program, (dls ? "%dls" : "%font"), file, bank, preset); | |
106 | 113 | else |
107 | - fprintf(fp, "%d %%font %s %d %d", program, file, bank, preset); | |
108 | - if (outComment) | |
109 | - fprintf(fp, " # %s ", comment); | |
114 | + fprintf(fp, "%d %s %s %d %d", program, (dls ? "%dls" : "%font"), file, bank, preset); | |
115 | + if (outComment && comment && strlen(comment)) | |
116 | + fprintf(fp, " # %s", comment); | |
110 | 117 | fprintf(fp, "\n"); |
111 | 118 | } |
112 | 119 | } |
113 | 120 | } |
114 | 121 | |
115 | 122 | for (std::map< int, std::map< int, sfvSFDrum > >::iterator it = g_sfDrum.begin(); it != g_sfDrum.end(); ++it) { |
116 | - if (outListEnable) | |
117 | - fprintf(fp, "drumset %d\n", (*it).first); | |
118 | - else | |
119 | - fprintf(fp, "drumset %d\n", (*it).first); | |
123 | + if (!outListEnable) | |
124 | + fprintf(fp, "\n"); | |
125 | + fprintf(fp, "drumset %d\n", (*it).first); | |
120 | 126 | for (std::map< int, sfvSFDrum >::iterator itc = (*it).second.begin(); itc != (*it).second.end(); ++itc) { |
127 | + BOOL dls = (*itc).second.dls; | |
121 | 128 | const char *file = (*itc).second.str.c_str(); |
122 | 129 | const int program = (*itc).first; |
123 | 130 | const int bank = (*itc).second.bank; |
@@ -132,11 +139,11 @@ void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outCommen | ||
132 | 139 | fprintf(fp, "%03d:%03d %s (%s)\n", preset, note, comment, file); |
133 | 140 | else { |
134 | 141 | if (strstr(file, " ")) |
135 | - fprintf(fp, "%d %%font \"%s\" %d %d %d", program, file, bank, preset, note); | |
142 | + fprintf(fp, "%d %s \"%s\" %d %d %d", program, (dls ? "%dls" : "%font"), file, bank, preset, note); | |
136 | 143 | else |
137 | - fprintf(fp, "%d %%font %s %d %d %d", program, file, bank, preset, note); | |
138 | - if (outComment) | |
139 | - fprintf(fp, " # %s ", comment); | |
144 | + fprintf(fp, "%d %s %s %d %d %d", program, (dls ? "%dls" : "%font"), file, bank, preset, note); | |
145 | + if (outComment && comment && strlen(comment)) | |
146 | + fprintf(fp, " # %s", comment); | |
140 | 147 | fprintf(fp, "\n"); |
141 | 148 | } |
142 | 149 | } |
@@ -152,8 +159,8 @@ void ExportFile(HWND hDlg, bool bExportList) | ||
152 | 159 | { |
153 | 160 | MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; |
154 | 161 | HMENU hMenu = GetMenu(hDlg); |
155 | - CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH }; | |
156 | - BOOL states[] = { FALSE, FALSE, FALSE }; | |
162 | + CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH, IDM_OPT_PREPEND_BASEDIR}; | |
163 | + BOOL states[] = { FALSE, FALSE, FALSE, FALSE }; | |
157 | 164 | CMyFileDialog fd; |
158 | 165 | fd.setSaveDlgDefaultSetting(); |
159 | 166 | fd.setTitle("Export filename .."); |
@@ -172,13 +179,15 @@ void ExportFile(HWND hDlg, bool bExportList) | ||
172 | 179 | fd.setDefaultExt("cfg"); |
173 | 180 | fd.setFilter("TiMidity++ Config File (*.cfg)\0*.cfg\0\0"); |
174 | 181 | } |
175 | - if (fd.Execute()) { | |
176 | - SFView_ExportConfigFile((char*)fd.getFile(0), | |
177 | - (int)bExportList, | |
178 | - (int)states[0], | |
179 | - (int)states[1], | |
180 | - (int)states[2]); | |
181 | - } | |
182 | + if (fd.Execute()) { | |
183 | + SFView_ExportConfigFile((char*)fd.getFile(0), | |
184 | + (int)bExportList, | |
185 | + (int)states[0], | |
186 | + (int)states[1], | |
187 | + (int)states[2], | |
188 | + (int)states[3] | |
189 | + ); | |
190 | + } | |
182 | 191 | } |
183 | 192 | |
184 | 193 | HIMAGELIST g_hil = NULL; |
@@ -188,8 +197,8 @@ LRESULT DlgMainProc_INITDIALOG(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
188 | 197 | { |
189 | 198 | MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; |
190 | 199 | HMENU hMenu = GetMenu(hDlg); |
191 | - CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH }; | |
192 | - CONST UINT states[] = { MFS_UNCHECKED, MFS_UNCHECKED, MFS_CHECKED }; | |
200 | + CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH, IDM_OPT_PREPEND_BASEDIR}; | |
201 | + CONST UINT states[] = { MFS_CHECKED, MFS_UNCHECKED, MFS_UNCHECKED, MFS_CHECKED }; | |
193 | 202 | |
194 | 203 | if (__argc == 2) { |
195 | 204 | ResetSoundFontTree(hDlg); |
@@ -247,7 +256,18 @@ LRESULT DlgMainProc_COMMAND(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
247 | 256 | CMyFileDialog fd; |
248 | 257 | fd.setOpenDlgDefaultSetting(); |
249 | 258 | fd.setTitle("open soundfont"); |
250 | - fd.setFilter("soundfont (*.sf2;*.sf3)\0*.sf2;*.sf3\0All files (*.*)\0*.*\0\0"); | |
259 | + fd.setFilter( | |
260 | +#ifdef ENABLE_DLS | |
261 | + "Supported files (*.dls;*.sf2;*.sf3)\0*.dls;*.sf2;*.sf3\0" | |
262 | +#else | |
263 | + "Supported files (*.sf2;*.sf3)\0*.sf2;*.sf3\0" | |
264 | +#endif | |
265 | + "Soundfont (*.sf2;*.sf3)\0*.sf2;*.sf3\0" | |
266 | +#ifdef ENABLE_DLS | |
267 | + "DLS (*.dls)\0*.dls\0" | |
268 | +#endif | |
269 | + "All files (*.*)\0*.*\0\0" | |
270 | + ); | |
251 | 271 | fd.setOwner(hDlg); |
252 | 272 | if (fd.Execute()) { |
253 | 273 | const int n = fd.getIndex(); |
@@ -276,6 +296,7 @@ LRESULT DlgMainProc_COMMAND(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
276 | 296 | case IDM_OPT_APPEND_COMMENT: |
277 | 297 | case IDM_OPT_APPEND_FSPACES: |
278 | 298 | case IDM_OPT_KEEP_FULLPATH: |
299 | + case IDM_OPT_PREPEND_BASEDIR: | |
279 | 300 | hMenu = GetMenu(hDlg); |
280 | 301 | mii.fMask = MIIM_STATE | MIIM_ID; |
281 | 302 | GetMenuItemInfo(hMenu, LOWORD(wParam), FALSE, &mii); |
@@ -297,6 +318,43 @@ LRESULT DlgMainProc_CLOSE(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
297 | 318 | return TRUE; |
298 | 319 | } |
299 | 320 | |
321 | +LRESULT DlgMainProc_SIZE(HWND hDlg, WPARAM wParam, LPARAM lParam) | |
322 | +{ | |
323 | + if (wParam != SC_MINIMIZE) { | |
324 | + SetWindowPos( | |
325 | + GetDlgItem(hDlg, IDC_TREE1), | |
326 | + NULL, | |
327 | + 0, | |
328 | + 0, | |
329 | + GET_X_LPARAM(lParam), | |
330 | + GET_Y_LPARAM(lParam) - 17, | |
331 | + SWP_NOACTIVATE | SWP_NOZORDER | |
332 | + ); | |
333 | + | |
334 | + SetWindowPos( | |
335 | + GetDlgItem(hDlg, IDC_EDSFLABEL), | |
336 | + NULL, | |
337 | + 0, | |
338 | + GET_Y_LPARAM(lParam) - 16, | |
339 | + 99, | |
340 | + 16, | |
341 | + SWP_NOACTIVATE | SWP_NOZORDER | |
342 | + ); | |
343 | + | |
344 | + SetWindowPos( | |
345 | + GetDlgItem(hDlg, IDC_EDSFNAME), | |
346 | + NULL, | |
347 | + 100, | |
348 | + GET_Y_LPARAM(lParam) - 16, | |
349 | + GET_X_LPARAM(lParam) - 100, | |
350 | + 16, | |
351 | + SWP_NOACTIVATE | SWP_NOZORDER | |
352 | + ); | |
353 | + } | |
354 | + | |
355 | + return TRUE; | |
356 | +} | |
357 | + | |
300 | 358 | LRESULT CALLBACK DlgMainProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) |
301 | 359 | { |
302 | 360 | #define SET_MYWINMSG(VN) case WM_ ## VN: return DlgMainProc_## VN(hDlg, wParam, lParam); |
@@ -305,6 +363,7 @@ LRESULT CALLBACK DlgMainProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) | ||
305 | 363 | SET_MYWINMSG(DROPFILES); |
306 | 364 | SET_MYWINMSG(COMMAND); |
307 | 365 | SET_MYWINMSG(CLOSE); |
366 | + SET_MYWINMSG(SIZE); | |
308 | 367 | } |
309 | 368 | #undef SET_MYWINMSG |
310 | 369 | return FALSE; |
@@ -283,6 +283,10 @@ | ||
283 | 283 | > |
284 | 284 | </File> |
285 | 285 | <File |
286 | + RelativePath="..\interface\rtsyn_portmidi.c" | |
287 | + > | |
288 | + </File> | |
289 | + <File | |
286 | 290 | RelativePath="..\interface\rtsyn_winmm.c" |
287 | 291 | > |
288 | 292 | </File> |
@@ -330,6 +330,7 @@ | ||
330 | 330 | <ClCompile Include="..\interface\portmidisyn_c.c" /> |
331 | 331 | <ClCompile Include="..\interface\rtsyn_common.c" /> |
332 | 332 | <ClCompile Include="..\interface\rtsyn_npipe.c" /> |
333 | + <ClCompile Include="..\interface\rtsyn_portmidi.c" /> | |
333 | 334 | <ClCompile Include="..\interface\rtsyn_winmm.c" /> |
334 | 335 | <ClCompile Include="..\interface\vt100.c" /> |
335 | 336 | <ClCompile Include="..\interface\vt100_c.c" /> |
@@ -421,7 +421,7 @@ struct timidity_file *open_with_constmem(const char *mem, ptr_size_t memlen, int | ||
421 | 421 | * This is meant to find and open files for reading, possibly piping |
422 | 422 | * them through a decompressor. |
423 | 423 | */ |
424 | -struct timidity_file *open_file(char *name, int decompress, int noise_mode) | |
424 | +struct timidity_file *open_file(const char *name, int decompress, int noise_mode) | |
425 | 425 | { |
426 | 426 | struct timidity_file *tf; |
427 | 427 | PathList *plp = pathlist; |
@@ -496,7 +496,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode) | ||
496 | 496 | * This is meant to find and open regular files for reading, possibly |
497 | 497 | * piping them through a decompressor. |
498 | 498 | */ |
499 | -struct timidity_file *open_file_r(char *name, int decompress, int noise_mode) | |
499 | +struct timidity_file *open_file_r(const char *name, int decompress, int noise_mode) | |
500 | 500 | { |
501 | 501 | struct stat st; |
502 | 502 | struct timidity_file *tf; |
@@ -47,6 +47,21 @@ extern "C" | ||
47 | 47 | namespace TimDLS |
48 | 48 | { |
49 | 49 | |
50 | +void TrimRight(std::string& str) | |
51 | +{ | |
52 | + using namespace std::string_view_literals; | |
53 | + std::size_t pos = str.find_last_not_of("\0 \t\r\n"sv); | |
54 | + | |
55 | + if (pos == str.npos) | |
56 | + { | |
57 | + str.clear(); | |
58 | + } | |
59 | + else | |
60 | + { | |
61 | + str.resize(pos + 1); | |
62 | + } | |
63 | +} | |
64 | + | |
50 | 65 | struct TFFileCloser |
51 | 66 | { |
52 | 67 | void operator()(timidity_file* pFile) const |
@@ -229,6 +244,25 @@ struct DLSCollection | ||
229 | 244 | std::uint32_t WavePoolOffset; // offset of wave pool from the beginning of the DLS file |
230 | 245 | }; |
231 | 246 | |
247 | +struct DLSProgram | |
248 | +{ | |
249 | + std::uint8_t ProgramNumber; | |
250 | + std::string Name; | |
251 | +}; | |
252 | + | |
253 | +struct DLSBank | |
254 | +{ | |
255 | + std::uint8_t BankNumber; | |
256 | + std::vector<DLSProgram> Programs; | |
257 | +}; | |
258 | + | |
259 | +struct DLSDrumset | |
260 | +{ | |
261 | + std::uint8_t DrumsetNumber; | |
262 | + std::string Name; | |
263 | + std::vector<std::uint8_t> Notes; | |
264 | +}; | |
265 | + | |
232 | 266 | std::int32_t CalcRate(std::int32_t diff, double sec) |
233 | 267 | { |
234 | 268 | const std::int32_t envMax = 0x3FFFFFFF; |
@@ -278,39 +312,63 @@ public: | ||
278 | 312 | } |
279 | 313 | |
280 | 314 | ParseRIFF(pFile.get()); |
315 | + } | |
316 | + | |
317 | + std::vector<DLSBank> GetBankList() const | |
318 | + { | |
319 | + std::vector<DLSBank> banks; | |
281 | 320 | |
282 | -#if 0 | |
283 | - for (const DLSInstrument& i : m_DLS.Instruments) | |
321 | + for (const TimDLS::DLSInstrument& i : m_DLS.Instruments) | |
284 | 322 | { |
285 | - if (i.Bank == 128) | |
323 | + if (i.Bank != 128) | |
286 | 324 | { |
287 | - for (const DLSRegion& r : i.Regions) | |
325 | + auto itBank = std::lower_bound(banks.begin(), banks.end(), i.Bank, [] (auto&& a, auto&& b) { return a.BankNumber < b; }); | |
326 | + | |
327 | + if (itBank == banks.end() || itBank->BankNumber != i.Bank) | |
288 | 328 | { |
289 | - ctl->cmsg( | |
290 | - CMSG_INFO, | |
291 | - VERB_NORMAL, | |
292 | - "%d %%dls \"gm.dls\" 128 %d %d # %s", | |
293 | - r.SampleInfo->UnityNote, | |
294 | - i.ProgramNumber, | |
295 | - r.SampleInfo->UnityNote, | |
296 | - i.Name.c_str() | |
297 | - ); | |
329 | + itBank = banks.emplace(itBank); | |
330 | + itBank->BankNumber = i.Bank; | |
298 | 331 | } |
332 | + | |
333 | + auto& program = itBank->Programs.emplace_back(); | |
334 | + program.ProgramNumber = i.ProgramNumber; | |
335 | + program.Name = i.Name; | |
336 | + TrimRight(program.Name); | |
299 | 337 | } |
300 | - else | |
338 | + } | |
339 | + | |
340 | + for (DLSBank& b : banks) | |
341 | + { | |
342 | + std::sort(b.Programs.begin(), b.Programs.end(), [] (auto&& a, auto&& b) { return a.ProgramNumber < b.ProgramNumber; }); | |
343 | + } | |
344 | + | |
345 | + return banks; | |
346 | + } | |
347 | + | |
348 | + std::vector<DLSDrumset> GetDrumsetList() const | |
349 | + { | |
350 | + std::vector<DLSDrumset> drumsets; | |
351 | + | |
352 | + for (const TimDLS::DLSInstrument& i : m_DLS.Instruments) | |
353 | + { | |
354 | + if (i.Bank == 128) | |
301 | 355 | { |
302 | - ctl->cmsg( | |
303 | - CMSG_INFO, | |
304 | - VERB_NORMAL, | |
305 | - "%d %%dls \"gm.dls\" %d %d # %s", | |
306 | - i.ProgramNumber, | |
307 | - i.Bank, | |
308 | - i.ProgramNumber, | |
309 | - i.Name.c_str() | |
310 | - ); | |
356 | + auto& drumset = drumsets.emplace_back(); | |
357 | + drumset.DrumsetNumber = i.ProgramNumber; | |
358 | + drumset.Name = i.Name; | |
359 | + TrimRight(drumset.Name); | |
360 | + | |
361 | + for (const TimDLS::DLSRegion& r : i.Regions) | |
362 | + { | |
363 | + drumset.Notes.push_back(r.SampleInfo->UnityNote); | |
364 | + } | |
365 | + | |
366 | + std::sort(drumset.Notes.begin(), drumset.Notes.end()); | |
311 | 367 | } |
312 | 368 | } |
313 | -#endif | |
369 | + | |
370 | + std::sort(drumsets.begin(), drumsets.end(), [] (auto&& a, auto&& b) { return a.DrumsetNumber < b.DrumsetNumber; }); | |
371 | + return drumsets; | |
314 | 372 | } |
315 | 373 | |
316 | 374 | std::unique_ptr<Instrument, InstrumentDeleter> BuildInstrument(std::uint8_t bank, std::int8_t programNumber, std::int8_t note) |
@@ -430,8 +488,10 @@ public: | ||
430 | 488 | |
431 | 489 | pSample->cutoff_freq = 20000; |
432 | 490 | pSample->cutoff_low_limit = -1; |
433 | - pSample->envelope_velf_bpo = 64; | |
434 | - pSample->modenv_velf_bpo = 64; | |
491 | + pSample->envelope_velf_bpo = 0; | |
492 | + pSample->modenv_velf_bpo = 0; | |
493 | + pSample->envelope_keyf_bpo = 0; | |
494 | + pSample->modenv_keyf_bpo = 0; | |
435 | 495 | pSample->key_to_fc_bpo = 60; |
436 | 496 | pSample->scale_freq = 60; |
437 | 497 | pSample->scale_factor = 1024; |
@@ -472,12 +532,12 @@ public: | ||
472 | 532 | case DLSConnectionBlock::DestinationKind::EG1AttackTime: |
473 | 533 | if (b.Source == DLSConnectionBlock::SourceKind::None && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
474 | 534 | { |
475 | - attackTime = TimeCentToSecond(b.Scale); | |
535 | + attackTime = std::clamp(TimeCentToSecond(b.Scale), 0.0, 20.0); | |
476 | 536 | continue; |
477 | 537 | } |
478 | 538 | else if (b.Source == DLSConnectionBlock::SourceKind::KeyOnVelocity && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
479 | 539 | { |
480 | - pSample->envelope_velf[0] = static_cast<int16>(b.Scale / 65536); | |
540 | + pSample->envelope_velf[0] = static_cast<int16>(b.Scale / 128 / 65536); | |
481 | 541 | continue; |
482 | 542 | } |
483 | 543 | break; |
@@ -485,13 +545,12 @@ public: | ||
485 | 545 | case DLSConnectionBlock::DestinationKind::EG1DecayTime: |
486 | 546 | if (b.Source == DLSConnectionBlock::SourceKind::None && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
487 | 547 | { |
488 | - decayTime = TimeCentToSecond(b.Scale); | |
548 | + decayTime = std::clamp(TimeCentToSecond(b.Scale), 0.0, 40.0); | |
489 | 549 | continue; |
490 | 550 | } |
491 | 551 | else if (b.Source == DLSConnectionBlock::SourceKind::KeyNumber && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
492 | 552 | { |
493 | - // this is probably incorrect | |
494 | - pSample->envelope_keyf[1] = static_cast<int16>(b.Scale / 65536); | |
553 | + pSample->envelope_keyf[1] = static_cast<int16>(b.Scale / 128 / 65536); | |
495 | 554 | continue; |
496 | 555 | } |
497 | 556 | break; |
@@ -499,7 +558,7 @@ public: | ||
499 | 558 | case DLSConnectionBlock::DestinationKind::EG1SustainLevel: |
500 | 559 | if (b.Source == DLSConnectionBlock::SourceKind::None && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
501 | 560 | { |
502 | - sustainLevel = std::lround(65533.0 * std::clamp(b.Scale, 0, 1000) / 1000.0); | |
561 | + sustainLevel = std::clamp(b.Scale / 1000, 0, 65533); | |
503 | 562 | continue; |
504 | 563 | } |
505 | 564 | break; |
@@ -507,7 +566,7 @@ public: | ||
507 | 566 | case DLSConnectionBlock::DestinationKind::EG1ReleaseTime: |
508 | 567 | if (b.Source == DLSConnectionBlock::SourceKind::None && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) |
509 | 568 | { |
510 | - releaseTime = TimeCentToSecond(b.Scale); | |
569 | + releaseTime = std::clamp(TimeCentToSecond(b.Scale), 0.0, 20.0); | |
511 | 570 | continue; |
512 | 571 | } |
513 | 572 | break; |
@@ -551,6 +610,14 @@ public: | ||
551 | 610 | } |
552 | 611 | break; |
553 | 612 | |
613 | + case DLSConnectionBlock::DestinationKind::Pan: | |
614 | + if (b.Source == DLSConnectionBlock::SourceKind::None && b.Control == DLSConnectionBlock::SourceKind::None && b.Transform == DLSConnectionBlock::TransformKind::None) | |
615 | + { | |
616 | + pSample->sample_pan = std::clamp(b.Scale / 65536.0 / 1000.0, -0.5, 0.5); | |
617 | + continue; | |
618 | + } | |
619 | + break; | |
620 | + | |
554 | 621 | default: |
555 | 622 | break; |
556 | 623 | } |
@@ -575,15 +642,17 @@ public: | ||
575 | 642 | pSample->envelope_rate[1] = CalcRate(1, holdTime); |
576 | 643 | |
577 | 644 | pSample->envelope_offset[2] = ToOffset(sustainLevel); |
578 | - pSample->envelope_rate[2] = CalcRate(65534 - sustainLevel, std::clamp(decayTime, 0.0, 100.0)); | |
645 | + pSample->envelope_rate[2] = CalcRate(65534 - sustainLevel, decayTime); | |
579 | 646 | |
580 | 647 | pSample->envelope_offset[3] = 0; |
581 | - pSample->envelope_rate[3] = CalcRate(sustainLevel, releaseTime); | |
582 | - pSample->envelope_offset[4] = pSample->envelope_offset[3]; | |
648 | + pSample->envelope_rate[3] = CalcRate(65535, releaseTime); | |
649 | + pSample->envelope_offset[4] = 0; | |
583 | 650 | pSample->envelope_rate[4] = pSample->envelope_rate[3]; |
584 | - pSample->envelope_offset[5] = pSample->envelope_offset[3]; | |
651 | + pSample->envelope_offset[5] = 0; | |
585 | 652 | pSample->envelope_rate[5] = pSample->envelope_rate[3]; |
586 | 653 | |
654 | + pSample->modes |= MODES_ENVELOPE; | |
655 | + | |
587 | 656 | filledSamples++; |
588 | 657 | |
589 | 658 | if (filledSamples >= regionCount) |
@@ -1669,3 +1738,86 @@ extern "C" void free_dls_file(Instrument *ip) | ||
1669 | 1738 | { |
1670 | 1739 | TimDLS::GlobalInstrumentCache.FreeInstrument(ip); |
1671 | 1740 | } |
1741 | + | |
1742 | +DLSCollectionInfo *get_dls_instrument_list(const char *sample_file) | |
1743 | +{ | |
1744 | + try | |
1745 | + { | |
1746 | + std::string fileName = sample_file; | |
1747 | + TimDLS::DLSParser dls(fileName); | |
1748 | + dls.Parse(); | |
1749 | + | |
1750 | + auto banks = dls.GetBankList(); | |
1751 | + auto drumsets = dls.GetDrumsetList(); | |
1752 | + | |
1753 | + std::unique_ptr<DLSCollectionInfo, TimDLS::TimDeleter> pList(reinterpret_cast<DLSCollectionInfo*>(safe_calloc(sizeof(DLSCollectionInfo), 1))); | |
1754 | + | |
1755 | + // move data from C++ to C | |
1756 | + pList->banks = reinterpret_cast<DLSBankInfo*>(safe_malloc(sizeof(DLSBankInfo) * banks.size())); | |
1757 | + pList->bank_count = static_cast<int>(banks.size()); | |
1758 | + | |
1759 | + for (std::size_t i = 0; i < banks.size(); i++) | |
1760 | + { | |
1761 | + auto& b = banks[i]; | |
1762 | + | |
1763 | + pList->banks[i].bank = b.BankNumber; | |
1764 | + pList->banks[i].programs = reinterpret_cast<DLSProgramInfo*>(safe_malloc(sizeof(DLSProgramInfo) * b.Programs.size())); | |
1765 | + pList->banks[i].program_count = static_cast<int>(b.Programs.size()); | |
1766 | + | |
1767 | + for (std::size_t j = 0; j < b.Programs.size(); j++) | |
1768 | + { | |
1769 | + pList->banks[i].programs[j].name = safe_strdup(b.Programs[j].Name.c_str()); | |
1770 | + pList->banks[i].programs[j].program = b.Programs[j].ProgramNumber; | |
1771 | + } | |
1772 | + } | |
1773 | + | |
1774 | + pList->drumsets = reinterpret_cast<DLSDrumsetInfo*>(safe_malloc(sizeof(DLSDrumsetInfo) * drumsets.size())); | |
1775 | + pList->drumset_count = static_cast<int>(drumsets.size()); | |
1776 | + | |
1777 | + for (std::size_t i = 0; i < drumsets.size(); i++) | |
1778 | + { | |
1779 | + auto& ds = drumsets[i]; | |
1780 | + pList->drumsets[i].name = safe_strdup(ds.Name.c_str()); | |
1781 | + pList->drumsets[i].program = ds.DrumsetNumber; | |
1782 | + pList->drumsets[i].notes = reinterpret_cast<uint8*>(safe_malloc(sizeof(uint8) * ds.Notes.size())); | |
1783 | + pList->drumsets[i].note_count = static_cast<int>(ds.Notes.size()); | |
1784 | + | |
1785 | + std::uninitialized_copy(ds.Notes.begin(), ds.Notes.end(), pList->drumsets[i].notes); | |
1786 | + } | |
1787 | + | |
1788 | + return pList.release(); | |
1789 | + } | |
1790 | + catch (const std::exception&) | |
1791 | + { | |
1792 | + return nullptr; | |
1793 | + } | |
1794 | +} | |
1795 | + | |
1796 | +void free_dls_instrument_list(DLSCollectionInfo *list) | |
1797 | +{ | |
1798 | + if (!list) | |
1799 | + { | |
1800 | + return; | |
1801 | + } | |
1802 | + | |
1803 | + for (int i = 0; i < list->bank_count; i++) | |
1804 | + { | |
1805 | + for (int j = 0; j < list->banks[i].program_count; j++) | |
1806 | + { | |
1807 | + safe_free(list->banks[i].programs[j].name); | |
1808 | + } | |
1809 | + | |
1810 | + safe_free(list->banks[i].programs); | |
1811 | + } | |
1812 | + | |
1813 | + for (int i = 0; i < list->drumset_count; i++) | |
1814 | + { | |
1815 | + safe_free(list->drumsets[i].name); | |
1816 | + safe_free(list->drumsets[i].notes); | |
1817 | + } | |
1818 | + | |
1819 | + safe_free(list->banks); | |
1820 | + safe_free(list->drumsets); | |
1821 | + | |
1822 | + safe_free(list); | |
1823 | +} |
@@ -8,4 +8,32 @@ void free_dls(void); | ||
8 | 8 | Instrument *extract_dls_file(char *sample_file, uint8 font_bank, int8 font_preset, int8 font_keynote); |
9 | 9 | void free_dls_file(Instrument *ip); |
10 | 10 | |
11 | +typedef struct { | |
12 | + char *name; | |
13 | + uint8 program; | |
14 | +} DLSProgramInfo; | |
15 | + | |
16 | +typedef struct { | |
17 | + DLSProgramInfo *programs; | |
18 | + int program_count; | |
19 | + uint8 bank; | |
20 | +} DLSBankInfo; | |
21 | + | |
22 | +typedef struct { | |
23 | + char *name; | |
24 | + uint8 *notes; | |
25 | + int note_count; | |
26 | + uint8 program; | |
27 | +} DLSDrumsetInfo; | |
28 | + | |
29 | +typedef struct { | |
30 | + DLSBankInfo *banks; | |
31 | + DLSDrumsetInfo *drumsets; | |
32 | + int bank_count; | |
33 | + int drumset_count; | |
34 | +} DLSCollectionInfo; | |
35 | + | |
36 | +DLSCollectionInfo *get_dls_instrument_list(const char *sample_file); | |
37 | +void free_dls_instrument_list(DLSCollectionInfo *list); | |
38 | + | |
11 | 39 | #endif |
@@ -2250,7 +2250,7 @@ void free_instruments(int reload_default_inst) | ||
2250 | 2250 | if(bank->tone[j][elm] == NULL) |
2251 | 2251 | continue; |
2252 | 2252 | ip = bank->tone[j][elm]->instrument; |
2253 | - if(ip && (ip->type == INST_SF2 || ip->type == INST_PCM || ip->type == INST_MMS || ip->type == INST_SCC || ip->type == INST_SFZ) && | |
2253 | + if(ip && (ip->type == INST_SF2 || ip->type == INST_PCM || ip->type == INST_MMS || ip->type == INST_SCC || ip->type == INST_SFZ || ip->type == INST_DLS) && | |
2254 | 2254 | (i == 0 || !tonebank[0]->tone[j][elm] || ip != tonebank[0]->tone[j][elm]->instrument) ) |
2255 | 2255 | free_instrument(ip); |
2256 | 2256 | bank->tone[j][elm]->instrument = NULL; |
@@ -2262,7 +2262,7 @@ void free_instruments(int reload_default_inst) | ||
2262 | 2262 | if(bank->tone[j][elm] == NULL) |
2263 | 2263 | continue; |
2264 | 2264 | ip = bank->tone[j][elm]->instrument; |
2265 | - if(ip && (ip->type == INST_SF2 || ip->type == INST_PCM || ip->type == INST_MMS || ip->type == INST_SCC || ip->type == INST_SFZ) && | |
2265 | + if(ip && (ip->type == INST_SF2 || ip->type == INST_PCM || ip->type == INST_MMS || ip->type == INST_SCC || ip->type == INST_SFZ || ip->type == INST_DLS) && | |
2266 | 2266 | (i == 0 || !drumset[0]->tone[j][elm] || ip != drumset[0]->tone[j][elm]->instrument) ) |
2267 | 2267 | free_instrument(ip); |
2268 | 2268 | bank->tone[j][elm]->instrument = NULL; |
@@ -232,7 +232,7 @@ static int read_mfi_information(int infoLength, int *mfiVersion, int *noteType, | ||
232 | 232 | case BE_FCC(0x30333030 /*0300*/): *mfiVersion = 3; break; |
233 | 233 | default: |
234 | 234 | ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "Unknown MFi version."); |
235 | - return 1; | |
235 | + //return 1; | |
236 | 236 | } |
237 | 237 | ctl->cmsg(CMSG_TEXT, VERB_VERBOSE, "MFi Version: %d", *mfiVersion); |
238 | 238 | /* |
@@ -531,7 +531,6 @@ void mix_voice(DATA_T *buf, int v, int32 c) | ||
531 | 531 | recompute_resample_filter(v); |
532 | 532 | } |
533 | 533 | apply_envelope_to_amp(v); |
534 | -#ifdef INT_SYNTH | |
535 | 534 | switch(vp->sample->inst_type){ |
536 | 535 | case INST_GUS: |
537 | 536 | case INST_SF2: |
@@ -553,24 +552,15 @@ void mix_voice(DATA_T *buf, int v, int32 c) | ||
553 | 552 | resample_filter(v, sp, c); |
554 | 553 | } |
555 | 554 | break; |
555 | +#ifdef INT_SYNTH | |
556 | 556 | case INST_MMS: |
557 | 557 | compute_voice_mms(v, sp, c); |
558 | 558 | break; |
559 | 559 | case INST_SCC: |
560 | 560 | compute_voice_scc(v, sp, c); |
561 | 561 | break; |
562 | - } | |
563 | -#else | |
564 | - if(opt_resample_over_sampling){ | |
565 | - int32 c2 = c * opt_resample_over_sampling; | |
566 | - resample_voice(v, sp, c2); | |
567 | - resample_filter(v, sp, c2); | |
568 | - resample_down_sampling(sp, c); | |
569 | - }else{ | |
570 | - resample_voice(v, sp, c); | |
571 | - resample_filter(v, sp, c); | |
572 | - } | |
573 | 562 | #endif |
563 | + } | |
574 | 564 | #ifdef VOICE_EFFECT |
575 | 565 | voice_effect(v, sp, c); |
576 | 566 | #endif |
@@ -245,7 +245,7 @@ extern double playmode_rate_us; | ||
245 | 245 | extern void init_output(void); |
246 | 246 | extern void change_output_volume(int32); |
247 | 247 | |
248 | -#ifdef __W32__ | |
248 | +#if defined(__W32__) && !defined(CFG_FOR_SF) | |
249 | 249 | extern CRITICAL_SECTION critSect; |
250 | 250 | #endif |
251 | 251 |
@@ -4129,7 +4129,8 @@ static void recompute_mod_envelope_follow(int v, int ch) | ||
4129 | 4129 | time_ms = calc_nrpn_param(time_ms, (double)add_param[EG_GUS_ATTACK] * env_attack_calc, nrpn_env_attack_mode); |
4130 | 4130 | if(time_ms <= 0.0) |
4131 | 4131 | vp->mod_env.rate[ENV0_ATTACK_STAGE] = ENV0_OFFSET_MAX; |
4132 | - vp->mod_env.rate[ENV0_ATTACK_STAGE] = sub_ofs_div_cr / time_ms; | |
4132 | + else | |
4133 | + vp->mod_env.rate[ENV0_ATTACK_STAGE] = sub_ofs_div_cr / time_ms; | |
4133 | 4134 | } |
4134 | 4135 | if(add_param[EG_GUS_DECAY]){ |
4135 | 4136 | FLOAT_T sub_ofs_div_cr = fabs(vp->mod_env.offset[ENV0_ATTACK_STAGE] - vp->mod_env.offset[ENV0_HOLD_STAGE]) * div_playmode_rate * 1000.0; |
@@ -662,53 +662,53 @@ enum { // module_id | ||
662 | 662 | |
663 | 663 | struct _ModuleList { |
664 | 664 | int num; |
665 | - char *name; | |
665 | + const char *name; | |
666 | 666 | }; |
667 | 667 | static struct _ModuleList module_list[] = { |
668 | - MODULE_TIMIDITY_DEFAULT, "TiMidity++ Default", | |
669 | - MODULE_SC55, "SC-55 CM-300 CM-500C", | |
670 | - MODULE_SC88, "SC-88", | |
671 | - MODULE_SC88PRO, "SC-88Pro", | |
672 | - MODULE_SC8850, "SC-8850 SC-8820 SC-D70", | |
673 | - MODULE_SD20, "SD-20", | |
674 | - MODULE_SD80, "SD-80", | |
675 | - MODULE_SD90, "SD-90", | |
676 | - MODULE_SD50, "SD-50", | |
677 | - MODULE_MU50, "MU-50", | |
678 | - MODULE_MU80, "MU-80", | |
679 | - MODULE_MU90, "MU-90", | |
680 | - MODULE_MU100, "MU-100", | |
681 | - MODULE_MU128, "MU-128", | |
682 | - MODULE_MU500, "MU-500", | |
683 | - MODULE_MU1000, "MU-1000", | |
684 | - MODULE_MU2000, "MU-2000", | |
685 | - MODULE_AG10, "AG-10", | |
686 | - MODULE_05RW, "05R/W", | |
687 | - MODULE_NX5R, "NX5R NS5R", | |
688 | - MODULE_MT32, "MT-32", | |
689 | - MODULE_CM32L, "CM-32L", | |
690 | - MODULE_CM32P, "CM-32P", | |
691 | - MODULE_CM64, "CM-64 (CM32L+CM32P)", | |
692 | - MODULE_CM500D, "CM-500 mode D", | |
693 | - MODULE_CM64_SN01, "CM64+SN01 P.Orgn+Harpsi", | |
694 | - MODULE_CM64_SN02, "CM64+SN02 Latin+FXPerc", | |
695 | - MODULE_CM64_SN03, "CM64+SN03 Ethic", | |
696 | - MODULE_CM64_SN04, "CM64+SN04 E.Grnd+Clavi", | |
697 | - MODULE_CM64_SN05, "CM64+SN05 Orch Strings", | |
698 | - MODULE_CM64_SN06, "CM64+SN06 Orch Winds", | |
699 | - MODULE_CM64_SN07, "CM64+SN07 Elec Guitar", | |
700 | - MODULE_CM64_SN08, "CM64+SN08 Synthesizer", | |
701 | - MODULE_CM64_SN09, "CM64+SN09 Guitar+KB", | |
702 | - MODULE_CM64_SN10, "CM64+SN10 Rock Drums", | |
703 | - MODULE_CM64_SN11, "CM64+SN11 Sound Effect", | |
704 | - MODULE_CM64_SN12, "CM64+SN12 Sax+Trombone", | |
705 | - MODULE_CM64_SN13, "CM64+SN13 Super Strings", | |
706 | - MODULE_CM64_SN14, "CM64+SN14 Super AcGuitar", | |
707 | - MODULE_CM64_SN15, "CM64+SN15 Super Brass", | |
708 | - MODULE_SBLIVE, "Sound Blaster Live!", | |
709 | - MODULE_SBAUDIGY, "Sound Blaster Audigy", | |
710 | - MODULE_TIMIDITY_SPECIAL1, "TiMidity++ Special 1", | |
711 | - MODULE_TIMIDITY_DEBUG, "TiMidity++ Debug", | |
668 | + {MODULE_TIMIDITY_DEFAULT, "TiMidity++ Default"}, | |
669 | + {MODULE_SC55, "SC-55 CM-300 CM-500C"}, | |
670 | + {MODULE_SC88, "SC-88"}, | |
671 | + {MODULE_SC88PRO, "SC-88Pro"}, | |
672 | + {MODULE_SC8850, "SC-8850 SC-8820 SC-D70"}, | |
673 | + {MODULE_SD20, "SD-20"}, | |
674 | + {MODULE_SD80, "SD-80"}, | |
675 | + {MODULE_SD90, "SD-90"}, | |
676 | + {MODULE_SD50, "SD-50"}, | |
677 | + {MODULE_MU50, "MU-50"}, | |
678 | + {MODULE_MU80, "MU-80"}, | |
679 | + {MODULE_MU90, "MU-90"}, | |
680 | + {MODULE_MU100, "MU-100"}, | |
681 | + {MODULE_MU128, "MU-128"}, | |
682 | + {MODULE_MU500, "MU-500"}, | |
683 | + {MODULE_MU1000, "MU-1000"}, | |
684 | + {MODULE_MU2000, "MU-2000"}, | |
685 | + {MODULE_AG10, "AG-10"}, | |
686 | + {MODULE_05RW, "05R/W"}, | |
687 | + {MODULE_NX5R, "NX5R NS5R"}, | |
688 | + {MODULE_MT32, "MT-32"}, | |
689 | + {MODULE_CM32L, "CM-32L"}, | |
690 | + {MODULE_CM32P, "CM-32P"}, | |
691 | + {MODULE_CM64, "CM-64 (CM32L+CM32P)"}, | |
692 | + {MODULE_CM500D, "CM-500 mode D"}, | |
693 | + {MODULE_CM64_SN01, "CM64+SN01 P.Orgn+Harpsi"}, | |
694 | + {MODULE_CM64_SN02, "CM64+SN02 Latin+FXPerc"}, | |
695 | + {MODULE_CM64_SN03, "CM64+SN03 Ethic"}, | |
696 | + {MODULE_CM64_SN04, "CM64+SN04 E.Grnd+Clavi"}, | |
697 | + {MODULE_CM64_SN05, "CM64+SN05 Orch Strings"}, | |
698 | + {MODULE_CM64_SN06, "CM64+SN06 Orch Winds"}, | |
699 | + {MODULE_CM64_SN07, "CM64+SN07 Elec Guitar"}, | |
700 | + {MODULE_CM64_SN08, "CM64+SN08 Synthesizer"}, | |
701 | + {MODULE_CM64_SN09, "CM64+SN09 Guitar+KB"}, | |
702 | + {MODULE_CM64_SN10, "CM64+SN10 Rock Drums"}, | |
703 | + {MODULE_CM64_SN11, "CM64+SN11 Sound Effect"}, | |
704 | + {MODULE_CM64_SN12, "CM64+SN12 Sax+Trombone"}, | |
705 | + {MODULE_CM64_SN13, "CM64+SN13 Super Strings"}, | |
706 | + {MODULE_CM64_SN14, "CM64+SN14 Super AcGuitar"}, | |
707 | + {MODULE_CM64_SN15, "CM64+SN15 Super Brass"}, | |
708 | + {MODULE_SBLIVE, "Sound Blaster Live!"}, | |
709 | + {MODULE_SBAUDIGY, "Sound Blaster Audigy"}, | |
710 | + {MODULE_TIMIDITY_SPECIAL1, "TiMidity++ Special 1"}, | |
711 | + {MODULE_TIMIDITY_DEBUG, "TiMidity++ Debug"}, | |
712 | 712 | }; |
713 | 713 | #define module_list_num (sizeof(module_list) / sizeof(struct _ModuleList)) |
714 | 714 |
@@ -33,7 +33,6 @@ | ||
33 | 33 | #include <strings.h> |
34 | 34 | #endif |
35 | 35 | |
36 | -#include "interface.h" | |
37 | 36 | #include "timidity.h" |
38 | 37 | #include "common.h" |
39 | 38 | #include "instrum.h" |
@@ -4640,9 +4639,10 @@ static void lo_rs_loop(Voice *vp, DATA_T *dest, int32 count) | ||
4640 | 4639 | dest = resample_linear_multi(vp, dest, j, &i); |
4641 | 4640 | for(; i < count; i++) { |
4642 | 4641 | *dest++ = resample_linear_single(vp); |
4643 | - if((resrc->offset += resrc->increment) >= resrc->loop_end) | |
4642 | + resrc->offset += resrc->increment; | |
4643 | + while(resrc->offset >= resrc->loop_end) | |
4644 | 4644 | resrc->offset -= resrc->loop_end - resrc->loop_start; |
4645 | - /* Hopefully the loop is longer than an increment. */ | |
4645 | + /* The loop may not be longer than an increment. */ | |
4646 | 4646 | } |
4647 | 4647 | } |
4648 | 4648 |
@@ -4825,9 +4825,10 @@ static void lo_rs_loop_float(Voice *vp, DATA_T *dest, int32 count) | ||
4825 | 4825 | dest = resample_linear_float_multi(vp, dest, j, &i); |
4826 | 4826 | for(; i < count; i++) { |
4827 | 4827 | *dest++ = resample_linear_float_single(vp); |
4828 | - if((resrc->offset += resrc->increment) >= resrc->loop_end) | |
4828 | + resrc->offset += resrc->increment; | |
4829 | + while(resrc->offset >= resrc->loop_end) | |
4829 | 4830 | resrc->offset -= resrc->loop_end - resrc->loop_start; |
4830 | - /* Hopefully the loop is longer than an increment. */ | |
4831 | + /* The loop may not be longer than an increment. */ | |
4831 | 4832 | } |
4832 | 4833 | } |
4833 | 4834 |
@@ -5704,9 +5705,10 @@ static void lao_rs_loop(Voice *vp, DATA_T *dest, int32 count) | ||
5704 | 5705 | } |
5705 | 5706 | for(; i < count; i++) { |
5706 | 5707 | *dest++ = resample_lagrange_single(vp); |
5707 | - if((resrc->offset += resrc->increment) >= resrc->loop_end) | |
5708 | + resrc->offset += resrc->increment; | |
5709 | + while(resrc->offset >= resrc->loop_end) | |
5708 | 5710 | resrc->offset -= resrc->loop_end - resrc->loop_start; |
5709 | - /* Hopefully the loop is longer than an increment. */ | |
5711 | + /* The loop may not be longer than an increment. */ | |
5710 | 5712 | } |
5711 | 5713 | } |
5712 | 5714 |
@@ -6088,9 +6090,10 @@ static void lao_rs_loop_float(Voice *vp, DATA_T *dest, int32 count) | ||
6088 | 6090 | } |
6089 | 6091 | for(; i < count; i++) { |
6090 | 6092 | *dest++ = resample_lagrange_float_single(vp); |
6091 | - if((resrc->offset += resrc->increment) >= resrc->loop_end) | |
6093 | + resrc->offset += resrc->increment; | |
6094 | + while(resrc->offset >= resrc->loop_end) | |
6092 | 6095 | resrc->offset -= resrc->loop_end - resrc->loop_start; |
6093 | - /* Hopefully the loop is longer than an increment. */ | |
6096 | + /* The loop may not be longer than an increment. */ | |
6094 | 6097 | } |
6095 | 6098 | } |
6096 | 6099 |
@@ -28,6 +28,7 @@ Instrument *extract_sample_file(char *sample_file); | ||
28 | 28 | #include <cstring> |
29 | 29 | |
30 | 30 | #include <algorithm> |
31 | +#include <deque> | |
31 | 32 | #include <exception> |
32 | 33 | #include <iterator> |
33 | 34 | #include <memory> |
@@ -795,7 +796,7 @@ private: | ||
795 | 796 | }; |
796 | 797 | |
797 | 798 | std::vector<std::string> m_FileNames; |
798 | - std::vector<TextBuffer> m_InBuffers; | |
799 | + std::deque<TextBuffer> m_InBuffers; | |
799 | 800 | std::stack<InputStackItem, std::vector<InputStackItem>> m_InputStack; |
800 | 801 | TextBuffer m_OutBuffer; |
801 | 802 | std::unordered_map<std::string, TextBuffer::View> m_DefinedMacros; |
@@ -810,6 +811,8 @@ enum class OpCodeKind | ||
810 | 811 | AmpEG_Hold, |
811 | 812 | AmpEG_Release, |
812 | 813 | AmpEG_Sustain, |
814 | + AmpKeyCenter, | |
815 | + AmpKeyTrack, | |
813 | 816 | AmpVelTrack, |
814 | 817 | DefaultPath, |
815 | 818 | HiKey, |
@@ -821,8 +824,10 @@ enum class OpCodeKind | ||
821 | 824 | LoVelocity, |
822 | 825 | Offset, |
823 | 826 | Key, |
827 | + Pan, | |
824 | 828 | PitchKeyCenter, |
825 | 829 | Sample, |
830 | + Transpose, | |
826 | 831 | Trigger, |
827 | 832 | Tune, |
828 | 833 | Volume |
@@ -951,6 +956,7 @@ public: | ||
951 | 956 | { |
952 | 957 | switch (opVal.OpCode) |
953 | 958 | { |
959 | + case OpCodeKind::AmpKeyCenter: | |
954 | 960 | case OpCodeKind::HiKey: |
955 | 961 | case OpCodeKind::LoKey: |
956 | 962 | case OpCodeKind::PitchKeyCenter: |
@@ -975,12 +981,15 @@ public: | ||
975 | 981 | case OpCodeKind::AmpEG_Hold: |
976 | 982 | case OpCodeKind::AmpEG_Release: |
977 | 983 | case OpCodeKind::AmpEG_Sustain: |
984 | + case OpCodeKind::AmpKeyTrack: | |
978 | 985 | case OpCodeKind::AmpVelTrack: |
979 | 986 | case OpCodeKind::HiVelocity: |
980 | 987 | case OpCodeKind::LoopEnd: |
981 | 988 | case OpCodeKind::LoopStart: |
982 | 989 | case OpCodeKind::LoVelocity: |
983 | 990 | case OpCodeKind::Offset: |
991 | + case OpCodeKind::Pan: | |
992 | + case OpCodeKind::Transpose: | |
984 | 993 | case OpCodeKind::Tune: |
985 | 994 | case OpCodeKind::Volume: |
986 | 995 | try |
@@ -1111,19 +1120,23 @@ private: | ||
1111 | 1120 | {"ampeg_hold"sv, OpCodeKind::AmpEG_Hold}, |
1112 | 1121 | {"ampeg_release"sv, OpCodeKind::AmpEG_Release}, |
1113 | 1122 | {"ampeg_sustain"sv, OpCodeKind::AmpEG_Sustain}, |
1123 | + {"amp_keycenter"sv, OpCodeKind::AmpKeyCenter}, | |
1124 | + {"amp_keytrack"sv, OpCodeKind::AmpKeyTrack}, | |
1114 | 1125 | {"amp_veltrack"sv, OpCodeKind::AmpVelTrack}, |
1115 | 1126 | {"default_path"sv, OpCodeKind::DefaultPath}, |
1116 | 1127 | {"hikey"sv, OpCodeKind::HiKey}, |
1117 | 1128 | {"hivel"sv, OpCodeKind::HiVelocity}, |
1129 | + {"key"sv, OpCodeKind::Key}, | |
1118 | 1130 | {"lokey"sv, OpCodeKind::LoKey}, |
1119 | 1131 | {"loop_end"sv, OpCodeKind::LoopEnd}, |
1120 | 1132 | {"loop_mode"sv, OpCodeKind::LoopMode}, |
1121 | 1133 | {"loop_start"sv, OpCodeKind::LoopStart}, |
1122 | 1134 | {"lovel"sv, OpCodeKind::LoVelocity}, |
1123 | 1135 | {"offset"sv, OpCodeKind::Offset}, |
1124 | - {"key"sv, OpCodeKind::Key}, | |
1136 | + {"pan"sv, OpCodeKind::Pan}, | |
1125 | 1137 | {"pitch_keycenter"sv, OpCodeKind::PitchKeyCenter}, |
1126 | 1138 | {"sample"sv, OpCodeKind::Sample}, |
1139 | + {"transpose"sv, OpCodeKind::Transpose}, | |
1127 | 1140 | {"trigger"sv, OpCodeKind::Trigger}, |
1128 | 1141 | {"tune"sv, OpCodeKind::Tune}, |
1129 | 1142 | {"volume"sv, OpCodeKind::Volume} |
@@ -1503,6 +1516,7 @@ private: | ||
1503 | 1516 | |
1504 | 1517 | case LoopModeKind::LoopContinuous: |
1505 | 1518 | s.modes |= MODES_LOOPING | MODES_SUSTAIN; |
1519 | + s.data_length = s.loop_end; | |
1506 | 1520 | break; |
1507 | 1521 | |
1508 | 1522 | case LoopModeKind::LoopSustain: |
@@ -1511,40 +1525,45 @@ private: | ||
1511 | 1525 | } |
1512 | 1526 | |
1513 | 1527 | s.volume = std::pow(10.0, flatSection.GetAs<double>(OpCodeKind::Volume).value_or(0.0) / 10.0); |
1514 | - s.tune = std::pow(2.0, std::clamp(flatSection.GetAs<double>(OpCodeKind::Tune).value_or(0.0), -100.0, 100.0) / 1200.0); | |
1528 | + s.tune = std::pow( | |
1529 | + 2.0, | |
1530 | + std::clamp(flatSection.GetAs<double>(OpCodeKind::Transpose).value_or(0.0), -127.0, 127.0) / 12.0 | |
1531 | + + std::clamp(flatSection.GetAs<double>(OpCodeKind::Tune).value_or(0.0), -100.0, 100.0) / 1200.0 | |
1532 | + ); | |
1533 | + | |
1534 | + s.sample_pan = std::clamp(flatSection.GetAs<double>(OpCodeKind::Pan).value_or(0.0), -100.0, 100.0) / 200.0; | |
1515 | 1535 | |
1516 | - s.envelope_delay = std::lround(std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Delay).value_or(0.0), 0.0, 100.0) * ::play_mode->rate); | |
1536 | + s.envelope_keyf_bpo = static_cast<int8>(std::clamp(flatSection.GetAs<std::int32_t>(OpCodeKind::AmpKeyCenter).value_or(60), -127, 127)); | |
1537 | + s.envelope_velf_bpo = 0; | |
1538 | + s.modenv_velf_bpo = 0; | |
1539 | + | |
1540 | + s.envelope_delay = std::lround(std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Delay).value_or(0.0), 0.0, 100.0) * s.sample_rate); | |
1517 | 1541 | |
1518 | 1542 | TriggerKind trigger = flatSection.GetAs<TriggerKind>(OpCodeKind::Trigger).value_or(TriggerKind::Attack); |
1519 | 1543 | |
1520 | 1544 | if (trigger == TriggerKind::Release) |
1521 | 1545 | { |
1522 | - // HACK: don't play the sample if trigger=release | |
1523 | 1546 | // FIXME: modify playmidi.c to implement this correctly |
1524 | 1547 | |
1525 | - auto loc = flatSection.GetLocationForOpCode(OpCodeKind::Trigger); | |
1526 | - ctl->cmsg( | |
1527 | - CMSG_WARNING, | |
1528 | - VERB_VERBOSE, | |
1529 | - "%s(%u): 'trigger=release' is not implemented yet", | |
1530 | - std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(), | |
1531 | - loc.Line | |
1532 | - ); | |
1533 | - | |
1534 | - s.envelope_offset[0] = ToOffset(65535); | |
1535 | - s.envelope_rate[0] = CalcRate(65535, 0.0); | |
1536 | - s.envelope_offset[1] = ToOffset(65534); | |
1548 | + s.envelope_offset[0] = ToOffset(3); | |
1549 | + s.envelope_rate[0] = CalcRate(1, 0.0); | |
1550 | + s.envelope_offset[1] = ToOffset(2); | |
1537 | 1551 | s.envelope_rate[1] = CalcRate(1, 0.0); |
1552 | + s.envelope_offset[2] = ToOffset(1); | |
1553 | + s.envelope_rate[2] = CalcRate(1, 0.0); | |
1538 | 1554 | |
1539 | - s.envelope_offset[2] = ToOffset(0); | |
1540 | - s.envelope_rate[2] = CalcRate(65534, 0.0); | |
1555 | + s.envelope_offset[3] = ToOffset(65535); | |
1556 | + s.envelope_rate[3] = CalcRate(65535, std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Attack).value_or(0.0), 0.0, 100.0)); | |
1557 | + s.envelope_offset[4] = ToOffset(65534); | |
1558 | + s.envelope_rate[4] = CalcRate(1, std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Hold).value_or(0.0), 0.0, 100.0)); | |
1541 | 1559 | |
1542 | - s.envelope_offset[3] = 0; | |
1543 | - s.envelope_rate[3] = CalcRate(0, 0.0); | |
1544 | - s.envelope_offset[4] = s.envelope_offset[3]; | |
1545 | - s.envelope_rate[4] = s.envelope_rate[3]; | |
1546 | - s.envelope_offset[5] = s.envelope_offset[3]; | |
1547 | - s.envelope_rate[5] = s.envelope_rate[3]; | |
1560 | + std::int32_t sustainLevel = std::lround(65533.0 * std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Sustain).value_or(100.0), 0.0, 100.0) / 100.0); | |
1561 | + s.envelope_offset[5] = ToOffset(sustainLevel); | |
1562 | + s.envelope_rate[5] = CalcRate(65534 - sustainLevel, std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Decay).value_or(0.0), 0.0, 100.0)); | |
1563 | + | |
1564 | + s.modes |= MODES_LOOPING | MODES_SUSTAIN | MODES_RELEASE; | |
1565 | + s.loop_start = 0; | |
1566 | + s.loop_end = std::clamp<splen_t>(s.loop_start + (1 << FRACTION_BITS), 0, s.data_length); | |
1548 | 1567 | } |
1549 | 1568 | else |
1550 | 1569 | { |
@@ -1573,17 +1592,22 @@ private: | ||
1573 | 1592 | |
1574 | 1593 | double releaseTime = std::clamp(flatSection.GetAs<double>(OpCodeKind::AmpEG_Release).value_or(0.0), 0.0, 100.0); |
1575 | 1594 | s.envelope_offset[3] = 0; |
1576 | - s.envelope_rate[3] = CalcRate(sustainLevel, releaseTime); | |
1595 | + s.envelope_rate[3] = CalcRate(65535, releaseTime); | |
1577 | 1596 | s.envelope_offset[4] = s.envelope_offset[3]; |
1578 | 1597 | s.envelope_rate[4] = s.envelope_rate[3]; |
1579 | 1598 | s.envelope_offset[5] = s.envelope_offset[3]; |
1580 | 1599 | s.envelope_rate[5] = s.envelope_rate[3]; |
1581 | 1600 | } |
1582 | 1601 | |
1602 | + if (auto ampKeyTrack = flatSection.GetAs<double>(OpCodeKind::AmpKeyTrack)) | |
1603 | + { | |
1604 | + std::fill(std::begin(s.envelope_keyf), std::end(s.envelope_keyf), std::clamp(ampKeyTrack.value(), -96.0, 12.0) * 0.1 * std::log2(10.0)); | |
1605 | + } | |
1606 | + | |
1583 | 1607 | if (auto ampVelTrack = flatSection.GetAs<double>(OpCodeKind::AmpVelTrack)) |
1584 | 1608 | { |
1585 | 1609 | // convert percent to rate |
1586 | - std::fill(std::begin(s.envelope_velf), std::end(s.envelope_velf), std::clamp(ampVelTrack.value() * 0.01, -1.0, 1.0)); | |
1610 | + std::fill(std::begin(s.envelope_velf), std::end(s.envelope_velf), std::clamp(ampVelTrack.value() * 0.01, -1.0, 1.0) * 1200.0 / 127.0); | |
1587 | 1611 | } |
1588 | 1612 | } |
1589 | 1613 |
@@ -1623,11 +1647,11 @@ private: | ||
1623 | 1647 | switch (i.Header) |
1624 | 1648 | { |
1625 | 1649 | case HeaderKind::Control: |
1626 | - controlOpCodes.insert(controlOpCodes.end(), i.OpCodes.begin(), i.OpCodes.end()); | |
1650 | + controlOpCodes = i.OpCodes; | |
1627 | 1651 | break; |
1628 | 1652 | |
1629 | 1653 | case HeaderKind::Global: |
1630 | - globalOpCodes.insert(globalOpCodes.end(), i.OpCodes.begin(), i.OpCodes.end()); | |
1654 | + globalOpCodes = i.OpCodes; | |
1631 | 1655 | break; |
1632 | 1656 | |
1633 | 1657 | case HeaderKind::Group: |
@@ -1686,12 +1710,10 @@ private: | ||
1686 | 1710 | |
1687 | 1711 | struct InstrumentCacheEntry |
1688 | 1712 | { |
1689 | - InstrumentCacheEntry(std::string_view filePath, std::unique_ptr<Instrument, InstrumentDeleter> pInstrument) | |
1690 | - : FilePath(filePath), pInstrument(std::move(pInstrument)) | |
1713 | + InstrumentCacheEntry(std::unique_ptr<Instrument, InstrumentDeleter> pInstrument) : pInstrument(std::move(pInstrument)) | |
1691 | 1714 | { |
1692 | 1715 | } |
1693 | 1716 | |
1694 | - std::string FilePath; | |
1695 | 1717 | std::unique_ptr<Instrument, InstrumentDeleter> pInstrument; |
1696 | 1718 | std::vector<Instrument*> RefInstruments; |
1697 | 1719 | }; |
@@ -1701,14 +1723,7 @@ class InstrumentCache | ||
1701 | 1723 | public: |
1702 | 1724 | Instrument* LoadSFZ(std::string filePath) |
1703 | 1725 | { |
1704 | - auto it = std::find_if( | |
1705 | - m_Instruments.begin(), | |
1706 | - m_Instruments.end(), | |
1707 | - [&filePath] (auto&& x) | |
1708 | - { | |
1709 | - return x.FilePath == filePath; | |
1710 | - } | |
1711 | - ); | |
1726 | + auto it = m_Instruments.find(filePath); | |
1712 | 1727 | |
1713 | 1728 | if (it == m_Instruments.end()) |
1714 | 1729 | { |
@@ -1719,7 +1734,7 @@ public: | ||
1719 | 1734 | TimSFZ::Parser parser(pp); |
1720 | 1735 | parser.Parse(); |
1721 | 1736 | TimSFZ::InstrumentBuilder builder(parser, filePath); |
1722 | - m_Instruments.emplace_back(filePath, builder.BuildInstrument()); | |
1737 | + it = m_Instruments.emplace(filePath, builder.BuildInstrument()).first; | |
1723 | 1738 | } |
1724 | 1739 | catch (const std::exception& e) |
1725 | 1740 | { |
@@ -1732,12 +1747,12 @@ public: | ||
1732 | 1747 | } |
1733 | 1748 | |
1734 | 1749 | std::unique_ptr<Instrument, InstrumentDeleter> pInstRef(reinterpret_cast<Instrument*>(safe_calloc(sizeof(Instrument), 1))); |
1735 | - it->RefInstruments.push_back(pInstRef.get()); | |
1736 | - pInstRef->type = it->pInstrument->type; | |
1737 | - pInstRef->instname = safe_strdup(it->pInstrument->instname); | |
1738 | - pInstRef->samples = it->pInstrument->samples; | |
1739 | - pInstRef->sample = reinterpret_cast<Sample*>(safe_calloc(sizeof(Sample), it->pInstrument->samples)); | |
1740 | - std::copy_n(it->pInstrument->sample, it->pInstrument->samples, pInstRef->sample); | |
1750 | + it->second.RefInstruments.push_back(pInstRef.get()); | |
1751 | + pInstRef->type = it->second.pInstrument->type; | |
1752 | + pInstRef->instname = safe_strdup(it->second.pInstrument->instname); | |
1753 | + pInstRef->samples = it->second.pInstrument->samples; | |
1754 | + pInstRef->sample = reinterpret_cast<Sample*>(safe_calloc(sizeof(Sample), it->second.pInstrument->samples)); | |
1755 | + std::copy_n(it->second.pInstrument->sample, it->second.pInstrument->samples, pInstRef->sample); | |
1741 | 1756 | std::for_each(pInstRef->sample, pInstRef->sample + pInstRef->samples, [] (auto&& x) { x.data_alloced = false; }); |
1742 | 1757 | |
1743 | 1758 | return pInstRef.release(); |
@@ -1753,16 +1768,16 @@ public: | ||
1753 | 1768 | m_Instruments.end(), |
1754 | 1769 | [pInstrument] (auto&& x) |
1755 | 1770 | { |
1756 | - auto it = std::find(x.RefInstruments.begin(), x.RefInstruments.end(), pInstrument); | |
1757 | - return it != x.RefInstruments.end(); | |
1771 | + auto it = std::find(x.second.RefInstruments.begin(), x.second.RefInstruments.end(), pInstrument); | |
1772 | + return it != x.second.RefInstruments.end(); | |
1758 | 1773 | } |
1759 | 1774 | ); |
1760 | 1775 | |
1761 | 1776 | if (it != m_Instruments.end()) |
1762 | 1777 | { |
1763 | - it->RefInstruments.erase(std::find(it->RefInstruments.begin(), it->RefInstruments.end(), pInstrument)); | |
1778 | + it->second.RefInstruments.erase(std::find(it->second.RefInstruments.begin(), it->second.RefInstruments.end(), pInstrument)); | |
1764 | 1779 | |
1765 | - if (it->RefInstruments.empty()) | |
1780 | + if (it->second.RefInstruments.empty()) | |
1766 | 1781 | { |
1767 | 1782 | m_Instruments.erase(it); |
1768 | 1783 | } |
@@ -1775,7 +1790,7 @@ public: | ||
1775 | 1790 | } |
1776 | 1791 | |
1777 | 1792 | private: |
1778 | - std::vector<InstrumentCacheEntry> m_Instruments; | |
1793 | + std::unordered_map<std::string, InstrumentCacheEntry> m_Instruments; | |
1779 | 1794 | }; |
1780 | 1795 | |
1781 | 1796 | InstrumentCache GlobalInstrumentCache; |
@@ -470,13 +470,17 @@ static void init_sf(SFInsts *rec) | ||
470 | 470 | int bank = sfinfo.preset[i].bank; |
471 | 471 | int preset = sfinfo.preset[i].preset; |
472 | 472 | |
473 | - if (bank == 128) | |
473 | + if (bank == 128 && 0 <= preset && preset < 128 + MAP_BANK_COUNT) | |
474 | 474 | /* FIXME: why not allow exclusion of drumsets? */ |
475 | 475 | alloc_instrument_bank(1, preset); |
476 | - else { | |
476 | + else if (0 <= bank && bank < 128 + MAP_BANK_COUNT) { | |
477 | 477 | if (is_excluded(rec, bank, preset, -1)) |
478 | 478 | continue; |
479 | 479 | alloc_instrument_bank(0, bank); |
480 | + } else { | |
481 | + ctl->cmsg(CMSG_ERROR, VERB_VERBOSE, "%s: bank/preset is out of range [bank = %d, preset = %d]", | |
482 | + FILENAME_REDUCED(rec->fname), bank, preset); | |
483 | + continue; | |
480 | 484 | } |
481 | 485 | load_font(&sfinfo, i); |
482 | 486 | } |
@@ -429,7 +429,6 @@ void mix_voice_thread(DATA_T *buf, int v, int32 c, int thread) | ||
429 | 429 | recompute_resample_filter(v); |
430 | 430 | } |
431 | 431 | apply_envelope_to_amp(v); |
432 | -#ifdef INT_SYNTH | |
433 | 432 | switch(vp->sample->inst_type){ |
434 | 433 | case INST_GUS: |
435 | 434 | case INST_SF2: |
@@ -451,24 +450,15 @@ void mix_voice_thread(DATA_T *buf, int v, int32 c, int thread) | ||
451 | 450 | resample_filter(v, sp, c); |
452 | 451 | } |
453 | 452 | break; |
453 | +#ifdef INT_SYNTH | |
454 | 454 | case INST_MMS: |
455 | 455 | compute_voice_mms_thread(v, sp, c, thread); |
456 | 456 | break; |
457 | 457 | case INST_SCC: |
458 | 458 | compute_voice_scc_thread(v, sp, c, thread); |
459 | 459 | break; |
460 | - } | |
461 | -#else | |
462 | - if(opt_resample_over_sampling){ | |
463 | - int32 c2 = c * opt_resample_over_sampling; | |
464 | - resample_voice(v, sp, c2); | |
465 | - resample_filter(v, sp, c2); | |
466 | - resample_down_sampling(sp, c); | |
467 | - }else{ | |
468 | - resample_voice(v, sp, c); | |
469 | - resample_filter(v, sp, c); | |
470 | - } | |
471 | 460 | #endif |
461 | + } | |
472 | 462 | #ifdef VOICE_EFFECT |
473 | 463 | voice_effect(v, sp, c); |
474 | 464 | #endif |
@@ -5776,7 +5776,7 @@ static int parse_opt_h(const char *arg) | ||
5776 | 5776 | #endif |
5777 | 5777 | { |
5778 | 5778 | static char *help_list[] = { |
5779 | -"TiMidity++ %s (C) 1999-2004 Masanao Izumo <iz@onicos.co.jp>", | |
5779 | +"TiMidity++ %s (C) 1999-2018 Masanao Izumo <iz@onicos.co.jp>", | |
5780 | 5780 | "The original version (C) 1995 Tuukka Toivonen <tt@cgs.fi>", |
5781 | 5781 | "TiMidity is free software and comes with ABSOLUTELY NO WARRANTY.", |
5782 | 5782 | "", |
@@ -6258,64 +6258,64 @@ static int parse_opt_h(const char *arg) | ||
6258 | 6258 | fprintf(fp, "%s", h); |
6259 | 6259 | } else |
6260 | 6260 | fputs(h, fp); |
6261 | - fputs(NLS, fp); | |
6262 | - } | |
6263 | - fputs(NLS, fp); | |
6264 | - fputs("Effect options (-EF, --ext=F option):" NLS | |
6265 | -" -EFdelay=d Disable delay effect (default)" NLS | |
6266 | -" -EFdelay=D Enable delay effect" NLS | |
6267 | -" -EFchorus=d Disable MIDI chorus effect control" NLS | |
6268 | -" -EFchorus=n Enable Normal MIDI chorus effect control" NLS | |
6269 | -" [,level] `level' is optional to specify chorus level [0..127]" NLS | |
6270 | -" (default)" NLS | |
6271 | -" -EFchorus=s Surround sound, chorus detuned to a lesser degree" NLS | |
6272 | -" [,level] `level' is optional to specify chorus level [0..127]" NLS | |
6273 | -" -EFreverb=d Disable MIDI reverb effect control" NLS | |
6261 | + fputs("\n", fp); | |
6262 | + } | |
6263 | + fputs("\n", fp); | |
6264 | + fputs("Effect options (-EF, --ext=F option):" "\n" | |
6265 | +" -EFdelay=d Disable delay effect (default)" "\n" | |
6266 | +" -EFdelay=D Enable delay effect" "\n" | |
6267 | +" -EFchorus=d Disable MIDI chorus effect control" "\n" | |
6268 | +" -EFchorus=n Enable Normal MIDI chorus effect control" "\n" | |
6269 | +" [,level] `level' is optional to specify chorus level [0..127]" "\n" | |
6270 | +" (default)" "\n" | |
6271 | +" -EFchorus=s Surround sound, chorus detuned to a lesser degree" "\n" | |
6272 | +" [,level] `level' is optional to specify chorus level [0..127]" "\n" | |
6273 | +" -EFreverb=d Disable MIDI reverb effect control" "\n" | |
6274 | 6274 | #if !defined(REVERB_CONTROL_ALLOW) && !defined(FREEVERB_CONTROL_ALLOW) |
6275 | -" (default)" NLS | |
6275 | +" (default)" "\n" | |
6276 | 6276 | #endif |
6277 | -" -EFreverb=n Enable Normal MIDI reverb effect control" NLS | |
6278 | -" [,level] `level' is optional to specify reverb level [1..127]" NLS | |
6277 | +" -EFreverb=n Enable Normal MIDI reverb effect control" "\n" | |
6278 | +" [,level] `level' is optional to specify reverb level [1..127]" "\n" | |
6279 | 6279 | #if defined(REVERB_CONTROL_ALLOW) |
6280 | -" (default)" NLS | |
6280 | +" (default)" "\n" | |
6281 | 6281 | #endif |
6282 | -" -EFreverb=g Global reverb effect" NLS | |
6283 | -" [,level] `level' is optional to specify reverb level [1..127]" NLS | |
6284 | -" -EFreverb=f Enable Freeverb MIDI reverb effect control" NLS | |
6285 | -" [,level] `level' is optional to specify reverb level [1..127]" NLS | |
6282 | +" -EFreverb=g Global reverb effect" "\n" | |
6283 | +" [,level] `level' is optional to specify reverb level [1..127]" "\n" | |
6284 | +" -EFreverb=f Enable Freeverb MIDI reverb effect control" "\n" | |
6285 | +" [,level] `level' is optional to specify reverb level [1..127]" "\n" | |
6286 | 6286 | #if !defined(REVERB_CONTROL_ALLOW) && defined(FREEVERB_CONTROL_ALLOW) |
6287 | -" (default)" NLS | |
6287 | +" (default)" "\n" | |
6288 | 6288 | #endif |
6289 | -" -EFreverb=G Global Freeverb effect" NLS | |
6290 | -" [,level] `level' is optional to specify reverb level [1..127]" NLS | |
6291 | -" -EFvlpf=d Disable voice LPF" NLS | |
6289 | +" -EFreverb=G Global Freeverb effect" "\n" | |
6290 | +" [,level] `level' is optional to specify reverb level [1..127]" "\n" | |
6291 | +" -EFvlpf=d Disable voice LPF" "\n" | |
6292 | 6292 | #if !defined(VOICE_MOOG_LPF_ALLOW) && !defined(VOICE_CHAMBERLIN_LPF_ALLOW) |
6293 | -" (default)" NLS | |
6293 | +" (default)" "\n" | |
6294 | 6294 | #endif |
6295 | -" -EFvlpf=c Enable Chamberlin resonant LPF (12dB/oct)" NLS | |
6295 | +" -EFvlpf=c Enable Chamberlin resonant LPF (12dB/oct)" "\n" | |
6296 | 6296 | #if defined(VOICE_CHAMBERLIN_LPF_ALLOW) |
6297 | -" (default)" NLS | |
6297 | +" (default)" "\n" | |
6298 | 6298 | #endif |
6299 | -" -EFvlpf=m Enable Moog resonant lowpass VCF (24dB/oct)" NLS | |
6299 | +" -EFvlpf=m Enable Moog resonant lowpass VCF (24dB/oct)" "\n" | |
6300 | 6300 | #if defined(VOICE_MOOG_LPF_ALLOW) && !defined(VOICE_CHAMBERLIN_LPF_ALLOW) |
6301 | -" (default)" NLS | |
6302 | -#endif | |
6303 | -" -EFvlpf=b Enable ButterworthFilter resonant lowpass (butterworth)" NLS | |
6304 | -" -EFvlpf=i Enable Resonant IIR lowpass VCF (12dB/oct)-2" NLS | |
6305 | -" -EFvlpf=a Enable amSynth resonant lowpass VCF (24dB/oct)-2" NLS | |
6306 | -" -EFvlpf=o Enable 1 pole 6db/oct resonant lowpass VCF (6dB/oct)" NLS | |
6307 | -" -EFvlpf=e Enable resonant 3 pole lowpass VCF (18dB/oct)" NLS | |
6308 | -" -EFvlpf=t Enable two first order lowpass VCF " NLS | |
6309 | -" -EFvlpf=h Enable HPF ButterworthFilter VCF (butterworth)" NLS | |
6310 | -" -EFvlpf=B Enable BPF ButterworthFilter VCF (butterworth)" NLS | |
6311 | -" -EFns=n Enable the n'th degree (type) noise shaping filter" NLS | |
6312 | -" n:[0..4] (for 8-bit linear encoding, default is 4)" NLS | |
6313 | -" n:[0..4] (for 16-bit linear encoding, default is 4)" NLS | |
6314 | -" n:[0] (for 24-bit linear encoding, default is 0)" NLS | |
6315 | -" n:[0] (for 32-bit linear encoding, default is 0)" NLS | |
6316 | -" n:[0] (for 64-bit linear encoding, default is 0)" NLS | |
6317 | -" n:[0] (for float 32-bit linear encoding, default is 0)" NLS | |
6318 | -" n:[0] (for float 64-bit linear encoding, default is 0)" NLS, fp); | |
6301 | +" (default)" "\n" | |
6302 | +#endif | |
6303 | +" -EFvlpf=b Enable ButterworthFilter resonant lowpass (butterworth)" "\n" | |
6304 | +" -EFvlpf=i Enable Resonant IIR lowpass VCF (12dB/oct)-2" "\n" | |
6305 | +" -EFvlpf=a Enable amSynth resonant lowpass VCF (24dB/oct)-2" "\n" | |
6306 | +" -EFvlpf=o Enable 1 pole 6db/oct resonant lowpass VCF (6dB/oct)" "\n" | |
6307 | +" -EFvlpf=e Enable resonant 3 pole lowpass VCF (18dB/oct)" "\n" | |
6308 | +" -EFvlpf=t Enable two first order lowpass VCF " "\n" | |
6309 | +" -EFvlpf=h Enable HPF ButterworthFilter VCF (butterworth)" "\n" | |
6310 | +" -EFvlpf=B Enable BPF ButterworthFilter VCF (butterworth)" "\n" | |
6311 | +" -EFns=n Enable the n'th degree (type) noise shaping filter" "\n" | |
6312 | +" n:[0..4] (for 8-bit linear encoding, default is 4)" "\n" | |
6313 | +" n:[0..4] (for 16-bit linear encoding, default is 4)" "\n" | |
6314 | +" n:[0] (for 24-bit linear encoding, default is 0)" "\n" | |
6315 | +" n:[0] (for 32-bit linear encoding, default is 0)" "\n" | |
6316 | +" n:[0] (for 64-bit linear encoding, default is 0)" "\n" | |
6317 | +" n:[0] (for float 32-bit linear encoding, default is 0)" "\n" | |
6318 | +" n:[0] (for float 64-bit linear encoding, default is 0)" "\n", fp); | |
6319 | 6319 | #ifndef FIXED_RESAMPLATION |
6320 | 6320 | #ifdef HAVE_STRINGIZE |
6321 | 6321 | #define tim_str_internal(x) #x |
@@ -6326,147 +6326,147 @@ static int parse_opt_h(const char *arg) | ||
6326 | 6326 | fputs(" -EFresamp=d Disable resamplation", fp); |
6327 | 6327 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_none")) |
6328 | 6328 | fputs(" (default)", fp); |
6329 | - fputs(NLS, fp); | |
6329 | + fputs("\n", fp); | |
6330 | 6330 | fputs(" -EFresamp=l Enable Linear resample algorithm", fp); |
6331 | 6331 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_linear")) |
6332 | 6332 | fputs(" (default)", fp); |
6333 | - fputs(NLS, fp); | |
6333 | + fputs("\n", fp); | |
6334 | 6334 | fputs(" -EFresamp=c Enable C-spline resample algorithm", fp); |
6335 | 6335 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_cspline")) |
6336 | 6336 | fputs(" (default)", fp); |
6337 | - fputs(NLS, fp); | |
6337 | + fputs("\n", fp); | |
6338 | 6338 | fputs(" -EFresamp=L Enable Lagrange resample algorithm", fp); |
6339 | 6339 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_lagrange")) |
6340 | 6340 | fputs(" (default)", fp); |
6341 | - fputs(NLS, fp); | |
6341 | + fputs("\n", fp); | |
6342 | 6342 | fputs(" -EFresamp=n Enable Newton resample algorithm", fp); |
6343 | 6343 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_newton")) |
6344 | 6344 | fputs(" (default)", fp); |
6345 | - fputs(NLS, fp); | |
6345 | + fputs("\n", fp); | |
6346 | 6346 | fputs(" -EFresamp=g Enable Gauss-like resample algorithm", fp); |
6347 | 6347 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_gauss")) |
6348 | 6348 | fputs(" (default)", fp); |
6349 | 6349 | ///r |
6350 | - fputs(NLS, fp); | |
6350 | + fputs("\n", fp); | |
6351 | 6351 | fputs(" -EFresamp=s Enable Sharp resample algorithm", fp); |
6352 | 6352 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_sharp")) |
6353 | 6353 | fputs(" (default)", fp); |
6354 | - fputs(NLS, fp); | |
6354 | + fputs("\n", fp); | |
6355 | 6355 | fputs(" -EFresamp=p Enable LinearP resample algorithm", fp); |
6356 | 6356 | if (! strcmp(tim_str(DEFAULT_RESAMPLATION), "resample_linear_p")) |
6357 | 6357 | fputs(" (default)", fp); |
6358 | - fputs(NLS | |
6359 | -" -EFresamp affects the behavior of -N option" NLS, fp); | |
6360 | -#endif | |
6361 | - fputs(NLS, fp); | |
6362 | - fputs("Alternative TiMidity sequencer extensional mode long options:" NLS | |
6363 | -" --[no-]mod-wheel" NLS | |
6364 | -" --[no-]portamento" NLS | |
6365 | -" --[no-]vibrato" NLS | |
6366 | -" --[no-]ch-pressure" NLS | |
6367 | -" --[no-]mod-envelope" NLS | |
6368 | -" --[no-]trace-text-meta" NLS | |
6369 | -" --[no-]overlap-voice" NLS | |
6358 | + fputs("\n" | |
6359 | +" -EFresamp affects the behavior of -N option" "\n", fp); | |
6360 | +#endif | |
6361 | + fputs("\n", fp); | |
6362 | + fputs("Alternative TiMidity sequencer extensional mode long options:" "\n" | |
6363 | +" --[no-]mod-wheel" "\n" | |
6364 | +" --[no-]portamento" "\n" | |
6365 | +" --[no-]vibrato" "\n" | |
6366 | +" --[no-]ch-pressure" "\n" | |
6367 | +" --[no-]mod-envelope" "\n" | |
6368 | +" --[no-]trace-text-meta" "\n" | |
6369 | +" --[no-]overlap-voice" "\n" | |
6370 | 6370 | ///r |
6371 | -" --overlap-voice-count=n" NLS | |
6372 | -" --[no-]temper-control" NLS | |
6373 | -" --default-mid=<HH>" NLS | |
6374 | -" --system-mid=<HH>" NLS | |
6375 | -" --default-bank=n" NLS | |
6376 | -" --force-bank=n" NLS | |
6377 | -" --default-program=n/m" NLS | |
6378 | -" --force-program=n/m" NLS | |
6379 | -" --delay=(d|D)" NLS | |
6380 | -" --chorus=(d|n|s|w|W|b|B|t|T|h|H|e|E)[,level]" NLS | |
6381 | -" --reverb=(d|n|g|f|G)[,level]" NLS | |
6382 | -" --reverb=(f|G)[,level[,scaleroom[,offsetroom[,predelay]]]]" NLS | |
6383 | -" --voice-lpf=(d|c|m|b|i|a|o|e|t|h|B)" NLS | |
6384 | -" --noise-shaping=n" NLS, fp); | |
6371 | +" --overlap-voice-count=n" "\n" | |
6372 | +" --[no-]temper-control" "\n" | |
6373 | +" --default-mid=<HH>" "\n" | |
6374 | +" --system-mid=<HH>" "\n" | |
6375 | +" --default-bank=n" "\n" | |
6376 | +" --force-bank=n" "\n" | |
6377 | +" --default-program=n/m" "\n" | |
6378 | +" --force-program=n/m" "\n" | |
6379 | +" --delay=(d|D)" "\n" | |
6380 | +" --chorus=(d|n|s|w|W|b|B|t|T|h|H|e|E)[,level]" "\n" | |
6381 | +" --reverb=(d|n|g|f|G)[,level]" "\n" | |
6382 | +" --reverb=(f|G)[,level[,scaleroom[,offsetroom[,predelay]]]]" "\n" | |
6383 | +" --voice-lpf=(d|c|m|b|i|a|o|e|t|h|B)" "\n" | |
6384 | +" --noise-shaping=n" "\n", fp); | |
6385 | 6385 | #ifndef FIXED_RESAMPLATION |
6386 | - fputs(" --resample=(d|l|c|L|n|g|s|p)" NLS, fp); | |
6386 | + fputs(" --resample=(d|l|c|L|n|g|s|p)" "\n", fp); | |
6387 | 6387 | #endif |
6388 | - fputs(NLS, fp); | |
6389 | - fputs("Available interfaces (-i, --interface option):" NLS, fp); | |
6388 | + fputs("\n", fp); | |
6389 | + fputs("Available interfaces (-i, --interface option):" "\n", fp); | |
6390 | 6390 | for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++) |
6391 | - fprintf(fp, " -i%c %s" NLS, | |
6391 | + fprintf(fp, " -i%c %s" "\n", | |
6392 | 6392 | cmp->id_character, cmp->id_name); |
6393 | 6393 | #ifdef IA_DYNAMIC |
6394 | - fprintf(fp, "Supported dynamic load interfaces (%s):" NLS, | |
6394 | + fprintf(fp, "Supported dynamic load interfaces (%s):" "\n", | |
6395 | 6395 | dynamic_lib_root); |
6396 | 6396 | memset(mark, 0, sizeof(mark)); |
6397 | 6397 | for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++) |
6398 | 6398 | mark[(int) cmp->id_character] = 1; |
6399 | 6399 | list_dyna_interface(fp, dynamic_lib_root, mark); |
6400 | 6400 | #endif /* IA_DYNAMIC */ |
6401 | - fputs(NLS, fp); | |
6402 | - fputs("Interface options (append to -i? option):" NLS | |
6403 | -" `v' more verbose (cumulative)" NLS | |
6404 | -" `q' quieter (cumulative)" NLS | |
6405 | -" `t' trace playing" NLS | |
6406 | -" `l' loop playing (some interface ignore this option)" NLS | |
6407 | -" `r' randomize file list arguments before playing" NLS | |
6408 | -" `s' sorting file list arguments before playing" NLS, fp); | |
6401 | + fputs("\n", fp); | |
6402 | + fputs("Interface options (append to -i? option):" "\n" | |
6403 | +" `v' more verbose (cumulative)" "\n" | |
6404 | +" `q' quieter (cumulative)" "\n" | |
6405 | +" `t' trace playing" "\n" | |
6406 | +" `l' loop playing (some interface ignore this option)" "\n" | |
6407 | +" `r' randomize file list arguments before playing" "\n" | |
6408 | +" `s' sorting file list arguments before playing" "\n", fp); | |
6409 | 6409 | #ifdef IA_ALSASEQ |
6410 | 6410 | fputs(" `D' daemonize TiMidity++ in background " |
6411 | - "(for alsaseq only)" NLS, fp); | |
6412 | -#endif | |
6413 | - fputs(NLS, fp); | |
6414 | - fputs("Alternative interface long options:" NLS | |
6415 | -" --verbose=n" NLS | |
6416 | -" --quiet=n" NLS | |
6417 | -" --[no-]trace" NLS | |
6418 | -" --[no-]loop" NLS | |
6419 | -" --[no-]random" NLS | |
6420 | -" --[no-]sort" NLS, fp); | |
6411 | + "(for alsaseq only)" "\n", fp); | |
6412 | +#endif | |
6413 | + fputs("\n", fp); | |
6414 | + fputs("Alternative interface long options:" "\n" | |
6415 | +" --verbose=n" "\n" | |
6416 | +" --quiet=n" "\n" | |
6417 | +" --[no-]trace" "\n" | |
6418 | +" --[no-]loop" "\n" | |
6419 | +" --[no-]random" "\n" | |
6420 | +" --[no-]sort" "\n", fp); | |
6421 | 6421 | #ifdef IA_ALSASEQ |
6422 | - fputs(" --[no-]background" NLS, fp); | |
6422 | + fputs(" --[no-]background" "\n", fp); | |
6423 | 6423 | #endif |
6424 | - fputs(NLS, fp); | |
6425 | - fputs("Available output modes (-O, --output-mode option):" NLS, fp); | |
6424 | + fputs("\n", fp); | |
6425 | + fputs("Available output modes (-O, --output-mode option):" "\n", fp); | |
6426 | 6426 | for (pmpp = play_mode_list; (pmp = *pmpp) != NULL; pmpp++) |
6427 | - fprintf(fp, " -O%c %s" NLS, | |
6427 | + fprintf(fp, " -O%c %s" "\n", | |
6428 | 6428 | pmp->id_character, pmp->id_name); |
6429 | - fputs(NLS, fp); | |
6430 | - fputs("Output format options (append to -O? option):" NLS | |
6431 | -" `S' stereo" NLS | |
6432 | -" `M' monophonic" NLS | |
6433 | -" `s' signed output" NLS | |
6434 | -" `u' unsigned output" NLS | |
6435 | -" `1' 16-bit sample width" NLS | |
6436 | -" `2' 24-bit sample width" NLS | |
6437 | -" `3' 32-bit sample width" NLS | |
6438 | -" `6' 64-bit sample width" NLS | |
6439 | -" `8' 8-bit sample width" NLS | |
6440 | -" `f' float 32-bit sample width" NLS | |
6441 | -" `D' float 64-bit sample width" NLS | |
6442 | -" `l' linear encoding" NLS | |
6443 | -" `U' U-Law encoding" NLS | |
6444 | -" `A' A-Law encoding" NLS | |
6445 | -" `x' byte-swapped output" NLS, fp); | |
6446 | - fputs(NLS, fp); | |
6447 | - fputs("Alternative output format long options:" NLS | |
6448 | -" --output-stereo" NLS | |
6449 | -" --output-mono" NLS | |
6450 | -" --output-signed" NLS | |
6451 | -" --output-unsigned" NLS | |
6452 | -" --output-16bit" NLS | |
6453 | -" --output-24bit" NLS | |
6454 | -" --output-32bit" NLS | |
6455 | -" --output-64bit" NLS | |
6456 | -" --output-8bit" NLS | |
6457 | -" --output-f32bit" NLS | |
6458 | -" --output-float32bit" NLS | |
6459 | -" --output-f64bit" NLS | |
6460 | -" --output-float64bit" NLS | |
6461 | -" --output-linear" NLS | |
6462 | -" --output-ulaw" NLS | |
6463 | -" --output-alaw" NLS | |
6464 | -" --[no-]output-swab" NLS, fp); | |
6465 | - fputs(NLS, fp); | |
6466 | - fputs("Available WRD interfaces (-W, --wrd option):" NLS, fp); | |
6429 | + fputs("\n", fp); | |
6430 | + fputs("Output format options (append to -O? option):" "\n" | |
6431 | +" `S' stereo" "\n" | |
6432 | +" `M' monophonic" "\n" | |
6433 | +" `s' signed output" "\n" | |
6434 | +" `u' unsigned output" "\n" | |
6435 | +" `1' 16-bit sample width" "\n" | |
6436 | +" `2' 24-bit sample width" "\n" | |
6437 | +" `3' 32-bit sample width" "\n" | |
6438 | +" `6' 64-bit sample width" "\n" | |
6439 | +" `8' 8-bit sample width" "\n" | |
6440 | +" `f' float 32-bit sample width" "\n" | |
6441 | +" `D' float 64-bit sample width" "\n" | |
6442 | +" `l' linear encoding" "\n" | |
6443 | +" `U' U-Law encoding" "\n" | |
6444 | +" `A' A-Law encoding" "\n" | |
6445 | +" `x' byte-swapped output" "\n", fp); | |
6446 | + fputs("\n", fp); | |
6447 | + fputs("Alternative output format long options:" "\n" | |
6448 | +" --output-stereo" "\n" | |
6449 | +" --output-mono" "\n" | |
6450 | +" --output-signed" "\n" | |
6451 | +" --output-unsigned" "\n" | |
6452 | +" --output-16bit" "\n" | |
6453 | +" --output-24bit" "\n" | |
6454 | +" --output-32bit" "\n" | |
6455 | +" --output-64bit" "\n" | |
6456 | +" --output-8bit" "\n" | |
6457 | +" --output-f32bit" "\n" | |
6458 | +" --output-float32bit" "\n" | |
6459 | +" --output-f64bit" "\n" | |
6460 | +" --output-float64bit" "\n" | |
6461 | +" --output-linear" "\n" | |
6462 | +" --output-ulaw" "\n" | |
6463 | +" --output-alaw" "\n" | |
6464 | +" --[no-]output-swab" "\n", fp); | |
6465 | + fputs("\n", fp); | |
6466 | + fputs("Available WRD interfaces (-W, --wrd option):" "\n", fp); | |
6467 | 6467 | for (wlpp = wrdt_list; (wlp = *wlpp) != NULL; wlpp++) |
6468 | - fprintf(fp, " -W%c %s" NLS, wlp->id, wlp->name); | |
6469 | - fputs(NLS, fp); | |
6468 | + fprintf(fp, " -W%c %s" "\n", wlp->id, wlp->name); | |
6469 | + fputs("\n", fp); | |
6470 | 6470 | close_pager(fp); |
6471 | 6471 | exit(EXIT_SUCCESS); |
6472 | 6472 | return 0; // dummy call |