Beispiel #1
0
int AY8910_sh_start(void)
{

    if (AY8910_init(8000000, SAMPLE_RATE, NULL, NULL, NULL, NULL) != 0)
	return 1;
    build_mixer_table();

    return 0;
}
Beispiel #2
0
void *ay8910_start_ym(sound_type chip_type, int sndindex, int clock, const struct AY8910interface *intf)
{
	ay8910_context *info;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));
	info->index = sndindex;
	info->intf = intf;
	if ((info->intf->flags & AY8910_SINGLE_OUTPUT) != 0)
	{
		logerror("AY-3-8910/YM2149 using single output!\n");
		info->streams = 1;
	}
	else
		info->streams = 3;

	switch (chip_type)
	{
		case SOUND_AY8910:
		case SOUND_AY8930:
			info->step = 2;
			info->par = &ay8910_param;
			info->par_env = &ay8910_param;
			info->zero_is_off = 1;
			info->env_step_mask = 0x0F;
			break;
		case SOUND_YM2149:
		case SOUND_YM2203:
		case SOUND_YM2610:
		case SOUND_YM2610B:
		case SOUND_YM2608:
		case SOUND_YMZ284:
		case SOUND_YMZ294:
		case SOUND_YM3439:
		default:
			info->step = 1;
			info->par = &ym2149_param;
			info->par_env = &ym2149_param_env;
			info->zero_is_off = 0;
			info->env_step_mask = 0x1F;
			break;
	}

	build_mixer_table(info);

	/* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910,    */
	/* This handled by the step parameter. Consequently we use a divider of 8 here. */
	info->channel = stream_create(0,info->streams,clock / 8 ,info,ay8910_update);

	ay8910_set_clock_ym(info,clock);
	ay8910_statesave(info, sndindex);

	return info;
}
Beispiel #3
0
INT32 AY8910Init(INT32 chip, INT32 clock, INT32 sample_rate,
		read8_handler portAread, read8_handler portBread,
		write8_handler portAwrite, write8_handler portBwrite)
{
	struct AY8910 *PSG = &AYPSG[chip];
	
#if defined FBA_DEBUG
#ifdef __GNUC__ 
	DebugSnd_AY8910Initted = 1;
#endif
#endif

	AYStreamUpdate = dummy_callback;

	if (chip != num) {
		return 1;
	}

	memset(PSG, 0, sizeof(struct AY8910));
	PSG->SampleRate = sample_rate;
	PSG->PortAread = portAread;
	PSG->PortBread = portBread;
	PSG->PortAwrite = portAwrite;
	PSG->PortBwrite = portBwrite;

	AY8910_set_clock(chip, clock);

	build_mixer_table(chip);
	
	// default routes
	AY8910Volumes[(chip * 3) + BURN_SND_AY8910_ROUTE_1] = 1.00;
	AY8910Volumes[(chip * 3) + BURN_SND_AY8910_ROUTE_2] = 1.00;
	AY8910Volumes[(chip * 3) + BURN_SND_AY8910_ROUTE_3] = 1.00;
	AY8910RouteDirs[(chip * 3) + BURN_SND_AY8910_ROUTE_1] = BURN_SND_ROUTE_BOTH;
	AY8910RouteDirs[(chip * 3) + BURN_SND_AY8910_ROUTE_2] = BURN_SND_ROUTE_BOTH;
	AY8910RouteDirs[(chip * 3) + BURN_SND_AY8910_ROUTE_3] = BURN_SND_ROUTE_BOTH;

	AY8910Reset(chip);

	num++;

	return 0;
}
Beispiel #4
0
int AY8910_sh_start(const struct MachineSound *msound)
{
	int chip;
	const struct AY8910interface *intf = msound->sound_interface;

	num = intf->num;

	for (chip = 0;chip < num;chip++)
	{
		if (AY8910_init(sound_name(msound),chip+ym_num,intf->baseclock,
				intf->mixing_level[chip] & 0xffff,
				Machine->sample_rate,
				intf->portAread[chip],intf->portBread[chip],
				intf->portAwrite[chip],intf->portBwrite[chip]) != 0)
			return 1;
		build_mixer_table(chip+ym_num);
	}
	return 0;
}
Beispiel #5
0
void *ay8910_start_ym(int chip_type, int sndindex, int clock, int streams,
		read8_handler portAread, read8_handler portBread,
		write8_handler portAwrite, write8_handler portBwrite)
{
	struct AY8910 *info;

	info = auto_malloc(sizeof(*info));
	memset(info, 0, sizeof(*info));
	info->index = sndindex;
	info->streams = streams;

	AY8910_init(info, streams, clock,
			clock/8,
			portAread,portBread,
			portAwrite,portBwrite);

	build_mixer_table(info);
	AY8910_statesave(info, sndindex);

	return info;
}