|
|
| version 1.2, 2003/11/18 14:32:48 | version 1.4, 2003/11/28 16:31:08 |
|---|---|
| Line 224 UINT | Line 224 UINT |
| soundmng_create(UINT rate, UINT bufmsec) | soundmng_create(UINT rate, UINT bufmsec) |
| { | { |
| UINT samples; | UINT samples; |
| #if defined(VERMOUTH_LIB) | |
| UINT num; | |
| #endif | |
| if (opened || ((rate != 11025) && (rate != 22050) && (rate != 44100))) { | if (opened || ((rate != 11025) && (rate != 22050) && (rate != 44100))) { |
| return 0; | return 0; |
| Line 252 soundmng_create(UINT rate, UINT bufmsec) | Line 249 soundmng_create(UINT rate, UINT bufmsec) |
| #if defined(VERMOUTH_LIB) | #if defined(VERMOUTH_LIB) |
| vermouth_module = midimod_create(rate); | vermouth_module = midimod_create(rate); |
| for (num = 0; num < 128; num++) { | midimod_loadall(vermouth_module); |
| midimod_loadprogram(vermouth_module, num); | |
| midimod_loadrhythm(vermouth_module, num); | |
| } | |
| #endif | #endif |
| soundmng_setreverse(FALSE); | soundmng_setreverse(FALSE); |
| Line 606 buffer_play(void *arg) | Line 600 buffer_play(void *arg) |
| size_t len = opna_frame; | size_t len = opna_frame; |
| size_t s; | size_t s; |
| ssize_t r; | ssize_t r; |
| int nextbuf; | |
| UNUSED(arg); | UNUSED(arg); |
| buf = (char *)_MALLOC(len, "sound playing buf"); | |
| if (buf == NULL) { | |
| fprintf(stderr, "buffer_play: can't alloc memory\n"); | |
| return NULL; | |
| } | |
| is_proc = TRUE; | is_proc = TRUE; |
| while (is_proc) { | while (is_proc) { |
| nextbuf = sound_nextbuf; | |
| if (sound_event) | if (sound_event) |
| memset(sound_event, 0, len); | memset(sound_event, 0, len); |
| memcpy(buf, sound_buffer[sound_nextbuf], len); | |
| sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; | sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; |
| sound_event = sound_buffer[sound_nextbuf]; | sound_event = sound_buffer[sound_nextbuf]; |
| buf = sound_buffer[nextbuf]; | |
| s = 0; | s = 0; |
| for (;;) { | for (;;) { |
| r = write(audio_fd, buf + s, len - s); | r = write(audio_fd, buf + s, len - s); |
| Line 633 buffer_play(void *arg) | Line 623 buffer_play(void *arg) |
| } | } |
| } | } |
| } | } |
| _MFREE(buf); | |
| is_proc = FALSE; | is_proc = FALSE; |
| return NULL; | return NULL; |