static int atari_sh_start(const struct MachineSound *msound) { if (Machine->gamedrv->flags & GAME_NO_SOUND) return -1; atarilocals.channel = mixer_allocate_channel(50); atarilocals.noisechannel = mixer_allocate_channel(25); return 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; }
int stream_init(const char *name,int default_mixing_level, int sample_rate, int param,void (*callback)(int param,INT16 *buffer,int length)) { int channel; channel = mixer_allocate_channel(default_mixing_level); stream_joined_channels[channel] = 1; mixer_set_name(channel,name); if ((stream_buffer[channel] = osd_malloc(sizeof(INT16)*BUFFER_LEN)) == 0) return -1; stream_sample_rate[channel] = sample_rate; stream_buffer_pos[channel] = 0; if (sample_rate) stream_sample_length[channel] = 1000000 / sample_rate; else stream_sample_length[channel] = 0; stream_param[channel] = param; stream_callback[channel] = callback; set_RC_filter(channel,0,0,0,0); return channel; }
int namco_52xx_sh_start(const struct MachineSound *msound) { int i; unsigned char bits; intf = msound->sound_interface; rom = memory_region(intf->region); rom_len = memory_region_length(intf->region); channel = mixer_allocate_channel(intf->mixing_level); mixer_set_name(channel,sound_name(msound)); samples = auto_malloc(2*rom_len); if (!samples) return 1; /* decode the rom samples */ for (i = 0;i < rom_len;i++) { bits = rom[i] & 0x0f; samples[2*i] = SAMPLE_CONV4(bits); bits = (rom[i] & 0xf0) >> 4; samples[2*i + 1] = SAMPLE_CONV4(bits); } return 0; }
MACHINE_DRIVER_END static int play2s_start(const struct MachineSound *msound) { if (Machine->gamedrv->flags & GAME_NO_SOUND) { return -1; } sndlocals.channel = mixer_allocate_channel(15); return 0; }
int pbillian_sh_start(const struct MachineSound *msound) { int i; unsigned char *ROM = memory_region(REGION_SOUND1); channel = mixer_allocate_channel(50); mixer_set_name(channel,"Samples"); samplebuf = auto_malloc(memory_region_length(REGION_SOUND1)); for(i=0;i<memory_region_length(REGION_SOUND1);i++)samplebuf[i]=ROM[i]-0x80; return 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; }
int cclimber_sh_start(const struct MachineSound *msound) { channel = mixer_allocate_channel(50); mixer_set_name(channel,"Samples"); samplebuf = 0; if (memory_region(REGION_SOUND1)) { samplebuf = malloc(2*memory_region_length(REGION_SOUND1)); if (!samplebuf) return 1; } return 0; }
int tia_sh_start(const struct MachineSound *msound) { // int i, res; intf = msound->sound_interface; if (Machine->sample_rate == 0) return 0; sample_pos = 0; channel = mixer_allocate_channel(intf->volume); if ((buffer = malloc(sizeof(INT16) * BUFFER_LEN)) == 0) return 1; memset(buffer,0,sizeof(INT16) * BUFFER_LEN); Tia_sound_init (intf->clock, Machine->sample_rate); return 0; }
int TMS3617_sh_start(const struct MachineSound *msound) { int voice; struct TMS3617_interface *intf = &monsterb_intf; buffer_len = intf->samplerate / Machine->drv->frames_per_second; emulation_rate = buffer_len * Machine->drv->frames_per_second; channel = mixer_allocate_channel(intf->volume); if ((output_buffer = malloc(buffer_len)) == 0) return 1; if ((mixer_buffer = malloc(sizeof(short) * buffer_len)) == 0) { free (output_buffer); return 1; } if (make_mixer_table (intf->gain)) { free (mixer_buffer); free (output_buffer); return 1; } sample_pos = 0; TMS3617_pitch = 0; interface = intf; for (voice = 0;voice < NUM_VOICES;voice++) { counter[voice] = 0; voice_enable[voice] = 1; } return 0; }
int bosco_sh_start(const struct MachineSound *msound) { int i; unsigned char bits; channel = mixer_allocate_channel(25); mixer_set_name(channel,"Samples"); speech = auto_malloc(2*memory_region_length(REGION_SOUND2)); if (!speech) return 1; /* decode the rom samples */ for (i = 0;i < memory_region_length(REGION_SOUND2);i++) { bits = memory_region(REGION_SOUND2)[i] & 0x0f; speech[2*i] = SAMPLE_CONV4(bits); bits = (memory_region(REGION_SOUND2)[i] & 0xf0) >> 4; speech[2*i + 1] = SAMPLE_CONV4(bits); } return 0; }
int llander_sh_start(const struct MachineSound *msound) { int loop,lfsrtmp,nor1,nor2,bit14,bit6; long fraction,remainder; /* Dont initialise if no sound system */ if (Machine->sample_rate == 0) return 0; /* Initialise the simple vars */ volume=0; tone_3khz=0; tone_6khz=0; llander_explosion=0; buffer_len = Machine->sample_rate / Machine->drv->frames_per_second; emulation_rate = buffer_len * Machine->drv->frames_per_second; sample_pos = 0; /* Calculate the multipler to convert output sample number to the oversample rate (768khz) number */ /* multipler is held as a fixed point number 16:16 */ multiplier=LANDER_OVERSAMPLE_RATE/(long)emulation_rate; remainder=multiplier*LANDER_OVERSAMPLE_RATE; fraction=remainder<<16; fraction/=emulation_rate; multiplier=(multiplier<<16)+fraction; // if (errorlog) fprintf (errorlog, "LANDER: Multiplier=%lx remainder=%lx fraction=%lx rate=%x\n",multiplier,remainder,fraction,emulation_rate); /* Generate the LFSR lookup table for the lander white noise generator */ lfsr_index=0; if ((lfsr_buffer = malloc(65536*2)) == 0) return 1; for(loop=0;loop<65536;loop++) { /* Calc next LFSR value from current value */ lfsrtmp=(short)loop<<1; bit14=(loop&0x04000)?1:0; bit6=(loop&0x0040)?1:0; nor1=(!( bit14 && bit6 ) )?0:1; /* Note the inversion for the NOR gate */ nor2=(!(!bit14 && !bit6 ) )?0:1; lfsrtmp|=nor1|nor2; lfsr_buffer[loop]=lfsrtmp; // if (errorlog) fprintf (errorlog, "LFSR Buffer: %04x Next=%04x\n",loop, lfsr_buffer[loop]); } /* Allocate channel and buffer */ channel = mixer_allocate_channel(25); if ((sample_buffer = malloc(sizeof(INT16)*buffer_len)) == 0) return 1; memset(sample_buffer,0,sizeof(INT16)*buffer_len); return 0; }