/* Stop Sound Core */ void RemoveSound(void) { #ifndef NOSOUND ao_close(ao_dev); ao_shutdown(); #endif }
void sal_AudioClose(void) { if (ao_dev) ao_close(ao_dev); ao_dev = NULL; ao_shutdown(); }
VoxPlayer::~VoxPlayer() { pthread_mutex_destroy(&m_cs); ao_shutdown(); mpg123_exit(); }
int unregister_aplayer() { // shutdowns the audio related structures, this should // avoid leaks in that subsystem ao_shutdown(); return 0; }
int libao_free_device (void) { ao_shutdown (); return 0; }
int muroard_driver_free(void) { if ( muroard_state_member(driver_vp) != NULL ) ao_close(muroard_state_member(driver_vp)); ao_shutdown(); return 0; }
void show_ao_device_info(FILE *fp) { int driver_count; ao_info **devices; int i; ao_initialize(); fputs("Output device name (ao only):" NLS " -o device ", fp); devices = ao_driver_info_list(&driver_count); if (driver_count < 1) { fputs("*no device found*" NLS, fp); } else { fputs("[ ", fp); for(i = 0; i < driver_count; i++) { if (devices[i]->type == AO_TYPE_LIVE) fprintf(fp, "%s ", devices[i]->short_name); } fputs("]", fp); } ao_shutdown(); }
static int detect(void) { int driver_id, result = 0; ao_sample_format ao_sample_format_ctx; ao_device *ao_device_ctx; ao_initialize(); /* Only succeed in autodetect mode when pulseaudio is available! */ driver_id = ao_driver_id("pulse"); ao_sample_format_ctx.rate = 44100; ao_sample_format_ctx.bits = 16; ao_sample_format_ctx.channels = 2; ao_sample_format_ctx.byte_format = AO_FMT_NATIVE; ao_sample_format_ctx.matrix = NULL; if ((ao_device_ctx = ao_open_live(driver_id, &ao_sample_format_ctx, NULL))) { result = 1; ao_close(ao_device_ctx); } ao_shutdown(); return result; }
int main(int argc, char *argv[]){ if(argc < 2) return 0; ao_initialize(); mpg123_init(); mh = mpg123_new(NULL, NULL); mpg123_open_feed(mh); CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, play_stream); curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_perform(curl); curl_easy_cleanup(curl); mpg123_close(mh); mpg123_delete(mh); mpg123_exit(); ao_close(dev); ao_shutdown(); return 0; }
// De-initialize the libPOLY environment. void poly_shutdown() { if(poly_playback == 1) { poly_stop(); } if(poly_card != NULL) { ao_close(poly_card); poly_card = NULL; } if(poly_format != NULL) { free(poly_format); poly_format = NULL; } if(poly_ao_init == 1) { ao_shutdown(); } if(poly_generators != NULL) { free(poly_generators); poly_generators = NULL; } return; }
int main(int argc, char *argv[]) { ao_device *device; ao_sample_format fmt; double duration = NOTE_LENGTH; float octave_mult = 1.0f; if (argc == 2); // do nothing else if (argc == 3) { sscanf(argv[2], "%lf", &duration); if (duration < 0) { printf("Note length can't be negative!\n"); return 1; } } else { printf("Usage: %s notes [length]\n", argv[0]); return 3; } fmt.bits = 16; fmt.rate = SAMPLE_RATE; fmt.channels = 1; fmt.byte_format = AO_FMT_NATIVE; fmt.matrix = NULL; ao_initialize(); device = ao_open_live(ao_default_driver_id(), &fmt, NULL); if (!device) { printf("Error %d opening audio device!\n", errno); return 2; } int i; for (i=0; i<strlen(argv[1]); i++) { char ch = argv[1][i]; char capital; switch (ch) { case '-': octave_mult *= 0.5f; break; case '+': octave_mult *= 2.0f; break; default: capital = ('A' <= ch && ch <= 'G'); if (capital) octave_mult *= 2.0f; play_note(device, tofreq(ch) * octave_mult, duration); if (capital) octave_mult *= 0.5f; break; //not needed, but good practice } } ao_close(device); ao_shutdown(); return 0; }
void AoEngine::uninit() { if (aoDevice) { ao_close(aoDevice); aoDevice = NULL; ao_shutdown(); } }
void au_deinit(){ au_mainStop(); for(int i=0;i<k_nSounds;i++){ free(sounds[i]); } close(piperw[1]); ao_shutdown(); }
static void close_output(void) { if (ao_device_ctx != NULL) { ao_close(ao_device_ctx); ao_device_ctx = NULL; ao_shutdown(); } }
void cleanup() { mpg123_close(mh); mpg123_delete(mh); mpg123_exit(); ao_close(dev); ao_shutdown(); }
cAudio::~cAudio(void) { closeDevice(); free(dmxbuf); if (adevice) ao_close(adevice); adevice = NULL; ao_shutdown(); }
/* SNDDMA_Shutdown: shutdown the DMA xfer */ void SNDDMA_Shutdown(void){ if(snd_inited){ ao_close(device); ao_shutdown(); free(si->dma->buffer); si->dma->buffer = 0; snd_inited = 0; } }
void close_sound(void) { free(buffer); ao_close(dev); mpg123_close(mh); mpg123_delete(mh); mpg123_exit(); ao_shutdown(); }
void ao_onexit (void *arg) { audio_device_t *devices = (audio_device_t *) arg; close_audio_devices (devices); free_audio_devices (devices); ao_shutdown(); }
void beep_shutdown(void) { if (!initialized) return; free(g_beep.buffer.data); if (g_beep.device != NULL) ao_close(g_beep.device); ao_shutdown(); memset(&g_beep, 0, sizeof(g_beep)); initialized = 0; }
int audio_exit (void* device) { if (ao_close ((ao_device*)device) == 0) { DSFYDEBUG ("ao_close() failed\n"); return -1; } ao_shutdown (); return 0; }
static void sound_ao_finish(ad_device_data *data) { sound_ao_data_t *ao_dev = data; if (ao_dev != NULL) { ao_close(ao_dev->ad); xfree(ao_dev->fmt); ao_shutdown(); } return; }
void endProgram(int ret) { params = freeParameters(params); GOC_DEBUG("Closing libao Device\n"); closeOutputDevice(); GOC_DEBUG("Closing libao\n"); ao_shutdown(); // goc_termRestore(); exit(ret); }
void audio_deinit() { // Deinitialize audio if (conf.audio_api == 0) { // SDL SDL_CloseAudioDevice(dev); } #ifndef _MINGW else if (conf.audio_api == 1) { // libao ao_close(aodevice); ao_shutdown(); } #endif }
void gp2x_deinit(void) { LeaveGraphicsMode(); CloseKeyboard(); free(gp2x_screen); if (ao_dev) ao_close(ao_dev); ao_dev = NULL; ao_shutdown(); munmap(fbp, screensize); close(fbfd); close(inputfd); }
static void ao_output_finish(void *data) { struct ao_data *ad = (struct ao_data *)data; ao_free_options(ad->options); g_free(ad); ao_output_ref--; if (ao_output_ref == 0) ao_shutdown(); }
int main(int argc, char **argv) { fd_set read_fd_set; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; int input_fd = serial_init("/dev/tty.usbserial-A4013GAY", 9600); // int input_fd = STDIN_FILENO; // -- Initialize -- // ao_initialize(); sin_init(); mp3_init("hey.mp3", "ho.mp3"); write(input_fd, "s", 1); for (;;) { FD_ZERO(&read_fd_set); FD_SET(input_fd, &read_fd_set); if (select(FD_SETSIZE, &read_fd_set, NULL, NULL, &tv) < 0) { perror("select"); exit(1); } if (FD_ISSET(input_fd, &read_fd_set)) { handleInput(input_fd); } switch (global_mode) { case SQUARE_WAVE_MODE: case SAWTOOTH_WAV_MODE: case MP3_MODE: mp3_play(); break; case SIN_WAVE_MODE: default: sin_play(); break; } } ao_shutdown(); return 0; }
static void ao_output_finish(struct audio_output *ao) { struct ao_data *ad = (struct ao_data *)ao; ao_free_options(ad->options); ao_base_finish(&ad->base); g_free(ad); ao_output_ref--; if (ao_output_ref == 0) ao_shutdown(); }
/* SNDDMA_Submit: send sound to device if buffer isn't really the dma buffer */ void SNDDMA_Submit(void){ if(!snd_inited) return; /* ao_play returns success, not number of samples successfully output * unlike alsa or arts, so we can only assume that the whole buffer * made it out... though this makes updating si->dma->samplepos easy */ if(ao_play(device, si->dma->buffer, si->dma->samples * samplesize) == 0){ Com_Printf("W: error occurred while playing buffer\n"); ao_close(device); ao_shutdown(); snd_inited = 0; } si->dma->samplepos += si->dma->samples; }
void wave_out_close(void) { /* Ack all remaining packets */ while (queue_lo != queue_hi) { rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index); free(packet_queue[queue_lo].s.data); queue_lo = (queue_lo + 1) % MAX_QUEUE; } if (o_device != NULL) ao_close(o_device); ao_shutdown(); }