Esempio n. 1
0
int pleiads_sh_start (void)
{
	if (Machine->samples != 0 && Machine->samples->sample[0] != 0)
		noisemulate = 0;
	else
		noisemulate = 1;

	/* Clear all the variables */
	{
		int i;
		for (i = 0; i < 3; i ++)
		{
			sound_play[i] = 0;
			sound_vol[i] = 0;
			sound_freq[i] = SAFREQ; /* The B voices use the same constant for now */
		}
		noise_vol = 0;
		noise_freq = 1000;
		pitch_a = pitch_b1 = pitch_b2 = 0;
		portBstatus = 0;
	}

	osd_play_sample (0,(signed char *)waveform1,32,1000,0,1);
	osd_play_sample (1,(signed char *)waveform1,32,1000,0,1);
	osd_play_sample (2,(signed char *)waveform1,32,1000,0,1);
	osd_play_sample (3,(signed char *)waveform2,128,1000,0,1);

	return 0;
}
Esempio n. 2
0
int phoenix_sh_start(void)
{
        osd_play_sample(0,Machine->drv->samples,32,1000,0,1);
        osd_play_sample(1,Machine->drv->samples,32,1000,0,1);
        osd_play_sample(2,&Machine->drv->samples[32],128,1000,0,1);
	return 0;
}
Esempio n. 3
0
void phoenix_sound_control_a_w(int offset,int data)
{
        static int lastnoise;

        /* voice a */
        int freq = data & 0x0f;
        int vol = (data & 0x30) >> 4;

        /* noise */
        int noise = (data & 0xc0) >> 6;

        if (freq != sound_a_freq) sound_a_adjust = 0;
        sound_a_freq = freq;
        sound_a_vol = vol;

        if (freq != 0x0f)
        {
                osd_adjust_sample(0,max_freq-(dec_freq*freq),85*(3-vol));
                sound_a_play = 1;
        }
        else
        {
                osd_adjust_sample(0,SAFREQ,0);
                sound_a_play = 0;
        }

        if (noisemulate) {
           if (noise_freq != 1750*(4-noise))
           {
                   noise_freq = 1750*(4-noise);
                   noise_vol = 85*noise;
           }

           if (noise) osd_adjust_sample(2,noise_freq,noise_vol);
           else
           {
                   osd_adjust_sample(2,1000,0);
                   noise_vol = 0;
           }
         }
        else
         {
           switch (noise) {
             case 1 : if (lastnoise != noise)
                        osd_play_sample(2,Machine->samples->sample[0]->data,
                                          Machine->samples->sample[0]->length,
                                          Machine->samples->sample[0]->smpfreq,
                                          Machine->samples->sample[0]->volume,0);
                      break;
             case 2 : if (lastnoise != noise)
                        osd_play_sample(2,Machine->samples->sample[1]->data,
                                          Machine->samples->sample[1]->length,
                                          Machine->samples->sample[1]->smpfreq,
                                          Machine->samples->sample[1]->volume,0);
                      break;
           }
           lastnoise = noise;
         }
}
Esempio n. 4
0
void invaders_sh_port3_w(int offset, int data)
{
	static unsigned char Sound = 0;


	if (Machine->samples == 0) return;

	if (data & 0x01 && ~Sound & 0x01 && Machine->samples->sample[0])
		osd_play_sample(0,Machine->samples->sample[0]->data,
				Machine->samples->sample[0]->length,
                                Machine->samples->sample[0]->smpfreq,
                                Machine->samples->sample[0]->volume,1);

	if (~data & 0x01 && Sound & 0x01)
		osd_stop_sample(0);

	if (data & 0x02 && ~Sound & 0x02 && Machine->samples->sample[1])
		osd_play_sample(1,Machine->samples->sample[1]->data,
				Machine->samples->sample[1]->length,
                                Machine->samples->sample[1]->smpfreq,
                                Machine->samples->sample[1]->volume,0);

	if (~data & 0x02 && Sound & 0x02)
		osd_stop_sample(1);

	if (data & 0x04 && ~Sound & 0x04 && Machine->samples->sample[2])
		osd_play_sample(2,Machine->samples->sample[2]->data,
				Machine->samples->sample[2]->length,
                                Machine->samples->sample[2]->smpfreq,
                                Machine->samples->sample[2]->volume,0);

	if (~data & 0x04 && Sound & 0x04)
		osd_stop_sample(2);

	if (data & 0x08 && ~Sound & 0x08 && Machine->samples->sample[3])
		osd_play_sample(3,Machine->samples->sample[3]->data,
				Machine->samples->sample[3]->length,
                                Machine->samples->sample[3]->smpfreq,
                                Machine->samples->sample[3]->volume,0);

	if (~data & 0x08 && Sound & 0x08)
		osd_stop_sample(3);

	Sound = data;
}
Esempio n. 5
0
void invaders_sh_port5_w(int offset, int data)
{
	static unsigned char Sound = 0;


	if (Machine->samples == 0) return;

	if (data & 0x01 && ~Sound & 0x01 && Machine->samples->sample[4])
		osd_play_sample(4,Machine->samples->sample[4]->data,
				Machine->samples->sample[4]->length,
                                Machine->samples->sample[4]->smpfreq,
                                Machine->samples->sample[4]->volume,0);

	if (data & 0x02 && ~Sound & 0x02 && Machine->samples->sample[5])
		osd_play_sample(4,Machine->samples->sample[5]->data,
				Machine->samples->sample[5]->length,
                                Machine->samples->sample[5]->smpfreq,
                                Machine->samples->sample[5]->volume,0);

	if (data & 0x04 && ~Sound & 0x04 && Machine->samples->sample[6])
		osd_play_sample(4,Machine->samples->sample[6]->data,
				Machine->samples->sample[6]->length,
                                Machine->samples->sample[6]->smpfreq,
                                Machine->samples->sample[6]->volume,0);

	if (data & 0x08 && ~Sound & 0x08 && Machine->samples->sample[7])
		osd_play_sample(4,Machine->samples->sample[7]->data,
				Machine->samples->sample[7]->length,
                                Machine->samples->sample[7]->smpfreq,
                                Machine->samples->sample[7]->volume,0);

	if (data & 0x10 && ~Sound & 0x10 && Machine->samples->sample[8])
		osd_play_sample(5,Machine->samples->sample[8]->data,
				Machine->samples->sample[8]->length,
                                Machine->samples->sample[8]->smpfreq,
                                Machine->samples->sample[8]->volume,0);

	if (~data & 0x10 && Sound & 0x10)
		osd_stop_sample(5);

	Sound = data;
}
Esempio n. 6
0
/***************************************************************************
This is a kludge to simulate interfacing with external IO chip to trigger
an explosion sound which is generated by the MAME supported functions.
 ***************************************************************************/
