int osd_start_audio_stream(int stereo) { #if LOG_SOUND sound_log = fopen("sound.log", "w"); #endif // skip if sound disabled if (Machine->sample_rate != 0) { // attempt to initialize directsound if (dsound_init()) return 1; // set the startup volume osd_set_mastervolume(attenuation); } // determine the number of samples per frame samples_per_frame = (double)Machine->sample_rate / (double)Machine->drv->frames_per_second; // compute how many samples to generate the first frame samples_left_over = samples_per_frame; samples_this_frame = (UINT32)samples_left_over; samples_left_over -= (double)samples_this_frame; // return the samples to play the first frame return samples_this_frame; }
int osd_start_audio_stream(int stereo) { #if LOG_SOUND sound_log = fopen("sound.log", "w"); #endif // attempt to initialize directsound if (dsound_init()) return 1; // set the startup volume osd_set_mastervolume(attenuation); // determine the number of samples per frame samples_per_frame = (double)Machine->sample_rate / (double)Machine->screen[0].refresh; // compute how many samples to generate the first frame samples_left_over = samples_per_frame; samples_this_frame = (UINT32)samples_left_over; samples_left_over -= (double)samples_this_frame; // create wav file if( wavwrite != NULL ) { wavptr = wav_open( wavwrite, Machine->sample_rate, 2); } else { wavptr = NULL; } // return the samples to play the first frame return samples_this_frame; }
static void sound_pause(running_machine *machine, int pause) { if (pause) sound_muted |= 0x02; else sound_muted &= ~0x02; osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); }
void sound_mute(int mute) { if (mute) sound_muted |= 0x01; else sound_muted &= ~0x01; osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); }
void sound_mute(running_machine *machine, int mute) { sound_private *global = machine->sound_data; if (mute) global->muted |= 0x01; else global->muted &= ~0x01; osd_set_mastervolume(global->muted ? -32 : global->attenuation); }
//============================================================ // osd_start_audio_stream //============================================================ void droid_init_sound(running_machine *machine) { // skip if sound disabled if (machine->sample_rate != 0) { // attempt to initialize SDL if (audio_init(machine)) return; add_exit_callback(machine, audio_cleanup_audio); // set the startup volume osd_set_mastervolume(attenuation); } return; }
//============================================================ // osd_start_audio_stream //============================================================ void sdlaudio_init(running_machine *machine) { if (LOG_SOUND) sound_log = fopen(SDLMAME_SOUND_LOG, "w"); // skip if sound disabled if (machine->sample_rate != 0) { // attempt to initialize SDL if (sdl_init(machine)) return; add_exit_callback(machine, sdl_cleanup_audio); // set the startup volume osd_set_mastervolume(attenuation); } return; }
static void DirectSound_sound_enable(int enable) { if (enable) { osd_set_mastervolume(attenuation); } else { if (dsb != NULL) { HRESULT hr; hr = IDirectSoundBuffer_SetVolume(dsb, DSBVOLUME_MIN); if (FAILED(hr)) ErrorMsg("Unable to set volume %s", DirectXDecodeError(hr)); } } }
int msdos_init_sound(void) { /* Ask the user if no soundcard was chosen */ if (soundcard == -1) { soundcard=1; } if (soundcard == 0) /* silence */ { /* update the Machine structure to show that sound is disabled */ Machine->sample_rate = 0; return 0; } /* use stereo output if supported */ gp2x_sound_stereo=0; if (usestereo) { if (Machine->drv->sound_attributes & SOUND_SUPPORTS_STEREO) gp2x_sound_stereo=1; } stream_cache_data = 0; stream_cache_len = 0; stream_cache_stereo = 0; gp2x_sound_rate=44100;//options.samplerate;//44100; //options.samplerate; /* update the Machine structure to reflect the actual sample rate */ Machine->sample_rate = gp2x_sound_rate; logerror("set stereo: %d\n",gp2x_sound_stereo); logerror("set sample rate: %d\n",Machine->sample_rate); osd_set_mastervolume(attenuation); /* set the startup volume */ app_MuteSound(); app_DemuteSound(); return 0; }
int msdos_init_sound(void) { /* Ask the user if no soundcard was chosen */ if (soundcard == -1) soundcard=1; if (soundcard == 0) /* silence */ { /* update the Machine structure to show that sound is disabled */ Machine->sample_rate = 0; return 0; } stream_cache_channels = 0; logerror("set sample rate: %d\n", Machine->sample_rate); osd_set_mastervolume(attenuation); /* set the startup volume */ return 0; }
/*************************************************************************** This function takes care of refreshing the screen, processing user input, and throttling the emulation speed to obtain the required frames per second. ***************************************************************************/ int updatescreen(void) { static int framecount = 0; /* read hi scores from disk */ if (hiscoreloaded == 0 && *gamedrv->hiscore_load) hiscoreloaded = (*gamedrv->hiscore_load)(hiscorename); /* if the user pressed ESC, stop the emulation */ if (osd_key_pressed(OSD_KEY_ESC)) return 1; /* if the user pressed F3, reset the emulation */ if (osd_key_pressed(OSD_KEY_F3)) { /* write hi scores to disk */ if (hiscoreloaded != 0 && *gamedrv->hiscore_save) (*gamedrv->hiscore_save)(hiscorename); hiscoreloaded = 0; return 2; } if (osd_key_pressed(OSD_KEY_F9)) { if (++VolumePTR > 4) VolumePTR = 0; ActualVolume = VolumiDefault[VolumePTR]; osd_set_mastervolume(ActualVolume); while (osd_key_pressed(OSD_KEY_F9)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } } if (osd_key_pressed(OSD_KEY_P)) /* pause the game */ { struct DisplayText dt[2]; int key; dt[0].text = "PAUSED"; dt[0].color = gamedrv->paused_color; dt[0].x = gamedrv->paused_x; dt[0].y = gamedrv->paused_y; dt[1].text = 0; displaytext(dt,0); osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_P)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } /* wait for key release */ do { key = osd_read_key(); if (key == OSD_KEY_ESC) return 1; else if (key == OSD_KEY_TAB) { if (setdipswitches()) return 1; (*drv->vh_update)(Machine->scrbitmap); /* redraw screen */ displaytext(dt,0); } } while (key != OSD_KEY_P); while (osd_key_pressed(key)); osd_set_mastervolume(ActualVolume); } /* if the user pressed TAB, go to dipswitch setup menu */ if (osd_key_pressed(OSD_KEY_TAB)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_TAB)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (setdipswitches()) return 1; osd_set_mastervolume(ActualVolume); } /* if the user pressed F8, go to keys setup menu */ if (osd_key_pressed(OSD_KEY_F8)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_F8)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (setkeysettings()) return 1; osd_set_mastervolume(ActualVolume); } /* if the user pressed F4, show the character set */ if (osd_key_pressed(OSD_KEY_F4)) { osd_set_mastervolume(0); while (osd_key_pressed(OSD_KEY_F4)) { if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } } if (showcharset()) return 1; osd_set_mastervolume(ActualVolume); } if (*drv->sh_update) { (*drv->sh_update)(); /* update sound */ osd_update_audio(); } if (++framecount > frameskip) { static int showfps,f11pressed; static int throttle = 1,f10pressed; uclock_t curr,mtpf; #define MEMORY 10 static uclock_t prev[MEMORY]; static int i,fps; framecount = 0; if (osd_key_pressed(OSD_KEY_F11)) { if (f11pressed == 0) { showfps ^= 1; if (showfps == 0) clearbitmap(Machine->scrbitmap); } f11pressed = 1; } else f11pressed = 0; if (osd_key_pressed(OSD_KEY_F10)) { if (f10pressed == 0) throttle ^= 1; f10pressed = 1; } else f10pressed = 0; (*drv->vh_update)(Machine->scrbitmap); /* update screen */ if (showfps) { drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[(fps%1000)/100],gamedrv->white_text,0,0,0,0,0,TRANSPARENCY_NONE,0); drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[(fps%100)/10],gamedrv->white_text,0,0,Machine->gfx[0]->width,0,0,TRANSPARENCY_NONE,0); drawgfx(Machine->scrbitmap,Machine->gfx[0],gamedrv->charset[fps%10],gamedrv->white_text,0,0,2*Machine->gfx[0]->width,0,0,TRANSPARENCY_NONE,0); } osd_update_display(); osd_poll_joystick(); /* now wait until it's time to trigger the interrupt */ do { curr = uclock(); } while (video_sync == 0 && throttle != 0 && (curr - prev[i]) < (frameskip+1) * UCLOCKS_PER_SEC/drv->frames_per_second); i = (i+1) % MEMORY; mtpf = ((curr - prev[i])/(MEMORY))/2; if (mtpf) fps = (UCLOCKS_PER_SEC+mtpf)/2/mtpf; prev[i] = curr; } return 0; }
int msdos_init_sound(int *rate, int card) { int i; seal_sample_rate = *rate; seal_sound_card = card; if (AInitialize() != AUDIO_ERROR_NONE) return 1; /* Ask the user if no sound card was chosen */ if (seal_sound_card == -1) { unsigned int k; printf("\n SELECT YOUR AUDIO DEVICE :\n\n" " AWE32/64 playback requires onboard DRAM,\n" " Sound Blaster playback is the most compatible & better for emulation\n\n"); for (k = 0;k < AGetAudioNumDevs();k++) { if (AGetAudioDevCaps(k,&caps) == AUDIO_ERROR_NONE) printf(" %2d. %s\n",k,caps.szProductName); } printf("\n"); if (k < 10) { i = getch(); seal_sound_card = i - '0'; } else scanf("%d",&seal_sound_card); } /* initialize SEAL audio library */ if (seal_sound_card == 0) /* silence */ { /* update the Machine structure to show that sound is disabled */ seal_sample_rate = 0; exit(0); return 0; } /* open audio device */ /* info.nDeviceId = AUDIO_DEVICE_MAPPER;*/ info.nDeviceId = seal_sound_card; /* always use 16 bit mixing if possible - better quality and same speed of 8 bit */ info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO | AUDIO_FORMAT_RAW_SAMPLE; info.nSampleRate = seal_sample_rate; if (AOpenAudio(&info) != AUDIO_ERROR_NONE) { return (1); } AGetAudioDevCaps(info.nDeviceId,&caps); printf("Using `%s' at %d-bit %s %u Hz\n", caps.szProductName, info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8, info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono", info.nSampleRate); /* open and allocate voices, allocate waveforms */ if (AOpenVoices(NUMVOICES) != AUDIO_ERROR_NONE) { printf("voices initialization failed\n"); return 1; } for (i = 0; i < NUMVOICES; i++) { if (ACreateAudioVoice(&hVoice[i]) != AUDIO_ERROR_NONE) { printf("voice #%d creation failed\n",i); return 1; } ASetVoicePanning(hVoice[i],128); lpWave[i] = 0; } /* update the Machine structure to reflect the actual sample rate */ *rate = seal_sample_rate = info.nSampleRate; { uclock_t a,b; LONG start,end; if ((lpWave[0] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0) return 1; lpWave[0]->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO; lpWave[0]->nSampleRate = seal_sample_rate; lpWave[0]->dwLength = 3*seal_sample_rate; lpWave[0]->dwLoopStart = 0; lpWave[0]->dwLoopEnd = 3*seal_sample_rate; if (ACreateAudioData(lpWave[0]) != AUDIO_ERROR_NONE) { free(lpWave[0]); lpWave[0] = 0; return 1; } memset(lpWave[0]->lpData,0,3*seal_sample_rate); /* upload the data to the audio DRAM local memory */ AWriteAudioData(lpWave[0],0,3*seal_sample_rate); APrimeVoice(hVoice[0],lpWave[0]); ASetVoiceFrequency(hVoice[0],seal_sample_rate); ASetVoiceVolume(hVoice[0],0); AStartVoice(hVoice[0]); a = uclock(); /* wait some time to let everything stabilize */ do { osd_update_audio(); b = uclock(); } while (b-a < UCLOCKS_PER_SEC/10); a = uclock(); AGetVoicePosition(hVoice[0],&start); do { osd_update_audio(); b = uclock(); } while (b-a < UCLOCKS_PER_SEC); AGetVoicePosition(hVoice[0],&end); nominal_sample_rate = seal_sample_rate; seal_sample_rate = end - start; AStopVoice(hVoice[0]); ADestroyAudioData(lpWave[0]); free(lpWave[0]); lpWave[0] = 0; } osd_set_mastervolume(0); /* start at maximum volume */ return 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; }
void xmame_set_sound_volume( int vol ) { if( vol > VOL_MAX ) vol = VOL_MAX; if( vol < VOL_MIN ) vol = VOL_MIN; osd_set_mastervolume( vol ); }
int msdos_init_sound(void) { #ifdef USE_SEAL int i; /* Ask the user if no soundcard was chosen */ if (soundcard == -1) { unsigned int k; printf("\nSelect the audio device:\n"); for (k = 0;k < AGetAudioNumDevs();k++) { /* don't show the AWE32, it's too slow, users must choose Sound Blaster */ if (AGetAudioDevCaps(k,&caps) == AUDIO_ERROR_NONE && strcmp(caps.szProductName,"Sound Blaster AWE32")) printf(" %2d. %s\n",k,caps.szProductName); } printf("\n"); if (k < 10) { i = getch(); soundcard = i - '0'; } else scanf("%d",&soundcard); } /* initialize SEAL audio library */ if (soundcard == 0) /* silence */ { /* update the Machine structure to show that sound is disabled */ Machine->sample_rate = 0; return 0; } /* open audio device */ /* info.nDeviceId = AUDIO_DEVICE_MAPPER;*/ info.nDeviceId = soundcard; /* always use 16 bit mixing if possible - better quality and same speed of 8 bit */ info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_RAW_SAMPLE; /* use stereo output if supported */ if (usestereo) { if (Machine->drv->sound_attributes & SOUND_SUPPORTS_STEREO) info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO | AUDIO_FORMAT_RAW_SAMPLE; } info.nSampleRate = Machine->sample_rate; if (AOpenAudio(&info) != AUDIO_ERROR_NONE) { printf("audio initialization failed\n"); return 1; } AGetAudioDevCaps(info.nDeviceId,&caps); logerror("Using %s at %d-bit %s %u Hz\n", caps.szProductName, info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8, info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono", info.nSampleRate); /* open and allocate voices, allocate waveforms */ if (AOpenVoices(SOUND_CHANNELS) != AUDIO_ERROR_NONE) { printf("voices initialization failed\n"); return 1; } for (i = 0; i < SOUND_CHANNELS; i++) { lpWave[i] = 0; } stream_playing = 0; stream_cache_data = 0; stream_cache_len = 0; stream_cache_stereo = 0; /* update the Machine structure to reflect the actual sample rate */ Machine->sample_rate = info.nSampleRate; logerror("set sample rate: %d\n",Machine->sample_rate); if (sampleratedetect) { TICKER a,b; LONG start,end; if (ACreateAudioVoice(&hVoice[0]) != AUDIO_ERROR_NONE) return 1; if ((lpWave[0] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0) { ADestroyAudioVoice(hVoice[0]); return 1; } lpWave[0]->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO; lpWave[0]->nSampleRate = Machine->sample_rate; lpWave[0]->dwLength = 3*Machine->sample_rate; lpWave[0]->dwLoopStart = 0; lpWave[0]->dwLoopEnd = 3*Machine->sample_rate; if (ACreateAudioData(lpWave[0]) != AUDIO_ERROR_NONE) { free(lpWave[0]); lpWave[0] = 0; return 1; } memset(lpWave[0]->lpData,0,3*Machine->sample_rate); /* upload the data to the audio DRAM local memory */ AWriteAudioData(lpWave[0],0,3*Machine->sample_rate); APrimeVoice(hVoice[0],lpWave[0]); ASetVoiceFrequency(hVoice[0],Machine->sample_rate); ASetVoiceVolume(hVoice[0],0); AStartVoice(hVoice[0]); a = ticker(); /* wait some time to let everything stabilize */ do { AUpdateAudioEx(Machine->sample_rate / Machine->drv->frames_per_second); b = ticker(); } while (b-a < TICKS_PER_SEC/10); a = ticker(); AGetVoicePosition(hVoice[0],&start); do { AUpdateAudioEx(Machine->sample_rate / Machine->drv->frames_per_second); b = ticker(); } while (b-a < TICKS_PER_SEC); AGetVoicePosition(hVoice[0],&end); nominal_sample_rate = Machine->sample_rate; Machine->sample_rate = end - start; logerror("actual sample rate: %d\n",Machine->sample_rate); AStopVoice(hVoice[0]); ADestroyAudioData(lpWave[0]); free(lpWave[0]); lpWave[0] = 0; ADestroyAudioVoice(hVoice[0]); } else nominal_sample_rate = Machine->sample_rate; #if 0 { char *blaster_env; /* Get Soundblaster base address from environment variabler BLASTER */ /* Soundblaster OPL base port, at some compatibles this must be 0x388 */ if(!getenv("BLASTER")) { printf("\nBLASTER variable not found, disabling fm sound!\n"); No_OPL = options.no_fm = 1; } else { blaster_env = getenv("BLASTER"); BaseSb = i = 0; while ((blaster_env[i] & 0x5f) != 0x41) i++; /* Look for 'A' char */ while (blaster_env[++i] != 0x20) { BaseSb = (BaseSb << 4) + (blaster_env[i]-0x30); } } } #endif #endif #ifdef USE_ALLEGRO reserve_voices(1,0); if (install_sound(DIGI_AUTODETECT,MIDI_NONE,0) != 0) { logerror("Allegro install_sound error: %s\n",allegro_error); return 1; } nominal_sample_rate = Machine->sample_rate; #endif num_used_opl = 0; osd_set_mastervolume(attenuation); /* set the startup volume */ return 0; }
void sound_set_attenuation(int attenuation) { sound_attenuation = attenuation; osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); }
void sound_set_attenuation(running_machine *machine, int attenuation) { sound_private *global = machine->sound_data; global->attenuation = attenuation; osd_set_mastervolume(global->muted ? -32 : global->attenuation); }
static void sound_resume(running_machine &machine) { sound_private *global = machine.sound_data; global->muted &= ~0x02; osd_set_mastervolume(global->muted ? -32 : global->attenuation); }
int osd_init() { BOOL bUseDirectDraw = TRUE; BOOL bUseWindow = FALSE; BOOL bNoSound = FALSE; BOOL bUseMIDASSound = FALSE; BOOL bUseDirectSound = FALSE; BOOL bUseAIMouse = FALSE; BOOL bUseDIKeyboard = FALSE; BOOL bUseDIJoystick = FALSE; #ifdef MAME_NET BOOL bUseNetwork = FALSE; #endif /* MAME_NET */ BOOL bDisplayInitialized = FALSE; BOOL bSoundInitialized = FALSE; BOOL bKeyboardInitialized = FALSE; BOOL bJoystickInitialized = FALSE; BOOL bTrakInitialized = FALSE; BOOL bFMSynthInitialized = FALSE; #ifdef MAME_NET BOOL bNetworkInitialized = FALSE; #endif /* MAME_NET */ options_type *options = GetPlayingGameOptions(); if (options->is_window) bUseWindow = TRUE; if (options->is_window && !options->window_ddraw) bUseDirectDraw = FALSE; if (options->sound == SOUND_NONE) bNoSound = TRUE; #ifndef NOMIDAS if (options->sound == SOUND_MIDAS) bUseMIDASSound = TRUE; #endif if (options->sound == SOUND_DIRECT) bUseDirectSound = TRUE; if (options->use_ai_mouse) bUseAIMouse = TRUE; if (options->di_keyboard) bUseDIKeyboard = TRUE; if (options->di_joystick) bUseDIJoystick = TRUE; #ifdef MAME_NET if (MAME32App.m_bUseNetwork) bUseNetwork = TRUE; #endif /* MAME_NET */ /* Set up. */ MAME32App_init(options); if (bUseDirectDraw == FALSE) MAME32App.m_pDisplay = &GDIDisplay; else if (bUseWindow == TRUE) MAME32App.m_pDisplay = &GDIDisplay;/*&DDrawWindowDisplay;*/ else #if defined(MAME_DEBUG) /* don't do fullscreen debugging */ MAME32App.m_pDisplay = &GDIDisplay; #else MAME32App.m_pDisplay = &DDrawDisplay; #endif if (bNoSound == TRUE) MAME32App.m_pSound = &NullSound; else #ifndef NOMIDAS if (bUseMIDASSound == TRUE) MAME32App.m_pSound = &MIDASSound; else #endif if (bUseDirectSound == TRUE) MAME32App.m_pSound = &DirectSound; MAME32App.m_pTrak = &Trak; MAME32App.m_bUseAIMouse = bUseAIMouse; if (bUseDIKeyboard == TRUE) MAME32App.m_pKeyboard = &DIKeyboard; else MAME32App.m_pKeyboard = &Keyboard; if (bUseDIJoystick == TRUE) MAME32App.m_pJoystick = &DIJoystick; else MAME32App.m_pJoystick = &Joystick; if (options->fm_ym3812) { if (OnNT()) MAME32App.m_pFMSynth = &NTFMSynth; else MAME32App.m_pFMSynth = &FMSynth; } else MAME32App.m_pFMSynth = NULL; #ifdef MAME_NET #if 0 if (bUseNetwork == TRUE ) { MAME32App.m_pNetwork = &Network; } else { MAME32App.m_pNetwork = NULL; } /* TODO: show chat screen */ #endif /* init network thread */ if (bUseNetwork) { if (net_game_init() != 0) { goto error; } else { bNetworkInitialized = TRUE; } } /* TODO: spin until chat screen says go */ #endif /* MAME_NET */ MAME32App.m_hWnd = MAME32App.CreateMAMEWindow(); if (IsWindow(MAME32App.m_hWnd) == FALSE) goto error; /* Initialize everything. */ uclock_init(); if (MAME32App.m_pDisplay != NULL) { if (MAME32App.m_pDisplay->init(options) != 0) goto error; else bDisplayInitialized = TRUE; } if (MAME32App.m_pSound != NULL) { if (MAME32App.m_pSound->init(options) != 0) goto error; else bSoundInitialized = TRUE; } if (MAME32App.m_pKeyboard != NULL) { if (MAME32App.m_pKeyboard->init(options) != 0) goto error; else bKeyboardInitialized = TRUE; } if (MAME32App.m_pJoystick != NULL) { if (MAME32App.m_pJoystick->init(options) != 0) goto error; else bJoystickInitialized = TRUE; } if (MAME32App.m_pTrak != NULL) { if (MAME32App.m_pTrak->init(options) != 0) goto error; else bTrakInitialized = TRUE; } if (MAME32App.m_pFMSynth != NULL) { if (MAME32App.m_pFMSynth->init(options) != 0) goto error; else bFMSynthInitialized = TRUE; } osd_set_mastervolume(- options->volume); return 0; error: if (bFMSynthInitialized == TRUE) MAME32App.m_pFMSynth->exit(); if (bTrakInitialized == TRUE) MAME32App.m_pTrak->exit(); if (bJoystickInitialized == TRUE) MAME32App.m_pJoystick->exit(); if (bKeyboardInitialized == TRUE) MAME32App.m_pKeyboard->exit(); if (bSoundInitialized == TRUE) MAME32App.m_pSound->exit(); if (bDisplayInitialized == TRUE) MAME32App.m_pDisplay->exit(); #ifdef MAME_NET //if (bNetInitialized) osd_net_game_exit(); if (MAME32App.m_pNetwork != NULL) net_exit( NET_QUIT_ABRT ); #endif /* MAME_NET */ uclock_exit(); if (IsWindow(MAME32App.m_hWnd)) DestroyWindow(MAME32App.m_hWnd); return 1; }
virtual void set_mastervolume(int attenuation) { return osd_set_mastervolume(attenuation); }