Exemple #1
0
static void playSound(void) {
    if (Machine->gamedrv->flags & GAME_NO_SOUND)
        return;

    if (atarilocals.sound & 0x02) { // noise on
        int i;
        for (i=0; i < sizeof(noiseWave); i++)
            noiseWave[i] = (UINT8)(rand() % 256);
        stopNoise();
        mixer_set_volume(atarilocals.noisechannel, atarilocals.volume*4);
        mixer_play_sample(atarilocals.noisechannel, (signed char *)noiseWave, sizeof(noiseWave),
                          ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
    }
    if (atarilocals.sound & 0x01) { // wave on
        stopSound();
        mixer_set_volume(atarilocals.channel, atarilocals.volume*4);
        if (atarilocals.waveform < 4)
            mixer_play_sample(atarilocals.channel, (signed char *)squareWave, sizeof(squareWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else if (atarilocals.waveform < 8)
            mixer_play_sample(atarilocals.channel, (signed char *)triangleWave, sizeof(triangleWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else if (atarilocals.waveform < 12)
            mixer_play_sample(atarilocals.channel, (signed char *)sineWave, sizeof(sineWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
        else
            mixer_play_sample(atarilocals.channel, (signed char *)sawtoothWave, sizeof(sawtoothWave),
                              2 * ATARI_SNDFREQ / (16-atarilocals.frequency) * (1 << atarilocals.octave), 1);
    }
}
Exemple #2
0
static int st300_sh_start(const struct MachineSound *msound)  {
  int mixing_levels[3] = {30,30,30};
  int i;
  int s = 0;

  memset(&st300loc, 0, sizeof(st300loc));
  for (i = 0;i < 9;i++) {
    snddatst300.ax[i] = 0;
    snddatst300.axb[i] = 0;
    snddatst300.c0 = 0;
  }
  for (i = 0;i < 32000;i++) {
    s =  (s ? 0 : 1);
    if (s) {
      sineWaveext[i] = rand();
    } else
      sineWaveext[i] = 0-rand();
  }
  st300loc.channel = mixer_allocate_channels(3, mixing_levels);
  mixer_set_name  (st300loc.channel, "MC6840 #Q2");   // 6840 Output timer 2 (q2) is easy wave + volume from q3
  mixer_set_volume(st300loc.channel,0);
  mixer_set_name  (st300loc.channel+1, "MC6840 #Q1");  // 6840 Output timer 1 (q1) is easy wave + volume always 100
  mixer_set_volume(st300loc.channel+1,70*ST300_VOL);
  mixer_set_name  (st300loc.channel+2, "EXT TIM");   // External Timer (U10) is Noise geneartor + volume from q3
  mixer_set_volume(st300loc.channel+2,0);
  timer_pulse(TIME_IN_HZ(ST300_INTCLOCK),0x02,st300_pulse); // start internal clock
  return 0;
}
Exemple #3
0
int rockola_sh_start(const struct MachineSound *msound)
{
	int vol[3];

	Machine->samples = readsamples(vanguard_sample_names,Machine->gamedrv->name);

	vol[0] = vol[1] = vol[2] = TONE_VOLUME;
	tonechannels = mixer_allocate_channels(3,vol);
	vol[0] = vol[1] = vol[2] = SAMPLE_VOLUME;
	samplechannels = mixer_allocate_channels(3,vol);

	NoSound0=1;
	Sound0Offset=0;
	Sound0Base=0x0000;
	NoSound1=1;
	Sound1Offset=0;
	Sound1Base=0x0800;
	NoSound2=1;
	Sound2Offset=0;
	Sound2Base=0x1000;

	mixer_set_volume(tonechannels+0,0);
	mixer_play_sample(tonechannels+0,(signed char*)waveform,32,1000,1);
	mixer_set_volume(tonechannels+1,0);
	mixer_play_sample(tonechannels+1,(signed char*)waveform,32,1000,1);
	mixer_set_volume(tonechannels+2,0);
	mixer_play_sample(tonechannels+2,(signed char*)waveform,32,1000,1);

	return 0;
}
Exemple #4
0
static void gpsm_init(struct sndbrdData *brdData)
{
  	int mixing_levels[4] = {25,25,25,25};
	int i;
  	int s = 0;
  	memset(&gps_locals, 0x00, sizeof(gps_locals));
	gps_locals.brdData = *brdData;
  	for (i = 0;i < 32000;i++) {
    		s =  (s ? 0 : 1);
    		if (s) {
      			sineWaveext[i] = rand();
    		} else
      			sineWaveext[i] = 0-rand();
  	}
	pia_config(GPS_PIA0, PIA_STANDARD_ORDERING, &gps_pia[0]);
	pia_config(GPS_PIA1, PIA_STANDARD_ORDERING, &gps_pia[1]);
	gps_locals.channel = mixer_allocate_channels(4, mixing_levels);
  	mixer_set_name  (gps_locals.channel, "MC6840 #Q1");   // 6840 Output timer 1 (q1) is easy wave
  	mixer_set_volume(gps_locals.channel,0); 
  	mixer_set_name  (gps_locals.channel+1,"MC6840 #Q2");  // 6840 Output timer 2 (q2) is easy wave
  	mixer_set_volume(gps_locals.channel+1,0);  
  	mixer_set_name  (gps_locals.channel+2,"MC6840 #Q3");  // 6840 Output timer 3 (q3) is easy wave
  	mixer_set_volume(gps_locals.channel+2,0);  
  	mixer_set_name  (gps_locals.channel+3,"Noise");  // Noise generator
  	mixer_set_volume(gps_locals.channel+3,0);  
   	mixer_play_sample_16(gps_locals.channel+3,sineWaveext, sizeof(sineWaveext), 625000 , 1);
        gps_locals.stateca1 = 0;
        timer_set(TIME_IN_NSEC(814000000),0,oneshoot); // fire ca1 only once
//
// this time should run to emulate the 6840 correctly, but it is not needed for gampelan games i think
// because the sound rum never reads back the decreased values from the m6840
//
//        timer_pulse(TIME_IN_HZ(MSU1_INTCLOCK),0x02,m6840_pulse); // start internal clock 6840
//
}
Exemple #5
0
static void playsam3(int param) {
// timer q3 from 6840 is used for volume controll
   if ((st300loc.cr3 & 0x80) && (st300loc.timlat3 > 0) && (st300loc.reset == 0))   { // output is enabled...
	startvol(0);
	if (setvol(0) == 0) {
		logerror("playsam Q2/Q3noise volume off \n");
	}
	if (setvol(0) == 100) {
		logerror("playsam Q2/Q3noise volume maximum\n");
	}

	mixer_set_volume(st300loc.channel,setvol(0)*ST300_VOL);
	mixer_set_volume(st300loc.channel+2,setvol(0)*ST300_VOL);
    } else {	// q3 is not running...
	startvol(0);
	if (setvol(0) == 0) {
		logerror("playsam Q2/EXT noise volume off \n");
	}
	if (setvol(0) == 100) {
		logerror("playsam q2/EXT noise volume maximum\n");
	}

	mixer_set_volume(st300loc.channel,setvol(0)*ST300_VOL);
	mixer_set_volume(st300loc.channel+2,setvol(0)*ST300_VOL);
    }
}
Exemple #6
0
static void st300_pulse (int param) {
// param = 0x02 -> internal 6840 clock
// param = 0 -> external 4049 clock
// timpX is the output level of the 6840 (only 0 or 1)
// decrase timers and update interface
// missig is external clock for the 6840 timers
  if (((st300loc.cr1 & 0x02) == param) && (st300loc.cr1 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer1 > 0) {
        	snddatst300.timer1--;
  	}
  	if ((snddatst300.timer1 == 0) && (st300loc.timlat1 != 0)) {
    		snddatst300.timer1 = st300loc.timlat1;
    		if (st300loc.timlat1 != st300loc.timlats1) {
    			playsam1(0);
    		}
    		st300loc.timlats1 = st300loc.timlat1;
    		st300loc.timp1 =  (st300loc.timp1 ? 0 : 1);
    	}
  }
  if (((st300loc.cr2 & 0x02) == param) && (st300loc.cr2 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer2 > 0) {
        	snddatst300.timer2--;
  	}
  	if ((snddatst300.timer2 == 0) && (st300loc.timlat2 != 0)) {
    		snddatst300.timer2 = st300loc.timlat2;
    		if (st300loc.timlat2 != st300loc.timlats2) {
    			playsam2(0);
    		}
    		st300loc.timlats2 = st300loc.timlat2;
    		st300loc.timp2 =  (st300loc.timp2 ? 0 : 1);

    	}
  }

  if (((st300loc.cr3 & 0x02) == param) && (st300loc.cr3 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer3 > 0) {
        	snddatst300.timer3--;
  	}
  	if ((snddatst300.timer3 == 0) && (st300loc.timlat3 != 0)) {
    		snddatst300.timer3 = st300loc.timlat3;
    		st300loc.timp3 =  (st300loc.timp3 ? 0 : 1);
		if (st300loc.timp3) {
			nextvol(0);

			if (setvol(0) == 0) {
				logerror("playsam Q2/EXT noise volume off \n");
			}
			if (setvol(0) == 100) {
				logerror("playsam Q2/EXT noise volume maximum\n");
			}

			mixer_set_volume(st300loc.channel,setvol(0)*ST300_VOL);
			mixer_set_volume(st300loc.channel+2,setvol(0)*ST300_VOL);
    		}
    	}
  }

}
Exemple #7
0
static WRITE_HANDLER(pia0a_w)
{
// pia0 a channels full emulated
	int indexq1,indexq2;
	logerror("pia0a_w: %02x\n", data);
	indexq1 = data  & 0x0f;
	indexq2 = (data  & 0xf0) >> 4;
  	mixer_set_volume(gps_locals.channel,volumemsu1[indexq1]); 	// Q1
  	mixer_set_volume(gps_locals.channel+1,volumemsu1[indexq2]);  	// q2
}
Exemple #8
0
static WRITE_HANDLER(pia1a_w)
{
// pia1 a channels 0 - 3 emulated
	int indexq3,indexn;
	logerror("pia1a_w: %02x\n", data);
	indexq3 = data  & 0x0f;
	indexn = (data  & 0xf0) >> 4;
  	mixer_set_volume(gps_locals.channel+2,volumemsu1[indexq3]);       // q3
// pia a channels 4 - 7 seems to be volume of the noise generator
  	mixer_set_volume(gps_locals.channel+3,volumemsu1[indexn]);       // noise
}
Exemple #9
0
int meadows_sh_start(const struct MachineSound *msound)
{
	int vol[2];

	vol[0]=vol[1]=255;
	channel = mixer_allocate_channels(2,vol);
	mixer_set_volume(channel,0);
	mixer_play_sample(channel,waveform,sizeof(waveform),freq1,1);
	mixer_set_volume(channel+1,0);
	mixer_play_sample(channel+1,waveform,sizeof(waveform),freq2,1);
    return 0;
}
Exemple #10
0
void rockola_sh_update(void)
{
	static int count;


	/* only update every second call (30 Hz update) */
	count++;
	if (count & 1) return;


	/* play musical tones according to tunes stored in ROM */

	if (!NoSound0)
	{
 		if (memory_region(REGION_SOUND1)[Sound0Base+Sound0Offset]!=0xff)
		{
 			mixer_set_sample_frequency(tonechannels+0,(32000 / (256-memory_region(REGION_SOUND1)[Sound0Base+Sound0Offset])) * 16);
 			mixer_set_volume(tonechannels+0,100);
		}
		else
			mixer_set_volume(tonechannels+0,0);
		Sound0Offset = (Sound0Offset + 1) & Sound0Mask;
		if (Sound0Offset == 0 && Sound0StopOnRollover)
			NoSound0 = 1;
	}
	else
		mixer_set_volume(tonechannels+0,0);

	if (!NoSound1)
	{
		if (memory_region(REGION_SOUND1)[Sound1Base+Sound1Offset]!=0xff)
		{
			mixer_set_sample_frequency(tonechannels+1,(32000 / (256-memory_region(REGION_SOUND1)[Sound1Base+Sound1Offset])) * 16);
			mixer_set_volume(tonechannels+1,100);
		}
		else
			mixer_set_volume(tonechannels+1,0);
		Sound1Offset = (Sound1Offset + 1) & Sound1Mask;
	}
	else
		mixer_set_volume(tonechannels+1,0);

	if (!NoSound2)
	{
		if (memory_region(REGION_SOUND1)[Sound2Base+Sound2Offset]!=0xff)
		{
			mixer_set_sample_frequency(tonechannels+2,(32000 / (256-memory_region(REGION_SOUND1)[Sound2Base+Sound2Offset])) * 16);
			mixer_set_volume(tonechannels+2,100);
		}
		else
			mixer_set_volume(tonechannels+2,0);
		Sound2Offset = (Sound2Offset + 1) & Sound2Mask;
	}
	else
		mixer_set_volume(tonechannels+2,0);
}
Exemple #11
0
int senjyo_sh_start(const struct MachineSound *msound)
{
    int i;


	channel = mixer_allocate_channel(15);
	mixer_set_name(channel,"Tone");

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

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

	if ((_single = (signed char *)malloc(SINGLE_LENGTH)) == 0)
	{
		free(_single);
		return 1;
	}
	for (i = 0;i < SINGLE_LENGTH;i++)		/* freq = ctc2 zco / 8 */
		_single[i] = ((i/SINGLE_DIVIDER)&0x01)*127;

	/* CTC2 single tone generator */
	mixer_set_volume(channel,0);
	mixer_play_sample(channel,_single,SINGLE_LENGTH,single_rate,1);

	return 0;
}
Exemple #12
0
static WRITE_HANDLER(play1s_data_w) {
  static UINT8 oldData;
  static int timer_on;
  if (data & 0x0f) {
    if (oldData != data) sndlocals.volume = 100;
    oldData = data;
    discrete_sound_w(8, data & 0x01);
    discrete_sound_w(4, data & 0x02);
    discrete_sound_w(2, data & 0x04);
    discrete_sound_w(1, data & 0x08);
    if (~data & 0x10) { // start fading
      timer_adjust(sndlocals.timer, 0.02, 0, 0.02);
      timer_on = 1;
    } else { // no fading used
      timer_adjust(sndlocals.timer, TIME_NEVER, 0, 0);
      timer_on = 0;
      mixer_set_volume(0, sndlocals.volume);
    }
  } else if (!timer_on) { // no fading going on, so stop sound
    discrete_sound_w(8, 0);
    discrete_sound_w(4, 0);
    discrete_sound_w(2, 0);
    discrete_sound_w(1, 0);
  }
}
Exemple #13
0
int rockola_sh_start(const struct MachineSound *msound)
{
	int vol[CHANNELS];
	int i, offs = 0;

	// allocate tone channels

	for (i = 0; i < CHANNELS; i++)
		vol[i] = TONE_VOLUME;

	tonechannels = mixer_allocate_channels(CHANNELS, vol);

	// allocate sample channels

	for (i = 0; i < CHANNELS; i++)
		vol[i] = SAMPLE_VOLUME;

	samplechannels = mixer_allocate_channels(CHANNELS, vol);

	// clear tone channels

	for (i = 0; i < CHANNELS; i++)
	{
		SoundMute[i] = 1;
		SoundOffset[i] = 0;
		SoundBase[i] = offs;

		offs += 0x800;

		mixer_set_volume(tonechannels + i, 0);
		mixer_play_sample(tonechannels + i, (signed char *)waveform, 32, 1000, 1);
	}

	return 0;
}
/**
 * Recalculates the new volume after a property was changed.
 */
static void
replay_gain_filter_update(struct replay_gain_filter *filter)
{
	if (filter->mode != REPLAY_GAIN_OFF) {
		const struct replay_gain_tuple *tuple =
			&filter->info.tuples[filter->mode];
		float scale = replay_gain_tuple_defined(tuple)
			? replay_gain_tuple_scale(tuple, replay_gain_preamp)
			: replay_gain_missing_preamp;
		g_debug("scale=%f\n", (double)scale);

		filter->volume = pcm_float_to_volume(scale);
	} else
		filter->volume = PCM_VOLUME_1;

	if (filter->mixer != NULL) {
		/* update the hardware mixer volume */

		unsigned volume = (filter->volume * filter->base) / PCM_VOLUME_1;
		if (volume > 100)
			volume = 100;

		GError *error = NULL;
		if (!mixer_set_volume(filter->mixer, volume, &error)) {
			g_warning("Failed to update hardware mixer: %s",
				  error->message);
			g_error_free(error);
		}
	}
}
Exemple #15
0
static void play2s_timer_callback(int n) {
  if (sndlocals.volume) {
    mixer_set_volume(sndlocals.channel, (--sndlocals.volume));
    if (!sndlocals.volume) {
      timer_adjust(sndlocals.timer, TIME_NEVER, 0, 0);
      mixer_stop_sample(sndlocals.channel);
    }
  }
}
Exemple #16
0
void AY8910_set_volume(int chip,int channel,int volume)
{
	struct AY8910 *PSG = &AYPSG[chip];
	int ch;

	for (ch = 0; ch < 3; ch++)
		if (channel == ch || channel == ALL_8910_CHANNELS)
			mixer_set_volume(PSG->Channel + ch, volume);
}
Exemple #17
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)
	{
		mixer_set_volume(tone_channel,0);
    }
    else
	{
		mixer_set_sample_frequency(tone_channel,maxfreq/(0xFF-sound_a_freq));
		mixer_set_volume(tone_channel,tone_active*100);
	}
}
Exemple #18
0
void play_channel2(int data)
{
	if (data) {
		freq2 = 2457600 / 16 / data / 8;
		mixer_set_volume(channellfo+1, channel_playing2 * 100);
		mixer_play_sample_16(channellfo+1, backgroundwave, sizeof(backgroundwave), sizeof(backgroundwave)*freq2,1);
	}
	else {
		polyplay_sh_stop();
	}
}
Exemple #19
0
int polyplay_sh_start(const struct MachineSound *msound)
{
	int i;

	for (i = 0; i < SAMPLE_LENGTH / 2; i++) {
		backgroundwave[i] = + SAMPLE_AMPLITUDE;
	}
	for (i = SAMPLE_LENGTH / 2; i < SAMPLE_LENGTH; i++) {
		backgroundwave[i] = - SAMPLE_AMPLITUDE;
	}
	freq1 = freq2 = 110;
	channellfo = mixer_allocate_channels(2,lfovol);
	mixer_set_name(channellfo+0,"Polyplay #0");
	mixer_set_name(channellfo+1,"Polyplay #1");
	mixer_set_volume(channellfo+0,0);
	mixer_set_volume(channellfo+1,0);

	channel_playing1 = 0;
	channel_playing2 = 0;
	return 0;
}
Exemple #20
0
void sample_set_volume(int channel,int volume)
{
    if (Machine->sample_rate == 0) return;
    if (Machine->samples == 0) return;
    if (channel >= numchannels)
    {
        logerror("error: sample_adjust() called with channel = %d, but only %d channels allocated\n",channel,numchannels);
        return;
    }

    mixer_set_volume(channel + firstchannel,volume * 100 / 255);
}
Exemple #21
0
int targ_sh_start(const struct MachineSound *msound)
{
	tone_channel = mixer_allocate_channel(50);

	tone_pointer=0;
	tone_offset=0;
	tone_active=0;
	sound_a_freq = 0x00;
	mixer_set_volume(tone_channel,0);
	mixer_play_sample(tone_channel,(signed char*)waveform1,32,1000,1);
	return 0;
}
Exemple #22
0
static WRITE_HANDLER(play2s_ctrl_w) {
  if (!sndlocals.enSn && (data & 1)) { // sound on to full volume
    timer_adjust(sndlocals.timer, TIME_NEVER, 0, 0);
    if (!mixer_is_sample_playing(sndlocals.channel)) {
      mixer_play_sample(sndlocals.channel, (signed char *)squareWave, sizeof(squareWave), 2950000.0 / 4 / (sndlocals.freq + 1), 1);
    }
    sndlocals.volume = 100;
    mixer_set_volume(sndlocals.channel, sndlocals.volume);
  } else if (!(data & 1) && sndlocals.enSn) { // start fading
    timer_adjust(sndlocals.timer, TIME_IN_HZ(120), 0, TIME_IN_HZ(120));
  }
  sndlocals.enSn = data & 1;
}
Exemple #23
0
void sample_set_volume(int channel,int volume)
{
// GN //	if (Machine->sample_rate == 0) return;
	if (g_Samplerate == 0) return;
//	if (Machine->samples == 0) return; // GN: this was not working for mspac, which does not have any "samples"
	if (channel >= numchannels)
	{
		if (errorlog) fprintf(errorlog,"error: sample_adjust() called with channel = %d, but only %d channels allocated\n",channel,numchannels);
		return;
	}

	mixer_set_volume(channel + firstchannel,volume * 100 / 255);
}
Exemple #24
0
void AY8910_set_volume(int chip,int channel,int volume)
{
	struct AY8910 *PSG = &AYPSG[chip];
	int ch;

	for (ch = 0; ch < 3; ch++)
		if (channel == ch || channel == ALL_8910_CHANNELS)
#ifdef SINGLE_CHANNEL_MIXER
			PSG->mix_vol[ch] = volume;
#else
			mixer_set_volume(PSG->Channel + ch, volume);
#endif
}
Exemple #25
0
void rockola_sh_update(void)
{
	static int count;
	int i;

	// only update every second call (30 Hz update)

	count++;
	if (count & 1) return;

	// play musical tones according to tunes stored in ROM

	for (i = 0; i < CHANNELS; i++)
	{
		if (!SoundMute[i])
		{
			if (memory_region(REGION_SOUND1)[SoundBase[i] + SoundOffset[i]] != 0xff)
			{
				mixer_set_sample_frequency(tonechannels + i, (32000 / (256 - memory_region(REGION_SOUND1)[SoundBase[i] + SoundOffset[i]])) * 16);
				mixer_set_volume(tonechannels + i, SoundVolume);
			}
			else
			{
				mixer_set_volume(tonechannels + i, 0);
			}
			SoundOffset[i] = (SoundOffset[i] + 1) & SoundMask[i];
		}
		else
		{
			mixer_set_volume(tonechannels + i, 0);
		}
	}

	if (SoundOffset[0] == 0 && Sound0StopOnRollover)
	{
		SoundMute[0] = 1;
	}
}
Exemple #26
0
int player_set_vol(int l, int lf, int r, int rf)
{
	int rc = OP_ERROR_SUCCESS;
	if (soft_vol) {
		l = calc_vol(l, soft_vol_l, 100, lf);
		r = calc_vol(r, soft_vol_r, 100, rf);
		player_set_soft_volume(l, r);
	} else {
		mixer_read_volume();
		l = calc_vol(l, volume_l, volume_max, lf);
		r = calc_vol(r, volume_r, volume_max, rf);
		rc = mixer_set_volume(l, r);
		mixer_read_volume();
	}
	return rc;
}
Exemple #27
0
void votrax_w(int data)
{
	int Phoneme,Intonation;

    Phoneme = data & 0x3F;
    Intonation = data >> 6;

  	if(errorlog) fprintf(errorlog,"Speech : %s at intonation %d\n",VotraxTable[Phoneme],Intonation);

    if(Phoneme==63)
   		mixer_stop_sample(VotraxChannel);

    if(VotraxSamples->sample[Phoneme])
	{
		mixer_set_volume(VotraxChannel,VotraxBaseVolume+(8*Intonation)*100/255);
		mixer_play_sample(VotraxChannel,VotraxSamples->sample[Phoneme]->data,
				  VotraxSamples->sample[Phoneme]->length,
				  VotraxBaseFrequency+(256*Intonation),
				  0);
	}
}
Exemple #28
0
static void changefr (int param) {
// emulationg the 556
  if (freqarb5 [st100loc.freqb5] < 9999)  {
	st100loc.freqb5++;
    	logerror("setfreq5 %i\n", freqarb5 [st100loc.freqb5] );
	}
  if (freqarb5 [st100loc.freqb5] < 9999)  {
	mixer_set_sample_frequency(st100loc.channel+4,freqarb5 [st100loc.freqb5] * sizeof(s100Waveb5));
	}
// emulationg the two lm324
  if (freqarb6 [st100loc.freqb6] < 9999)  {
	st100loc.freqb6++;
    	logerror("setfreq6 %i\n", freqarb6 [st100loc.freqb6] );
	}
  if (freqarb6 [st100loc.freqb6] < 9999)  {
	mixer_set_sample_frequency(st100loc.channel+5,freqarb6 [st100loc.freqb6] * sizeof(s100Waveb6));
	} else {
     	logerror("stopsample 6 \n");
   	mixer_set_volume(st100loc.channel+5,0);	   // bit 5
  }

}
Exemple #29
0
void meadows_sh_update(void)
{
static  unsigned char latched_0c01 = 0;
static	unsigned char latched_0c02 = 0;
static	unsigned char latched_0c03 = 0;
int preset, amp;

    if (latched_0c01 != meadows_0c01 || latched_0c03 != meadows_0c03)
	{
		/* amplitude is a combination of the upper 4 bits of 0c01 */
		/* and bit 4 merged from S2650's flag output */
		amp = ((meadows_0c03 & ENABLE_CTR1) == 0) ? 0 : (meadows_0c01 & 0xf0) >> 1;
		if( s2650_get_flag() )
			amp += 0x80;
		/* calculate frequency for counter #1 */
		/* bit 0..3 of 0c01 are ctr preset */
		preset = (meadows_0c01 & 15) ^ 15;
		if (preset)
			freq1 = BASE_CTR1 / (preset + 1);
		else amp = 0;
		//logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", channel, preset, freq1, amp);
		mixer_set_sample_frequency(channel, freq1 * sizeof(waveform));
		mixer_set_volume(channel,amp*100/255);
    }
Exemple #30
0
static int st100_sh_start(const struct MachineSound *msound)  {
  int mixing_levels[6] = {25,25,25,25,25,25};
  memset(&st100loc, 0, sizeof(st100loc));
  st100loc.channel = mixer_allocate_channels(6, mixing_levels);
  mixer_set_volume(st100loc.channel,0);	   // bit 1
  mixer_set_volume(st100loc.channel+1,0);  // bit 2
  mixer_set_volume(st100loc.channel+2,0);  // bit 3
  mixer_set_volume(st100loc.channel+3,0);  // bit 4
  mixer_set_volume(st100loc.channel+4,0);  // bit 5
  mixer_set_volume(st100loc.channel+5,0);  // bit 6
  mixer_play_sample_16(st100loc.channel,s100Waveb1, sizeof(s100Waveb1), ST100_FREQ1*sizeof(s100Waveb1), 1);
  mixer_play_sample_16(st100loc.channel+1,s100Waveb1, sizeof(s100Waveb1), ST100_FREQ2*sizeof(s100Waveb1), 1);
  mixer_play_sample_16(st100loc.channel+2,s100Waveb1, sizeof(s100Waveb1), ST100_FREQ3*sizeof(s100Waveb1), 1);
  mixer_play_sample_16(st100loc.channel+3,s100Waveb1, sizeof(s100Waveb1), ST100_FREQ4*sizeof(s100Waveb1), 1);
  st100loc.freqb5 = 0;
  mixer_play_sample_16(st100loc.channel+4,s100Waveb5, sizeof(s100Waveb5), (freqarb5[st100loc.freqb5])*sizeof(s100Waveb5), 1);
  st100loc.freqb6 = 0;
  mixer_play_sample_16(st100loc.channel+5,s100Waveb6, sizeof(s100Waveb6), (freqarb6[st100loc.freqb6])*sizeof(s100Waveb6), 1);
  timer_pulse(TIME_IN_SEC(0.02),0,changefr);
  return 0;
}