コード例 #1
0
ファイル: 2413intf.c プロジェクト: cdenix/ps3-mame-0125
static void *ym2413_start(int sndindex, int clock, const void *config)
{
	int rate = clock/72;
	struct ym2413_info *info;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));

	/* emulator create */
	info->chip = YM2413Init(clock, rate, sndindex);
	if (!info->chip)
		return NULL;

	/* stream system initialize */
	info->stream = stream_create(0,2,rate,info,ym2413_stream_update);

	YM2413SetUpdateHandler(info->chip, _stream_update, info);

	return info;




#if 0
	int i, tst;
	char name[40];

	num = intf->num;

	tst = YM3812_sh_start (msound);
	if (tst)
		return 1;

	for (i=0;i<num;i++)
	{
		ym2413_reset (i);

		ym2413[i].DAC_stream = stream_create(0, 1, clock/72, i, YM2413DAC_update);

		if (ym2413[i].DAC_stream == -1)
			return 1;
	}
	return 0;
#endif

}
コード例 #2
0
ファイル: 2413intf.c プロジェクト: clobber/UME
static DEVICE_START( ym2413 )
{
	ym2413_state *info = get_safe_token(device);
	int rate = device->clock()/72;

	/* emulator create */
	info->chip = ym2413_init(device, device->clock(), rate);
	assert_always(info->chip != NULL, "Error creating YM2413 chip");

	/* stream system initialize */
	info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2413_stream_update);

	ym2413_set_update_handler(info->chip, _stream_update, info);




#if 0
	int i, tst;
	char name[40];

	num = intf->num;

	tst = YM3812_sh_start (msound);
	if (tst)
		return 1;

	for (i=0;i<num;i++)
	{
		ym2413_reset (i);

		ym2413[i].DAC_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/72, i, YM2413DAC_update);

		if (ym2413[i].DAC_stream == -1)
			return 1;
	}
	return 0;
#endif

}
コード例 #3
0
ファイル: ym2413.cpp プロジェクト: ArnaudFeld/MameAppleTV
int YM2413_sh_start(const struct MachineSound *msound)
{
	int i, j;
	for (i=0; i<MAX_2413; i++)
	{
		/* Reset the chip state to 0 */
		memset(&ym2413_state[i], 0, sizeof(ym2413_state[0]));

		/*
		Copy default values for the user instument. This is not strictly necessary,
		but will allow altering of the extra OPL settings that aren't
		set by the 2413 (feedback and wave select).
		*/
		for (j=0; j<ym2413_parameter_count; j++)
		{
			ym2413_state[i].user_instrument[j]=ym2413_instruments[0][j];
		}
        ym2413_state[i].fsam = ym2413_clock / 72;

	}


	return YM3812_sh_start(msound);
}
コード例 #4
0
ファイル: emulator.c プロジェクト: albinoz/raine
int init_sound_emulators(void)
{
   int i,j;

   if(change_sample_rate)
      saStopSoundEmulators();
   if (emulators_active)
     return 0;

   change_sample_rate = 0;
   if( SndMachine ){
    if( !SndMachine->first ){
      saInitVolPan();		/* moved. (hiro-shi) */
      SndMachine->first = 1;	/* first flag clear */
      streams_sh_start();	/* streaming system initialize & start */
      for( j = 0; j < SndMachine->control_max; j++ ){
	switch( SndMachine->init[j] ){
#if HAS_YM2203
	case SOUND_YM2203:
	  i = YM2203_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM2151
	case SOUND_YM2151S:
		  i = YM2151_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM2413
	case SOUND_YM2413:
		  i = YM2413_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM2151_ALT
	case SOUND_YM2151J:
	  i = YM2151_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM2610
	case SOUND_YM2610:
	  i = YM2610_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM2610B
	case SOUND_YM2610B:
	  i = YM2610B_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_MSM5205_BUFF
	case SOUND_MSM5205_BUFF:
	  i = MSM5205buffer_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_ADPCM
	case SOUND_M6295:
	  i = OKIM6295_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_AY8910
	case SOUND_AY8910:
	  i = AY8910_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YM3812
	case SOUND_YM3812:
	  i = YM3812_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_SMP16
	case SOUND_SMP16:
	  i = SMP16buffer_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_M6585
	case SOUND_M6585:
	  i = M6585buffer_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_YMZ280B
	case SOUND_YMZ280B:
	  i = YMZ280B_sh_start( SndMachine->intf[j] );
	break;
#endif
#if HAS_ES5505
	case SOUND_ES5505:
	  i = ES5505_sh_start( SndMachine->intf[j] );
	  break;
	case SOUND_ES5506:
	  i = ES5506_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_QSOUND
	case SOUND_QSOUND:
	  i = qsound_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_YMF278B
	case SOUND_YMF278B:
	  i = YMF278B_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_NAMCO
	case SOUND_NAMCO:
	  i = namco_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_X1_010
	case SOUND_X1_010:
	  i = seta_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_DAC
	case SOUND_DAC:
	  i = DAC_sh_start( SndMachine->intf[j] );
	  break;
#endif
#if HAS_DXSMP
	case SOUND_DXSMP:
	  i = dxsmp_sh_start( SndMachine->intf[j] );
	  break;
#endif
	default:
	  i = 1;
	break;
	}
	if( i ){
	  audio_sample_rate = 0;
	  SndMachine = NULL;
	  printf("emulator init failed\n");
	  return 1;
	}
      }
    }
  }
   emulators_active = 1;
  return 0;
}