Esempio n. 1
0
static void playsam1(int param){
// timer 1 (q1) is easy wave 
   if ((gps_locals.cr1 & 0x80)  && (gps_locals.timlat1 > 0) && (gps_locals.reset == 0))   { // output is enabled...
  	mixer_play_sample_16(gps_locals.channel,sineWaveinp, sizeof(sineWaveinp), (int)(gps_locals.tfre1*sizeof(sineWaveinp) / 2 / 1.137), 1);
 	if (mixer_is_sample_playing(gps_locals.channel))	{	// is already playing
 		 mixer_set_sample_frequency(gps_locals.channel,(gps_locals.tfre1*sizeof(sineWaveinp) / 2) );
 	} else	{
	  	mixer_play_sample_16(gps_locals.channel,sineWaveinp, sizeof(sineWaveinp), gps_locals.tfre1*sizeof(sineWaveinp) / 2, 1);
		logerror("*** playsam Q1 start %04d ***\n",gps_locals.tfre1);
	}
	}
}
Esempio n. 2
0
static void playsam1(int param){
// timer 1 (q1) is easy wave + volume always 100
   if ((st300loc.cr1 & 0x80)  && (st300loc.timlat1 > 0) && (st300loc.reset == 0))   { // output is enabled...
 	mixer_play_sample_16(st300loc.channel+1,sineWaveinpq1, sizeof(sineWaveinpq1), st300loc.tfre1*sizeof(sineWaveinpq1) / 2 / 1.137, 1);
	logerror("*** playsam Q1 start %04d ***\n",st300loc.tfre1);
	}
}
Esempio n. 3
0
static void playsam2(int param){
// timer 2 (q2) is easy wave + volume from q3
   if ((st300loc.cr2 & 0x80)  && (st300loc.timlat2 > 0) && (st300loc.reset == 0))   { // output is enabled...
 	mixer_play_sample_16(st300loc.channel,sineWaveinp, sizeof(sineWaveinp), st300loc.tfre2*sizeof(sineWaveinp) / 2 / 1.137, 1);
	logerror("*** playsam Q2 start %04d ***\n",st300loc.tfre2);
	}
}
Esempio n. 4
0
/* mixer_play_sample() */
void sample_start(int channel,int samplenum,int loop)
{
    if (Machine->sample_rate == 0) return;
    if (Machine->samples == 0) return;
    if (Machine->samples->sample[samplenum] == 0) return;
    if (channel >= numchannels)
    {
        logerror("error: sample_start() called with channel = %d, but only %d channels allocated\n",channel,numchannels);
        return;
    }
    if (samplenum >= Machine->samples->total)
    {
        logerror("error: sample_start() called with samplenum = %d, but only %d samples available\n",samplenum,Machine->samples->total);
        return;
    }

    if ( Machine->samples->sample[samplenum]->resolution == 8 )
    {
        logerror("play 8 bit sample %d, channel %d\n",samplenum,channel);
        mixer_play_sample(firstchannel + channel,
                          Machine->samples->sample[samplenum]->data,
                          Machine->samples->sample[samplenum]->length,
                          Machine->samples->sample[samplenum]->smpfreq,
                          loop);
    }
    else
    {
        logerror("play 16 bit sample %d, channel %d\n",samplenum,channel);
        mixer_play_sample_16(firstchannel + channel,
                             (short *) Machine->samples->sample[samplenum]->data,
                             Machine->samples->sample[samplenum]->length,
                             Machine->samples->sample[samplenum]->smpfreq,
                             loop);
    }
}
Esempio n. 5
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
//
}
Esempio n. 6
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();
	}
}
Esempio n. 7
0
static void playsam3(int param){
// timer 3 (q3) is easy wave 
   if ((gps_locals.cr3 & 0x80)  && (gps_locals.timlat3 > 0) && (gps_locals.reset == 0))   { // output is enabled...
 	if (mixer_is_sample_playing(gps_locals.channel+2))	{	// is already playing
 		 mixer_set_sample_frequency(gps_locals.channel+2,(gps_locals.tfre3*sizeof(sineWaveinp) / 2) );
 	} else	{
	 	mixer_play_sample_16(gps_locals.channel+2,sineWaveinp, sizeof(sineWaveinp), gps_locals.tfre3*sizeof(sineWaveinp) / 2 , 1);
		logerror("*** playsam Q3 start %04d ***\n",gps_locals.tfre3);
	}
	}
}
Esempio n. 8
0
static void playsamext(int param){
// external timer + volume from q3
   int f;

//   f = (17-(st300loc.extfreq))*sizeof(sineWaveext);
// Noise is not 100 % accurate, there is a wav file availiable from the author (solenoid 22 - 29)
// formular for f not correct
   f = 625000 / (17-(st300loc.extfreq));

   if (st300loc.noise)   { // output is enabled...
 	mixer_play_sample_16(st300loc.channel+2,sineWaveext, sizeof(sineWaveext), f , 1);
	logerror("*** playsam EXT noise frequenz %08d data %04d ***\n",f,st300loc.extfreq);
        } else {
	mixer_stop_sample(st300loc.channel+2);
	logerror("playsam EXT noise stop \n");
   	}
}
Esempio n. 9
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;
}