Exemplo n.º 1
0
int sound_start(void)
{
	int totalsound = 0;
	int i;

	/* Verify the order of entries in the sndintf[] array */
	for (i = 0;i < SOUND_COUNT;i++)
	{
		if (sndintf[i].sound_num != i)
		{
            int j;
logerror("Sound #%d wrong ID %d: check enum SOUND_... in src/sndintrf.h!\n",i,sndintf[i].sound_num);
			for (j = 0; j < i; j++)
				logerror("ID %2d: %s\n", j, sndintf[j].name);
            return 1;
		}
	}


	/* samples will be read later if needed */
	Machine->samples = 0;

	refresh_period = TIME_IN_HZ(Machine->drv->frames_per_second);
	refresh_period_inv = 1.0 / refresh_period;
	sound_update_timer = timer_alloc(NULL);

	if (mixer_sh_start() != 0)
		return 1;

	if (streams_sh_start() != 0)
		return 1;

	while (totalsound < MAX_SOUND && Machine->drv->sound[totalsound].sound_type != 0)
	{
		if ((*sndintf[Machine->drv->sound[totalsound].sound_type].start)(&Machine->drv->sound[totalsound]) != 0)
			goto getout;

		totalsound++;
	}

	return 0;


getout:
	/* TODO: should also free the resources allocated before */
	return 1;
}
Exemplo n.º 2
0
int sound_start(void)
{
#if 0	/* forQUASI88 */
	int totalsound = 0;
	int i;

	/* Verify the order of entries in the sndintf[] array */
	for (i = 0;i < SOUND_COUNT;i++)
	{
		if (sndintf[i].sound_num != i)
		{
            int j;
logerror("Sound #%d wrong ID %d: check enum SOUND_... in src/sndintrf.h!\n",i,sndintf[i].sound_num);
			for (j = 0; j < i; j++)
				logerror("ID %2d: %s\n", j, sndintf[j].name);
            return 1;
		}
	}


	/* samples will be read later if needed */
	Machine->samples = 0;

	refresh_period = TIME_IN_HZ(Machine->drv->frames_per_second);
	refresh_period_inv = 1.0 / refresh_period;
	sound_update_timer = timer_alloc(NULL);
#endif	/* forQUASI88 */




#if 1	/* forQUASI88 */


#ifndef	USE_FMGEN
	if( use_fmgen ){
	  if(verbose_proc) printf("(cisc's Fmgen liblary not available)...");
	  use_fmgen = 0;
	}
#endif


	/* set interface parameter ( volume, mono/stereo, and so on ) */

	/* set interface parameter and set xmame interface function */

#ifdef	USE_FMGEN
	if( use_fmgen ){
	  if( sound_board==SOUND_I ){					/* fmgen ym2203 */

	    fm_interface     = pc88_fmgen_interface;
	    beep_interface   = pc88_beep_interface;
	    xmame_func_sound = pc88_fmgen_func;

		Machine__drv__sound_attributes = SOUND_SUPPORTS_STEREO;

	  }else{										/* fmgen ym2608 */

	    fm_interface     = pc88_fmgen2_interface;
	    beep_interface   = pc88_beep_interface;
	    xmame_func_sound = pc88_fmgen2_func;

		Machine__drv__sound_attributes = SOUND_SUPPORTS_STEREO;
	  }
	}else
#endif
	{
	  if( sound_board==SOUND_I ){					/* xmame ym2203 */

	    fm_interface     = pc88_sound_interface;
	    beep_interface   = pc88_beep_interface;
	    xmame_func_sound = pc88_sound_func;

		Machine__drv__sound_attributes = 0;

	  }else{										/* xmame ym2608 */
	    fm_interface     = pc88_sound2_interface;
	    beep_interface   = pc88_beep_interface;
	    xmame_func_sound = pc88_sound2_func;

		Machine__drv__sound_attributes = SOUND_SUPPORTS_STEREO;
	  }
	}


	/* set volume ( fm, psg, beep ) */

	if( sound_board==SOUND_I ){
	  if( Machine__drv__sound_attributes == 0)
		ym2203_interface.mixing_level[0] = YM2203_VOL(fmvol,psgvol);
	  else
		ym2203_interface.mixing_level[0] = 
						YM3012_VOL(fmvol,MIXER_PAN_LEFT,fmvol,MIXER_PAN_RIGHT);
	}else{
	  ym2608_interface.volumeSSG[0] = psgvol;
	  ym2608_interface.volumeFM[0]  = 
						YM3012_VOL(fmvol,MIXER_PAN_LEFT,fmvol,MIXER_PAN_RIGHT);
	}
	beep88_interface.mixing_level[0] = beepvol;



#endif	/* forQUASI88 */

	if (mixer_sh_start() != 0)
		return 1;

	if (streams_sh_start() != 0)
		return 1;

#if 0	/* forQUASI88 */
	while (Machine->drv->sound[totalsound].sound_type != 0 && totalsound < MAX_SOUND)
	{
		if ((*sndintf[Machine->drv->sound[totalsound].sound_type].start)(&Machine->drv->sound[totalsound]) != 0)
			goto getout;

		totalsound++;
	}
#else	/* forQUASI88 */
	{
	  
		if ((*sndintf[ fm_interface.sound_type ].start)(&fm_interface) != 0)
			goto getout;

		if ((*sndintf[ beep_interface.sound_type ].start)(&beep_interface) != 0)
			goto getout;

	}
#endif	/* forQUASI88 */

	return 0;


getout:
	/* TODO: should also free the resources allocated before */
	return 1;
}