void c_io_cmd_wait(void)
{
    //    struct RunningMachine *Machine = pMachine ;
#if 0 // TODO: function call has changed
    if (Machine->samples->sample[0])
        osd_play_sample(7, (unsigned char *)Machine->samples->sample[0]->data,
                        Machine->samples->sample[0]->length,
                        Machine->samples->sample[0]->smpfreq,
                        Machine->samples->sample[0]->volume, 0);
#endif // XMAME
}
Esempio n. 7
0
void pleiads_sound_control_a_w (int offset,int data)
{
	static int lastnoise;

	/* voice a */
	int freq = data & 0x0f;
	int vol = (data & 0x30) >> 4;

	/* noise */
	int noise = (data & 0xc0) >> 6;

	sound_freq[0] = freq;
	sound_vol[0] = vol;

	if (freq != 0x0f)
	{
		osd_adjust_sample (0, MAXFREQ_A/(16-sound_freq[0]), MAX_VOLUME*(3-vol));
		sound_play[0] = 1;
	}
	else
	{
		osd_adjust_sample (0,SAFREQ,0);
		sound_play[0] = 0;
	}

	if (noisemulate)
	{
		if (noise_freq != 1750*(4-noise))
		{
			noise_freq = 1750*(4-noise);
			noise_vol = 85*noise;
		}

		if (noise) osd_adjust_sample (3,noise_freq,noise_vol/4);
		else
		{
			osd_adjust_sample (3,1000,0);
			noise_vol = 0;
		}
	}
	else
	{
		switch (noise)
		{
			case 1 :
				if (lastnoise != noise)
					osd_play_sample(3,Machine->samples->sample[0]->data,
						Machine->samples->sample[0]->length,
						Machine->samples->sample[0]->smpfreq,
						Machine->samples->sample[0]->volume,0);
				break;
			case 2 :
		 		if (lastnoise != noise)
					osd_play_sample(3,Machine->samples->sample[1]->data,
						Machine->samples->sample[1]->length,
						Machine->samples->sample[1]->smpfreq,
						Machine->samples->sample[1]->volume,0);
				break;
		}
		lastnoise = noise;
	}
}
Esempio n. 8
0
int starforc_sh_start(void)
{
	int i;


	if (SN76496_sh_start(&interface) != 0)
		return 1;

	/* z80 ctc init */
	ctc_intf.baseclock[0] = Machine->drv->cpu[1].cpu_clock;
	z80ctc_init (&ctc_intf);

	/* z80 pio init */
	z80pio_init (&pio_intf);

	/* setup daisy chain connection */
	{
		static Z80_DaisyChain daisy_chain[] =
		{
			{ z80pio_reset , z80pio_interrupt, z80pio_reti , 0 }, /* device 0 = PIO_0 , low  priority */
			{ z80ctc_reset , z80ctc_interrupt, z80ctc_reti , 0 }, /* device 1 = CTC_0 , high priority */
			{ 0,0,0,-1}        /* end mark */
		};
		cpu_setdaisychain (1,daisy_chain );
/*
	daisy_chain is connect link for Z80 daisy-chain .
	paramater is
	{ pointer of reset , pointer of interrupt entry,pointer of RETI handler , device paramater }

	reset           : This function is called when z80 cpu reset
	interrupt entry : This function is called when z80 interrupt entry for this device
	                  It shoud be change interrupt status and
	                  set new status with cpu_cause_interrupt function
	                  return value is interrupt vector

	RETI handler    : This function is called when z80 reti operation for this device
	                  It shoud be change interrupt status and
	                  set new status with cpu_cause_interrupt function

	handler shoud be allocate static.
	Because this pointers is used when reset cpu.

	The daisy chain link is build by this pointers.

	daisy chain priority:
		As for Priority , the top side is lower , bottom side is higher

*/
	}

	if ((_single = (signed char *)gp2x_malloc(SINGLE_LENGTH)) == 0)
	{
		SN76496_sh_stop();
		gp2x_free(_single);
		return 1;
	}
	for (i = 0;i < SINGLE_LENGTH;i++)		/* freq = ctc2 zco / 8 */
		_single[i] = ((i/SINGLE_DIVIDER)&0x01)*(SINGLE_VOLUME/2);

	/* CTC2 single tone generator */
	osd_play_sample(4,_single,SINGLE_LENGTH,single_rate,single_volume,1);

	return 0;
}