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; }
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; }
int stream_init_multi(int channels,const char **names,const int *default_mixing_levels, int sample_rate, int param,void (*callback)(int param,INT16 **buffer,int length)) { int channel,i; channel = mixer_allocate_channels(channels,default_mixing_levels); stream_joined_channels[channel] = channels; for (i = 0;i < channels;i++) { mixer_set_name(channel+i,names[i]); if ((stream_buffer[channel+i] = osd_malloc(sizeof(INT16)*BUFFER_LEN)) == 0) return -1; stream_sample_rate[channel+i] = sample_rate; stream_buffer_pos[channel+i] = 0; if (sample_rate) stream_sample_length[channel+i] = 1000000 / sample_rate; else stream_sample_length[channel+i] = 0; } stream_param[channel] = param; stream_callback_multi[channel] = callback; set_RC_filter(channel,0,0,0,0); return channel; }
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; }
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 // }
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; }
int seta_sh_start(const struct MachineSound *msound) { int i; int mix_lev[SETA_NUM_CHANNELS]; for (i = 0; i < SETA_NUM_CHANNELS; i++) mix_lev[i] = (100 * 2) / SETA_NUM_CHANNELS + 1; firstchannel = mixer_allocate_channels(SETA_NUM_CHANNELS,mix_lev); for (i = 0; i < SETA_NUM_CHANNELS; i++) { char buf[40]; sprintf(buf,"X1-010 Channel #%d",i); mixer_set_name(firstchannel + i,buf); } return 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; }
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; }
int samples_sh_start(const struct MachineSound *msound) { int i; int vol[MIXER_MAX_CHANNELS]; const struct Samplesinterface *intf = msound->sound_interface; /* read audio samples if available */ Machine->samples = readsamples(intf->samplenames,Machine->gamedrv->name); numchannels = intf->channels; for (i = 0; i < numchannels; i++) vol[i] = intf->volume; firstchannel = mixer_allocate_channels(numchannels,vol); for (i = 0; i < numchannels; i++) { char buf[40]; sprintf(buf,"Sample #%d",i); mixer_set_name(firstchannel + i,buf); } return 0; }
int mixer_allocate_channel(int default_mixing_level) { /* this is just a degenerate case of the multi-channel mixer allocate */ return mixer_allocate_channels(1, &default_mixing_level); }