void play_sound_file(char *sound_file, int volume) { int count = specpdl_depth(); int input_fd; unsigned char buffer[CHUNKSIZE]; int bytes_read; AudioContext ac = (AudioContext) 0; input_fd = open(sound_file, O_RDONLY); if (input_fd == -1) /* no error message -- this can't happen because Fplay_sound_file has checked the file for us. */ return; record_unwind_protect(close_sound_file, make_int(input_fd)); while ((bytes_read = read(input_fd, buffer, CHUNKSIZE)) > 0) { if (ac == (AudioContext) 0) { ac = audio_initialize(buffer, bytes_read, volume); if (ac == 0) return; } else { ac->ac_data = buffer; ac->ac_size = bytes_read; } play_internal(buffer, bytes_read, ac); } drain_audio_port(ac); unbind_to(count, Qnil); }
void play_sound_data(unsigned char *data, int length, int volume) { int count = specpdl_depth(); AudioContext ac; ac = audio_initialize(data, length, volume); if (ac == (AudioContext) 0) return; play_internal(data, length, ac); drain_audio_port(ac); unbind_to(count, Qnil); }
bool wav_play_with_talking_skull(wav_t *w, audio_t *audio, talking_skull_t *talking_skull) { return play_internal(w, audio, talking_skull, NULL); }
bool wav_play_with_stop(wav_t *w, audio_t *audio, stop_t *stop) { return play_internal(w, audio, NULL, stop); }