Changeset 1924:4b8f87ffd0b0 in roaraudio
- Timestamp:
- 05/29/09 19:07:41 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/midi.h
r1892 r1924 69 69 #define MIDI_MFLAG_FREE_DP (1<<0) 70 70 71 #define MIDI_INITED_MAIN 0x01 72 #define MIDI_INITED_CB 0x02 73 #define MIDI_INITED_CLOCK 0x04 74 75 struct { 76 int init; 77 int inited; 78 int init_cb; 79 char * console_dev; 80 } midi_config; 81 71 82 struct midi_message { 72 83 unsigned char type; … … 103 114 104 115 // general midi interface: 116 int midi_init_config(void); 117 105 118 int midi_init (void); 106 119 int midi_free (void); -
roard/midi.c
r1911 r1924 29 29 #endif 30 30 31 int midi_init_config(void) { 32 midi_config.init = 1; 33 midi_config.inited = 0; 34 midi_config.init_cb = 1; 35 midi_config.console_dev = NULL; 36 37 return 0; 38 } 39 31 40 int midi_init (void) { 32 41 33 if ( midi_cb_init() == -1 ) { 34 ROAR_WARN("Can not initialize MIDI subsystem component CB"); 35 } 36 37 if ( midi_clock_init() == -1 ) { 38 ROAR_WARN("Can not initialize MIDI subsystem component clock"); 42 midi_config.inited = 0; 43 44 if ( midi_config.init ) { 45 if ( midi_config.init_cb ) { 46 if ( midi_cb_init() == -1 ) { 47 ROAR_WARN("Can not initialize MIDI subsystem component CB"); 48 } 49 } 50 51 if ( midi_clock_init() == -1 ) { 52 ROAR_WARN("Can not initialize MIDI subsystem component clock"); 53 } 54 39 55 } 40 56 41 57 g_midi_mess.buf = NULL; 42 58 59 midi_config.inited |= MIDI_INITED_MAIN; 60 43 61 return 0; 44 62 } 45 63 46 64 int midi_free (void) { 47 return midi_cb_free(); 65 if ( midi_reinit() == -1 ) 66 return -1; 67 68 if ( midi_cb_free() == -1 ) 69 return -1; 70 71 return 0; 48 72 } 49 73 … … 495 519 midi_clock_set_bph(3600); // one tick per sec 496 520 521 midi_config.inited |= MIDI_INITED_CLOCK; 522 497 523 return 0; 498 524 } … … 560 586 int i; 561 587 char * files[] = { 588 "/NX", 589 "/dev/roarconsole", 562 590 "/dev/console", 563 591 #ifdef __linux__ … … 573 601 g_midi_cb.playing = 0; 574 602 603 if ( midi_config.console_dev != NULL ) { 604 files[0] = midi_config.console_dev; 605 } 606 575 607 for (i = 0; files[i] != NULL; i++) { 576 608 if ( (g_midi_cb.console = open(files[i], O_WRONLY|O_NOCTTY, 0)) != -1 ) … … 615 647 streams_set_flag(g_midi_cb.stream, ROAR_FLAG_HWMIXER); 616 648 streams_set_flag(g_midi_cb.stream, ROAR_FLAG_MUTE); 649 650 midi_config.inited |= MIDI_INITED_CB; 617 651 618 652 return 0; -
roard/roard.c
r1923 r1924 79 79 80 80 printf("\nMIDI Options:\n\n"); 81 printf(" --midi-no-console - Disable console based MIDI synth\n" 82 " --midi-console DEV - Set device for MIDI console\n" 83 ); 81 84 82 85 printf("\nLight Control Options:\n\n"); … … 424 427 } 425 428 429 if ( midi_init_config() == -1 ) { 430 ROAR_ERR("Can not init MIDI config!"); 431 return 1; 432 } 426 433 427 434 #ifdef ROAR_SUPPORT_LISTEN … … 572 579 } else if ( strcmp(k, "--light-channels") == 0 ) { 573 580 light_channels = atoi(argv[++i]); 581 582 } else if ( strcmp(k, "--midi-no-console") == 0 ) { 583 midi_config.init_cb = 0; 584 } else if ( strcmp(k, "--midi-console") == 0 ) { 585 midi_config.console_dev = argv[++i]; 574 586 575 587 } else if ( strcmp(k, "-p") == 0 || strcmp(k, "--port") == 0 ) {
Note: See TracChangeset
for help on using the changeset viewer.