mirror of
https://github.com/holub/mame
synced 2025-05-18 19:49:35 +03:00
From: Atari Ace [mailto:atari_ace@verizon.net]
Sent: Wednesday, December 17, 2008 9:03 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] STREAM_UPDATE update Hi mamedev, This patch modifies the parameters of the stream_update_func callback. The first two patches go through and changes all the callbacks to use a consistent set of parameters (the larger patch was mechanically generated, the smaller second patch are hand edits where review or compilation showed issues with the automatic conversion). The third patch then macroizes all the callbacks to STREAM_UPDATE, and was done mechanically except for the change to streams.h. The fourth patch then adds device to the callback, and eliminates Machine in a handful of callbacks by referencing the device. deprecat.h -= 8. ~aa
This commit is contained in:
parent
cf9fc58618
commit
785b6a50c6
@ -146,7 +146,7 @@ static TIMER_CALLBACK( perform_player_update );
|
||||
static void read_track_data(laserdisc_state *ld);
|
||||
static void process_track_data(const device_config *device);
|
||||
static CUSTOM_START( custom_start );
|
||||
static void custom_stream_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
static STREAM_UPDATE( custom_stream_callback );
|
||||
static void configuration_load(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
static void configuration_save(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
|
||||
@ -957,7 +957,7 @@ static CUSTOM_START( custom_start )
|
||||
for laserdiscs
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void custom_stream_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( custom_stream_callback )
|
||||
{
|
||||
sound_token *token = param;
|
||||
laserdisc_state *ld = token->ld;
|
||||
|
@ -118,7 +118,7 @@ static void sound_save(running_machine *machine, int config_type, xml_data_node
|
||||
static TIMER_CALLBACK( sound_update );
|
||||
static void start_sound_chips(running_machine *machine);
|
||||
static void route_sound(running_machine *machine);
|
||||
static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
|
||||
static STREAM_UPDATE( mixer_update );
|
||||
static STATE_POSTLOAD( mixer_postload );
|
||||
|
||||
|
||||
@ -770,16 +770,16 @@ static TIMER_CALLBACK( sound_update )
|
||||
mixer_update - mix all inputs to one output
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( mixer_update )
|
||||
{
|
||||
speaker_info *speaker = param;
|
||||
int numinputs = speaker->inputs;
|
||||
int pos;
|
||||
|
||||
VPRINTF(("Mixer_update(%d)\n", length));
|
||||
VPRINTF(("Mixer_update(%d)\n", samples));
|
||||
|
||||
/* loop over samples */
|
||||
for (pos = 0; pos < length; pos++)
|
||||
for (pos = 0; pos < samples; pos++)
|
||||
{
|
||||
INT32 sample = inputs[0][pos];
|
||||
int inp;
|
||||
@ -787,7 +787,7 @@ static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
/* add up all the inputs */
|
||||
for (inp = 1; inp < numinputs; inp++)
|
||||
sample += inputs[inp][pos];
|
||||
buffer[0][pos] = sample;
|
||||
outputs[0][pos] = sample;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,10 @@ struct ym2151_info
|
||||
};
|
||||
|
||||
|
||||
static void ym2151_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2151_update )
|
||||
{
|
||||
struct ym2151_info *info = param;
|
||||
ym2151_update_one(info->chip, buffers, length);
|
||||
ym2151_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,10 +91,10 @@ static void timer_handler(void *param,int c,int count,int clock)
|
||||
}
|
||||
}
|
||||
|
||||
static void ym2203_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( ym2203_stream_update )
|
||||
{
|
||||
struct ym2203_info *info = param;
|
||||
ym2203_update_one(info->chip, buffer[0], length);
|
||||
ym2203_update_one(info->chip, outputs[0], samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,10 +36,10 @@ void YM2413DAC_update(int chip,stream_sample_t **inputs, stream_sample_t **_buff
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ym2413_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2413_stream_update )
|
||||
{
|
||||
struct ym2413_info *info = param;
|
||||
ym2413_update_one(info->chip, buffers, length);
|
||||
ym2413_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
static void _stream_update(void *param, int interval)
|
||||
|
@ -104,10 +104,10 @@ void ym2608_update_request(void *param)
|
||||
stream_update(info->stream);
|
||||
}
|
||||
|
||||
static void ym2608_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2608_stream_update )
|
||||
{
|
||||
struct ym2608_info *info = param;
|
||||
ym2608_update_one(info->chip, buffers, length);
|
||||
ym2608_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,10 +106,10 @@ void ym2610_update_request(void *param)
|
||||
}
|
||||
|
||||
#if BUILD_YM2610
|
||||
static void ym2610_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2610_stream_update )
|
||||
{
|
||||
struct ym2610_info *info = param;
|
||||
ym2610_update_one(info->chip, buffers, length);
|
||||
ym2610_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
|
||||
@ -181,10 +181,10 @@ static SND_START( ym2610 )
|
||||
#endif
|
||||
|
||||
#if BUILD_YM2610B
|
||||
static void ym2610b_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2610b_stream_update )
|
||||
{
|
||||
struct ym2610_info *info = param;
|
||||
ym2610b_update_one(info->chip, buffers, length);
|
||||
ym2610b_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
static SND_START( ym2610b )
|
||||
|
@ -73,10 +73,10 @@ void ym2612_update_request(void *param)
|
||||
/* YM2612 */
|
||||
/***********************************************************/
|
||||
|
||||
static void ym2612_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ym2612_stream_update )
|
||||
{
|
||||
struct ym2612_info *info = param;
|
||||
ym2612_update_one(info->chip, buffers, length);
|
||||
ym2612_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,10 +54,10 @@ static void timer_handler_262(void *param,int timer, attotime period)
|
||||
}
|
||||
}
|
||||
|
||||
static void ymf262_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
|
||||
static STREAM_UPDATE( ymf262_stream_update )
|
||||
{
|
||||
struct ymf262_info *info = param;
|
||||
ymf262_update_one(info->chip, buffers, length);
|
||||
ymf262_update_one(info->chip, outputs, samples);
|
||||
}
|
||||
|
||||
static void _stream_update(void *param, int interval)
|
||||
|
@ -66,10 +66,10 @@ static void TimerHandler_3812(void *param,int c,attotime period)
|
||||
}
|
||||
|
||||
|
||||
static void ym3812_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( ym3812_stream_update )
|
||||
{
|
||||
struct ym3812_info *info = param;
|
||||
ym3812_update_one(info->chip, buffer[0], length);
|
||||
ym3812_update_one(info->chip, outputs[0], samples);
|
||||
}
|
||||
|
||||
static void _stream_update_3812(void * param, int interval)
|
||||
@ -237,10 +237,10 @@ static void TimerHandler_3526(void *param,int c,attotime period)
|
||||
}
|
||||
|
||||
|
||||
static void ym3526_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( ym3526_stream_update )
|
||||
{
|
||||
struct ym3526_info *info = param;
|
||||
ym3526_update_one(info->chip, buffer[0], length);
|
||||
ym3526_update_one(info->chip, outputs[0], samples);
|
||||
}
|
||||
|
||||
static void _stream_update_3526(void *param, int interval)
|
||||
@ -442,10 +442,10 @@ static void Y8950KeyboardHandler_w(void *param,unsigned char data)
|
||||
info->intf->keyboardwrite(space,info->index,data);
|
||||
}
|
||||
|
||||
static void y8950_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( y8950_stream_update )
|
||||
{
|
||||
struct y8950_info *info = param;
|
||||
y8950_update_one(info->chip, buffer[0], length);
|
||||
y8950_update_one(info->chip, outputs[0], samples);
|
||||
}
|
||||
|
||||
static void _stream_update_8950(void *param, int interval)
|
||||
|
@ -33,7 +33,7 @@ struct tms5110_info
|
||||
|
||||
|
||||
/* static function prototypes */
|
||||
static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
|
||||
static STREAM_UPDATE( tms5110_update );
|
||||
|
||||
static int speech_rom_read_bit(void)
|
||||
{
|
||||
@ -242,25 +242,25 @@ int tms5110_ready_r(void)
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( tms5110_update )
|
||||
{
|
||||
struct tms5110_info *info = param;
|
||||
INT16 sample_data[MAX_SAMPLE_CHUNK];
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* loop while we still have samples to generate */
|
||||
while (length)
|
||||
while (samples)
|
||||
{
|
||||
int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
|
||||
int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
|
||||
int index;
|
||||
|
||||
/* generate the samples and copy to the target buffer */
|
||||
tms5110_process(info->chip, sample_data, samples);
|
||||
for (index = 0; index < samples; index++)
|
||||
tms5110_process(info->chip, sample_data, length);
|
||||
for (index = 0; index < length; index++)
|
||||
*buffer++ = sample_data[index];
|
||||
|
||||
/* account for the samples */
|
||||
length -= samples;
|
||||
samples -= length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ struct tms5220_info
|
||||
|
||||
|
||||
/* static function prototypes */
|
||||
static void tms5220_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
|
||||
static STREAM_UPDATE( tms5220_update );
|
||||
|
||||
|
||||
|
||||
@ -195,25 +195,25 @@ int tms5220_int_r(void)
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void tms5220_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( tms5220_update )
|
||||
{
|
||||
struct tms5220_info *info = param;
|
||||
INT16 sample_data[MAX_SAMPLE_CHUNK];
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* loop while we still have samples to generate */
|
||||
while (length)
|
||||
while (samples)
|
||||
{
|
||||
int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
|
||||
int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
|
||||
int index;
|
||||
|
||||
/* generate the samples and copy to the target buffer */
|
||||
tms5220_process(info->chip, sample_data, samples);
|
||||
for (index = 0; index < samples; index++)
|
||||
tms5220_process(info->chip, sample_data, length);
|
||||
for (index = 0; index < length; index++)
|
||||
*buffer++ = sample_data[index];
|
||||
|
||||
/* account for the samples */
|
||||
length -= samples;
|
||||
samples -= length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1276,11 +1276,11 @@ static int AICA_IRQCB(void *param)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void AICA_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
|
||||
static STREAM_UPDATE( AICA_Update )
|
||||
{
|
||||
struct _AICA *AICA = param;
|
||||
bufferl = buf[0];
|
||||
bufferr = buf[1];
|
||||
bufferl = outputs[0];
|
||||
bufferr = outputs[1];
|
||||
length = samples;
|
||||
AICA_DoMasterSamples(AICA, samples);
|
||||
}
|
||||
|
@ -76,10 +76,10 @@ struct astrocade_info
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void astrocade_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int samples)
|
||||
static STREAM_UPDATE( astrocade_update )
|
||||
{
|
||||
struct astrocade_info *chip = param;
|
||||
stream_sample_t *dest = buffer[0];
|
||||
stream_sample_t *dest = outputs[0];
|
||||
UINT16 noise_state;
|
||||
UINT8 master_count;
|
||||
UINT8 noise_clock;
|
||||
|
@ -473,19 +473,19 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
|
||||
}
|
||||
}
|
||||
|
||||
static void ay8910_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
|
||||
static STREAM_UPDATE( ay8910_update )
|
||||
{
|
||||
ay8910_context *psg = param;
|
||||
stream_sample_t *buf[NUM_CHANNELS];
|
||||
int chan;
|
||||
|
||||
buf[0] = buffer[0];
|
||||
buf[0] = outputs[0];
|
||||
buf[1] = NULL;
|
||||
buf[2] = NULL;
|
||||
if (psg->streams == NUM_CHANNELS)
|
||||
{
|
||||
buf[1] = buffer[1];
|
||||
buf[2] = buffer[2];
|
||||
buf[1] = outputs[1];
|
||||
buf[2] = outputs[2];
|
||||
}
|
||||
|
||||
/* hack to prevent us from hanging when starting filtered outputs */
|
||||
@ -493,7 +493,7 @@ static void ay8910_update(void *param,stream_sample_t **inputs, stream_sample_t
|
||||
{
|
||||
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
||||
if (buf[chan] != NULL)
|
||||
memset(buf[chan], 0, length * sizeof(*buf[chan]));
|
||||
memset(buf[chan], 0, samples * sizeof(*buf[chan]));
|
||||
}
|
||||
|
||||
/* The 8910 has three outputs, each output is the mix of one of the three */
|
||||
@ -504,7 +504,7 @@ static void ay8910_update(void *param,stream_sample_t **inputs, stream_sample_t
|
||||
/* is 1, not 0, and can be modulated changing the volume. */
|
||||
|
||||
/* buffering loop */
|
||||
while (length)
|
||||
while (samples)
|
||||
{
|
||||
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
||||
{
|
||||
@ -601,7 +601,7 @@ static void ay8910_update(void *param,stream_sample_t **inputs, stream_sample_t
|
||||
+ vol_enabled[2] * psg->vol_table[psg->Vol[2]]) / psg->step;
|
||||
#endif
|
||||
}
|
||||
length--;
|
||||
samples--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ struct beep_sound
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void beep_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( beep_sound_update )
|
||||
{
|
||||
struct beep_sound *bs = (struct beep_sound *) param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
INT16 signal = bs->signal;
|
||||
int clock = 0, rate = BEEP_RATE / 2;
|
||||
|
||||
@ -52,12 +52,12 @@ static void beep_sound_update(void *param,stream_sample_t **inputs, stream_sampl
|
||||
/* if we're not enabled, just fill with 0 */
|
||||
if ( !bs->enable || clock == 0 )
|
||||
{
|
||||
memset( buffer, 0, length * sizeof(*buffer) );
|
||||
memset( buffer, 0, samples * sizeof(*buffer) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill in the sample */
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
*buffer++ = signal;
|
||||
incr -= clock;
|
||||
|
@ -86,7 +86,7 @@ struct _bsmt2000_chip
|
||||
|
||||
/* core implementation */
|
||||
static void bsmt2000_reset(bsmt2000_chip *chip);
|
||||
static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
|
||||
static STREAM_UPDATE( bsmt2000_update );
|
||||
|
||||
/* read/write access */
|
||||
static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data);
|
||||
@ -183,17 +183,17 @@ static SND_RESET( bsmt2000 )
|
||||
sample generation
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( bsmt2000_update )
|
||||
{
|
||||
stream_sample_t *left = buffer[0];
|
||||
stream_sample_t *right = buffer[1];
|
||||
stream_sample_t *left = outputs[0];
|
||||
stream_sample_t *right = outputs[1];
|
||||
bsmt2000_chip *chip = param;
|
||||
bsmt2000_voice *voice;
|
||||
int samp, voicenum;
|
||||
|
||||
/* clear out the accumulator */
|
||||
memset(left, 0, length * sizeof(left[0]));
|
||||
memset(right, 0, length * sizeof(right[0]));
|
||||
memset(left, 0, samples * sizeof(left[0]));
|
||||
memset(right, 0, samples * sizeof(right[0]));
|
||||
|
||||
/* loop over voices */
|
||||
for (voicenum = 0; voicenum < chip->voices; voicenum++)
|
||||
@ -211,7 +211,7 @@ static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample
|
||||
UINT16 frac = voice->fraction;
|
||||
|
||||
/* loop while we still have samples to generate */
|
||||
for (samp = 0; samp < length; samp++)
|
||||
for (samp = 0; samp < samples; samp++)
|
||||
{
|
||||
#if ENABLE_INTERPOLATION
|
||||
INT32 sample = (base[pos] * (0x800 - frac) + (base[pos + 1] * frac)) >> 11;
|
||||
@ -249,7 +249,7 @@ static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample
|
||||
UINT32 frac = voice->fraction;
|
||||
|
||||
/* loop while we still have samples to generate */
|
||||
for (samp = 0; samp < length && pos < voice->loopend; samp++)
|
||||
for (samp = 0; samp < samples && pos < voice->loopend; samp++)
|
||||
{
|
||||
/* apply volumes and add */
|
||||
left[samp] += (chip->adpcm_current * lvol) >> 8;
|
||||
@ -304,7 +304,7 @@ static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample
|
||||
}
|
||||
|
||||
/* reduce the overall gain */
|
||||
for (samp = 0; samp < length; samp++)
|
||||
for (samp = 0; samp < samples; samp++)
|
||||
{
|
||||
left[samp] >>= 9;
|
||||
right[samp] >>= 9;
|
||||
|
@ -259,7 +259,7 @@ INLINE int limit(INT32 in)
|
||||
return in;
|
||||
}
|
||||
|
||||
static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( update_stereo )
|
||||
{
|
||||
struct c140_info *info = param;
|
||||
int i,j;
|
||||
@ -277,11 +277,11 @@ static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
INT16 *lmix, *rmix;
|
||||
|
||||
if(length>info->sample_rate) length=info->sample_rate;
|
||||
if(samples>info->sample_rate) samples=info->sample_rate;
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(info->mixer_buffer_left, 0, length * sizeof(INT16));
|
||||
memset(info->mixer_buffer_right, 0, length * sizeof(INT16));
|
||||
memset(info->mixer_buffer_left, 0, samples * sizeof(INT16));
|
||||
memset(info->mixer_buffer_right, 0, samples * sizeof(INT16));
|
||||
|
||||
/* get the number of voices to update */
|
||||
voicecnt = (info->banking_type == C140_TYPE_ASIC219) ? 16 : 24;
|
||||
@ -306,7 +306,7 @@ static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
lvol=(vreg->volume_left*32)/MAX_VOICE; //32ch -> 24ch
|
||||
rvol=(vreg->volume_right*32)/MAX_VOICE;
|
||||
|
||||
/* Set mixer buffer base pointers */
|
||||
/* Set mixer outputs base pointers */
|
||||
lmix = info->mixer_buffer_left;
|
||||
rmix = info->mixer_buffer_right;
|
||||
|
||||
@ -330,7 +330,7 @@ static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
{
|
||||
//compressed PCM (maybe correct...)
|
||||
/* Loop for enough to fill sample buffer as requested */
|
||||
for(j=0;j<length;j++)
|
||||
for(j=0;j<samples;j++)
|
||||
{
|
||||
offset += delta;
|
||||
cnt = (offset>>16)&0x7fff;
|
||||
@ -377,7 +377,7 @@ static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
else
|
||||
{
|
||||
/* linear 8bit signed PCM */
|
||||
for(j=0;j<length;j++)
|
||||
for(j=0;j<samples;j++)
|
||||
{
|
||||
offset += delta;
|
||||
cnt = (offset>>16)&0x7fff;
|
||||
@ -444,9 +444,9 @@ static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
lmix = info->mixer_buffer_left;
|
||||
rmix = info->mixer_buffer_right;
|
||||
{
|
||||
stream_sample_t *dest1 = buffer[0];
|
||||
stream_sample_t *dest2 = buffer[1];
|
||||
for (i = 0; i < length; i++)
|
||||
stream_sample_t *dest1 = outputs[0];
|
||||
stream_sample_t *dest2 = outputs[1];
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
*dest1++ = limit(8*(*lmix++));
|
||||
*dest2++ = limit(8*(*rmix++));
|
||||
|
@ -325,26 +325,26 @@ static void c352_mix_one_channel(struct c352_info *info, unsigned long ch, long
|
||||
}
|
||||
|
||||
|
||||
static void c352_update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int sample_count)
|
||||
static STREAM_UPDATE( c352_update )
|
||||
{
|
||||
struct c352_info *info = param;
|
||||
int i, j;
|
||||
stream_sample_t *bufferl = buf[0];
|
||||
stream_sample_t *bufferr = buf[1];
|
||||
stream_sample_t *bufferl2 = buf[2];
|
||||
stream_sample_t *bufferr2 = buf[3];
|
||||
stream_sample_t *bufferl = outputs[0];
|
||||
stream_sample_t *bufferr = outputs[1];
|
||||
stream_sample_t *bufferl2 = outputs[2];
|
||||
stream_sample_t *bufferr2 = outputs[3];
|
||||
|
||||
for(i = 0 ; i < sample_count ; i++)
|
||||
for(i = 0 ; i < samples ; i++)
|
||||
{
|
||||
info->channel_l[i] = info->channel_r[i] = info->channel_l2[i] = info->channel_r2[i] = 0;
|
||||
}
|
||||
|
||||
for (j = 0 ; j < 32 ; j++)
|
||||
{
|
||||
c352_mix_one_channel(info, j, sample_count);
|
||||
c352_mix_one_channel(info, j, samples);
|
||||
}
|
||||
|
||||
for(i = 0 ; i < sample_count ; i++)
|
||||
for(i = 0 ; i < samples ; i++)
|
||||
{
|
||||
*bufferl++ = (short) (info->channel_l[i] >>3);
|
||||
*bufferr++ = (short) (info->channel_r[i] >>3);
|
||||
|
@ -208,7 +208,7 @@ static void c6280_write(c6280_t *p, int offset, int data)
|
||||
}
|
||||
|
||||
|
||||
static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( c6280_update )
|
||||
{
|
||||
static const int scale_tab[] = {
|
||||
0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
|
||||
@ -226,10 +226,10 @@ static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
rmal = scale_tab[rmal];
|
||||
|
||||
/* Clear buffer */
|
||||
for(i = 0; i < length; i++)
|
||||
for(i = 0; i < samples; i++)
|
||||
{
|
||||
buffer[0][i] = 0;
|
||||
buffer[1][i] = 0;
|
||||
outputs[0][i] = 0;
|
||||
outputs[1][i] = 0;
|
||||
}
|
||||
|
||||
for(ch = 0; ch < 6; ch++)
|
||||
@ -259,7 +259,7 @@ static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
{
|
||||
/* Noise mode */
|
||||
UINT32 step = p->noise_freq_tab[(p->channel[ch].noise_control & 0x1F) ^ 0x1F];
|
||||
for(i = 0; i < length; i += 1)
|
||||
for(i = 0; i < samples; i += 1)
|
||||
{
|
||||
static int data = 0;
|
||||
p->channel[ch].noise_counter += step;
|
||||
@ -268,25 +268,25 @@ static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
data = (mame_rand(p->device->machine) & 1) ? 0x1F : 0;
|
||||
}
|
||||
p->channel[ch].noise_counter &= 0x7FF;
|
||||
buffer[0][i] += (INT16)(vll * (data - 16));
|
||||
buffer[1][i] += (INT16)(vlr * (data - 16));
|
||||
outputs[0][i] += (INT16)(vll * (data - 16));
|
||||
outputs[1][i] += (INT16)(vlr * (data - 16));
|
||||
}
|
||||
}
|
||||
else
|
||||
if(p->channel[ch].control & 0x40)
|
||||
{
|
||||
/* DDA mode */
|
||||
for(i = 0; i < length; i++)
|
||||
for(i = 0; i < samples; i++)
|
||||
{
|
||||
buffer[0][i] += (INT16)(vll * (p->channel[ch].dda - 16));
|
||||
buffer[1][i] += (INT16)(vlr * (p->channel[ch].dda - 16));
|
||||
outputs[0][i] += (INT16)(vll * (p->channel[ch].dda - 16));
|
||||
outputs[1][i] += (INT16)(vlr * (p->channel[ch].dda - 16));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Waveform mode */
|
||||
UINT32 step = p->wave_freq_tab[p->channel[ch].frequency];
|
||||
for(i = 0; i < length; i += 1)
|
||||
for(i = 0; i < samples; i += 1)
|
||||
{
|
||||
int offset;
|
||||
INT16 data;
|
||||
@ -294,8 +294,8 @@ static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
p->channel[ch].counter += step;
|
||||
p->channel[ch].counter &= 0x1FFFF;
|
||||
data = p->channel[ch].waveform[offset];
|
||||
buffer[0][i] += (INT16)(vll * (data - 16));
|
||||
buffer[1][i] += (INT16)(vlr * (data - 16));
|
||||
outputs[0][i] += (INT16)(vll * (data - 16));
|
||||
outputs[1][i] += (INT16)(vlr * (data - 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ static void get_audio_data(cdda_info *info, stream_sample_t *bufL, stream_sample
|
||||
cdda_update - stream update callback
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cdda_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( cdda_update )
|
||||
{
|
||||
cdda_info *info = param;
|
||||
get_audio_data(info, &outputs[0][0], &outputs[1][0], length);
|
||||
get_audio_data(info, &outputs[0][0], &outputs[1][0], samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,13 +40,13 @@ struct CDP1869
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void cdp1869_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( cdp1869_update )
|
||||
{
|
||||
struct CDP1869 *info = param;
|
||||
INT16 signal = info->signal;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
memset( buffer, 0, length * sizeof(*buffer) );
|
||||
memset( buffer, 0, samples * sizeof(*buffer) );
|
||||
|
||||
if (!info->toneoff && info->toneamp)
|
||||
{
|
||||
@ -67,7 +67,7 @@ static void cdp1869_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
signal = info->toneamp * (0x07fff / 15);
|
||||
}
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
*buffer++ = signal;
|
||||
incr -= frequency;
|
||||
|
@ -139,13 +139,13 @@ typedef struct
|
||||
|
||||
|
||||
/* generate sound to the mix buffer in mono */
|
||||
static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( cem3394_update )
|
||||
{
|
||||
sound_chip *chip = param;
|
||||
int int_volume = (chip->volume * chip->mixer_internal) / 256;
|
||||
int ext_volume = (chip->volume * chip->mixer_external) / 256;
|
||||
UINT32 step = chip->step, position, end_position = 0;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
INT16 *mix, *ext;
|
||||
int i;
|
||||
|
||||
@ -160,7 +160,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
/* bail if nothing's going on */
|
||||
if (int_volume == 0 && ext_volume == 0)
|
||||
{
|
||||
memset(buffer, 0, sizeof(*buffer) * length);
|
||||
memset(buffer, 0, sizeof(*buffer) * samples);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
INT16 last_ext = chip->last_ext;
|
||||
|
||||
/* fetch the external data */
|
||||
(*chip->external)(chip->index, length, chip->external_buffer);
|
||||
(*chip->external)(chip->index, samples, chip->external_buffer);
|
||||
|
||||
/* compute the modulation depth, and adjust fstep to the maximum frequency */
|
||||
/* we lop off 13 bits of depth so that we can multiply by stepadjust, below, */
|
||||
@ -182,7 +182,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* "apply" the filter: note this is pretty cheesy; it basically just downsamples the
|
||||
external sample to filter_freq by allowing only 2 transitions for every cycle */
|
||||
for (i = 0, ext = chip->external_buffer, position = chip->position; i < length; i++, ext++)
|
||||
for (i = 0, ext = chip->external_buffer, position = chip->position; i < samples; i++, ext++)
|
||||
{
|
||||
UINT32 newposition;
|
||||
INT32 stepadjust;
|
||||
@ -224,7 +224,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
/* if the width is wider than the step, we're guaranteed to hit it once per cycle */
|
||||
if (pulse_width >= step)
|
||||
{
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
|
||||
{
|
||||
if (position < pulse_width)
|
||||
*mix = 0x1932;
|
||||
@ -238,7 +238,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
else
|
||||
{
|
||||
INT16 volume = 0x1932 * pulse_width / step;
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
|
||||
{
|
||||
UINT32 newposition = position + step;
|
||||
if ((newposition ^ position) & ~FRACTION_MASK)
|
||||
@ -253,13 +253,13 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* otherwise, clear the mixing buffer */
|
||||
else
|
||||
memset(chip->mixer_buffer, 0, sizeof(INT16) * length);
|
||||
memset(chip->mixer_buffer, 0, sizeof(INT16) * samples);
|
||||
|
||||
/* handle the sawtooth component; it maxes out at 0x2000, which is 27% larger */
|
||||
/* than the pulse */
|
||||
if (ENABLE_SAWTOOTH && (chip->wave_select & WAVE_SAWTOOTH))
|
||||
{
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
|
||||
{
|
||||
*mix += ((position >> (FRACTION_BITS - 14)) & 0x3fff) - 0x2000;
|
||||
position += step;
|
||||
@ -272,7 +272,7 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
/* a multiplication) */
|
||||
if (ENABLE_TRIANGLE && (chip->wave_select & WAVE_TRIANGLE))
|
||||
{
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
|
||||
for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
|
||||
{
|
||||
INT16 value;
|
||||
if (position & (1 << (FRACTION_BITS - 1)))
|
||||
@ -296,19 +296,19 @@ static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
/* internal + external */
|
||||
if (ext_volume != 0 && int_volume != 0)
|
||||
{
|
||||
for (i = 0; i < length; i++, mix++, ext++)
|
||||
for (i = 0; i < samples; i++, mix++, ext++)
|
||||
*buffer++ = (*mix * int_volume + *ext * ext_volume) / 128;
|
||||
}
|
||||
/* internal only */
|
||||
else if (int_volume != 0)
|
||||
{
|
||||
for (i = 0; i < length; i++, mix++)
|
||||
for (i = 0; i < samples; i++, mix++)
|
||||
*buffer++ = *mix * int_volume / 128;
|
||||
}
|
||||
/* external only */
|
||||
else
|
||||
{
|
||||
for (i = 0; i < length; i++, ext++)
|
||||
for (i = 0; i < samples; i++, ext++)
|
||||
*buffer++ = *ext * ext_volume / 128;
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ struct dac_info
|
||||
|
||||
|
||||
|
||||
static void DAC_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( DAC_update )
|
||||
{
|
||||
struct dac_info *info = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
INT16 out = info->output;
|
||||
|
||||
while (length--) *(buffer++) = out;
|
||||
while (samples--) *(buffer++) = out;
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,7 +424,7 @@ static SND_RESET( discrete )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void discrete_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( discrete_stream_update )
|
||||
{
|
||||
discrete_info *info = param;
|
||||
int samplenum, nodenum, outputnum;
|
||||
@ -439,8 +439,8 @@ static void discrete_stream_update(void *param, stream_sample_t **inputs, stream
|
||||
info->input_stream_data[nodenum] = inputs[nodenum];
|
||||
}
|
||||
|
||||
/* Now we must do length iterations of the node list, one output for each step */
|
||||
for (samplenum = 0; samplenum < length; samplenum++)
|
||||
/* Now we must do samples iterations of the node list, one output for each step */
|
||||
for (samplenum = 0; samplenum < samples; samplenum++)
|
||||
{
|
||||
/* loop over all nodes */
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
@ -463,7 +463,7 @@ static void discrete_stream_update(void *param, stream_sample_t **inputs, stream
|
||||
for (outputnum = 0; outputnum < info->discrete_outputs; outputnum++)
|
||||
{
|
||||
val = (*info->output_node[outputnum]->input[0]) * (*info->output_node[outputnum]->input[1]);
|
||||
buffer[outputnum][samplenum] = val;
|
||||
outputs[outputnum][samplenum] = val;
|
||||
}
|
||||
|
||||
/* Dump any csv logs */
|
||||
|
@ -62,21 +62,21 @@ struct dmadac_channel_data
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void dmadac_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( dmadac_update )
|
||||
{
|
||||
struct dmadac_channel_data *ch = param;
|
||||
stream_sample_t *output = _buffer[0];
|
||||
stream_sample_t *output = outputs[0];
|
||||
INT16 *source = ch->buffer;
|
||||
UINT32 curout = ch->bufout;
|
||||
UINT32 curin = ch->bufin;
|
||||
int volume = ch->volume;
|
||||
|
||||
/* feed as much as we can */
|
||||
while (curout != curin && length-- > 0)
|
||||
while (curout != curin && samples-- > 0)
|
||||
*output++ = (source[curout++ % BUFFER_SIZE] * volume) >> 8;
|
||||
|
||||
/* fill the rest with silence */
|
||||
while (length-- > 0)
|
||||
while (samples-- > 0)
|
||||
*output++ = 0;
|
||||
|
||||
/* save the new output pointer */
|
||||
|
@ -141,7 +141,7 @@ static TIMER_CALLBACK( es5503_timer_cb )
|
||||
stream_update(chip->stream);
|
||||
}
|
||||
|
||||
static void es5503_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( es5503_pcm_update )
|
||||
{
|
||||
INT32 mix[48000*2];
|
||||
INT32 *mixp;
|
||||
@ -169,7 +169,7 @@ static void es5503_pcm_update(void *param, stream_sample_t **inputs, stream_samp
|
||||
int resshift = resshifts[pOsc->resolution] - pOsc->wavetblsize;
|
||||
UINT32 sizemask = accmasks[pOsc->wavetblsize];
|
||||
|
||||
for (snum = 0; snum < length; snum++)
|
||||
for (snum = 0; snum < samples; snum++)
|
||||
{
|
||||
ramptr = (acc >> resshift) & sizemask;
|
||||
altram = acc >> resshift;
|
||||
@ -216,7 +216,7 @@ static void es5503_pcm_update(void *param, stream_sample_t **inputs, stream_samp
|
||||
}
|
||||
|
||||
mixp = &mix[0];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outputs[0][i] = (*mixp++)>>1;
|
||||
outputs[1][i] = (*mixp++)>>1;
|
||||
|
@ -769,12 +769,12 @@ logerror("IRQ raised on voice %d!!\n",v);
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void es5506_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( es5506_update )
|
||||
{
|
||||
struct ES5506Chip *chip = param;
|
||||
INT32 *lsrc = chip->scratch, *rsrc = chip->scratch;
|
||||
stream_sample_t *ldest = buffer[0];
|
||||
stream_sample_t *rdest = buffer[1];
|
||||
stream_sample_t *ldest = outputs[0];
|
||||
stream_sample_t *rdest = outputs[1];
|
||||
|
||||
#if MAKE_WAVS
|
||||
/* start the logging once we have a sample rate */
|
||||
@ -786,18 +786,18 @@ static void es5506_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
#endif
|
||||
|
||||
/* loop until all samples are output */
|
||||
while (length)
|
||||
while (samples)
|
||||
{
|
||||
int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
|
||||
int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
|
||||
int samp;
|
||||
|
||||
/* determine left/right source data */
|
||||
lsrc = chip->scratch;
|
||||
rsrc = chip->scratch + samples;
|
||||
generate_samples(chip, lsrc, rsrc, samples);
|
||||
rsrc = chip->scratch + length;
|
||||
generate_samples(chip, lsrc, rsrc, length);
|
||||
|
||||
/* copy the data */
|
||||
for (samp = 0; samp < samples; samp++)
|
||||
for (samp = 0; samp < length; samp++)
|
||||
{
|
||||
*ldest++ = lsrc[samp] >> 4;
|
||||
*rdest++ = rsrc[samp] >> 4;
|
||||
@ -806,11 +806,11 @@ static void es5506_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
#if MAKE_WAVS
|
||||
/* log the raw data */
|
||||
if (chip->wavraw)
|
||||
wav_add_data_32lr(chip->wavraw, lsrc, rsrc, samples, 4);
|
||||
wav_add_data_32lr(chip->wavraw, lsrc, rsrc, length, 4);
|
||||
#endif
|
||||
|
||||
/* account for these samples */
|
||||
length -= samples;
|
||||
samples -= length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static void generate_adpcm(struct es8712 *chip, stream_sample_t *buffer, int sam
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void es8712_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( es8712_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
struct es8712 *chip = param;
|
||||
|
@ -14,7 +14,7 @@ struct filter_rc_info
|
||||
const flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)};
|
||||
|
||||
|
||||
static void filter_rc_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( filter_rc_update )
|
||||
{
|
||||
stream_sample_t *src = inputs[0];
|
||||
stream_sample_t *dst = outputs[0];
|
||||
|
@ -11,7 +11,7 @@ struct filter_volume_info
|
||||
|
||||
|
||||
|
||||
static void filter_volume_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( filter_volume_update )
|
||||
{
|
||||
stream_sample_t *src = inputs[0];
|
||||
stream_sample_t *dst = outputs[0];
|
||||
|
@ -83,13 +83,13 @@ static void * wavraw; /* raw waveform */
|
||||
Writes length bytes to the sound buffer
|
||||
============================================================================*/
|
||||
|
||||
static void gaelco_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( gaelco_update )
|
||||
{
|
||||
struct GAELCOSND *info = param;
|
||||
int j, ch;
|
||||
|
||||
/* fill all data needed */
|
||||
for(j = 0; j < length; j++){
|
||||
for(j = 0; j < samples; j++){
|
||||
int output_l = 0, output_r = 0;
|
||||
|
||||
/* for each channel */
|
||||
@ -175,12 +175,12 @@ static void gaelco_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
#endif
|
||||
|
||||
/* now that we have computed all channels, save current data to the output buffer */
|
||||
buffer[0][j] = output_l;
|
||||
buffer[1][j] = output_r;
|
||||
outputs[0][j] = output_l;
|
||||
outputs[1][j] = output_r;
|
||||
}
|
||||
|
||||
if (wavraw)
|
||||
wav_add_data_32lr(wavraw, buffer[0], buffer[1], length, 0);
|
||||
wav_add_data_32lr(wavraw, outputs[0], outputs[1], samples, 0);
|
||||
}
|
||||
|
||||
/*============================================================================
|
||||
|
@ -48,7 +48,7 @@ struct hc55516_data
|
||||
static double charge, decay, leak;
|
||||
|
||||
|
||||
static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length);
|
||||
static STREAM_UPDATE( hc55516_update );
|
||||
|
||||
|
||||
|
||||
@ -182,21 +182,21 @@ static void process_digit(struct hc55516_data *chip)
|
||||
}
|
||||
|
||||
|
||||
static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( hc55516_update )
|
||||
{
|
||||
struct hc55516_data *chip = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i;
|
||||
INT32 sample, slope;
|
||||
|
||||
/* zero-length? bail */
|
||||
if (length == 0)
|
||||
if (samples == 0)
|
||||
return;
|
||||
|
||||
if (!is_external_osciallator(chip))
|
||||
{
|
||||
/* track how many samples we've updated without a clock */
|
||||
chip->update_count += length;
|
||||
chip->update_count += samples;
|
||||
if (chip->update_count > SAMPLE_RATE / 32)
|
||||
{
|
||||
chip->update_count = SAMPLE_RATE;
|
||||
@ -206,13 +206,13 @@ static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* compute the interpolation slope */
|
||||
sample = chip->curr_sample;
|
||||
slope = ((INT32)chip->next_sample - sample) / length;
|
||||
slope = ((INT32)chip->next_sample - sample) / samples;
|
||||
chip->curr_sample = chip->next_sample;
|
||||
|
||||
if (is_external_osciallator(chip))
|
||||
{
|
||||
/* external oscillator */
|
||||
for (i = 0; i < length; i++, sample += slope)
|
||||
for (i = 0; i < samples; i++, sample += slope)
|
||||
{
|
||||
UINT8 clock_state;
|
||||
|
||||
@ -236,7 +236,7 @@ static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* software driven clock */
|
||||
else
|
||||
for (i = 0; i < length; i++, sample += slope)
|
||||
for (i = 0; i < samples; i++, sample += slope)
|
||||
*buffer++ = sample;
|
||||
}
|
||||
|
||||
|
@ -85,14 +85,14 @@ static void recalc_irq(struct ics2115 *chip)
|
||||
}
|
||||
|
||||
|
||||
static void update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( update )
|
||||
{
|
||||
struct ics2115 *chip = param;
|
||||
int osc, i;
|
||||
int rec_irq = 0;
|
||||
|
||||
memset(buffer[0], 0, length*sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length*sizeof(*buffer[0]));
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[0]));
|
||||
|
||||
for(osc = 0; osc < 32; osc++)
|
||||
if(chip->voice[osc].state & V_ON) {
|
||||
@ -108,7 +108,7 @@ static void update(void *param, stream_sample_t **inputs, stream_sample_t **buff
|
||||
if (ICS2115LOGERROR) logerror("ICS2115: KEYRUN %02d adr=%08x end=%08x delta=%08x\n",
|
||||
osc, adr, end, delta);
|
||||
|
||||
for(i=0; i<length; i++) {
|
||||
for(i=0; i<samples; i++) {
|
||||
INT32 v = chip->rom[badr|(adr >> 12)];
|
||||
if(conf & 1)
|
||||
v = chip->ulaw[v];
|
||||
@ -116,8 +116,8 @@ static void update(void *param, stream_sample_t **inputs, stream_sample_t **buff
|
||||
v = ((INT8)v) << 6;
|
||||
|
||||
v = (v*vol)>>(16+5);
|
||||
buffer[0][i] += v;
|
||||
buffer[1][i] += v;
|
||||
outputs[0][i] += v;
|
||||
outputs[1][i] += v;
|
||||
adr += delta;
|
||||
if(adr >= end) {
|
||||
if (ICS2115LOGERROR) logerror("ICS2115: KEYDONE %2d\n", osc);
|
||||
|
@ -55,7 +55,7 @@ struct IremGA20_chip_def
|
||||
struct IremGA20_channel_def channel[4];
|
||||
};
|
||||
|
||||
static void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
|
||||
static STREAM_UPDATE( IremGA20_update )
|
||||
{
|
||||
struct IremGA20_chip_def *chip = param;
|
||||
UINT32 rate[4], pos[4], frac[4], end[4], vol[4], play[4];
|
||||
@ -74,12 +74,12 @@ static void IremGA20_update( void *param, stream_sample_t **inputs, stream_sampl
|
||||
play[i] = chip->channel[i].play;
|
||||
}
|
||||
|
||||
i = length;
|
||||
i = samples;
|
||||
pSamples = chip->rom;
|
||||
outL = buffer[0];
|
||||
outR = buffer[1];
|
||||
outL = outputs[0];
|
||||
outR = outputs[1];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
sampleout = 0;
|
||||
|
||||
|
@ -87,16 +87,16 @@ static int make_mixer_table(struct k005289_info *info, int voices)
|
||||
|
||||
|
||||
/* generate sound to the mix buffer */
|
||||
static void K005289_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( K005289_update )
|
||||
{
|
||||
struct k005289_info *info = param;
|
||||
k005289_sound_channel *voice=info->channel_list;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
short *mix;
|
||||
int i,v,f;
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(info->mixer_buffer, 0, length * sizeof(INT16));
|
||||
memset(info->mixer_buffer, 0, samples * sizeof(INT16));
|
||||
|
||||
v=voice[0].volume;
|
||||
f=voice[0].frequency;
|
||||
@ -108,7 +108,7 @@ static void K005289_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
mix = info->mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int offs;
|
||||
|
||||
@ -131,7 +131,7 @@ static void K005289_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
mix = info->mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int offs;
|
||||
|
||||
@ -146,7 +146,7 @@ static void K005289_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* mix it down */
|
||||
mix = info->mixer_buffer;
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
*buffer++ = info->mixer_lookup[*mix++];
|
||||
}
|
||||
|
||||
|
@ -216,13 +216,13 @@ static void KDAC_A_make_fncode( struct kdacApcm *info ){
|
||||
/* Konami PCM update */
|
||||
/************************************************/
|
||||
|
||||
static void KDAC_A_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int buffer_len)
|
||||
static STREAM_UPDATE( KDAC_A_update )
|
||||
{
|
||||
struct kdacApcm *info = param;
|
||||
int i;
|
||||
|
||||
memset(buffer[0],0,buffer_len * sizeof(*buffer[0]));
|
||||
memset(buffer[1],0,buffer_len * sizeof(*buffer[1]));
|
||||
memset(outputs[0],0,samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1],0,samples * sizeof(*outputs[1]));
|
||||
|
||||
for( i = 0; i < KDAC_A_PCM_MAX; i++ )
|
||||
{
|
||||
@ -242,7 +242,7 @@ static void KDAC_A_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
volB = (volB + cen) < 0x1fe ? (volB + cen) : 0x1fe;
|
||||
#endif
|
||||
|
||||
for( j = 0; j < buffer_len; j++ )
|
||||
for( j = 0; j < samples; j++ )
|
||||
{
|
||||
old_addr = addr;
|
||||
addr = info->start[i] + ((info->addr[i]>>BASE_SHIFT)&0x000fffff);
|
||||
@ -282,8 +282,8 @@ static void KDAC_A_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
out = (info->pcmbuf[i][addr] & 0x7f) - 0x40;
|
||||
|
||||
buffer[0][j] += out * volA;
|
||||
buffer[1][j] += out * volB;
|
||||
outputs[0][j] += out * volA;
|
||||
outputs[1][j] += out * volB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,16 +81,16 @@ static int make_mixer_table(struct k051649_info *info, int voices)
|
||||
|
||||
|
||||
/* generate sound to the mix buffer */
|
||||
static void k051649_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( k051649_update )
|
||||
{
|
||||
struct k051649_info *info = param;
|
||||
k051649_sound_channel *voice=info->channel_list;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
short *mix;
|
||||
int i,v,f,j,k;
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(info->mixer_buffer, 0, length * sizeof(short));
|
||||
memset(info->mixer_buffer, 0, samples * sizeof(short));
|
||||
|
||||
for (j=0; j<5; j++) {
|
||||
v=voice[j].volume;
|
||||
@ -105,7 +105,7 @@ static void k051649_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
mix = info->mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int offs;
|
||||
|
||||
@ -123,7 +123,7 @@ static void k051649_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
/* mix it down */
|
||||
mix = info->mixer_buffer;
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
*buffer++ = info->mixer_lookup[*mix++];
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ INLINE int limit( int val, int max, int min ) {
|
||||
#define MAXOUT 0x7fff
|
||||
#define MINOUT -0x8000
|
||||
|
||||
static void k053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) {
|
||||
static STREAM_UPDATE( k053260_update ) {
|
||||
static const long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1};
|
||||
|
||||
int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4];
|
||||
@ -126,7 +126,7 @@ static void k053260_update( void * param, stream_sample_t **inputs, stream_sampl
|
||||
delta[i] /= 2;
|
||||
}
|
||||
|
||||
for ( j = 0; j < length; j++ ) {
|
||||
for ( j = 0; j < samples; j++ ) {
|
||||
|
||||
dataL = dataR = 0;
|
||||
|
||||
@ -187,8 +187,8 @@ static void k053260_update( void * param, stream_sample_t **inputs, stream_sampl
|
||||
}
|
||||
}
|
||||
|
||||
buffer[1][j] = limit( dataL, MAXOUT, MINOUT );
|
||||
buffer[0][j] = limit( dataR, MAXOUT, MINOUT );
|
||||
outputs[1][j] = limit( dataL, MAXOUT, MINOUT );
|
||||
outputs[0][j] = limit( dataR, MAXOUT, MINOUT );
|
||||
}
|
||||
|
||||
/* update the regs now */
|
||||
|
@ -119,7 +119,7 @@ static void k054539_keyoff(struct k054539_info *info, int channel)
|
||||
info->regs[0x22c] &= ~(1 << channel);
|
||||
}
|
||||
|
||||
static void k054539_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( k054539_update )
|
||||
{
|
||||
struct k054539_info *info = param;
|
||||
#define VOL_CAP 1.80
|
||||
@ -131,7 +131,7 @@ static void k054539_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
|
||||
int ch, reverb_pos;
|
||||
short *rbase;
|
||||
unsigned char *samples;
|
||||
unsigned char *rom;
|
||||
UINT32 rom_mask;
|
||||
|
||||
unsigned char *base1, *base2;
|
||||
@ -146,15 +146,15 @@ static void k054539_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
reverb_pos = info->reverb_pos;
|
||||
rbase = (short *)(info->ram);
|
||||
|
||||
memset(buffer[0], 0, length*sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length*sizeof(*buffer[1]));
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[1]));
|
||||
|
||||
samples = info->rom;
|
||||
rom = info->rom;
|
||||
rom_mask = info->rom_mask;
|
||||
|
||||
if(!(info->regs[0x22f] & 1)) return;
|
||||
|
||||
info->reverb_pos = (reverb_pos + length) & 0x3fff;
|
||||
info->reverb_pos = (reverb_pos + samples) & 0x3fff;
|
||||
|
||||
|
||||
for(ch=0; ch<8; ch++)
|
||||
@ -199,8 +199,8 @@ else
|
||||
|
||||
cur_pos = (base1[0x0c] | (base1[0x0d] << 8) | (base1[0x0e] << 16)) & rom_mask;
|
||||
|
||||
bufl = buffer[0];
|
||||
bufr = buffer[1];
|
||||
bufl = outputs[0];
|
||||
bufr = outputs[1];
|
||||
//*
|
||||
|
||||
if(base2[0] & 0x20) {
|
||||
@ -233,18 +233,18 @@ else
|
||||
|
||||
switch(base2[0] & 0xc) {
|
||||
case 0x0: { // 8bit pcm
|
||||
for(i=0; i<length; i++) {
|
||||
for(i=0; i<samples; i++) {
|
||||
cur_pfrac += delta;
|
||||
while(cur_pfrac & ~0xffff) {
|
||||
cur_pfrac += fdelta;
|
||||
cur_pos += pdelta;
|
||||
|
||||
cur_pval = cur_val;
|
||||
cur_val = (INT16)(samples[cur_pos] << 8);
|
||||
cur_val = (INT16)(rom[cur_pos] << 8);
|
||||
if(cur_val == (INT16)0x8000) {
|
||||
if(base2[1] & 1) {
|
||||
cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
|
||||
cur_val = (INT16)(samples[cur_pos] << 8);
|
||||
cur_val = (INT16)(rom[cur_pos] << 8);
|
||||
if(cur_val != (INT16)0x8000)
|
||||
continue;
|
||||
}
|
||||
@ -261,18 +261,18 @@ else
|
||||
case 0x4: { // 16bit pcm lsb first
|
||||
pdelta <<= 1;
|
||||
|
||||
for(i=0; i<length; i++) {
|
||||
for(i=0; i<samples; i++) {
|
||||
cur_pfrac += delta;
|
||||
while(cur_pfrac & ~0xffff) {
|
||||
cur_pfrac += fdelta;
|
||||
cur_pos += pdelta;
|
||||
|
||||
cur_pval = cur_val;
|
||||
cur_val = (INT16)(samples[cur_pos] | samples[cur_pos+1]<<8);
|
||||
cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
|
||||
if(cur_val == (INT16)0x8000) {
|
||||
if(base2[1] & 1) {
|
||||
cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
|
||||
cur_val = (INT16)(samples[cur_pos] | samples[cur_pos+1]<<8);
|
||||
cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
|
||||
if(cur_val != (INT16)0x8000)
|
||||
continue;
|
||||
}
|
||||
@ -294,18 +294,18 @@ else
|
||||
cur_pos |= 1;
|
||||
}
|
||||
|
||||
for(i=0; i<length; i++) {
|
||||
for(i=0; i<samples; i++) {
|
||||
cur_pfrac += delta;
|
||||
while(cur_pfrac & ~0xffff) {
|
||||
cur_pfrac += fdelta;
|
||||
cur_pos += pdelta;
|
||||
|
||||
cur_pval = cur_val;
|
||||
cur_val = samples[cur_pos>>1];
|
||||
cur_val = rom[cur_pos>>1];
|
||||
if(cur_val == 0x88) {
|
||||
if(base2[1] & 1) {
|
||||
cur_pos = ((base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask) << 1;
|
||||
cur_val = samples[cur_pos>>1];
|
||||
cur_val = rom[cur_pos>>1];
|
||||
if(cur_val != 0x88)
|
||||
goto next_iter;
|
||||
}
|
||||
@ -351,19 +351,19 @@ else
|
||||
//* drivers should be given the option to disable reverb when things go terribly wrong
|
||||
if(!(info->k054539_flags & K054539_DISABLE_REVERB))
|
||||
{
|
||||
for(i=0; i<length; i++) {
|
||||
for(i=0; i<samples; i++) {
|
||||
short val = rbase[(i+reverb_pos) & 0x3fff];
|
||||
buffer[0][i] += val;
|
||||
buffer[1][i] += val;
|
||||
outputs[0][i] += val;
|
||||
outputs[1][i] += val;
|
||||
}
|
||||
}
|
||||
|
||||
if(reverb_pos + length > 0x4000) {
|
||||
if(reverb_pos + samples > 0x4000) {
|
||||
i = 0x4000 - reverb_pos;
|
||||
memset(rbase + reverb_pos, 0, i*2);
|
||||
memset(rbase, 0, (length-i)*2);
|
||||
memset(rbase, 0, (samples-i)*2);
|
||||
} else
|
||||
memset(rbase + reverb_pos, 0, length*2);
|
||||
memset(rbase + reverb_pos, 0, samples*2);
|
||||
|
||||
#if CHANNEL_DEBUG
|
||||
{
|
||||
|
@ -90,23 +90,23 @@ static void ComputeTables (struct MSM5205Voice *voice)
|
||||
}
|
||||
|
||||
/* stream update callbacks */
|
||||
static void MSM5205_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( MSM5205_update )
|
||||
{
|
||||
struct MSM5205Voice *voice = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* if this voice is active */
|
||||
if(voice->signal)
|
||||
{
|
||||
short val = voice->signal * 16;
|
||||
while (length)
|
||||
while (samples)
|
||||
{
|
||||
*buffer++ = val;
|
||||
length--;
|
||||
samples--;
|
||||
}
|
||||
}
|
||||
else
|
||||
memset (buffer,0,length*sizeof(*buffer));
|
||||
memset (buffer,0,samples*sizeof(*buffer));
|
||||
}
|
||||
|
||||
/* timer callback at VCLK low eddge */
|
||||
|
@ -703,20 +703,20 @@ INLINE void TG_group_advance(MSM5232 *chip, int groupidx)
|
||||
#endif
|
||||
|
||||
|
||||
static void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples)
|
||||
static STREAM_UPDATE( MSM5232_update_one )
|
||||
{
|
||||
MSM5232 * chip = param;
|
||||
stream_sample_t *buf1 = buffer[0];
|
||||
stream_sample_t *buf2 = buffer[1];
|
||||
stream_sample_t *buf3 = buffer[2];
|
||||
stream_sample_t *buf4 = buffer[3];
|
||||
stream_sample_t *buf5 = buffer[4];
|
||||
stream_sample_t *buf6 = buffer[5];
|
||||
stream_sample_t *buf7 = buffer[6];
|
||||
stream_sample_t *buf8 = buffer[7];
|
||||
stream_sample_t *bufsolo1 = buffer[8];
|
||||
stream_sample_t *bufsolo2 = buffer[9];
|
||||
stream_sample_t *bufnoise = buffer[10];
|
||||
stream_sample_t *buf1 = outputs[0];
|
||||
stream_sample_t *buf2 = outputs[1];
|
||||
stream_sample_t *buf3 = outputs[2];
|
||||
stream_sample_t *buf4 = outputs[3];
|
||||
stream_sample_t *buf5 = outputs[4];
|
||||
stream_sample_t *buf6 = outputs[5];
|
||||
stream_sample_t *buf7 = outputs[6];
|
||||
stream_sample_t *buf8 = outputs[7];
|
||||
stream_sample_t *bufsolo1 = outputs[8];
|
||||
stream_sample_t *bufsolo2 = outputs[9];
|
||||
stream_sample_t *bufnoise = outputs[10];
|
||||
int i;
|
||||
|
||||
for (i=0; i<samples; i++)
|
||||
|
@ -413,20 +413,20 @@ static void WriteSlot(struct _MultiPCM *ptChip,struct _SLOT *slot,int reg,unsign
|
||||
}
|
||||
}
|
||||
|
||||
static void MultiPCM_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
|
||||
static STREAM_UPDATE( MultiPCM_update )
|
||||
{
|
||||
struct _MultiPCM *ptChip = param;
|
||||
stream_sample_t *datap[2];
|
||||
int i,sl;
|
||||
|
||||
datap[0] = buffer[0];
|
||||
datap[1] = buffer[1];
|
||||
datap[0] = outputs[0];
|
||||
datap[1] = outputs[1];
|
||||
|
||||
memset(datap[0], 0, sizeof(*datap[0])*length);
|
||||
memset(datap[1], 0, sizeof(*datap[1])*length);
|
||||
memset(datap[0], 0, sizeof(*datap[0])*samples);
|
||||
memset(datap[1], 0, sizeof(*datap[1])*samples);
|
||||
|
||||
|
||||
for(i=0;i<length;++i)
|
||||
for(i=0;i<samples;++i)
|
||||
{
|
||||
signed int smpl=0;
|
||||
signed int smpr=0;
|
||||
|
@ -45,14 +45,14 @@ struct namco_63701x
|
||||
static const int vol_table[4] = { 26, 84, 200, 258 };
|
||||
|
||||
|
||||
static void namco_63701x_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( namco_63701x_update )
|
||||
{
|
||||
struct namco_63701x *chip = param;
|
||||
int ch;
|
||||
|
||||
for (ch = 0;ch < 2;ch++)
|
||||
{
|
||||
stream_sample_t *buf = buffer[ch];
|
||||
stream_sample_t *buf = outputs[ch];
|
||||
voice *v = &chip->voices[ch];
|
||||
|
||||
if (v->playing)
|
||||
@ -62,7 +62,7 @@ static void namco_63701x_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
int vol = vol_table[v->volume];
|
||||
int p;
|
||||
|
||||
for (p = 0;p < length;p++)
|
||||
for (p = 0;p < samples;p++)
|
||||
{
|
||||
if (v->silence_counter)
|
||||
{
|
||||
@ -94,7 +94,7 @@ static void namco_63701x_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
v->position = pos;
|
||||
}
|
||||
else
|
||||
memset(buf, 0, length * sizeof(*buf));
|
||||
memset(buf, 0, samples * sizeof(*buf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,14 +160,14 @@ INLINE UINT32 namco_update_one(struct namco_sound *chip, stream_sample_t *buffer
|
||||
|
||||
|
||||
/* generate sound to the mix buffer in mono */
|
||||
static void namco_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( namco_update_mono )
|
||||
{
|
||||
struct namco_sound *chip = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
sound_channel *voice;
|
||||
|
||||
/* zap the contents of the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
|
||||
/* if no sound, we're done */
|
||||
if (chip->sound_enable == 0)
|
||||
@ -194,7 +194,7 @@ static void namco_update_mono(void *param, stream_sample_t **inputs, stream_samp
|
||||
int i;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
@ -235,7 +235,7 @@ static void namco_update_mono(void *param, stream_sample_t **inputs, stream_samp
|
||||
const INT16 *w = &chip->waveform[v][voice->waveform_select * 32];
|
||||
|
||||
/* generate sound into buffer and update the counter for this voice */
|
||||
voice->counter = namco_update_one(chip, mix, length, w, voice->counter, voice->frequency);
|
||||
voice->counter = namco_update_one(chip, mix, samples, w, voice->counter, voice->frequency);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,14 +243,14 @@ static void namco_update_mono(void *param, stream_sample_t **inputs, stream_samp
|
||||
|
||||
|
||||
/* generate sound to the mix buffer in stereo */
|
||||
static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( namco_update_stereo )
|
||||
{
|
||||
struct namco_sound *chip = param;
|
||||
sound_channel *voice;
|
||||
|
||||
/* zap the contents of the buffers */
|
||||
memset(buffer[0], 0, length * sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length * sizeof(*buffer[1]));
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples * sizeof(*outputs[1]));
|
||||
|
||||
/* if no sound, we're done */
|
||||
if (chip->sound_enable == 0)
|
||||
@ -259,8 +259,8 @@ static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sa
|
||||
/* loop over each voice and add its contribution */
|
||||
for (voice = chip->channel_list; voice < chip->last_channel; voice++)
|
||||
{
|
||||
stream_sample_t *lmix = buffer[0];
|
||||
stream_sample_t *rmix = buffer[1];
|
||||
stream_sample_t *lmix = outputs[0];
|
||||
stream_sample_t *rmix = outputs[1];
|
||||
int lv = voice->volume[0];
|
||||
int rv = voice->volume[1];
|
||||
|
||||
@ -280,7 +280,7 @@ static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sa
|
||||
int i;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
@ -333,7 +333,7 @@ static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sa
|
||||
const INT16 *lw = &chip->waveform[lv][voice->waveform_select * 32];
|
||||
|
||||
/* generate sound into the buffer */
|
||||
c = namco_update_one(chip, lmix, length, lw, voice->counter, voice->frequency);
|
||||
c = namco_update_one(chip, lmix, samples, lw, voice->counter, voice->frequency);
|
||||
}
|
||||
|
||||
/* only update if we have non-zero right volume */
|
||||
@ -342,7 +342,7 @@ static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sa
|
||||
const INT16 *rw = &chip->waveform[rv][voice->waveform_select * 32];
|
||||
|
||||
/* generate sound into the buffer */
|
||||
c = namco_update_one(chip, rmix, length, rw, voice->counter, voice->frequency);
|
||||
c = namco_update_one(chip, rmix, samples, rw, voice->counter, voice->frequency);
|
||||
}
|
||||
|
||||
/* update the counter for this voice */
|
||||
|
@ -72,19 +72,19 @@ struct namco_52xx
|
||||
static void namco_52xx_reset(struct namco_52xx *chip);
|
||||
|
||||
|
||||
static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( namco_52xx_stream_update_one )
|
||||
{
|
||||
struct namco_52xx *chip = param;
|
||||
int i, rom_pos, whole_pb_cycles, buf;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
if (chip->n52_start >= chip->n52_end)
|
||||
{
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
chip->n52_pb_cycle += chip->n52_step;
|
||||
if (chip->n52_pb_cycle >= 1)
|
||||
@ -97,8 +97,8 @@ static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs,
|
||||
if (chip->n52_pos > chip->n52_length)
|
||||
{
|
||||
/* sample done */
|
||||
memset(&buffer[i], 0, (length - i) * sizeof(INT16));
|
||||
i = length;
|
||||
memset(&buffer[i], 0, (samples - i) * sizeof(INT16));
|
||||
i = samples;
|
||||
namco_52xx_reset(chip);
|
||||
}
|
||||
else
|
||||
|
@ -660,10 +660,10 @@ WRITE8_HANDLER( nes_psg_0_w ) {apu_write(0,offset,data);}
|
||||
WRITE8_HANDLER( nes_psg_1_w ) {apu_write(1,offset,data);}
|
||||
|
||||
/* UPDATE APU SYSTEM */
|
||||
static void nes_psg_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( nes_psg_update_sound )
|
||||
{
|
||||
struct nesapu_info *info = param;
|
||||
apu_update(info, buffer[0], length);
|
||||
apu_update(info, outputs[0], samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,7 @@ WRITE16_HANDLER(nile_snd_w)
|
||||
// printf("v%02d: %04x to reg %02d (PC=%x)\n", v, nile_sound_regs[offset], r, cpu_get_pc(space->cpu));
|
||||
}
|
||||
|
||||
static void nile_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( nile_update )
|
||||
{
|
||||
struct nile_info *info = param;
|
||||
UINT8 *sound_ram = info->sound_ram;
|
||||
@ -144,7 +144,7 @@ static void nile_update(void *param, stream_sample_t **inputs, stream_sample_t *
|
||||
|
||||
lsptr=leptr=0;
|
||||
|
||||
memset(mix, 0, sizeof(mix[0])*length*2);
|
||||
memset(mix, 0, sizeof(mix[0])*samples*2);
|
||||
|
||||
for (v = 0; v < NILE_VOICES; v++)
|
||||
{
|
||||
@ -161,7 +161,7 @@ static void nile_update(void *param, stream_sample_t **inputs, stream_sample_t *
|
||||
lsptr = slot[NILE_REG_LSPTR_HI]<<16 | slot[NILE_REG_LSPTR_LO];
|
||||
leptr = slot[NILE_REG_LEPTR_HI]<<16 | slot[NILE_REG_LEPTR_LO];
|
||||
|
||||
for (snum = 0; snum < length; snum++)
|
||||
for (snum = 0; snum < samples; snum++)
|
||||
{
|
||||
sample = sound_ram[sptr + info->vpos[v]]<<8;
|
||||
|
||||
@ -209,7 +209,7 @@ static void nile_update(void *param, stream_sample_t **inputs, stream_sample_t *
|
||||
}
|
||||
}
|
||||
mixp = &mix[0];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outputs[0][i] = (*mixp++)>>4;
|
||||
outputs[1][i] = (*mixp++)>>4;
|
||||
|
@ -120,7 +120,7 @@ static INT16 clock_adpcm(struct okim6258 *chip, UINT8 nibble)
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void okim6258_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( okim6258_update )
|
||||
{
|
||||
struct okim6258 *chip = param;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
@ -251,7 +251,7 @@ static void generate_adpcm(struct okim6295 *chip, struct ADPCMVoice *voice, INT1
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void okim6295_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( okim6295_update )
|
||||
{
|
||||
struct okim6295 *chip = param;
|
||||
int i;
|
||||
|
@ -336,7 +336,7 @@ static TIMER_CALLBACK( pokey_pot_trigger );
|
||||
chip->samplepos_whole++; \
|
||||
/* store sum of output signals into the buffer */ \
|
||||
*buffer++ = (sum > 0x7fff) ? 0x7fff : sum; \
|
||||
length--
|
||||
samples--
|
||||
|
||||
#if HEAVY_MACRO_USAGE
|
||||
|
||||
@ -357,7 +357,7 @@ static TIMER_CALLBACK( pokey_pot_trigger );
|
||||
sum += chip->volume[CHAN3]; \
|
||||
if( chip->output[CHAN4] ) \
|
||||
sum += chip->volume[CHAN4]; \
|
||||
while( length > 0 ) \
|
||||
while( samples > 0 ) \
|
||||
{ \
|
||||
if( chip->counter[CHAN1] < chip->samplepos_whole ) \
|
||||
{ \
|
||||
@ -486,7 +486,7 @@ static TIMER_CALLBACK( pokey_pot_trigger );
|
||||
sum += chip->volume[CHAN3]; \
|
||||
if( chip->output[CHAN4] ) \
|
||||
sum += chip->volume[CHAN4]; \
|
||||
while( length > 0 ) \
|
||||
while( samples > 0 ) \
|
||||
{ \
|
||||
UINT32 event = chip->samplepos_whole; \
|
||||
UINT32 channel = SAMPLE; \
|
||||
@ -524,10 +524,10 @@ static TIMER_CALLBACK( pokey_pot_trigger );
|
||||
#endif
|
||||
|
||||
|
||||
static void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( pokey_update )
|
||||
{
|
||||
struct POKEYregisters *chip = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
PROCESS_POKEY(chip);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ INLINE int limit( int v )
|
||||
return v;
|
||||
}
|
||||
|
||||
static void PSXSPU_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( PSXSPU_update )
|
||||
{
|
||||
struct psxinfo *chip = param;
|
||||
int v;
|
||||
@ -136,15 +136,15 @@ static void PSXSPU_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
{ 122, -60 }
|
||||
};
|
||||
|
||||
memset( buffer[ 0 ], 0, length * sizeof( *buffer[ 0 ] ));
|
||||
memset( buffer[ 1 ], 0, length * sizeof( *buffer[ 1 ] ));
|
||||
memset( outputs[ 0 ], 0, samples * sizeof( *outputs[ 0 ] ));
|
||||
memset( outputs[ 1 ], 0, samples * sizeof( *outputs[ 1 ] ));
|
||||
|
||||
for( n_channel = 0; n_channel < MAX_CHANNEL; n_channel++ )
|
||||
{
|
||||
voll = volume( chip->m_p_n_volumeleft[ n_channel ] );
|
||||
volr = volume( chip->m_p_n_volumeright[ n_channel ] );
|
||||
|
||||
for( n_sample = 0; n_sample < length; n_sample++ )
|
||||
for( n_sample = 0; n_sample < samples; n_sample++ )
|
||||
{
|
||||
if( chip->m_p_n_blockoffset[ n_channel ] >= ( SAMPLES_PER_BLOCK << PITCH_SHIFT ) )
|
||||
{
|
||||
@ -207,8 +207,8 @@ static void PSXSPU_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
}
|
||||
v = chip->m_p_n_blockbuffer[ ( n_channel * SAMPLES_PER_BLOCK ) + ( chip->m_p_n_blockoffset[ n_channel ] >> PITCH_SHIFT ) ];
|
||||
chip->m_p_n_blockoffset[ n_channel ] += chip->m_p_n_pitch[ n_channel ];
|
||||
buffer[ 0 ][ n_sample ] = limit( buffer[ 0 ][ n_sample ] + ( ( v * voll ) / 0x4000 ) );
|
||||
buffer[ 1 ][ n_sample ] = limit( buffer[ 1 ][ n_sample ] + ( ( v * volr ) / 0x4000 ) );
|
||||
outputs[ 0 ][ n_sample ] = limit( outputs[ 0 ][ n_sample ] + ( ( v * voll ) / 0x4000 ) );
|
||||
outputs[ 1 ][ n_sample ] = limit( outputs[ 1 ][ n_sample ] + ( ( v * volr ) / 0x4000 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ struct qsound_info
|
||||
};
|
||||
|
||||
/* Function prototypes */
|
||||
static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length );
|
||||
static STREAM_UPDATE( qsound_update );
|
||||
static void qsound_set_command(struct qsound_info *chip, int data, int value);
|
||||
|
||||
static SND_START( qsound )
|
||||
@ -304,7 +304,7 @@ static void qsound_set_command(struct qsound_info *chip, int data, int value)
|
||||
}
|
||||
|
||||
|
||||
static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
|
||||
static STREAM_UPDATE( qsound_update )
|
||||
{
|
||||
struct qsound_info *chip = param;
|
||||
int i,j;
|
||||
@ -312,10 +312,10 @@ static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_
|
||||
struct QSOUND_CHANNEL *pC=&chip->channel[0];
|
||||
stream_sample_t *datap[2];
|
||||
|
||||
datap[0] = buffer[0];
|
||||
datap[1] = buffer[1];
|
||||
memset( datap[0], 0x00, length * sizeof(*datap[0]) );
|
||||
memset( datap[1], 0x00, length * sizeof(*datap[1]) );
|
||||
datap[0] = outputs[0];
|
||||
datap[1] = outputs[1];
|
||||
memset( datap[0], 0x00, samples * sizeof(*datap[0]) );
|
||||
memset( datap[1], 0x00, samples * sizeof(*datap[1]) );
|
||||
|
||||
for (i=0; i<QSOUND_CHANNELS; i++)
|
||||
{
|
||||
@ -326,7 +326,7 @@ static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_
|
||||
rvol=(pC->rvol*pC->vol)>>8;
|
||||
lvol=(pC->lvol*pC->vol)>>8;
|
||||
|
||||
for (j=length-1; j>=0; j--)
|
||||
for (j=samples-1; j>=0; j--)
|
||||
{
|
||||
count=(pC->offset)>>16;
|
||||
pC->offset &= 0xffff;
|
||||
@ -358,9 +358,9 @@ static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_
|
||||
}
|
||||
|
||||
if (chip->fpRawDataL)
|
||||
fwrite(datap[0], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL);
|
||||
fwrite(datap[0], samples*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL);
|
||||
if (chip->fpRawDataR)
|
||||
fwrite(datap[1], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR);
|
||||
fwrite(datap[1], samples*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ static UINT8 decode80(UINT8 val)
|
||||
return val;
|
||||
}
|
||||
|
||||
static void rf5c400_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( rf5c400_update )
|
||||
{
|
||||
int i, ch;
|
||||
struct rf5c400_info *info = param;
|
||||
@ -113,14 +113,14 @@ static void rf5c400_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
UINT8 env_phase;
|
||||
double env_level, env_step, env_rstep;
|
||||
|
||||
memset(buffer[0], 0, length * sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length * sizeof(*buffer[1]));
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples * sizeof(*outputs[1]));
|
||||
|
||||
for (ch=0; ch < 32; ch++)
|
||||
{
|
||||
struct RF5C400_CHANNEL *channel = &info->channels[ch];
|
||||
stream_sample_t *buf0 = buffer[0];
|
||||
stream_sample_t *buf1 = buffer[1];
|
||||
stream_sample_t *buf0 = outputs[0];
|
||||
stream_sample_t *buf1 = outputs[1];
|
||||
|
||||
start = ((channel->startH & 0xFF00) << 8) | channel->startL;
|
||||
end = ((channel->endHloopH & 0xFF) << 16) | channel->endL;
|
||||
@ -136,7 +136,7 @@ static void rf5c400_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
env_step = channel->env_step;
|
||||
env_rstep = env_step * channel->env_scale;
|
||||
|
||||
for (i=0; i < length; i++)
|
||||
for (i=0; i < samples; i++)
|
||||
{
|
||||
INT16 tmp;
|
||||
INT32 sample;
|
||||
|
@ -39,16 +39,16 @@ struct rf5c68pcm
|
||||
/* RF5C68 stream update */
|
||||
/************************************************/
|
||||
|
||||
static void rf5c68_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( rf5c68_update )
|
||||
{
|
||||
struct rf5c68pcm *chip = param;
|
||||
stream_sample_t *left = buffer[0];
|
||||
stream_sample_t *right = buffer[1];
|
||||
stream_sample_t *left = outputs[0];
|
||||
stream_sample_t *right = outputs[1];
|
||||
int i, j;
|
||||
|
||||
/* start with clean buffers */
|
||||
memset(left, 0, length * sizeof(*left));
|
||||
memset(right, 0, length * sizeof(*right));
|
||||
memset(left, 0, samples * sizeof(*left));
|
||||
memset(right, 0, samples * sizeof(*right));
|
||||
|
||||
/* bail if not enabled */
|
||||
if (!chip->enable)
|
||||
@ -66,7 +66,7 @@ static void rf5c68_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
int rv = ((chan->pan >> 4) & 0x0f) * chan->env;
|
||||
|
||||
/* loop over the sample buffer */
|
||||
for (j = 0; j < length; j++)
|
||||
for (j = 0; j < samples; j++)
|
||||
{
|
||||
int sample;
|
||||
|
||||
@ -100,7 +100,7 @@ static void rf5c68_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
}
|
||||
|
||||
/* now clamp and shift the result (output is only 10 bits) */
|
||||
for (j = 0; j < length; j++)
|
||||
for (j = 0; j < samples; j++)
|
||||
{
|
||||
stream_sample_t temp;
|
||||
|
||||
|
@ -532,7 +532,7 @@ static void s14001a_clock(S14001AChip *chip) /* called once per clock */
|
||||
MAME glue code
|
||||
**************************************************************************/
|
||||
|
||||
static void s14001a_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( s14001a_pcm_update )
|
||||
{
|
||||
INT32 mix[48000];
|
||||
INT32 *mixp;
|
||||
@ -542,7 +542,7 @@ static void s14001a_pcm_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
memset(mix, 0, sizeof(mix));
|
||||
|
||||
mixp = &mix[0];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
s14001a_clock(chip);
|
||||
if (chip->audioout == ALTFLAG) // input from test pins -> output
|
||||
|
@ -212,7 +212,7 @@ static void saa1099_envelope(struct SAA1099 *saa, int ch)
|
||||
}
|
||||
|
||||
|
||||
static void saa1099_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( saa1099_update )
|
||||
{
|
||||
struct SAA1099 *saa = param;
|
||||
int j, ch;
|
||||
@ -221,8 +221,8 @@ static void saa1099_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
if (!saa->all_ch_enable)
|
||||
{
|
||||
/* init output data */
|
||||
memset(buffer[LEFT],0,length*sizeof(*buffer[LEFT]));
|
||||
memset(buffer[RIGHT],0,length*sizeof(*buffer[RIGHT]));
|
||||
memset(outputs[LEFT],0,samples*sizeof(*outputs[LEFT]));
|
||||
memset(outputs[RIGHT],0,samples*sizeof(*outputs[RIGHT]));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ static void saa1099_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
}
|
||||
|
||||
/* fill all data needed */
|
||||
for( j = 0; j < length; j++ )
|
||||
for( j = 0; j < samples; j++ )
|
||||
{
|
||||
int output_l = 0, output_r = 0;
|
||||
|
||||
@ -305,8 +305,8 @@ static void saa1099_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
}
|
||||
}
|
||||
/* write sound data to the buffer */
|
||||
buffer[LEFT][j] = output_l / 6;
|
||||
buffer[RIGHT][j] = output_r / 6;
|
||||
outputs[LEFT][j] = output_l / 6;
|
||||
outputs[RIGHT][j] = output_r / 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,10 +442,10 @@ int sample_loaded(int samplenum)
|
||||
}
|
||||
|
||||
|
||||
static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( sample_update_sound )
|
||||
{
|
||||
struct sample_channel *chan = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
if (chan->source && !chan->paused)
|
||||
{
|
||||
@ -456,7 +456,7 @@ static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sa
|
||||
const INT16 *sample = chan->source;
|
||||
UINT32 sample_length = chan->source_length;
|
||||
|
||||
while (length--)
|
||||
while (samples--)
|
||||
{
|
||||
/* do a linear interp on the sample */
|
||||
INT32 sample1 = sample[pos];
|
||||
@ -478,8 +478,8 @@ static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sa
|
||||
{
|
||||
chan->source = NULL;
|
||||
chan->source_num = -1;
|
||||
if (length > 0)
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
if (samples > 0)
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -490,7 +490,7 @@ static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sa
|
||||
chan->frac = frac;
|
||||
}
|
||||
else
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1212,11 +1212,11 @@ int SCSP_IRQCB(void *param)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void SCSP_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
|
||||
static STREAM_UPDATE( SCSP_Update )
|
||||
{
|
||||
struct _SCSP *SCSP = param;
|
||||
bufferl = buf[0];
|
||||
bufferr = buf[1];
|
||||
bufferl = outputs[0];
|
||||
bufferr = outputs[1];
|
||||
length = samples;
|
||||
SCSP_DoMasterSamples(SCSP, samples);
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ struct segapcm
|
||||
sound_stream * stream;
|
||||
};
|
||||
|
||||
static void SEGAPCM_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( SEGAPCM_update )
|
||||
{
|
||||
struct segapcm *spcm = param;
|
||||
int ch;
|
||||
|
||||
/* clear the buffers */
|
||||
memset(buffer[0], 0, length*sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length*sizeof(*buffer[1]));
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[1]));
|
||||
|
||||
/* loop over channels */
|
||||
for (ch = 0; ch < 16; ch++)
|
||||
@ -43,7 +43,7 @@ static void SEGAPCM_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
int i;
|
||||
|
||||
/* loop over samples on this channel */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
INT8 v = 0;
|
||||
|
||||
@ -63,8 +63,8 @@ static void SEGAPCM_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
v = rom[addr >> 8] - 0x80;
|
||||
|
||||
/* apply panning and advance */
|
||||
buffer[0][i] += v * voll;
|
||||
buffer[1][i] += v * volr;
|
||||
outputs[0][i] += v * voll;
|
||||
outputs[1][i] += v * volr;
|
||||
addr += delta;
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@ static SID6581 *get_sid(int indx)
|
||||
|
||||
|
||||
|
||||
static void sid_update(void *token,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( sid_update )
|
||||
{
|
||||
SID6581 *sid = (SID6581 *) token;
|
||||
sidEmuFillBuffer(sid, _buffer[0], length);
|
||||
SID6581 *sid = (SID6581 *) param;
|
||||
sidEmuFillBuffer(sid, outputs[0], samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1959,7 +1959,7 @@ void sn76477_feedback_res_w(int chip, double data)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void SN76477_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( SN76477_update )
|
||||
{
|
||||
double one_shot_cap_charging_step;
|
||||
double one_shot_cap_discharging_step;
|
||||
@ -1979,7 +1979,7 @@ static void SN76477_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
double center_to_peak_voltage_out;
|
||||
|
||||
struct SN76477 *sn = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
|
||||
#if TEST_MODE
|
||||
@ -2017,8 +2017,8 @@ static void SN76477_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
center_to_peak_voltage_out = compute_center_to_peak_voltage_out(sn);
|
||||
|
||||
|
||||
/* process 'length' number of samples */
|
||||
while (length--)
|
||||
/* process 'samples' number of samples */
|
||||
while (samples--)
|
||||
{
|
||||
/* update the one-shot cap voltage */
|
||||
if (!sn->one_shot_cap_voltage_ext)
|
||||
|
@ -134,11 +134,11 @@ WRITE8_HANDLER( sn76496_3_w ) { SN76496Write(3,data); }
|
||||
WRITE8_HANDLER( sn76496_4_w ) { SN76496Write(4,data); }
|
||||
|
||||
|
||||
static void SN76496Update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( SN76496Update )
|
||||
{
|
||||
int i;
|
||||
struct SN76496 *R = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
|
||||
/* If the volume is 0, increase the counter */
|
||||
@ -146,14 +146,14 @@ static void SN76496Update(void *param,stream_sample_t **inputs, stream_sample_t
|
||||
{
|
||||
if (R->Volume[i] == 0)
|
||||
{
|
||||
/* note that I do count += length, NOT count = length + 1. You might think */
|
||||
/* note that I do count += samples, NOT count = samples + 1. You might think */
|
||||
/* it's the same since the volume is 0, but doing the latter could cause */
|
||||
/* interferencies when the program is rapidly modulating the volume. */
|
||||
if (R->Count[i] <= length*STEP) R->Count[i] += length*STEP;
|
||||
if (R->Count[i] <= samples*STEP) R->Count[i] += samples*STEP;
|
||||
}
|
||||
}
|
||||
|
||||
while (length > 0)
|
||||
while (samples > 0)
|
||||
{
|
||||
int vol[4];
|
||||
unsigned int out;
|
||||
@ -245,7 +245,7 @@ static void SN76496Update(void *param,stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
*(buffer++) = out / STEP;
|
||||
|
||||
length--;
|
||||
samples--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ static void update_waveform(struct snkwave_sound *chip, unsigned int offset, UIN
|
||||
|
||||
|
||||
/* generate sound to the mix buffer */
|
||||
static void snkwave_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( snkwave_update )
|
||||
{
|
||||
struct snkwave_sound *chip = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* zap the contents of the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
|
||||
assert(chip->counter < 0x1000);
|
||||
assert(chip->frequency < 0x1000);
|
||||
@ -69,7 +69,7 @@ static void snkwave_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
return;
|
||||
|
||||
/* generate sound into buffer while updating the counter */
|
||||
while (length-- > 0)
|
||||
while (samples-- > 0)
|
||||
{
|
||||
int loops;
|
||||
INT16 out = 0;
|
||||
|
@ -123,12 +123,12 @@ static TIMER_CALLBACK( sp0250_timer_tick )
|
||||
stream_update(sp->stream);
|
||||
}
|
||||
|
||||
static void sp0250_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( sp0250_update )
|
||||
{
|
||||
struct sp0250 *sp = param;
|
||||
stream_sample_t *output = buffer[0];
|
||||
stream_sample_t *output = outputs[0];
|
||||
int i;
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
if (sp->playing)
|
||||
{
|
||||
|
@ -1091,14 +1091,14 @@ static void sp0256_micro(struct sp0256 *sp)
|
||||
}
|
||||
}
|
||||
|
||||
static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( sp0256_update )
|
||||
{
|
||||
struct sp0256 *sp = param;
|
||||
stream_sample_t *output = buffer[0];
|
||||
stream_sample_t *output = outputs[0];
|
||||
int output_index = 0;
|
||||
int samples, did_samp, old_idx;
|
||||
int length, did_samp, old_idx;
|
||||
|
||||
while( output_index < length )
|
||||
while( output_index < samples )
|
||||
{
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* First, drain as much of our scratch buffer as we can into the */
|
||||
@ -1110,17 +1110,17 @@ static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
output[output_index++] = sp->scratch[sp->sc_tail++ & SCBUF_MASK];
|
||||
sp->sc_tail &= SCBUF_MASK;
|
||||
|
||||
if( output_index > length )
|
||||
if( output_index > samples )
|
||||
break;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* If output buffer is full, then we're done. */
|
||||
/* If output outputs is full, then we're done. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
if( output_index > length )
|
||||
if( output_index > samples )
|
||||
break;
|
||||
|
||||
samples = length - output_index;
|
||||
length = samples - output_index;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Process the current set of filter coefficients as long as the */
|
||||
@ -1128,7 +1128,7 @@ static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
/* ---------------------------------------------------------------- */
|
||||
did_samp = 0;
|
||||
old_idx = sp->sc_head;
|
||||
if (samples > 0) do
|
||||
if (length > 0) do
|
||||
{
|
||||
int do_samp;
|
||||
|
||||
@ -1141,7 +1141,7 @@ static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
/* ------------------------------------------------------------ */
|
||||
/* Do as many samples as we can. */
|
||||
/* ------------------------------------------------------------ */
|
||||
do_samp = samples - did_samp;
|
||||
do_samp = length - did_samp;
|
||||
if (sp->sc_head + do_samp - sp->sc_tail > SCBUF_SIZE)
|
||||
do_samp = sp->sc_tail + SCBUF_SIZE - sp->sc_head;
|
||||
|
||||
@ -1164,7 +1164,7 @@ static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
sp->sc_head &= SCBUF_MASK;
|
||||
|
||||
} while (sp->filt.rpt >= 0 && samples > did_samp);
|
||||
} while (sp->filt.rpt >= 0 && length > did_samp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,13 +23,13 @@ struct speaker
|
||||
|
||||
|
||||
|
||||
static void speaker_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( speaker_sound_update )
|
||||
{
|
||||
struct speaker *sp = (struct speaker *) param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int volume = sp->levels[sp->level];
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
*buffer++ = volume;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ WRITE8_HANDLER(st0016_snd_w)
|
||||
}
|
||||
}
|
||||
|
||||
static void st0016_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( st0016_update )
|
||||
{
|
||||
struct st0016_info *info = param;
|
||||
UINT8 *sound_ram = *info->sound_ram;
|
||||
@ -59,7 +59,7 @@ static void st0016_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
INT16 sample;
|
||||
int sptr, eptr, freq, lsptr, leptr;
|
||||
|
||||
memset(mix, 0, sizeof(mix[0])*length*2);
|
||||
memset(mix, 0, sizeof(mix[0])*samples*2);
|
||||
|
||||
for (v = 0; v < 8; v++)
|
||||
{
|
||||
@ -75,7 +75,7 @@ static void st0016_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
lsptr = slot[0x06]<<16 | slot[0x05]<<8 | slot[0x04];
|
||||
leptr = slot[0x0a]<<16 | slot[0x09]<<8 | slot[0x08];
|
||||
|
||||
for (snum = 0; snum < length; snum++)
|
||||
for (snum = 0; snum < samples; snum++)
|
||||
{
|
||||
sample = sound_ram[(sptr + info->vpos[v])&0x1fffff]<<8;
|
||||
|
||||
@ -117,7 +117,7 @@ static void st0016_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
}
|
||||
|
||||
mixp = &mix[0];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outputs[0][i] = (*mixp++)>>4;
|
||||
outputs[1][i] = (*mixp++)>>4;
|
||||
|
@ -10,10 +10,10 @@ struct tia_info
|
||||
};
|
||||
|
||||
|
||||
static void tia_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( tia_update )
|
||||
{
|
||||
struct tia_info *info = param;
|
||||
tia_process(info->chip, buffer[0], length);
|
||||
tia_process(info->chip, outputs[0], samples);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,14 +20,14 @@ struct TMS3615 {
|
||||
int enable; /* mask which tones to play */
|
||||
};
|
||||
|
||||
static void tms3615_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( tms3615_sound_update )
|
||||
{
|
||||
struct TMS3615 *tms = param;
|
||||
int samplerate = tms->samplerate;
|
||||
stream_sample_t *buffer8 = _buffer[TMS3615_FOOTAGE_8];
|
||||
stream_sample_t *buffer16 = _buffer[TMS3615_FOOTAGE_16];
|
||||
stream_sample_t *buffer8 = outputs[TMS3615_FOOTAGE_8];
|
||||
stream_sample_t *buffer16 = outputs[TMS3615_FOOTAGE_16];
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
int sum8 = 0, sum16 = 0, tone = 0;
|
||||
|
||||
|
@ -341,21 +341,21 @@ static const int *const tunes[] = {NULL,tune1,tune2,tune3,tune4};
|
||||
|
||||
|
||||
|
||||
static void tms36xx_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( tms36xx_sound_update )
|
||||
{
|
||||
struct TMS36XX *tms = param;
|
||||
int samplerate = tms->samplerate;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* no tune played? */
|
||||
if( !tunes[tms->tune_num] || tms->voices == 0 )
|
||||
{
|
||||
while (--length >= 0)
|
||||
buffer[length] = 0;
|
||||
while (--samples >= 0)
|
||||
buffer[samples] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
int sum = 0;
|
||||
|
||||
|
@ -459,14 +459,14 @@ static void advance_state(struct upd7759_chip *chip)
|
||||
|
||||
*************************************************************/
|
||||
|
||||
static void upd7759_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int samples)
|
||||
static STREAM_UPDATE( upd7759_update )
|
||||
{
|
||||
struct upd7759_chip *chip = param;
|
||||
INT32 clocks_left = chip->clocks_left;
|
||||
INT16 sample = chip->sample;
|
||||
UINT32 step = chip->step;
|
||||
UINT32 pos = chip->pos;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* loop until done */
|
||||
if (chip->state != STATE_IDLE)
|
||||
|
@ -287,20 +287,20 @@ static int parse_frame (struct vlm5030_info *chip)
|
||||
}
|
||||
|
||||
/* decode and buffering data */
|
||||
static void vlm5030_update_callback(void *param,stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( vlm5030_update_callback )
|
||||
{
|
||||
struct vlm5030_info *chip = param;
|
||||
int buf_count=0;
|
||||
int interp_effect;
|
||||
int i;
|
||||
int u[11];
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* running */
|
||||
if( chip->phase == PH_RUN || chip->phase == PH_STOP )
|
||||
{
|
||||
/* playing speech */
|
||||
while (length > 0)
|
||||
while (samples > 0)
|
||||
{
|
||||
int current_val;
|
||||
|
||||
@ -401,7 +401,7 @@ static void vlm5030_update_callback(void *param,stream_sample_t **inputs, stream
|
||||
if (chip->pitch_count >= chip->current_pitch )
|
||||
chip->pitch_count = 0;
|
||||
/* size */
|
||||
length--;
|
||||
samples--;
|
||||
}
|
||||
/* return;*/
|
||||
}
|
||||
@ -410,7 +410,7 @@ phase_stop:
|
||||
switch( chip->phase )
|
||||
{
|
||||
case PH_SETUP:
|
||||
if( chip->sample_count <= length)
|
||||
if( chip->sample_count <= samples)
|
||||
{
|
||||
chip->sample_count = 0;
|
||||
/* logerror("VLM5030 BSY=H\n" ); */
|
||||
@ -419,11 +419,11 @@ phase_stop:
|
||||
}
|
||||
else
|
||||
{
|
||||
chip->sample_count -= length;
|
||||
chip->sample_count -= samples;
|
||||
}
|
||||
break;
|
||||
case PH_END:
|
||||
if( chip->sample_count <= length)
|
||||
if( chip->sample_count <= samples)
|
||||
{
|
||||
chip->sample_count = 0;
|
||||
/* logerror("VLM5030 BSY=L\n" ); */
|
||||
@ -432,14 +432,14 @@ phase_stop:
|
||||
}
|
||||
else
|
||||
{
|
||||
chip->sample_count -= length;
|
||||
chip->sample_count -= samples;
|
||||
}
|
||||
}
|
||||
/* silent buffering */
|
||||
while (length > 0)
|
||||
while (samples > 0)
|
||||
{
|
||||
buffer[buf_count++] = 0x00;
|
||||
length--;
|
||||
samples--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,10 @@ static const char *const VotraxTable[65] =
|
||||
0
|
||||
};
|
||||
|
||||
static void votrax_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
|
||||
static STREAM_UPDATE( votrax_update_sound )
|
||||
{
|
||||
struct votrax_info *info = param;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
if (info->sample)
|
||||
{
|
||||
|
@ -25,10 +25,10 @@ struct _VR0Chip
|
||||
|
||||
static void VR0_RenderAudio(struct _VR0Chip *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r);
|
||||
|
||||
static void VR0_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
|
||||
static STREAM_UPDATE( VR0_Update )
|
||||
{
|
||||
struct _VR0Chip *VR0 = param;
|
||||
VR0_RenderAudio(VR0, samples,buf[0],buf[1]);
|
||||
VR0_RenderAudio(VR0, samples,outputs[0],outputs[1]);
|
||||
}
|
||||
|
||||
//Correct table thanks to Evoga
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
|
||||
static void wave_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( wave_sound_update )
|
||||
{
|
||||
#ifdef MESS
|
||||
const device_config *image = param;
|
||||
@ -30,7 +30,7 @@ static void wave_sound_update(void *param,stream_sample_t **inputs, stream_sampl
|
||||
cassette_state state;
|
||||
double time_index;
|
||||
double duration;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i;
|
||||
|
||||
state = cassette_get_state(image);
|
||||
@ -40,16 +40,16 @@ static void wave_sound_update(void *param,stream_sample_t **inputs, stream_sampl
|
||||
{
|
||||
cassette = cassette_get_image(image);
|
||||
time_index = cassette_get_position(image);
|
||||
duration = ((double) length) / image->machine->sample_rate;
|
||||
duration = ((double) samples) / image->machine->sample_rate;
|
||||
|
||||
cassette_get_samples(cassette, 0, time_index, duration, length, 2, buffer, CASSETTE_WAVEFORM_16BIT);
|
||||
cassette_get_samples(cassette, 0, time_index, duration, samples, 2, buffer, CASSETTE_WAVEFORM_16BIT);
|
||||
|
||||
for (i = length-1; i >= 0; i--)
|
||||
for (i = samples-1; i >= 0; i--)
|
||||
buffer[i] = ((INT16 *) buffer)[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(buffer, 0, sizeof(*buffer) * length);
|
||||
memset(buffer, 0, sizeof(*buffer) * samples);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ struct x1_010_info
|
||||
/*--------------------------------------------------------------
|
||||
generate sound to the mix buffer
|
||||
--------------------------------------------------------------*/
|
||||
static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
|
||||
static STREAM_UPDATE( seta_update )
|
||||
{
|
||||
struct x1_010_info *info = param;
|
||||
X1_010_CHANNEL *reg;
|
||||
@ -113,16 +113,16 @@ static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t
|
||||
const UINT8 *snd1 = info->region;
|
||||
|
||||
// mixer buffer zero clear
|
||||
memset( buffer[0], 0, length*sizeof(*buffer[0]) );
|
||||
memset( buffer[1], 0, length*sizeof(*buffer[1]) );
|
||||
memset( outputs[0], 0, samples*sizeof(*outputs[0]) );
|
||||
memset( outputs[1], 0, samples*sizeof(*outputs[1]) );
|
||||
|
||||
// if( info->sound_enable == 0 ) return;
|
||||
|
||||
for( ch = 0; ch < SETA_NUM_CHANNELS; ch++ ) {
|
||||
reg = (X1_010_CHANNEL *)&(info->reg[ch*sizeof(X1_010_CHANNEL)]);
|
||||
if( (reg->status&1) != 0 ) { // Key On
|
||||
stream_sample_t *bufL = buffer[0];
|
||||
stream_sample_t *bufR = buffer[1];
|
||||
stream_sample_t *bufL = outputs[0];
|
||||
stream_sample_t *bufR = outputs[1];
|
||||
if( (reg->status&2) == 0 ) { // PCM sampling
|
||||
start = (INT8 *)(reg->start *0x1000+snd1);
|
||||
end = (INT8 *)((0x100-reg->end)*0x1000+snd1);
|
||||
@ -138,7 +138,7 @@ static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t
|
||||
LOG_SOUND(( "Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n",
|
||||
start, end, ch, volL, volR, freq, smp_step, smp_offs ));
|
||||
}
|
||||
for( i = 0; i < length; i++ ) {
|
||||
for( i = 0; i < samples; i++ ) {
|
||||
delta = smp_offs>>FREQ_BASE_BITS;
|
||||
// sample ended?
|
||||
if( start+delta >= end ) {
|
||||
@ -165,7 +165,7 @@ static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t
|
||||
LOG_SOUND(( "Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n",
|
||||
reg->volume, ch, reg->end, freq, smp_step, smp_offs ));
|
||||
}
|
||||
for( i = 0; i < length; i++ ) {
|
||||
for( i = 0; i < samples; i++ ) {
|
||||
int vol;
|
||||
delta = env_offs>>ENV_BASE_BITS;
|
||||
// Envelope one shot mode
|
||||
|
@ -675,14 +675,14 @@ INLINE INT32 calculate_1op_fm_1(YMF271Chip *chip, int slotnum)
|
||||
return slot_output;
|
||||
}
|
||||
|
||||
static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( ymf271_update )
|
||||
{
|
||||
int i, j;
|
||||
int op;
|
||||
INT32 *mixp;
|
||||
YMF271Chip *chip = param;
|
||||
|
||||
memset(mix, 0, sizeof(mix[0])*length*2);
|
||||
memset(mix, 0, sizeof(mix[0])*samples*2);
|
||||
|
||||
for (j = 0; j < 12; j++)
|
||||
{
|
||||
@ -707,7 +707,7 @@ static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
if (chip->slots[slot1].active)
|
||||
{
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
INT64 output1 = 0, output2 = 0, output3 = 0, output4 = 0, phase_mod1 = 0, phase_mod2 = 0;
|
||||
switch (chip->slots[slot1].algorithm)
|
||||
@ -893,7 +893,7 @@ static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
mixp = &mix[0];
|
||||
if (chip->slots[slot1].active)
|
||||
{
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
INT64 output1 = 0, output2 = 0, phase_mod = 0;
|
||||
switch (chip->slots[slot1].algorithm & 3)
|
||||
@ -946,7 +946,7 @@ static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
if (chip->slots[slot1].active)
|
||||
{
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
INT64 output1 = 0, output2 = 0, output3 = 0, phase_mod = 0;
|
||||
switch (chip->slots[slot1].algorithm & 7)
|
||||
@ -1028,16 +1028,16 @@ static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
}
|
||||
}
|
||||
|
||||
update_pcm(chip, j + (3*12), mixp, length);
|
||||
update_pcm(chip, j + (3*12), mixp, samples);
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: // PCM
|
||||
{
|
||||
update_pcm(chip, j + (0*12), mixp, length);
|
||||
update_pcm(chip, j + (1*12), mixp, length);
|
||||
update_pcm(chip, j + (2*12), mixp, length);
|
||||
update_pcm(chip, j + (3*12), mixp, length);
|
||||
update_pcm(chip, j + (0*12), mixp, samples);
|
||||
update_pcm(chip, j + (1*12), mixp, samples);
|
||||
update_pcm(chip, j + (2*12), mixp, samples);
|
||||
update_pcm(chip, j + (3*12), mixp, samples);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
}
|
||||
|
||||
mixp = &mix[0];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outputs[0][i] = (*mixp++)>>2;
|
||||
outputs[1][i] = (*mixp++)>>2;
|
||||
|
@ -255,7 +255,7 @@ static void ymf278b_envelope_next(YMF278BSlot *slot)
|
||||
}
|
||||
}
|
||||
|
||||
static void ymf278b_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( ymf278b_pcm_update )
|
||||
{
|
||||
YMF278BChip *chip = param;
|
||||
int i, j;
|
||||
@ -265,7 +265,7 @@ static void ymf278b_pcm_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
INT32 *mixp;
|
||||
INT32 vl, vr;
|
||||
|
||||
memset(mix, 0, sizeof(mix[0])*length*2);
|
||||
memset(mix, 0, sizeof(mix[0])*samples*2);
|
||||
|
||||
rombase = chip->rom;
|
||||
|
||||
@ -277,7 +277,7 @@ static void ymf278b_pcm_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
{
|
||||
mixp = mix;
|
||||
|
||||
for (j = 0; j < length; j++)
|
||||
for (j = 0; j < samples; j++)
|
||||
{
|
||||
switch (slot->bits)
|
||||
{
|
||||
@ -329,7 +329,7 @@ static void ymf278b_pcm_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
mixp = mix;
|
||||
vl = chip->mix_level[chip->pcm_l];
|
||||
vr = chip->mix_level[chip->pcm_r];
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outputs[0][i] = (*mixp++ * vl) >> 16;
|
||||
outputs[1][i] = (*mixp++ * vr) >> 16;
|
||||
|
@ -488,16 +488,16 @@ static int generate_pcm16(struct YMZ280BVoice *voice, UINT8 *base, INT16 *buffer
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( ymz280b_update )
|
||||
{
|
||||
struct YMZ280BChip *chip = param;
|
||||
stream_sample_t *lacc = buffer[0];
|
||||
stream_sample_t *racc = buffer[1];
|
||||
stream_sample_t *lacc = outputs[0];
|
||||
stream_sample_t *racc = outputs[1];
|
||||
int v;
|
||||
|
||||
/* clear out the accumulator */
|
||||
memset(lacc, 0, length * sizeof(lacc[0]));
|
||||
memset(racc, 0, length * sizeof(racc[0]));
|
||||
memset(lacc, 0, samples * sizeof(lacc[0]));
|
||||
memset(racc, 0, samples * sizeof(racc[0]));
|
||||
|
||||
/* loop over voices */
|
||||
for (v = 0; v < 8; v++)
|
||||
@ -510,7 +510,7 @@ static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
INT32 *rdest = racc;
|
||||
UINT32 new_samples, samples_left;
|
||||
UINT32 final_pos;
|
||||
int remaining = length;
|
||||
int remaining = samples;
|
||||
int lvol = voice->output_left;
|
||||
int rvol = voice->output_right;
|
||||
|
||||
@ -612,10 +612,10 @@ static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
voice->curr_sample = curr;
|
||||
}
|
||||
|
||||
for (v = 0; v < length; v++)
|
||||
for (v = 0; v < samples; v++)
|
||||
{
|
||||
buffer[0][v] /= 256;
|
||||
buffer[1][v] /= 256;
|
||||
outputs[0][v] /= 256;
|
||||
outputs[1][v] /= 256;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ struct _stream_output
|
||||
struct _sound_stream
|
||||
{
|
||||
/* linking information */
|
||||
running_machine * machine; /* owning machine object */
|
||||
const device_config * device; /* owning device */
|
||||
sound_stream * next; /* next stream in the chain */
|
||||
void * tag; /* tag (used for identification) */
|
||||
int index; /* index for save states */
|
||||
@ -362,7 +362,7 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs
|
||||
VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream));
|
||||
|
||||
/* fill in the data */
|
||||
stream->machine = machine;
|
||||
stream->device = device;
|
||||
stream->tag = strdata->current_tag;
|
||||
stream->index = strdata->stream_index++;
|
||||
stream->sample_rate = sample_rate;
|
||||
@ -457,7 +457,7 @@ void stream_set_input(sound_stream *stream, int index, sound_stream *input_strea
|
||||
input->source->dependents++;
|
||||
|
||||
/* update sample rates now that we know the input */
|
||||
recompute_sample_rate_data(stream->machine->streams_data, stream);
|
||||
recompute_sample_rate_data(stream->device->machine->streams_data, stream);
|
||||
}
|
||||
|
||||
|
||||
@ -468,8 +468,9 @@ void stream_set_input(sound_stream *stream, int index, sound_stream *input_strea
|
||||
|
||||
void stream_update(sound_stream *stream)
|
||||
{
|
||||
streams_private *strdata = stream->machine->streams_data;
|
||||
INT32 update_sampindex = time_to_sampindex(strdata, stream, timer_get_time(stream->machine));
|
||||
running_machine *machine = stream->device->machine;
|
||||
streams_private *strdata = machine->streams_data;
|
||||
INT32 update_sampindex = time_to_sampindex(strdata, stream, timer_get_time(machine));
|
||||
|
||||
/* generate samples to get us up to the appropriate time */
|
||||
assert(stream->output_sampindex - stream->output_base_sampindex >= 0);
|
||||
@ -538,7 +539,7 @@ void stream_set_sample_rate(sound_stream *stream, int sample_rate)
|
||||
|
||||
attotime stream_get_time(sound_stream *stream)
|
||||
{
|
||||
streams_private *strdata = stream->machine->streams_data;
|
||||
streams_private *strdata = stream->device->machine->streams_data;
|
||||
attotime base = attotime_make(strdata->last_update.seconds, 0);
|
||||
return attotime_add_attoseconds(base, stream->output_sampindex * stream->attoseconds_per_sample);
|
||||
}
|
||||
@ -808,7 +809,7 @@ static void generate_samples(sound_stream *stream, int samples)
|
||||
|
||||
/* run the callback */
|
||||
VPRINTF((" callback(%p, %d)\n", stream, samples));
|
||||
(*stream->callback)(stream->param, stream->input_array, stream->output_array, samples);
|
||||
(*stream->callback)(stream->device, stream->param, stream->input_array, stream->output_array, samples);
|
||||
VPRINTF((" callback done\n"));
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
typedef struct _sound_stream sound_stream;
|
||||
|
||||
typedef void (*stream_update_func)(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
typedef void (*stream_update_func)(const device_config *device, void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
#define STREAM_UPDATE(name) void name(const device_config *device, void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "streams.h"
|
||||
#include "deprecat.h"
|
||||
#include "includes/amiga.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
|
||||
@ -123,7 +122,7 @@ void amiga_audio_update(void)
|
||||
|
||||
|
||||
|
||||
static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( amiga_stream_update )
|
||||
{
|
||||
amiga_audio *audio = param;
|
||||
int channum, sampoffs = 0;
|
||||
@ -138,11 +137,11 @@ static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
|
||||
/* clear the sample data to 0 */
|
||||
for (channum = 0; channum < 4; channum++)
|
||||
memset(outputs[channum], 0, sizeof(stream_sample_t) * length);
|
||||
memset(outputs[channum], 0, sizeof(stream_sample_t) * samples);
|
||||
return;
|
||||
}
|
||||
|
||||
length *= CLOCK_DIVIDER;
|
||||
samples *= CLOCK_DIVIDER;
|
||||
|
||||
/* update the DMA states on each channel and reload if fresh */
|
||||
for (channum = 0; channum < 4; channum++)
|
||||
@ -154,10 +153,10 @@ static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
}
|
||||
|
||||
/* loop until done */
|
||||
while (length > 0)
|
||||
while (samples > 0)
|
||||
{
|
||||
int nextper, nextvol;
|
||||
int ticks = length;
|
||||
int ticks = samples;
|
||||
|
||||
/* determine the number of ticks we can do in this chunk */
|
||||
if (ticks > audio->channel[0].curticks)
|
||||
@ -242,7 +241,7 @@ static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
/* if we're in manual mode, signal an interrupt once we latch the low byte */
|
||||
if (!chan->dmaenabled && chan->manualmode && (chan->curlocation & 1))
|
||||
{
|
||||
signal_irq(Machine, NULL, channum);
|
||||
signal_irq(device->machine, NULL, channum);
|
||||
chan->manualmode = FALSE;
|
||||
}
|
||||
}
|
||||
@ -250,7 +249,7 @@ static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
|
||||
/* bump ourselves forward by the number of ticks */
|
||||
sampoffs += ticks;
|
||||
length -= ticks;
|
||||
samples -= ticks;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,12 +132,12 @@ void attckufo_soundport_w (int offset, int data)
|
||||
/************************************/
|
||||
/* Sound handler update */
|
||||
/************************************/
|
||||
static void attckufo_update (void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
|
||||
static STREAM_UPDATE( attckufo_update )
|
||||
{
|
||||
int i, v;
|
||||
stream_sample_t *buffer = _buffer[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
v = 0;
|
||||
if (TONE1_ON /*||(tone1pos!=0) */ )
|
||||
|
@ -67,10 +67,10 @@ WRITE8_HANDLER( bzone_sounds_w )
|
||||
sound_global_enable(latch & 0x20);
|
||||
}
|
||||
|
||||
static void bzone_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( bzone_sound_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
while( length-- )
|
||||
while( samples-- )
|
||||
{
|
||||
static int last_val = 0;
|
||||
int sum = 0;
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
***************************************************************************/
|
||||
#include "driver.h"
|
||||
#include "deprecat.h"
|
||||
#include "streams.h"
|
||||
#include "includes/cps3.h"
|
||||
|
||||
@ -25,14 +24,14 @@ static struct
|
||||
UINT16 key;
|
||||
} chip;
|
||||
|
||||
static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
|
||||
static STREAM_UPDATE( cps3_stream_update )
|
||||
{
|
||||
int i;
|
||||
INT8 *base = (INT8*)memory_region(Machine, "user5");
|
||||
INT8 *base = (INT8*)memory_region(device->machine, "user5");
|
||||
|
||||
/* Clear the buffers */
|
||||
memset(buffer[0], 0, length*sizeof(*buffer[0]));
|
||||
memset(buffer[1], 0, length*sizeof(*buffer[1]));
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[1]));
|
||||
|
||||
for (i = 0; i < CPS3_VOICES; i ++)
|
||||
{
|
||||
@ -62,7 +61,7 @@ static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
loop -= 0x400000;
|
||||
|
||||
/* Go through the buffer and add voice contributions */
|
||||
for (j = 0; j < length; j ++)
|
||||
for (j = 0; j < samples; j ++)
|
||||
{
|
||||
INT32 sample;
|
||||
|
||||
@ -86,8 +85,8 @@ static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sam
|
||||
sample = base[BYTE4_XOR_LE(start + pos)];
|
||||
frac += step;
|
||||
|
||||
buffer[0][j] += (sample * (vol_l >> 8));
|
||||
buffer[1][j] += (sample * (vol_r >> 8));
|
||||
outputs[0][j] += (sample * (vol_l >> 8));
|
||||
outputs[1][j] += (sample * (vol_r >> 8));
|
||||
}
|
||||
|
||||
vptr->pos = pos;
|
||||
|
@ -222,13 +222,13 @@ INLINE int sh6840_update_noise(int clocks)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void exidy_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( exidy_stream_update )
|
||||
{
|
||||
int noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0);
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* loop over samples */
|
||||
while (length--)
|
||||
while (samples--)
|
||||
{
|
||||
struct sh6840_timer_channel *t;
|
||||
struct sh8253_timer_channel *c;
|
||||
|
@ -111,7 +111,7 @@ static const int channel_bits[4] =
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
static void channel_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length);
|
||||
static STREAM_UPDATE( channel_update );
|
||||
static void m6844_finished(int ch);
|
||||
static void play_cvsd(running_machine *machine, int ch);
|
||||
static void stop_cvsd(int ch);
|
||||
@ -277,19 +277,19 @@ static void mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *d
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void channel_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( channel_update )
|
||||
{
|
||||
int ch;
|
||||
|
||||
/* reset the mixer buffers */
|
||||
memset(mixer_buffer_left, 0, length * sizeof(INT32));
|
||||
memset(mixer_buffer_right, 0, length * sizeof(INT32));
|
||||
memset(mixer_buffer_left, 0, samples * sizeof(INT32));
|
||||
memset(mixer_buffer_right, 0, samples * sizeof(INT32));
|
||||
|
||||
/* loop over channels */
|
||||
for (ch = 0; ch < 4; ch++)
|
||||
{
|
||||
sound_channel_data *channel = &sound_channel[ch];
|
||||
int samples, volume, left = length;
|
||||
int length, volume, left = samples;
|
||||
int effective_offset;
|
||||
|
||||
/* if we're not active, bail */
|
||||
@ -297,22 +297,22 @@ static void channel_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
continue;
|
||||
|
||||
/* see how many samples to copy */
|
||||
samples = (left > channel->remaining) ? channel->remaining : left;
|
||||
length = (left > channel->remaining) ? channel->remaining : left;
|
||||
|
||||
/* get a pointer to the sample data and copy to the left */
|
||||
volume = sound_volume[2 * ch + 0];
|
||||
if (volume)
|
||||
add_and_scale_samples(ch, mixer_buffer_left, samples, volume);
|
||||
add_and_scale_samples(ch, mixer_buffer_left, length, volume);
|
||||
|
||||
/* get a pointer to the sample data and copy to the left */
|
||||
volume = sound_volume[2 * ch + 1];
|
||||
if (volume)
|
||||
add_and_scale_samples(ch, mixer_buffer_right, samples, volume);
|
||||
add_and_scale_samples(ch, mixer_buffer_right, length, volume);
|
||||
|
||||
/* update our counters */
|
||||
channel->offset += samples;
|
||||
channel->remaining -= samples;
|
||||
left -= samples;
|
||||
channel->offset += length;
|
||||
channel->remaining -= length;
|
||||
left -= length;
|
||||
|
||||
/* update the MC6844 */
|
||||
effective_offset = (ch & 2) ? channel->offset / 2 : channel->offset;
|
||||
@ -327,7 +327,7 @@ static void channel_update(void *param, stream_sample_t **inputs, stream_sample_
|
||||
}
|
||||
|
||||
/* all done, time to mix it */
|
||||
mix_to_16(length, outputs[0], outputs[1]);
|
||||
mix_to_16(samples, outputs[0], outputs[1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ static int make_mixer_table(int voices, int gain)
|
||||
|
||||
|
||||
/* generate sound to the mix buffer in mono */
|
||||
static void flower_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( flower_update_mono )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
sound_channel *voice;
|
||||
@ -87,12 +87,12 @@ static void flower_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
/* if no sound, we're done */
|
||||
if (sound_enable == 0)
|
||||
{
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
return;
|
||||
}
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(mixer_buffer, 0, length * sizeof(short));
|
||||
memset(mixer_buffer, 0, samples * sizeof(short));
|
||||
|
||||
/* loop over each voice and add its contribution */
|
||||
for (voice = channel_list; voice < last_channel; voice++)
|
||||
@ -109,7 +109,7 @@ static void flower_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
mix = mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int offs;
|
||||
|
||||
@ -148,7 +148,7 @@ static void flower_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
|
||||
/* mix it down */
|
||||
mix = mixer_buffer;
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
*buffer++ = mixer_lookup[*mix++];
|
||||
}
|
||||
|
||||
|
@ -70,16 +70,16 @@ static emu_timer *noisetimer;
|
||||
static TIMER_CALLBACK( lfo_timer_cb );
|
||||
static TIMER_CALLBACK( galaxian_sh_update );
|
||||
|
||||
static void tone_update(void *param, stream_sample_t **input, stream_sample_t **output, int length)
|
||||
static STREAM_UPDATE( tone_update )
|
||||
{
|
||||
stream_sample_t *buffer = output[0];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i,j;
|
||||
INT16 *w = tonewave[vol];
|
||||
|
||||
/* only update if we have non-zero volume and frequency */
|
||||
if( pitch != 0xff )
|
||||
{
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int mix = 0;
|
||||
|
||||
@ -99,7 +99,7 @@ static void tone_update(void *param, stream_sample_t **input, stream_sample_t **
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < length; i++ )
|
||||
for( i = 0; i < samples; i++ )
|
||||
*buffer++ = 0;
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ WRITE8_HANDLER( geebee_sound_w )
|
||||
}
|
||||
}
|
||||
|
||||
static void geebee_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( geebee_sound_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
while (length--)
|
||||
while (samples--)
|
||||
{
|
||||
*buffer++ = sound_signal;
|
||||
/* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
|
||||
|
@ -78,7 +78,7 @@ static int make_mixer_table(int voices, int gain)
|
||||
|
||||
|
||||
/* generate sound to the mix buffer in mono */
|
||||
static void gomoku_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( gomoku_update_mono )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
sound_channel *voice;
|
||||
@ -88,12 +88,12 @@ static void gomoku_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
/* if no sound, we're done */
|
||||
if (sound_enable == 0)
|
||||
{
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
return;
|
||||
}
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(mixer_buffer, 0, length * sizeof(short));
|
||||
memset(mixer_buffer, 0, samples * sizeof(short));
|
||||
|
||||
/* loop over each voice and add its contribution */
|
||||
for (ch = 0, voice = channel_list; voice < last_channel; ch++, voice++)
|
||||
@ -115,7 +115,7 @@ static void gomoku_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
mix = mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
c += f;
|
||||
|
||||
@ -156,7 +156,7 @@ static void gomoku_update_mono(void *param, stream_sample_t **inputs, stream_sam
|
||||
|
||||
/* mix it down */
|
||||
mix = mixer_buffer;
|
||||
for (i = 0; i < length; i++)
|
||||
for (i = 0; i < samples; i++)
|
||||
*buffer++ = mixer_lookup[*mix++];
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,12 @@ static double freq_to_step;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void gridlee_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( gridlee_stream_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
/* loop over samples */
|
||||
while (length--)
|
||||
while (samples--)
|
||||
{
|
||||
/* tone channel */
|
||||
tone_fraction += tone_step;
|
||||
|
@ -104,13 +104,13 @@ static UINT32 dac_bufout[2];
|
||||
|
||||
static sound_stream * dac_stream;
|
||||
|
||||
static void leland_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( leland_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int dacnum;
|
||||
|
||||
/* reset the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
for (dacnum = 0; dacnum < 2; dacnum++)
|
||||
{
|
||||
int bufout = dac_bufout[dacnum];
|
||||
@ -121,7 +121,7 @@ static void leland_update(void *param, stream_sample_t **inputs, stream_sample_t
|
||||
UINT8 *base = dac_buffer[dacnum];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length && count > 0; i++, count--)
|
||||
for (i = 0; i < samples && count > 0; i++, count--)
|
||||
{
|
||||
buffer[i] += ((INT16)base[bufout] - 0x80) * 0x40;
|
||||
bufout = (bufout + 1) & DAC_BUFFER_MASK;
|
||||
@ -304,7 +304,7 @@ static WRITE16_HANDLER( peripheral_w );
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void leland_80186_dac_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( leland_80186_dac_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i, j, start, stop;
|
||||
@ -312,7 +312,7 @@ static void leland_80186_dac_update(void *param, stream_sample_t **inputs, strea
|
||||
if (LOG_SHORTAGES) logerror("----\n");
|
||||
|
||||
/* reset the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
|
||||
/* if we're redline racer, we have more DACs */
|
||||
if (!is_redline)
|
||||
@ -335,7 +335,7 @@ static void leland_80186_dac_update(void *param, stream_sample_t **inputs, strea
|
||||
int step = d->step;
|
||||
|
||||
/* sample-rate convert to the output frequency */
|
||||
for (j = 0; j < length && count > 0; j++)
|
||||
for (j = 0; j < samples && count > 0; j++)
|
||||
{
|
||||
buffer[j] += base[source];
|
||||
frac += step;
|
||||
@ -345,8 +345,8 @@ static void leland_80186_dac_update(void *param, stream_sample_t **inputs, strea
|
||||
source &= DAC_BUFFER_SIZE_MASK;
|
||||
}
|
||||
|
||||
if (LOG_SHORTAGES && j < length)
|
||||
logerror("DAC #%d short by %d/%d samples\n", i, length - j, length);
|
||||
if (LOG_SHORTAGES && j < samples)
|
||||
logerror("DAC #%d short by %d/%d samples\n", i, samples - j, samples);
|
||||
|
||||
/* update the DAC state */
|
||||
d->fraction = frac;
|
||||
@ -367,14 +367,14 @@ static void leland_80186_dac_update(void *param, stream_sample_t **inputs, strea
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void leland_80186_dma_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( leland_80186_dma_update )
|
||||
{
|
||||
const address_space *dmaspace = param;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i, j;
|
||||
|
||||
/* reset the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
|
||||
/* loop over DMA buffers */
|
||||
for (i = 0; i < 2; i++)
|
||||
@ -416,7 +416,7 @@ static void leland_80186_dma_update(void *param, stream_sample_t **inputs, strea
|
||||
volume = dac[which].volume;
|
||||
|
||||
/* sample-rate convert to the output frequency */
|
||||
for (j = 0; j < length && count > 0; j++)
|
||||
for (j = 0; j < samples && count > 0; j++)
|
||||
{
|
||||
buffer[j] += ((int)memory_read_byte(dmaspace, source) - 0x80) * volume;
|
||||
frac += step;
|
||||
@ -456,7 +456,7 @@ static void leland_80186_dma_update(void *param, stream_sample_t **inputs, strea
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void leland_80186_extern_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( leland_80186_extern_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
struct dac_state *d = &dac[7];
|
||||
@ -464,7 +464,7 @@ static void leland_80186_extern_update(void *param, stream_sample_t **inputs, st
|
||||
int j;
|
||||
|
||||
/* reset the buffer */
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
|
||||
/* if we have data, process it */
|
||||
if (count > 0 && ext_active)
|
||||
@ -474,7 +474,7 @@ static void leland_80186_extern_update(void *param, stream_sample_t **inputs, st
|
||||
int step = d->step;
|
||||
|
||||
/* sample-rate convert to the output frequency */
|
||||
for (j = 0; j < length && count > 0; j++)
|
||||
for (j = 0; j < samples && count > 0; j++)
|
||||
{
|
||||
buffer[j] += ((INT16)ext_base[source] - 0x80) * d->volume;
|
||||
frac += step;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "streams.h"
|
||||
#include "deprecat.h"
|
||||
#include "sound/custom.h"
|
||||
#include "sound/tms36xx.h"
|
||||
#include "phoenix.h"
|
||||
@ -205,12 +204,12 @@ INLINE int noise(int samplerate)
|
||||
return sum;
|
||||
}
|
||||
|
||||
static void phoenix_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( phoenix_sound_update )
|
||||
{
|
||||
int samplerate = Machine->sample_rate;
|
||||
int samplerate = device->machine->sample_rate;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
int sum = 0;
|
||||
sum = noise(samplerate) / 2;
|
||||
|
@ -8,7 +8,6 @@
|
||||
****************************************************************************/
|
||||
#include "driver.h"
|
||||
#include "streams.h"
|
||||
#include "deprecat.h"
|
||||
#include "sound/custom.h"
|
||||
#include "sound/tms36xx.h"
|
||||
#include "includes/phoenix.h"
|
||||
@ -397,12 +396,12 @@ INLINE int noise(int samplerate)
|
||||
return sum / 2;
|
||||
}
|
||||
|
||||
static void pleiads_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( pleiads_sound_update )
|
||||
{
|
||||
int rate = Machine->sample_rate;
|
||||
int rate = device->machine->sample_rate;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
while( length-- > 0 )
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate);
|
||||
*buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767;
|
||||
|
@ -3,7 +3,6 @@
|
||||
Sound handler
|
||||
****************************************************************************/
|
||||
#include "driver.h"
|
||||
#include "deprecat.h"
|
||||
#include "streams.h"
|
||||
#include "sound/filter.h"
|
||||
#include "machine/rescap.h"
|
||||
@ -47,7 +46,7 @@ static const double r_filt_total = 1.0 / (1.0/RES_K(4.7) + 1.0/RES_K(7.5) + 1.0/
|
||||
/************************************/
|
||||
/* Stream updater */
|
||||
/************************************/
|
||||
static void engine_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( engine_sound_update )
|
||||
{
|
||||
static UINT32 current_position;
|
||||
UINT32 step, clock, slot;
|
||||
@ -59,21 +58,21 @@ static void engine_sound_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
/* if we're not enabled, just fill with 0 */
|
||||
if (!sample_enable)
|
||||
{
|
||||
memset(buffer, 0, length * sizeof(*buffer));
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
return;
|
||||
}
|
||||
|
||||
/* determine the effective clock rate */
|
||||
clock = (cpu_get_clock(Machine->cpu[0]) / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
|
||||
clock = (cpu_get_clock(device->machine->cpu[0]) / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
|
||||
step = (clock << 12) / OUTPUT_RATE;
|
||||
|
||||
/* determine the volume */
|
||||
slot = (sample_msb >> 3) & 7;
|
||||
volume = volume_table[slot];
|
||||
base = &memory_region(Machine, "engine")[slot * 0x800];
|
||||
base = &memory_region(device->machine, "engine")[slot * 0x800];
|
||||
|
||||
/* fill in the sample */
|
||||
while (length--)
|
||||
while (samples--)
|
||||
{
|
||||
filter_engine[0].x0 = (3.4 / 255 * base[(current_position >> 12) & 0x7ff] - 2) * volume;
|
||||
filter_engine[1].x0 = filter_engine[0].x0;
|
||||
|
@ -62,10 +62,10 @@ WRITE8_HANDLER( redbaron_pokey_w )
|
||||
pokey1_w(space, offset, data);
|
||||
}
|
||||
|
||||
static void redbaron_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
|
||||
static STREAM_UPDATE( redbaron_sound_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
while( length-- )
|
||||
while( samples-- )
|
||||
{
|
||||
int sum = 0;
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "deprecat.h"
|
||||
#include "streams.h"
|
||||
#include "sound/custom.h"
|
||||
#include "sound/sn76477.h"
|
||||
@ -394,15 +393,15 @@ INLINE void validate_tone_channel(running_machine *machine, int channel)
|
||||
}
|
||||
}
|
||||
|
||||
static void rockola_tone_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int len)
|
||||
static STREAM_UPDATE( rockola_tone_update )
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CHANNELS; i++)
|
||||
validate_tone_channel(Machine, i);
|
||||
validate_tone_channel(device->machine, i);
|
||||
|
||||
while (len-- > 0)
|
||||
while (samples-- > 0)
|
||||
{
|
||||
INT32 data = 0;
|
||||
|
||||
@ -435,7 +434,7 @@ static void rockola_tone_update(void *param, stream_sample_t **inputs, stream_sa
|
||||
tone_channels[i].offset++;
|
||||
tone_channels[i].offset &= tone_channels[i].mask;
|
||||
|
||||
validate_tone_channel(Machine, i);
|
||||
validate_tone_channel(device->machine, i);
|
||||
}
|
||||
|
||||
if (tone_channels[0].offset == 0 && Sound0StopOnRollover)
|
||||
|
@ -8,7 +8,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "deprecat.h"
|
||||
#include "streams.h"
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
#include "segag80r.h"
|
||||
@ -340,7 +339,7 @@ WRITE8_HANDLER( astrob_sound_w )
|
||||
|
||||
static SOUND_START( 005 );
|
||||
static CUSTOM_START( sega005_custom_start );
|
||||
static void sega005_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
static STREAM_UPDATE( sega005_stream_update );
|
||||
static TIMER_CALLBACK( sega005_auto_timer );
|
||||
static WRITE8_DEVICE_HANDLER( sega005_sound_a_w );
|
||||
static WRITE8_DEVICE_HANDLER( sega005_sound_b_w );
|
||||
@ -595,9 +594,9 @@ static CUSTOM_START( sega005_custom_start )
|
||||
}
|
||||
|
||||
|
||||
static void sega005_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
static STREAM_UPDATE( sega005_stream_update )
|
||||
{
|
||||
const UINT8 *sound_prom = memory_region(Machine, "proms");
|
||||
const UINT8 *sound_prom = memory_region(device->machine, "proms");
|
||||
int i;
|
||||
|
||||
/* no implementation yet */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user