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); }
static WRITE_HANDLER(sts_data_w) { if (data & 0x01) { mixer_set_volume(st100loc.channel,100); // bit 1 logerror("playsample 1 %i\n", data); } else { mixer_set_volume(st100loc.channel,0); // bit 1 } if (data & 0x02) { mixer_set_volume(st100loc.channel+1,100); // bit 2 logerror("playsample 2 %i\n", data); } else { mixer_set_volume(st100loc.channel+1,0); // bit 2 } if (data & 0x04) { mixer_set_volume(st100loc.channel+2,100); // bit 3 logerror("playsample 3 %i\n", data); } else { mixer_set_volume(st100loc.channel+2,0); // bit 3 } if (data & 0x08) { mixer_set_volume(st100loc.channel+3,100); // bit 4 logerror("playsample 4 %i\n", data); } else { mixer_set_volume(st100loc.channel+3,0); // bit 4 } if (data & 0x10) { st100loc.freqb5 = 0; mixer_set_sample_frequency(st100loc.channel+4,freqarb5 [st100loc.freqb5] * sizeof(s100Waveb5)); mixer_set_volume(st100loc.channel+4,100); // bit 4 logerror("playsample 5 %i\n", data); } else { logerror("stopsample 5 %i\n", data); mixer_set_volume(st100loc.channel+4,0); // bit 4 } if (data & 0x20) { st100loc.freqb6 = 0; mixer_set_sample_frequency(st100loc.channel+5,freqarb6 [st100loc.freqb6] * sizeof(s100Waveb6)); mixer_set_volume(st100loc.channel+5,100); // bit 5 logerror("playsample 6 %i\n", data); } else { // logerror("stopsample 6 %i\n", data); // mixer_set_volume(st100loc.channel+5,0); // bit 5 } logerror("snd_data_w: %i\n", data); }
static void playnoise(int param){ int f; f = (625000 / 23) / param; mixer_set_sample_frequency(gps_locals.channel+3, f ); logerror("*** playsam noise frequenz %08d data ***\n",f); logerror("*** playsam noise param %08d data ***\n",param); }
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); } } }
void sample_set_freq(int channel,int freq) { 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_sample_frequency(channel + firstchannel,freq); }
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); } } }
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 } }
void senjyo_sh_update(void) { float period; if (Machine->sample_rate == 0) return; /* ctc2 timer single tone generator frequency */ period = z80ctc_getperiod (0, 2); if( period != 0 ) single_rate = (int)(1.0 / period ); else single_rate = 0; mixer_set_sample_frequency(channel,single_rate); }
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); } }
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; } }
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); }
void polyplay_sh_update(void) { mixer_set_sample_frequency(channellfo+0, sizeof(backgroundwave)*freq1 ); mixer_set_sample_frequency(channellfo+1, sizeof(backgroundwave)*freq2 ); }
static WRITE_HANDLER(play2s_data_w) { sndlocals.freq = data; if (mixer_is_sample_playing(sndlocals.channel)) { mixer_set_sample_frequency(sndlocals.channel, 2950000.0 / 4 / (sndlocals.freq + 1)); } }