Esempio n. 1
0
void pleiads_sound_control_b_w (int offset,int data)
{
	/* voice b1 & b2 */
	int freq = data & 0x0f;
	int vol = (data & 0x30) >> 4;

	/* melody - osd_play_midi anyone? */
	/* 0 - no tune, 1 - alarm beep?, 2 - even level tune, 3 - odd level tune */
	/*int tune = (data & 0xc0) >> 6;*/
	/* LBO - not sure if the non-phoenix games play a tune. For example, */
	/* Pop Flamer & Pleiades set bit 0x40 occassionally. */

	sound_freq[portBstatus + 1] = freq;
	sound_vol[portBstatus + 1] = vol;

	if (freq < 0x0e) /* LBO clip both 0xe and 0xf to get rid of whine in Pop Flamer */
	{
		osd_adjust_sample (portBstatus + 1, MAXFREQ_B1/(16-sound_freq[portBstatus + 1]), MAX_VOLUME*(3-vol));
		sound_play[portBstatus + 1] = 1;
	}
	else
	{
		osd_adjust_sample (portBstatus + 1, SBFREQ, 0);
		sound_play[portBstatus + 1] = 0;
	}
	portBstatus ^= 0x01;
}
Esempio n. 2
0
void phoenix_sound_control_b_w(int offset,int data)
{
        /* voice b */
        int freq = data & 0x0f;
        int vol = (data & 0x30) >> 4;

        /* melody - osd_play_midi anyone? */
        /* 0 - no tune, 1 - alarm beep?, 2 - even level tune, 3 - odd level tune */
        /*int tune = (data & 0xc0) >> 6;*/

        if (freq != sound_b_freq) sound_b_adjust = 0;
        sound_b_freq = freq;
        sound_b_vol = vol;

        if (freq != 0x0f)
        {
                osd_adjust_sample(1,(dec_freq*freq),85*(3-vol));
                sound_b_play = 1;
        }
        else
        {
                osd_adjust_sample(1,SBFREQ,0);
                sound_b_play = 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 pleiads_sh_update (void)
{
	pitch_a  = MAXFREQ_A/(16-sound_freq[0]);
	pitch_b1 = MAXFREQ_B1/(16-sound_freq[1]);
	pitch_b2 = MAXFREQ_B2/(16-sound_freq[2]);
/*
	if (hifreq)
		pitch_a=pitch_a*5/4;

	pitch_a+=((double)pitch_a*MOD_DEPTH*sin(t));

	sound_a_sw++;

	if (sound_a_sw==SW_INTERVAL)
	{
		hifreq=!hifreq;
		sound_a_sw=0;
	}

	t+=MOD_RATE;

	if (t>2*PI)
		t=0;

	pitch_b+=((double)pitch_b*SWEEP_DEPTH*sin(x));

if (sound_b_vol==3 || (last_b_freq==15&&sound_b_freq==12) || (last_b_freq!=14&&sound_b_freq==6))
		x=0;

	x+=SWEEP_RATE;

	if (x>3*PI/2)
		x=3*PI/2;

  */

	if (sound_play[0])
		osd_adjust_sample (0, pitch_a, MAX_VOLUME*(3-sound_vol[0]));
	if (sound_play[1])
		osd_adjust_sample (1, pitch_b1, MAX_VOLUME*(3-sound_vol[1]));
	if (sound_play[2])
		osd_adjust_sample (2, pitch_b2, MAX_VOLUME*(3-sound_vol[2]));

	if ((noise_vol) && (noisemulate))
	{
		osd_adjust_sample (3,noise_freq,noise_vol/4);
		noise_vol-=3;
	}
}
Esempio n. 5
0
void phoenix_sh_update(void)
{
        sound_a_adjust++;
        sound_b_adjust++;
        sound_a_sine_adjust++;

        if (sound_a_adjust == SALIMIT) sound_a_adjust = -SALIMIT;
        if (sound_b_adjust == SBLIMIT) sound_b_adjust = -SBLIMIT;
        if (sound_a_sine_adjust == 4) sound_a_sine_adjust = 0;

        if (sound_a_play)
                osd_adjust_sample(0,((inc_freq*sound_a_freq)+sound_a_adjust+sound_a_sine[sound_a_sine_adjust]),85*(3-sound_a_vol));
        if (sound_b_play)
                osd_adjust_sample(1,max_freq-((dec_freq*sound_b_freq)+sound_b_adjust),85*(3-sound_b_vol));

        if ((noise_vol) && (noisemulate))
        {
                osd_adjust_sample(2,noise_freq,noise_vol);
                noise_vol-=3;
        }

}
Esempio n. 6
0
void starforc_sh_update(void)
{
	double period;

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

	SN76496_sh_update();

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

	osd_adjust_sample(4,single_rate,single_volume );
}
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;
	}
}