void osd_sound_enable (int enable_it) { if (sound_stream && enable_it) { sound_enabled = 1; xmame_func_set(sound_enabled); /* for QUASI88 */ if (!sound_dsp) { if (!(sound_dsp = sysdep_dsp_create(NULL, sound_dsp_device, &options_samplerate, &type, sound_bufsize * (1 / Machine__drv__frames_per_second), SYSDEP_DSP_EMULATE_TYPE | SYSDEP_DSP_O_NONBLOCK))) { sound_enabled = 0; xmame_func_set(sound_enabled); /* for QUASI88 */ } else { sound_stream_destroy(sound_stream); if (!(sound_stream = sound_stream_create(sound_dsp, type, sound_samples_per_frame, 3))) { osd_stop_audio_stream(); sound_enabled = 0; xmame_func_set(sound_enabled); /* for QUASI88 */ } } } } else { if (sound_dsp) { sysdep_dsp_destroy(sound_dsp); sound_dsp = NULL; } sound_enabled = 0; xmame_func_set(sound_enabled); /* for QUASI88 */ } }
void osd_sound_enable (int enable_it) { if (sound_stream && enable_it) { sound_enabled = 1; if (!sound_dsp) { if (!(sound_dsp = sysdep_dsp_create(NULL, sound_dsp_device, &options.samplerate, &type, sound_bufsize * (1 / Machine->drv->frames_per_second), SYSDEP_DSP_EMULATE_TYPE | SYSDEP_DSP_O_NONBLOCK))) sound_enabled = 0; else { sound_stream_destroy(sound_stream); if (!(sound_stream = sound_stream_create(sound_dsp, type, sound_samples_per_frame, 3))) { osd_stop_audio_stream(); sound_enabled = 0; } } } } else { if (sound_dsp) { sysdep_dsp_destroy(sound_dsp); sound_dsp = NULL; } sound_enabled = 0; } }
int osd_start_audio_stream(int stereo) { type = SYSDEP_DSP_16BIT | (stereo? SYSDEP_DSP_STEREO:SYSDEP_DSP_MONO); sound_stream = NULL; /* create dsp */ if(sound_enabled) { if(!(sound_dsp = sysdep_dsp_create(NULL, sound_dsp_device, &options_samplerate, &type, sound_bufsize * (1 / Machine__drv__frames_per_second), SYSDEP_DSP_EMULATE_TYPE | SYSDEP_DSP_O_NONBLOCK))) { osd_stop_audio_stream(); sound_enabled = 0; xmame_func_set(sound_enabled); /* for QUASI88 */ } } /* create sound_stream */ if(sound_enabled) { #if 0 /* forQUASI88 */ /* sysdep_dsp_open may have changed the samplerate */ Machine->sample_rate = options.samplerate; #endif /* forQUASI88 */ /* calculate samples_per_frame */ sound_samples_per_frame = Machine__sample_rate / Machine__drv__frames_per_second; #ifdef SOUND_DEBUG fprintf(stderr, "debug: sound: samples_per_frame = %d\n", sound_samples_per_frame); #endif if(!(sound_stream = sound_stream_create(sound_dsp, type, sound_samples_per_frame, 3))) { osd_stop_audio_stream(); sound_enabled = 0; xmame_func_set(sound_enabled); /* for QUASI88 */ } } /* if sound is not enabled, set the samplerate of the core to 0 */ if(!sound_enabled) { #if 0 /* forQUASI88 */ if(sound_fake) Machine->sample_rate = options.samplerate = 8000; else Machine->sample_rate = options.samplerate = 0; #else /* forQUASI88 */ if(sound_fake) Machine__sample_rate = 8000; else Machine__sample_rate = 0; #endif /* forQUASI88 */ /* calculate samples_per_frame */ sound_samples_per_frame = Machine__sample_rate / Machine__drv__frames_per_second; return sound_samples_per_frame; } /* create a mixer instance */ sound_mixer = sysdep_mixer_create(NULL, sound_mixer_device, SYSDEP_MIXER_RESTORE_SETTINS_ON_EXIT); /* check if the user specified a volume, and ifso set it */ if(sound_mixer && rc_get_priority2(sound_opts, "volume")) osd_set_mastervolume(sound_attenuation); return sound_samples_per_frame; }