示例#1
0
int sound_direct_sound::init()
{
	// attempt to initialize directsound
	// don't make it fatal if we can't -- we'll just run without sound
	dsound_init();
	return 0;
}
示例#2
0
文件: sound.c 项目: chrisjubb/pinmame
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;
}
示例#3
0
//int main () {
int CALLBACK WinMain( HINSTANCE, HINSTANCE, LPSTR cmdline, int cmdshow ) {
  InitCommonControls();
  if(!dsound_init() ) {
    printf("dsound init error %u\n", (unsigned)GetLastError() );
    return 1;
  }
  
  HINSTANCE hinst = GetModuleHandle(NULL);
  
  HWND dlg1 = CreateDialog( hinst, MAKEINTRESOURCE( IDD_DIALOG1 ), NULL, dlgproc1 );
  if( !dlg1 ) {
    printf("error dialog %x\n", (unsigned)GetLastError() );
    return 1;
  }
  
  HWND tb1 = GetDlgItem( dlg1, IDC_SLIDER1 );
  if( !tb1 ) {
    printf("error slider %u\n", (unsigned)GetLastError() );
    return 1;
  }
  
  SendMessage( tb1, TBM_SETRANGE, 1, MAKELONG(0,10000) );
  SendMessage( tb1, TBM_SETTICFREQ, 100, 0 );
  
  MSG msg;
  while( GetMessage( &msg, NULL, 0, 0 ) ) {
    IsDialogMessage( dlg1, &msg );
  }
  
  return 0;
}
示例#4
0
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;
}
示例#5
0
int sound_direct_sound::init(osd_options const &options)
{
	// attempt to initialize directsound
	// don't make it fatal if we can't -- we'll just run without sound
	dsound_init();
	m_buffer_underflows = m_buffer_overflows = 0;
	return 0;
}
示例#6
0
void winsound_init(running_machine *machine)
{
	// if no sound, don't create anything
	if (!options_get_bool(machine->options(), OPTION_SOUND))
		return;

	// ensure we get called on the way out
	machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit);

	// attempt to initialize directsound
	// don't make it fatal if we can't -- we'll just run without sound
	dsound_init(machine);
}
示例#7
0
void winsound_init(running_machine &machine)
{
	// if no sound, don't create anything
	if (!machine.options().sound())
		return;

#ifdef USE_AUDIO_SYNC
	audio_sync = machine.options().bool_value(WINOPTION_AUDIO_SYNC);
#endif /* USE_AUDIO_SYNC */

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sound_exit), &machine));

	// attempt to initialize directsound
	// don't make it fatal if we can't -- we'll just run without sound
	dsound_init(machine);
}
示例#8
0
文件: kmain.c 项目: abbrev/xs
void kmain(void)
{
  int reset_after_shutdown=0;
#ifdef CONF_DKEY
  int c;
#endif

  /* Install the text.hi segment in the correct place.  The
   * firmware loader puts it in the bss segment, we copy it 
   * to it's final location.
   */
  memcpy(&__text_hi, &__bss, &__etext_hi - &__text_hi);

  reset_vector = rom_reset_vector;

  /* Turn off motor, since writing to hitext manipulates motors */
  motor_controller = 0;
  
  memset(&__bss, 0, &__bss_end - &__bss);

#ifdef CONF_MM
  mm_init();
#endif

  while (1) {
    power_init();

#ifdef CONF_AUTOSHUTOFF
    shutoff_init();
#endif

    lcd_init();

#ifdef CONF_DSOUND
    dsound_init();
#endif
#ifdef CONF_TIME
    systime_init();
#endif
#ifdef CONF_DSENSOR
    ds_init();
#endif
#ifdef CONF_DMOTOR
    dm_init();
#endif
#ifdef CONF_LNP
    lnp_init();
    lnp_logical_init();
#endif
#ifdef CONF_TM
    tm_init();
#endif
#ifdef CONF_PROGRAM
    program_init();
#endif

    show_on();

    // wait till power key released
    //
#ifdef CONF_DKEY
    dkey_multi=KEY_ANY;
    while((c=dkey_multi) & KEY_ONOFF);
#else
    while (PRESSED(dbutton(), BUTTON_ONOFF));
    delay(100);
#endif

    cls();
#ifndef CONF_PROGRAM
    lcd_show(man_run);
#ifndef CONF_LCD_REFRESH
    lcd_refresh();
#endif
#endif

    // run app
    //
#ifdef CONF_TM
#ifndef CONF_PROGRAM
    execi(&main,0,0,PRIO_NORMAL,DEFAULT_STACK_SIZE);
#endif
    tm_start();
#else
    main(0,0);
#endif

    show_off();

    // ON/OFF + PROGRAM -> erase firmware
#ifdef CONF_DKEY
    while((c=dkey_multi) & KEY_ONOFF)
      if(c&KEY_PRGM)
        reset_after_shutdown=1;
#else
    while (PRESSED(dbutton(), BUTTON_ONOFF))
      if (PRESSED(dbutton(), BUTTON_PROGRAM))
        reset_after_shutdown=1;
#endif

#ifdef CONF_PROGRAM
    program_shutdown();
#endif
#ifdef CONF_LNP
    lnp_logical_shutdown();
#endif
#ifdef CONF_DMOTOR
    dm_shutdown();
#endif
#ifdef CONF_DSENSOR
    ds_shutdown();
#endif
#ifdef CONF_TIME
    systime_shutdown();
#endif

    if (reset_after_shutdown)
      rom_reset();

    lcd_clear();
    lcd_power_off();

    power_off();
  }
}