int init_sound (void) { #ifdef DEBUG_SOUND dbg("sound.c : init_sound"); #endif have_sound=open_sound(); #ifdef DEBUG_SOUND dbg(" sound.c : ! init_sound"); #endif return have_sound; }
static void *sound_thread (void *dummy) { for (;;) { int cmd = read_comm_pipe_int_blocking(&to_sound_pipe); switch(cmd) { case 0: open_sound(); uae_sem_post(&sound_init_sem); break; case 1: uae_sem_post(&sound_init_sem); return 0; } } }
gpointer sound_thread(gpointer args) { open_sound(); for ( ; *((gboolean *)args) ; ) /* exit loop when flag is cleared */ { if (play) { start_sound(args); play = FALSE; } else { g_usleep(100000); } } close_sound(); g_thread_exit(NULL); /* not required just good pratice */ return NULL; }
int init_sound (void) { write_log("init_sound\n"); gui_data.sndbuf_status = 3; gui_data.sndbuf = 0; if (!sound_available) return 0; if (currprefs.produce_sound <= 1) return 0; if (have_sound) return 1; if (!open_sound ()) return 0; //sdp->paused = 1; #ifdef DRIVESOUND driveclick_reset (); #endif //reset_sound (); //resume_sound (); return 1; }
/* * 1) Parses arguments * 2) Opens each sound file given (or reads from stdin) * 3) Concatenates sounds in order * 4) Writes out sound */ int main(int argc, char* argv[]) { sndtype out_type = CS229; int i; char c; char* outfile = NULL; snd_t* info = 0; snd_t* current; FILE* out; while((c = getopt(argc, argv, "ho:w")) != -1) { switch(c) { case 'h': print_usage(0); break; case 'o': outfile = optarg; break; case 'w': out_type = WAVE; break; case '?': fprintf(stderr, "sndcat: Error: Try 'sndcat -h' for more information.\n"); exit(1); break; default: print_usage(1); } } /* Get from stdin */ if(optind == argc) { info = read_sound(stdin, "Standard Input"); } for(i = optind; i < argc; ++i) { if(!info) { info = open_sound(argv[i]); if(!info) { fprintf(stderr, "sndcat: Error: %s could not be opened. Exiting.\n", argv[i]); exit(1); } continue; } current = open_sound(argv[i]); if(!current) { fprintf(stderr, "sndcat: Error: %s could not be opened. Exiting.\n", argv[i]); exit(1); } concatenate(info, current); free(current); } if(out_type != info->type) { convert(info); } if(!outfile) { out = stdout; } else { out = fopen(outfile, "wb"); } write_sound(out, info); close_sound(info); if(out != stdout) { fclose(out); } return 0; }