/* Try to determine whether sound is available. This is only for GUI purposes. */ int32_t setup_sound (void) { sound_fd = open ("/dev/dsp", O_WRONLY); sound_available = 0; if (sound_fd < 0) { perror ("Can't open /dev/dsp"); if (errno == EBUSY) { /* We can hope, can't we ;) */ sound_available = 1; return 1; } return 0; } if (ioctl (sound_fd, SNDCTL_DSP_GETFMTS, &formats) == -1) { perror ("ioctl failed - can't use sound"); close (sound_fd); return 0; } sound_available = 1; close (sound_fd); #ifdef DRIVESOUND driveclick_init(); #endif return 1; }
static int open_sound (void) { if (!currprefs.produce_sound) return 0; config_changed = 1; clearbuffer(); currprefs.sound_stereo = 1; //currprefs.sound_freq = fs_emu_get_audio_frequency(); //changed_prefs.sound_freq = g_audio_frequency; //init_sound_table16 (); sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; //obtainedfreq = currprefs.sound_freq; obtainedfreq = g_audio_frequency; have_sound = 1; sound_available = 1; update_sound (fake_vblank_hz, 1, currprefs.ntscmode); //paula_sndbufsize = spec.samples * 2 * spec.channels; //paula_sndbufsize = fs_emu_get_audio_buffer_size(); paula_sndbufsize = g_audio_buffer_size; paula_sndbufpt = paula_sndbuffer; #ifdef DRIVESOUND write_log("initialize drivesound\n"); driveclick_init(); #endif write_log("open_sound returning 1\n"); return 1; }
static int open_sound (void) { if (!currprefs.produce_sound) { return 0; } config_changed = 1; clearbuffer(); currprefs.sound_stereo = 1; //currprefs.sound_freq = fs_emu_get_audio_frequency(); //changed_prefs.sound_freq = sdp->obtainedfreq; //init_sound_table16 (); sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; //obtainedfreq = currprefs.sound_freq; obtainedfreq = sdp->obtainedfreq; have_sound = 1; sound_available = 1; paula_sndbufsize = g_audio_buffer_size; paula_sndbufpt = paula_sndbuffer; #ifdef DRIVESOUND driveclick_init(); #endif write_log("open_sound returning 1\n"); return 1; }