コード例 #1
0
ファイル: senjyo.c プロジェクト: CrouchingLlama/openlase-mame
static void senjyo_sh_update(int param)
{
	double period;

	/* ctc2 timer single tone generator frequency */
	period = z80ctc_getperiod (0, 2);
	if( period != 0 ) single_rate = (int)(1.0 / period );
	else single_rate = 0;

	sample_set_freq(0,single_rate);
}
コード例 #2
0
ファイル: senjyo.c プロジェクト: cdenix/ps3-mame-0125
static TIMER_CALLBACK( senjyo_sh_update )
{
	/* ctc2 timer single tone generator frequency */
	attotime period = z80ctc_getperiod (0, 2);
	if (attotime_compare(period, attotime_zero) != 0 )
		single_rate = ATTOSECONDS_TO_HZ(period.attoseconds);
	else
		single_rate = 0;

	sample_set_freq(0,single_rate);
}
コード例 #3
0
static void adjust_sample(device_t *samples, UINT8 freq)
{
	tone_freq = freq;

	if ((tone_freq == 0xff) || (tone_freq == 0x00))
		sample_set_volume(samples, 3, 0);
	else
	{
		sample_set_freq(samples, 3, 1.0 * max_freq / (0xff - tone_freq));
		sample_set_volume(samples, 3, tone_active);
	}
}
コード例 #4
0
ファイル: senjyo.c プロジェクト: DarrenBranford/MAME4iOS
static TIMER_CALLBACK( senjyo_sh_update )
{
	running_device *samples = machine->device("samples");

	/* ctc2 timer single tone generator frequency */
	z80ctc_device *ctc = machine->device<z80ctc_device>("z80ctc");
	attotime period = ctc->period(2);
	if (attotime_compare(period, attotime_zero) != 0 )
		single_rate = ATTOSECONDS_TO_HZ(period.attoseconds);
	else
		single_rate = 0;

	sample_set_freq(samples, 0,single_rate);
}
コード例 #5
0
static TIMER_CALLBACK( senjyo_sh_update )
{
	device_t *samples = machine->device("samples");
	senjyo_state *state = machine->driver_data<senjyo_state>();

	/* ctc2 timer single tone generator frequency */
	z80ctc_device *ctc = machine->device<z80ctc_device>("z80ctc");
	attotime period = ctc->period(2);
	if (period != attotime::zero)
		state->single_rate = ATTOSECONDS_TO_HZ(period.attoseconds);
	else
		state->single_rate = 0;

	sample_set_freq(samples, 0, state->single_rate);
}
コード例 #6
0
void targ_tone_generator(int data)
{
	int maxfreq;


	if (targ_spec_flag) maxfreq = MAXFREQ_A_TARG;
	else maxfreq = MAXFREQ_A_SPECTAR;

    sound_a_freq = data;
    if (sound_a_freq == 0xFF || sound_a_freq == 0x00)
	{
		sample_set_volume(3,0);
    }
    else
	{
		sample_set_freq(3,maxfreq/(0xFF-sound_a_freq));
		sample_set_volume(3,tone_active*1.0);
	}
}
コード例 #7
0
ファイル: cinemat.c プロジェクト: Ezio-PS/mame2003-libretro
void starcas_sound_w(UINT8 sound_val, UINT8 bits_changed)
{
    UINT32 target_pitch;
	UINT8 shift_diff;

    cinemat_shift (sound_val, bits_changed, 0x80, 0x10);

	// Now see if it's time to act upon the shifted data

	if ((bits_changed & 0x01) && (0 == (sound_val & 0x01)))
	{
		// Yep. Falling edge! Find out what has changed.

		shift_diff = current_shift ^ last_shift;

		if ((shift_diff & 1) && (0 == (current_shift & 1)))
			sample_start(2, 2, 0);	// Castle fire

		if ((shift_diff & 2) && (0 == (current_shift & 2)))
			sample_start(5, 5, 0);	// Shield hit

		if (shift_diff & 0x04)
		{
			if (current_shift & 0x04)
				sample_start(6, 6, 1);	// Star sound
			else
				sample_stop(6);	// Stop it!
		}

		if (shift_diff & 0x08)
		{
			if (current_shift & 0x08)
				sample_stop(7);	// Stop it!
			else
				sample_start(7, 7, 1);	// Thrust sound
		}

		if (shift_diff & 0x10)
		{
			if (current_shift & 0x10)
				sample_stop(4);
			else
				sample_start(4, 4, 1);	// Drone
		}

		// Latch the drone pitch

        target_pitch = (current_shift & 0x60) >> 3;
        target_pitch |= ((current_shift & 0x40) >> 5);
        target_pitch |= ((current_shift & 0x80) >> 7);

        // target_pitch = (current_shift & 0x60) >> 3;
        // is the the target drone pitch to rise and stop at.

        target_pitch = 0x10000 + (target_pitch << 12);

        // 0x10000 is lowest value the pitch will drop to
        // Star Castle drone sound

        if (cpu_getcurrentframe() > last_frame)
        {
            if (current_pitch > target_pitch)
                current_pitch -= 300;
            if (current_pitch < target_pitch)
                current_pitch += 200;
            sample_set_freq(4, current_pitch);
            last_frame = cpu_getcurrentframe();
        }

		last_shift = current_shift;
	}
コード例 #8
0
void namcoio_54XX_write(int data)
{
	static int fetch;
	static int fetchmode;
	static UINT8 config1[4],config2[4],config3[5];


//logerror("%04x: custom 54XX write %02x\n",activecpu_get_pc(),data);

	if (fetch)
	{
		switch (fetchmode)
		{
			default:
			case 1:
				config1[4-(fetch--)] = data;
				break;

			case 2:
				config2[4-(fetch--)] = data;
				break;

			case 3:
				config3[5-(fetch--)] = data;
				break;
		}
	}
	else
	{
		switch (data & 0xf0)
		{
			case 0x00:	// nop
				break;

			case 0x10:	// output sound on pins 4-7 only
				if (memcmp(config1,"\x40\x00\x02\xdf",4) == 0)
					// bosco
					// galaga
					// xevious
					sample_start(0, 0, 0);
				else if (memcmp(config1,"\x10\x00\x80\xff",4) == 0)
					// xevious
					sample_start(0, 1, 0);
				else if (memcmp(config1,"\x80\x80\x01\xff",4) == 0)
					// xevious
					sample_start(0, 2, 0);
				break;

			case 0x20:	// output sound on pins 8-11 only
				if (memcmp(config2,"\x40\x40\x01\xff",4) == 0)
					// xevious
					sample_start(1, 3, 0);
				else if (memcmp(config2,"\x30\x30\x03\xdf",4) == 0)
					// bosco
					// galaga
					sample_start(1, 1, 0);
				else if (memcmp(config2,"\x60\x30\x03\x66",4) == 0)
					// polepos
					sample_start( 0, 0, 0 );
				break;

			case 0x30:
				fetch = 4;
				fetchmode = 1;
				break;

			case 0x40:
				fetch = 4;
				fetchmode = 2;
				break;

			case 0x50:	// output sound on pins 17-20 only
				if (memcmp(config3,"\x08\x04\x21\x00\xf1",5) == 0)
					// bosco
					sample_start(2, 2, 0);
				break;

			case 0x60:
				fetch = 5;
				fetchmode = 3;
				break;

			case 0x70:
				// polepos
				/* 0x7n = Screech sound. n = pitch (if 0 then no sound) */
				/* followed by 0x60 command? */
				if (( data & 0x0f ) == 0)
				{
					if (sample_playing(1))
						sample_stop(1);
				}
				else
				{
					int freq = (int)( ( 44100.0f / 10.0f ) * (float)(data & 0x0f) );

					if (!sample_playing(1))
						sample_start(1, 1, 1);
					sample_set_freq(1, freq);
				}
				break;
		}
	}
}