From: Atari Ace [mailto:atari_ace@verizon.net]

Sent: Tuesday, December 09, 2008 8:13 PM
To: submit@mamedev.org
Cc: atariace@hotmail.com
Subject: [patch] Add device parameter to stream_create()

Hi mamedev,

This patch adds the sound device to the parameters passed to
stream_create so that the global Machine can be removed from
streams.c.  It assumes my previous patch which added CUSTOM_START and
SAMPLES_START has been applied.

~aa
This commit is contained in:
Aaron Giles 2008-12-10 06:31:23 +00:00
parent b98c709380
commit e2a760bcbd
109 changed files with 140 additions and 142 deletions

View File

@ -946,7 +946,7 @@ static void process_track_data(const device_config *device)
static CUSTOM_START( custom_start ) static CUSTOM_START( custom_start )
{ {
sound_token *token = auto_malloc(sizeof(*token)); sound_token *token = auto_malloc(sizeof(*token));
token->stream = stream_create(0, 2, 48000, token, custom_stream_callback); token->stream = stream_create(device, 0, 2, 48000, token, custom_stream_callback);
token->ld = NULL; token->ld = NULL;
return token; return token;
} }

View File

@ -396,7 +396,7 @@ static void route_sound(running_machine *machine)
speaker_info *info = curspeak->token; speaker_info *info = curspeak->token;
if (info->inputs != 0) if (info->inputs != 0)
{ {
info->mixer_stream = stream_create(info->inputs, 1, machine->sample_rate, info, mixer_update); info->mixer_stream = stream_create(curspeak, info->inputs, 1, machine->sample_rate, info, mixer_update);
state_save_register_postload(machine, mixer_postload, info->mixer_stream); state_save_register_postload(machine, mixer_postload, info->mixer_stream);
info->input = auto_malloc(info->inputs * sizeof(*info->input)); info->input = auto_malloc(info->inputs * sizeof(*info->input));
info->inputs = 0; info->inputs = 0;

View File

@ -50,7 +50,7 @@ static SND_START( ym2151 )
rate = clock/64; rate = clock/64;
/* stream setup */ /* stream setup */
info->stream = stream_create(0,2,rate,info,ym2151_update); info->stream = stream_create(device,0,2,rate,info,ym2151_update);
info->chip = ym2151_init(device,clock,rate); info->chip = ym2151_init(device,clock,rate);

View File

@ -132,7 +132,7 @@ static SND_START( ym2203 )
info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info); info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info);
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,1,rate,info,ym2203_stream_update); info->stream = stream_create(device,0,1,rate,info,ym2203_stream_update);
/* Initialize FM emurator */ /* Initialize FM emurator */
info->chip = ym2203_init(info,device,clock,rate,timer_handler,IRQHandler,&psgintf); info->chip = ym2203_init(info,device,clock,rate,timer_handler,IRQHandler,&psgintf);

View File

@ -62,7 +62,7 @@ static SND_START( ym2413 )
return NULL; return NULL;
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2413_stream_update); info->stream = stream_create(device,0,2,rate,info,ym2413_stream_update);
ym2413_set_update_handler(info->chip, _stream_update, info); ym2413_set_update_handler(info->chip, _stream_update, info);
@ -85,7 +85,7 @@ static SND_START( ym2413 )
{ {
ym2413_reset (i); ym2413_reset (i);
ym2413[i].DAC_stream = stream_create(0, 1, clock/72, i, YM2413DAC_update); ym2413[i].DAC_stream = stream_create(device, 0, 1, clock/72, i, YM2413DAC_update);
if (ym2413[i].DAC_stream == -1) if (ym2413[i].DAC_stream == -1)
return 1; return 1;

View File

@ -149,7 +149,7 @@ static SND_START( ym2608 )
info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info); info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info);
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2608_stream_update); info->stream = stream_create(device,0,2,rate,info,ym2608_stream_update);
/* setup adpcm buffers */ /* setup adpcm buffers */
pcmbufa = device->region; pcmbufa = device->region;
pcmsizea = device->regionbytes; pcmsizea = device->regionbytes;

View File

@ -150,7 +150,7 @@ static SND_START( ym2610 )
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info); info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2610_stream_update); info->stream = stream_create(device,0,2,rate,info,ym2610_stream_update);
/* setup adpcm buffers */ /* setup adpcm buffers */
pcmbufa = device->region; pcmbufa = device->region;
pcmsizea = device->regionbytes; pcmsizea = device->regionbytes;
@ -216,7 +216,7 @@ static SND_START( ym2610b )
info->timer[1] =timer_alloc(device->machine, timer_callback_1, info); info->timer[1] =timer_alloc(device->machine, timer_callback_1, info);
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2610b_stream_update); info->stream = stream_create(device, 0,2,rate,info,ym2610b_stream_update);
/* setup adpcm buffers */ /* setup adpcm buffers */
pcmbufa = device->region; pcmbufa = device->region;
pcmsizea = device->regionbytes; pcmsizea = device->regionbytes;

View File

@ -104,7 +104,7 @@ static SND_START( ym2612 )
info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info); info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info);
/* stream system initialize */ /* stream system initialize */
info->stream = stream_create(0,2,rate,info,ym2612_stream_update); info->stream = stream_create(device,0,2,rate,info,ym2612_stream_update);
/**** initialize YM2612 ****/ /**** initialize YM2612 ****/
info->chip = ym2612_init(info,device,clock,rate,timer_handler,IRQHandler); info->chip = ym2612_init(info,device,clock,rate,timer_handler,IRQHandler);

View File

@ -83,7 +83,7 @@ static SND_START( ymf262 )
if (info->chip == NULL) if (info->chip == NULL)
return NULL; return NULL;
info->stream = stream_create(0,4,rate,info,ymf262_stream_update); info->stream = stream_create(device,0,4,rate,info,ymf262_stream_update);
/* YMF262 setup */ /* YMF262 setup */
ymf262_set_timer_handler (info->chip, timer_handler_262, info); ymf262_set_timer_handler (info->chip, timer_handler_262, info);

View File

@ -95,7 +95,7 @@ static SND_START( ym3812 )
if (!info->chip) if (!info->chip)
return NULL; return NULL;
info->stream = stream_create(0,1,rate,info,ym3812_stream_update); info->stream = stream_create(device,0,1,rate,info,ym3812_stream_update);
/* YM3812 setup */ /* YM3812 setup */
ym3812_set_timer_handler (info->chip, TimerHandler_3812, info); ym3812_set_timer_handler (info->chip, TimerHandler_3812, info);
@ -264,7 +264,7 @@ static SND_START( ym3526 )
if (!info->chip) if (!info->chip)
return NULL; return NULL;
info->stream = stream_create(0,1,rate,info,ym3526_stream_update); info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
/* YM3526 setup */ /* YM3526 setup */
ym3526_set_timer_handler (info->chip, TimerHandler_3526, info); ym3526_set_timer_handler (info->chip, TimerHandler_3526, info);
ym3526_set_irq_handler (info->chip, IRQHandler_3526, info); ym3526_set_irq_handler (info->chip, IRQHandler_3526, info);
@ -471,7 +471,7 @@ static SND_START( y8950 )
/* ADPCM ROM data */ /* ADPCM ROM data */
y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes); y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes);
info->stream = stream_create(0,1,rate,info,y8950_stream_update); info->stream = stream_create(device,0,1,rate,info,y8950_stream_update);
/* port and keyboard handler */ /* port and keyboard handler */
y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info); y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info);

View File

@ -80,7 +80,7 @@ static SND_START( tms5110 )
sndintrf_register_token(info); sndintrf_register_token(info);
/* initialize a stream */ /* initialize a stream */
info->stream = stream_create(0, 1, clock / 80, info, tms5110_update); info->stream = stream_create(device, 0, 1, clock / 80, info, tms5110_update);
if (info->table == NULL) if (info->table == NULL)
{ {

View File

@ -56,7 +56,7 @@ static SND_START( tms5220 )
sndintrf_register_token(info); sndintrf_register_token(info);
/* initialize a info->stream */ /* initialize a info->stream */
info->stream = stream_create(0, 1, clock / 80, info, tms5220_update); info->stream = stream_create(device, 0, 1, clock / 80, info, tms5220_update);
info->clock = clock; info->clock = clock;
/* reset the 5220 */ /* reset the 5220 */

View File

@ -1302,7 +1302,7 @@ static SND_START( aica )
{ {
AICA->IntARMCB = intf->irq_callback; AICA->IntARMCB = intf->irq_callback;
AICA->stream = stream_create(0, 2, 44100, AICA, AICA_Update); AICA->stream = stream_create(device, 0, 2, 44100, AICA, AICA_Update);
} }
return AICA; return AICA;

View File

@ -270,7 +270,7 @@ static SND_START( astrocade )
chip->bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7); chip->bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7);
/* allocate a stream for output */ /* allocate a stream for output */
chip->stream = stream_create(0, 1, clock, chip, astrocade_update); chip->stream = stream_create(device, 0, 1, clock, chip, astrocade_update);
/* reset state */ /* reset state */
astrocade_reset(chip); astrocade_reset(chip);

View File

@ -706,7 +706,7 @@ void *ay8910_start_ym(sound_type chip_type, const device_config *device, int clo
/* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */ /* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */
/* This handled by the step parameter. Consequently we use a divider of 8 here. */ /* This handled by the step parameter. Consequently we use a divider of 8 here. */
info->channel = stream_create(0,info->streams,clock / 8 ,info,ay8910_update); info->channel = stream_create(device, 0, info->streams, clock / 8, info, ay8910_update);
ay8910_set_clock_ym(info,clock); ay8910_set_clock_ym(info,clock);
ay8910_statesave(info, device); ay8910_statesave(info, device);

View File

@ -88,7 +88,7 @@ static SND_START( beep )
pBeep = auto_malloc(sizeof(*pBeep)); pBeep = auto_malloc(sizeof(*pBeep));
memset(pBeep, 0, sizeof(*pBeep)); memset(pBeep, 0, sizeof(*pBeep));
pBeep->stream = stream_create(0, 1, BEEP_RATE, pBeep, beep_sound_update ); pBeep->stream = stream_create(device, 0, 1, BEEP_RATE, pBeep, beep_sound_update );
pBeep->enable = 0; pBeep->enable = 0;
pBeep->frequency = 3250; pBeep->frequency = 3250;
pBeep->incr = 0; pBeep->incr = 0;

View File

@ -115,7 +115,7 @@ static SND_START( bsmt2000 )
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
/* create a stream at a nominal sample rate (real one specified later) */ /* create a stream at a nominal sample rate (real one specified later) */
chip->stream = stream_create(0, 2, clock / 1000, chip, bsmt2000_update); chip->stream = stream_create(device, 0, 2, clock / 1000, chip, bsmt2000_update);
chip->clock = clock; chip->clock = clock;
/* initialize the regions */ /* initialize the regions */

View File

@ -466,7 +466,7 @@ static SND_START( c140 )
info->banking_type = intf->banking_type; info->banking_type = intf->banking_type;
info->stream = stream_create(0,2,info->sample_rate,info,update_stereo); info->stream = stream_create(device,0,2,info->sample_rate,info,update_stereo);
info->pRom=device->region; info->pRom=device->region;

View File

@ -542,7 +542,7 @@ static SND_START( c352 )
info->sample_rate_base = clock / 192; info->sample_rate_base = clock / 192;
info->stream = stream_create(0, 4, info->sample_rate_base, info, c352_update); info->stream = stream_create(device, 0, 4, info->sample_rate_base, info, c352_update);
c352_init(info, device); c352_init(info, device);

View File

@ -322,7 +322,7 @@ static SND_START( c6280 )
c6280_init(info, clock, rate); c6280_init(info, clock, rate);
/* Create stereo stream */ /* Create stereo stream */
info->stream = stream_create(0, 2, rate, info, c6280_update); info->stream = stream_create(device, 0, 2, rate, info, c6280_update);
return info; return info;
} }

View File

@ -56,7 +56,7 @@ static SND_START( cdda )
intf = config; intf = config;
info->stream = stream_create(0, 2, 44100, info, cdda_update); info->stream = stream_create(device, 0, 2, 44100, info, cdda_update);
state_save_register_device_item( device, 0, info->audio_playing ); state_save_register_device_item( device, 0, info->audio_playing );
state_save_register_device_item( device, 0, info->audio_pause ); state_save_register_device_item( device, 0, info->audio_pause );

View File

@ -110,7 +110,7 @@ static SND_START( cdp1869 )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->stream = stream_create(0, 1, device->machine->sample_rate, info, cdp1869_update ); info->stream = stream_create(device, 0, 1, device->machine->sample_rate, info, cdp1869_update );
info->incr = 0; info->incr = 0;
info->signal = 0x07fff; info->signal = 0x07fff;

View File

@ -329,7 +329,7 @@ static SND_START( cem3394 )
chip->inv_sample_rate = 1.0 / (double)chip->sample_rate; chip->inv_sample_rate = 1.0 / (double)chip->sample_rate;
/* allocate stream channels, 1 per chip */ /* allocate stream channels, 1 per chip */
chip->stream = stream_create(0, 1, chip->sample_rate, chip, cem3394_update); chip->stream = stream_create(device, 0, 1, chip->sample_rate, chip, cem3394_update);
chip->external = intf->external; chip->external = intf->external;
chip->vco_zero_freq = intf->vco_zero_freq; chip->vco_zero_freq = intf->vco_zero_freq;
chip->filter_zero_freq = intf->filter_zero_freq; chip->filter_zero_freq = intf->filter_zero_freq;

View File

@ -108,7 +108,7 @@ static SND_START( dac )
DAC_build_voltable(info); DAC_build_voltable(info);
info->channel = stream_create(0,1,clock ? clock : DEFAULT_SAMPLE_RATE,info,DAC_update); info->channel = stream_create(device,0,1,clock ? clock : DEFAULT_SAMPLE_RATE,info,DAC_update);
info->output = 0; info->output = 0;
state_save_register_device_item(device, 0, info->output); state_save_register_device_item(device, 0, info->output);

View File

@ -68,7 +68,7 @@ discrete_info *discrete_current_context = NULL;
static void init_nodes(discrete_info *info, discrete_sound_block *block_list, const device_config *device); static void init_nodes(discrete_info *info, discrete_sound_block *block_list, const device_config *device);
static void find_input_nodes(discrete_info *info, discrete_sound_block *block_list); static void find_input_nodes(discrete_info *info, discrete_sound_block *block_list);
static void setup_output_nodes(discrete_info *info); static void setup_output_nodes(const device_config *device, discrete_info *info);
static void setup_disc_logs(discrete_info *info); static void setup_disc_logs(discrete_info *info);
static SND_RESET( discrete ); static SND_RESET( discrete );
@ -314,7 +314,7 @@ static SND_START( discrete )
find_input_nodes(info, intf); find_input_nodes(info, intf);
/* then set up the output nodes */ /* then set up the output nodes */
setup_output_nodes(info); setup_output_nodes(device, info);
setup_disc_logs(info); setup_disc_logs(info);
@ -693,10 +693,10 @@ static void find_input_nodes(discrete_info *info, discrete_sound_block *block_li
* *
*************************************/ *************************************/
static void setup_output_nodes(discrete_info *info) static void setup_output_nodes(const device_config *device, discrete_info *info)
{ {
/* initialize the stream(s) */ /* initialize the stream(s) */
info->discrete_stream = stream_create(info->discrete_input_streams, info->discrete_outputs, info->sample_rate, info, discrete_stream_update); info->discrete_stream = stream_create(device, info->discrete_input_streams, info->discrete_outputs, info->sample_rate, info, discrete_stream_update);
} }

View File

@ -106,7 +106,7 @@ static SND_START( dmadac )
info->volume = 0x100; info->volume = 0x100;
/* allocate a stream channel */ /* allocate a stream channel */
info->channel = stream_create(0, 1, DEFAULT_SAMPLE_RATE, info, dmadac_update); info->channel = stream_create(device, 0, 1, DEFAULT_SAMPLE_RATE, info, dmadac_update);
/* register with the save state system */ /* register with the save state system */
state_save_register_device_item(device, 0, info->bufin); state_save_register_device_item(device, 0, info->bufin);

View File

@ -267,7 +267,7 @@ static SND_START( es5503 )
chip->oscsenabled = 1; chip->oscsenabled = 1;
chip->output_rate = (clock/8)/34; // (input clock / 8) / # of oscs. enabled + 2 chip->output_rate = (clock/8)/34; // (input clock / 8) / # of oscs. enabled + 2
chip->stream = stream_create(0, 2, chip->output_rate, chip, es5503_pcm_update); chip->stream = stream_create(device, 0, 2, chip->output_rate, chip, es5503_pcm_update);
return chip; return chip;
} }

View File

@ -839,7 +839,7 @@ static void *es5506_start_common(const device_config *device, int sndindex, int
return NULL; return NULL;
/* create the stream */ /* create the stream */
chip->stream = stream_create(0, 2, clock / (16*32), chip, es5506_update); chip->stream = stream_create(device, 0, 2, clock / (16*32), chip, es5506_update);
/* initialize the regions */ /* initialize the regions */
chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(device->machine, intf->region0) : NULL; chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(device->machine, intf->region0) : NULL;

View File

@ -224,7 +224,7 @@ static SND_START( es8712 )
chip->region_base = device->region; chip->region_base = device->region;
/* generate the name and create the stream */ /* generate the name and create the stream */
chip->stream = stream_create(0, 1, clock, chip, es8712_update); chip->stream = stream_create(device, 0, 1, clock, chip, es8712_update);
/* initialize the rest of the structure */ /* initialize the rest of the structure */
chip->signal = -2; chip->signal = -2;

View File

@ -88,7 +88,7 @@ static SND_START( filter_rc )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->stream = stream_create(1, 1, device->machine->sample_rate, info, filter_rc_update); info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_rc_update);
if (conf) if (conf)
set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C); set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C);
else else

View File

@ -30,7 +30,7 @@ static SND_START( filter_volume )
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->gain = 0x100; info->gain = 0x100;
info->stream = stream_create(1, 1, device->machine->sample_rate, info, filter_volume_update); info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_volume_update);
return info; return info;
} }

View File

@ -257,7 +257,7 @@ static void *gaelcosnd_start(sound_type sndtype, const device_config *device, in
for (j = 0; j < 4; j++){ for (j = 0; j < 4; j++){
info->banks[j] = intf->banks[j]; info->banks[j] = intf->banks[j];
} }
info->stream = stream_create(0, 2, 8000, info, gaelco_update); info->stream = stream_create(device, 0, 2, 8000, info, gaelco_update);
info->snd_data = (UINT8 *)memory_region(device->machine, intf->gfxregion); info->snd_data = (UINT8 *)memory_region(device->machine, intf->gfxregion);
if (info->snd_data == NULL) if (info->snd_data == NULL)
info->snd_data = device->region; info->snd_data = device->region;

View File

@ -72,7 +72,7 @@ static void *start_common(const device_config *device, int clock,
chip->last_clock_state = 0; chip->last_clock_state = 0;
/* create the stream */ /* create the stream */
chip->channel = stream_create(0, 1, SAMPLE_RATE, chip, hc55516_update); chip->channel = stream_create(device, 0, 1, SAMPLE_RATE, chip, hc55516_update);
state_save_register_device_item(device, 0, chip->last_clock_state); state_save_register_device_item(device, 0, chip->last_clock_state);
state_save_register_device_item(device, 0, chip->digit); state_save_register_device_item(device, 0, chip->digit);

View File

@ -454,7 +454,7 @@ static SND_START( ics2115 )
chip->timer[0].timer = timer_alloc(device->machine, timer_cb_0, chip); chip->timer[0].timer = timer_alloc(device->machine, timer_cb_0, chip);
chip->timer[1].timer = timer_alloc(device->machine, timer_cb_1, chip); chip->timer[1].timer = timer_alloc(device->machine, timer_cb_1, chip);
chip->ulaw = auto_malloc(256*sizeof(INT16)); chip->ulaw = auto_malloc(256*sizeof(INT16));
chip->stream = stream_create(0, 2, 33075, chip, update); chip->stream = stream_create(device, 0, 2, 33075, chip, update);
for(i=0; i<256; i++) { for(i=0; i<256; i++) {
UINT8 c = ~i; UINT8 c = ~i;

View File

@ -246,7 +246,7 @@ static SND_START( iremga20 )
for ( i = 0; i < 0x40; i++ ) for ( i = 0; i < 0x40; i++ )
chip->regs[i] = 0; chip->regs[i] = 0;
chip->stream = stream_create( 0, 2, clock/4, chip, IremGA20_update ); chip->stream = stream_create( device, 0, 2, clock/4, chip, IremGA20_update );
state_save_register_device_item_array(device, sndindex, chip->regs); state_save_register_device_item_array(device, sndindex, chip->regs);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)

View File

@ -161,7 +161,7 @@ static SND_START( k005289 )
/* get stream channels */ /* get stream channels */
info->rate = clock/16; info->rate = clock/16;
info->stream = stream_create(0, 1, info->rate, info, K005289_update); info->stream = stream_create(device, 0, 1, info->rate, info, K005289_update);
info->mclock = clock; info->mclock = clock;
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */

View File

@ -326,7 +326,7 @@ static SND_START( k007232 )
for( i = 0; i < 0x10; i++ ) info->wreg[i] = 0; for( i = 0; i < 0x10; i++ ) info->wreg[i] = 0;
info->stream = stream_create(0,2,clock/128,info,KDAC_A_update); info->stream = stream_create(device,0,2,clock/128,info,KDAC_A_update);
KDAC_A_make_fncode(info); KDAC_A_make_fncode(info);

View File

@ -136,7 +136,7 @@ static SND_START( k051649 )
/* get stream channels */ /* get stream channels */
info->rate = clock/16; info->rate = clock/16;
info->stream = stream_create(0, 1, info->rate, info, k051649_update); info->stream = stream_create(device, 0, 1, info->rate, info, k051649_update);
info->mclock = clock; info->mclock = clock;
/* allocate a buffer to mix into - 1 second's worth should be more than enough */ /* allocate a buffer to mix into - 1 second's worth should be more than enough */

View File

@ -227,7 +227,7 @@ static SND_START( k053260 )
ic->delta_table = ( unsigned long * )auto_malloc( 0x1000 * sizeof( unsigned long ) ); ic->delta_table = ( unsigned long * )auto_malloc( 0x1000 * sizeof( unsigned long ) );
ic->channel = stream_create( 0, 2, rate, ic, k053260_update ); ic->channel = stream_create( device, 0, 2, rate, ic, k053260_update );
InitDeltaTable( ic, rate, clock ); InitDeltaTable( ic, rate, clock );

View File

@ -466,7 +466,7 @@ static void k054539_init_chip(const device_config *device, struct k054539_info *
// 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise
timer_pulse(device->machine, ATTOTIME_IN_HZ(480), info, 0, k054539_irq); timer_pulse(device->machine, ATTOTIME_IN_HZ(480), info, 0, k054539_irq);
info->stream = stream_create(0, 2, clock, info, k054539_update); info->stream = stream_create(device, 0, 2, clock, info, k054539_update);
state_save_register_device_item_array(device, 0, info->regs); state_save_register_device_item_array(device, 0, info->regs);
state_save_register_device_item_pointer(device, 0, info->ram, 0x4000); state_save_register_device_item_pointer(device, 0, info->ram, 0x4000);

View File

@ -188,7 +188,7 @@ static SND_START( msm5205 )
ComputeTables (voice); ComputeTables (voice);
/* stream system initialize */ /* stream system initialize */
voice->stream = stream_create(0,1,clock,voice,MSM5205_update); voice->stream = stream_create(device,0,1,clock,voice,MSM5205_update);
voice->timer = timer_alloc(device->machine, MSM5205_vclk_callback, voice); voice->timer = timer_alloc(device->machine, MSM5205_vclk_callback, voice);
/* initialize */ /* initialize */

View File

@ -789,7 +789,7 @@ static SND_START( msm5232 )
msm5232_init(chip, intf, clock, rate); msm5232_init(chip, intf, clock, rate);
chip->stream = stream_create(0,11,rate,chip,MSM5232_update_one); chip->stream = stream_create(device,0,11,rate,chip,MSM5232_update_one);
return chip; return chip;
} }

View File

@ -496,7 +496,7 @@ static SND_START( multipcm )
ptChip->ROM=(INT8 *)device->region; ptChip->ROM=(INT8 *)device->region;
ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV; ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV;
ptChip->stream = stream_create(0, 2, ptChip->Rate, ptChip, MultiPCM_update); ptChip->stream = stream_create(device, 0, 2, ptChip->Rate, ptChip, MultiPCM_update);
//Volume+pan table //Volume+pan table
for(i=0;i<0x800;++i) for(i=0;i<0x800;++i)

View File

@ -108,7 +108,7 @@ static SND_START( namco_63701x )
chip->rom = device->region; chip->rom = device->region;
chip->stream = stream_create(0, 2, clock/1000, chip, namco_63701x_update); chip->stream = stream_create(device, 0, 2, clock/1000, chip, namco_63701x_update);
return chip; return chip;
} }

View File

@ -386,9 +386,9 @@ static SND_START( namco )
/* get stream channels */ /* get stream channels */
if (intf->stereo) if (intf->stereo)
chip->stream = stream_create(0, 2, chip->sample_rate, chip, namco_update_stereo); chip->stream = stream_create(device, 0, 2, chip->sample_rate, chip, namco_update_stereo);
else else
chip->stream = stream_create(0, 1, chip->sample_rate, chip, namco_update_mono); chip->stream = stream_create(device, 0, 1, chip->sample_rate, chip, namco_update_mono);
/* start with sound enabled, many games don't have a sound enable register */ /* start with sound enabled, many games don't have a sound enable register */
chip->sound_enable = 1; chip->sound_enable = 1;

View File

@ -157,7 +157,7 @@ static SND_START( namco_52xx )
filter2_setup(FILTER_LOWPASS, chip->intf->lp_filt_fc, Q_TO_DAMP(chip->intf->lp_filt_q), chip->intf->filt_gain, &chip->n52_lp_filter); filter2_setup(FILTER_LOWPASS, chip->intf->lp_filt_fc, Q_TO_DAMP(chip->intf->lp_filt_q), chip->intf->filt_gain, &chip->n52_lp_filter);
chip->stream = stream_create(0, 1, rate, chip, namco_52xx_stream_update_one); chip->stream = stream_create(device, 0, 1, rate, chip, namco_52xx_stream_update_one);
namco_52xx_reset(chip); namco_52xx_reset(chip);

View File

@ -696,7 +696,7 @@ static SND_START( nesapu )
/* Initialize individual chips */ /* Initialize individual chips */
(info->APU.dpcm).memory = cputag_get_address_space(device->machine, intf->cpu_tag, ADDRESS_SPACE_PROGRAM); (info->APU.dpcm).memory = cputag_get_address_space(device->machine, intf->cpu_tag, ADDRESS_SPACE_PROGRAM);
info->stream = stream_create(0, 1, rate, info, nes_psg_update_sound); info->stream = stream_create(device, 0, 1, rate, info, nes_psg_update_sound);
/* register for save */ /* register for save */
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)

View File

@ -225,7 +225,7 @@ static SND_START( nile )
info->sound_ram = device->region; info->sound_ram = device->region;
info->stream = stream_create(0, 2, 44100, info, nile_update); info->stream = stream_create(device, 0, 2, 44100, info, nile_update);
return info; return info;
} }

View File

@ -199,7 +199,7 @@ static SND_START( okim6258 )
info->output_bits = intf->output_12bits ? 12 : 10; info->output_bits = intf->output_12bits ? 12 : 10;
info->divider = dividers[intf->divider]; info->divider = dividers[intf->divider];
info->stream = stream_create(0, 1, clock/info->divider, info, okim6258_update); info->stream = stream_create(device, 0, 1, clock/info->divider, info, okim6258_update);
info->signal = -2; info->signal = -2;
info->step = 0; info->step = 0;

View File

@ -338,7 +338,7 @@ static SND_START( okim6295 )
info->master_clock = clock; info->master_clock = clock;
/* generate the name and create the stream */ /* generate the name and create the stream */
info->stream = stream_create(0, 1, clock/divisor, info, okim6295_update); info->stream = stream_create(device, 0, 1, clock/divisor, info, okim6295_update);
/* initialize the voices */ /* initialize the voices */
for (voice = 0; voice < OKIM6295_VOICES; voice++) for (voice = 0; voice < OKIM6295_VOICES; voice++)

View File

@ -664,7 +664,7 @@ static SND_START( pokey )
chip->serout_w = chip->intf.serout_w; chip->serout_w = chip->intf.serout_w;
chip->interrupt_cb = chip->intf.interrupt_cb; chip->interrupt_cb = chip->intf.interrupt_cb;
chip->channel = stream_create(0, 1, sample_rate, chip, pokey_update); chip->channel = stream_create(device, 0, 1, sample_rate, chip, pokey_update);
register_for_save(chip, device); register_for_save(chip, device);

View File

@ -349,7 +349,7 @@ static SND_START( psxspu )
chip->intf->spu_install_read_handler( 4, spu_read ); chip->intf->spu_install_read_handler( 4, spu_read );
chip->intf->spu_install_write_handler( 4, spu_write ); chip->intf->spu_install_write_handler( 4, spu_write );
chip->stream = stream_create( 0, 2, 44100, chip, PSXSPU_update ); chip->stream = stream_create( device, 0, 2, 44100, chip, PSXSPU_update );
return chip; return chip;
} }

View File

@ -120,7 +120,7 @@ static SND_START( qsound )
{ {
/* Allocate stream */ /* Allocate stream */
chip->stream = stream_create( chip->stream = stream_create(
0, 2, device, 0, 2,
clock / QSOUND_CLOCKDIV, clock / QSOUND_CLOCKDIV,
chip, chip,
qsound_update ); qsound_update );

View File

@ -334,7 +334,7 @@ static void rf5c400_init_chip(const device_config *device, struct rf5c400_info *
state_save_register_device_item(device, i, info->channels[i].env_scale); state_save_register_device_item(device, i, info->channels[i].env_scale);
} }
info->stream = stream_create(0, 2, clock/384, info, rf5c400_update); info->stream = stream_create(device, 0, 2, clock/384, info, rf5c400_update);
} }

View File

@ -129,7 +129,7 @@ static SND_START( rf5c68 )
memset(chip->data, 0xff, sizeof(chip->data)); memset(chip->data, 0xff, sizeof(chip->data));
/* allocate the stream */ /* allocate the stream */
chip->stream = stream_create(0, 2, clock / 384, chip, rf5c68_update); chip->stream = stream_create(device, 0, 2, clock / 384, chip, rf5c68_update);
return chip; return chip;
} }

View File

@ -578,7 +578,7 @@ static SND_START( s14001a )
chip->SpeechRom = device->region; chip->SpeechRom = device->region;
chip->stream = stream_create(0, 1, clock ? clock : device->machine->sample_rate, chip, s14001a_pcm_update); chip->stream = stream_create(device, 0, 1, clock ? clock : device->machine->sample_rate, chip, s14001a_pcm_update);
return chip; return chip;
} }

View File

@ -322,7 +322,7 @@ static SND_START( saa1099 )
saa->sample_rate = clock / 256; saa->sample_rate = clock / 256;
/* for each chip allocate one stream */ /* for each chip allocate one stream */
saa->stream = stream_create(0, 2, saa->sample_rate, saa, saa1099_update); saa->stream = stream_create(device, 0, 2, saa->sample_rate, saa, saa1099_update);
return saa; return saa;
} }

View File

@ -545,11 +545,11 @@ static SND_START( samples )
/* allocate channels */ /* allocate channels */
info->numchannels = intf->channels; info->numchannels = intf->channels;
assert(info->numchannels < MAX_CHANNELS); assert(info->numchannels < MAX_CHANNELS);
info->channel = auto_malloc(sizeof(*info->channel) * info->numchannels); info->channel = auto_malloc(sizeof(*info->channel) * info->numchannels);
for (i = 0; i < info->numchannels; i++) for (i = 0; i < info->numchannels; i++)
{ {
info->channel[i].stream = stream_create(0, 1, device->machine->sample_rate, &info->channel[i], sample_update_sound); info->channel[i].stream = stream_create(device, 0, 1, device->machine->sample_rate, &info->channel[i], sample_update_sound);
info->channel[i].source = NULL; info->channel[i].source = NULL;
info->channel[i].source_num = -1; info->channel[i].source_num = -1;

View File

@ -1239,7 +1239,7 @@ static SND_START( scsp )
{ {
SCSP->Int68kCB = intf->irq_callback; SCSP->Int68kCB = intf->irq_callback;
SCSP->stream = stream_create(0, 2, 44100, SCSP, SCSP_Update); SCSP->stream = stream_create(device, 0, 2, 44100, SCSP, SCSP_Update);
} }
return SCSP; return SCSP;

View File

@ -101,7 +101,7 @@ static SND_START( segapcm )
spcm->bankmask = mask & (rom_mask >> spcm->bankshift); spcm->bankmask = mask & (rom_mask >> spcm->bankshift);
spcm->stream = stream_create(0, 2, clock / 128, spcm, SEGAPCM_update); spcm->stream = stream_create(device, 0, 2, clock / 128, spcm, SEGAPCM_update);
state_save_register_device_item_array(device, 0, spcm->low); state_save_register_device_item_array(device, 0, spcm->low);
state_save_register_device_item_pointer(device, 0, spcm->ram, 0x800); state_save_register_device_item_pointer(device, 0, spcm->ram, 0x800);

View File

@ -37,7 +37,7 @@ static void *sid_start(const device_config *device, int clock, SIDTYPE sidtype)
sid = (SID6581 *) auto_malloc(sizeof(*sid)); sid = (SID6581 *) auto_malloc(sizeof(*sid));
memset(sid, 0, sizeof(*sid)); memset(sid, 0, sizeof(*sid));
sid->mixer_channel = stream_create (0, 1, device->machine->sample_rate, (void *) sid, sid_update); sid->mixer_channel = stream_create (device, 0, 1, device->machine->sample_rate, (void *) sid, sid_update);
sid->PCMfreq = device->machine->sample_rate; sid->PCMfreq = device->machine->sample_rate;
sid->clock = clock; sid->clock = clock;
sid->ad_read = iface ? iface->ad_read : NULL; sid->ad_read = iface ? iface->ad_read : NULL;

View File

@ -2404,7 +2404,7 @@ static SND_START( sn76477 )
sn->device = device; sn->device = device;
sn->channel = stream_create(0, 1, device->machine->sample_rate, sn, SN76477_update); sn->channel = stream_create(device, 0, 1, device->machine->sample_rate, sn, SN76477_update);
if (clock > 0) if (clock > 0)
{ {

View File

@ -278,12 +278,12 @@ static void SN76496_set_gain(struct SN76496 *R,int gain)
static int SN76496_init(struct SN76496 *R,int clock) static int SN76496_init(const device_config *device, int clock, struct SN76496 *R)
{ {
int sample_rate = clock/16; int sample_rate = clock/16;
int i; int i;
R->Channel = stream_create(0,1, sample_rate,R,SN76496Update); R->Channel = stream_create(device,0,1,sample_rate,R,SN76496Update);
R->SampleRate = sample_rate; R->SampleRate = sample_rate;
@ -321,7 +321,7 @@ static void *generic_start(const device_config *device, int clock, int feedbackm
chip = auto_malloc(sizeof(*chip)); chip = auto_malloc(sizeof(*chip));
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
if (SN76496_init(chip,clock) != 0) if (SN76496_init(device,clock,chip) != 0)
return NULL; return NULL;
SN76496_set_gain(chip, 0); SN76496_set_gain(chip, 0);

View File

@ -115,7 +115,7 @@ static SND_START( snkwave )
chip->sample_rate = chip->external_clock >> CLOCK_SHIFT; chip->sample_rate = chip->external_clock >> CLOCK_SHIFT;
/* get stream channels */ /* get stream channels */
chip->stream = stream_create(0, 1, chip->sample_rate, chip, snkwave_update); chip->stream = stream_create(device, 0, 1, chip->sample_rate, chip, snkwave_update);
/* reset all the voices */ /* reset all the voices */
chip->frequency = 0; chip->frequency = 0;

View File

@ -202,7 +202,7 @@ static SND_START( sp0250 )
sp->drq(ASSERT_LINE); sp->drq(ASSERT_LINE);
timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick); timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick);
sp->stream = stream_create(0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update); sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update);
return sp; return sp;
} }

View File

@ -1180,7 +1180,7 @@ static SND_START( sp0256 )
if( sp->drq ) sp->drq(ASSERT_LINE); if( sp->drq ) sp->drq(ASSERT_LINE);
if( sp->sby ) sp->sby(sp->sby_line = ASSERT_LINE); if( sp->sby ) sp->sby(sp->sby_line = ASSERT_LINE);
sp->stream = stream_create(0, 1, clock / CLOCK_DIVIDER, sp, sp0256_update); sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0256_update);
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* Configure our internal variables. */ /* Configure our internal variables. */

View File

@ -39,7 +39,7 @@ static SND_START( speaker )
{ {
struct speaker *sp = auto_malloc(sizeof(*sp)); struct speaker *sp = auto_malloc(sizeof(*sp));
sp->channel = stream_create(0, 1, device->machine->sample_rate, sp, speaker_sound_update); sp->channel = stream_create(device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update);
sp->num_levels = 2; sp->num_levels = 2;
sp->levels = default_levels; sp->levels = default_levels;
sp->level = 0; sp->level = 0;

View File

@ -134,7 +134,7 @@ static SND_START( st0016 )
info->sound_ram = intf->p_soundram; info->sound_ram = intf->p_soundram;
info->stream = stream_create(0, 2, 44100, info, st0016_update); info->stream = stream_create(device, 0, 2, 44100, info, st0016_update);
return info; return info;
} }

View File

@ -24,7 +24,7 @@ static SND_START( tia )
info = auto_malloc(sizeof(*info)); info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->channel = stream_create(0, 1, clock, info, tia_update); info->channel = stream_create(device, 0, 1, clock, info, tia_update);
info->chip = tia_sound_init(clock, clock, 16); info->chip = tia_sound_init(clock, clock, 16);
if (!info->chip) if (!info->chip)

View File

@ -84,7 +84,7 @@ static SND_START( tms3615 )
tms = auto_malloc(sizeof(*tms)); tms = auto_malloc(sizeof(*tms));
memset(tms, 0, sizeof(*tms)); memset(tms, 0, sizeof(*tms));
tms->channel = stream_create(0, 2, clock/8, tms, tms3615_sound_update); tms->channel = stream_create(device, 0, 2, clock/8, tms, tms3615_sound_update);
tms->samplerate = clock/8; tms->samplerate = clock/8;
tms->basefreq = clock; tms->basefreq = clock;

View File

@ -496,7 +496,7 @@ static SND_START( tms36xx )
tms->intf = config; tms->intf = config;
tms->channel = stream_create(0, 1, clock * 64, tms, tms36xx_sound_update); tms->channel = stream_create(device, 0, 1, clock * 64, tms, tms36xx_sound_update);
tms->samplerate = clock * 64; tms->samplerate = clock * 64;
tms->basefreq = clock; tms->basefreq = clock;
enable = 0; enable = 0;

View File

@ -635,7 +635,7 @@ static SND_START( upd7759 )
memset(chip, 0, sizeof(*chip)); memset(chip, 0, sizeof(*chip));
/* allocate a stream channel */ /* allocate a stream channel */
chip->channel = stream_create(0, 1, clock/4, chip, upd7759_update); chip->channel = stream_create(device, 0, 1, clock/4, chip, upd7759_update);
/* compute the stepping rate based on the chip's clock speed */ /* compute the stepping rate based on the chip's clock speed */
chip->step = 4 * FRAC_ONE; chip->step = 4 * FRAC_ONE;

View File

@ -664,7 +664,7 @@ static SND_START( vlm5030 )
else else
chip->address_mask = chip->intf->memory_size-1; chip->address_mask = chip->intf->memory_size-1;
chip->channel = stream_create(0, 1, emulation_rate,chip,vlm5030_update_callback); chip->channel = stream_create(device, 0, 1, emulation_rate,chip,vlm5030_update_callback);
/* don't restore "UINT8 *chip->rom" when use vlm5030_set_rom() */ /* don't restore "UINT8 *chip->rom" when use vlm5030_set_rom() */

View File

@ -111,7 +111,7 @@ static SND_START( votrax )
votrax->frequency = 8000; votrax->frequency = 8000;
votrax->volume = 230; votrax->volume = 230;
votrax->channel = stream_create(0, 1, device->machine->sample_rate, votrax, votrax_update_sound); votrax->channel = stream_create(device, 0, 1, device->machine->sample_rate, votrax, votrax_update_sound);
votrax->sample = NULL; votrax->sample = NULL;
votrax->step = 0; votrax->step = 0;

View File

@ -107,7 +107,7 @@ static SND_START( vrender0 )
memcpy(&(VR0->Intf),intf,sizeof(vr0_interface)); memcpy(&(VR0->Intf),intf,sizeof(vr0_interface));
memset(VR0->SOUNDREGS,0,sizeof(VR0->SOUNDREGS)); memset(VR0->SOUNDREGS,0,sizeof(VR0->SOUNDREGS));
VR0->stream = stream_create(0, 2, 44100, VR0, VR0_Update); VR0->stream = stream_create(device, 0, 2, 44100, VR0, VR0_Update);
return VR0; return VR0;
} }

View File

@ -64,7 +64,7 @@ static SND_START( wave )
#ifdef MESS #ifdef MESS
image = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, device->tag ); image = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, device->tag );
#endif #endif
stream_create(0, 1, device->machine->sample_rate, (void *)image, wave_sound_update); stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update);
return (void *) (FPTR)(sndindex | WAVE_TOKEN_MASK); return (void *) (FPTR)(sndindex | WAVE_TOKEN_MASK);
} }

View File

@ -213,7 +213,7 @@ static SND_START( x1_010 )
LOG_SOUND(("masterclock = %d rate = %d\n", clock, info->rate )); LOG_SOUND(("masterclock = %d rate = %d\n", clock, info->rate ));
/* get stream channels */ /* get stream channels */
info->stream = stream_create(0,2,info->rate,info,seta_update); info->stream = stream_create(device,0,2,info->rate,info,seta_update);
return info; return info;
} }

View File

@ -1756,7 +1756,7 @@ static SND_START( ymf271 )
intf = (config != NULL) ? config : &defintrf; intf = (config != NULL) ? config : &defintrf;
ymf271_init(device, chip, device->region, intf->irq_callback, intf->ext_read, intf->ext_write); ymf271_init(device, chip, device->region, intf->irq_callback, intf->ext_read, intf->ext_write);
chip->stream = stream_create(0, 2, clock/384, chip, ymf271_update); chip->stream = stream_create(device, 0, 2, clock/384, chip, ymf271_update);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {

View File

@ -680,7 +680,7 @@ static SND_START( ymf278b )
intf = (config != NULL) ? config : &defintrf; intf = (config != NULL) ? config : &defintrf;
ymf278b_init(device->machine, chip, device->region, intf->irq_callback, clock); ymf278b_init(device->machine, chip, device->region, intf->irq_callback, clock);
chip->stream = stream_create(0, 2, clock/768, chip, ymf278b_pcm_update); chip->stream = stream_create(device, 0, 2, clock/768, chip, ymf278b_pcm_update);
// Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB // Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB
for(i = 0; i < 256; i++) for(i = 0; i < 256; i++)

View File

@ -648,7 +648,7 @@ static SND_START( ymz280b )
chip->irq_callback = intf->irq_callback; chip->irq_callback = intf->irq_callback;
/* create the stream */ /* create the stream */
chip->stream = stream_create(0, 2, INTERNAL_SAMPLE_RATE, chip, ymz280b_update); chip->stream = stream_create(device, 0, 2, INTERNAL_SAMPLE_RATE, chip, ymz280b_update);
/* allocate memory */ /* allocate memory */
chip->scratch = auto_malloc(sizeof(chip->scratch[0]) * MAX_SAMPLE_CHUNK); chip->scratch = auto_malloc(sizeof(chip->scratch[0]) * MAX_SAMPLE_CHUNK);

View File

@ -45,7 +45,6 @@
#include "driver.h" #include "driver.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
@ -348,9 +347,9 @@ void streams_update(running_machine *machine)
stream_create - create a new stream stream_create - create a new stream
-------------------------------------------------*/ -------------------------------------------------*/
sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_update_func callback) sound_stream *stream_create(const device_config *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback)
{ {
running_machine *machine = Machine; running_machine *machine = device->machine;
streams_private *strdata = machine->streams_data; streams_private *strdata = machine->streams_data;
int inputnum, outputnum; int inputnum, outputnum;
sound_stream *stream; sound_stream *stream;

View File

@ -46,7 +46,7 @@ void streams_update(running_machine *machine);
/* ----- stream configuration and setup ----- */ /* ----- stream configuration and setup ----- */
/* create a new stream */ /* create a new stream */
sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_update_func callback); sound_stream *stream_create(const device_config *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback);
/* configure a stream's input */ /* configure a stream's input */
void stream_set_input(sound_stream *stream, int index, sound_stream *input_stream, int output_index, float gain); void stream_set_input(sound_stream *stream, int index, sound_stream *input_stream, int output_index, float gain);

View File

@ -277,6 +277,6 @@ CUSTOM_START( amiga_sh_start )
} }
/* create the stream */ /* create the stream */
audio_state->stream = stream_create(0, 4, clock / CLOCK_DIVIDER, audio_state, amiga_stream_update); audio_state->stream = stream_create(device, 0, 4, clock / CLOCK_DIVIDER, audio_state, amiga_stream_update);
return audio_state; return audio_state;
} }

View File

@ -212,7 +212,7 @@ CUSTOM_START( attckufo_custom_start )
{ {
int i; int i;
channel = stream_create(0, 1, OUTPUT_RATE, 0, attckufo_update); channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, attckufo_update);
/* buffer for fastest played sample for 5 second /* buffer for fastest played sample for 5 second

View File

@ -273,13 +273,13 @@ static void bzone_sound_update(void *param, stream_sample_t **inputs, stream_sam
CUSTOM_START( bzone_sh_start ) CUSTOM_START( bzone_sh_start )
{ {
int i; int i;
discharge = (INT16 *)auto_malloc(32768 * sizeof(INT16)); discharge = (INT16 *)auto_malloc(32768 * sizeof(INT16));
for( i = 0; i < 0x8000; i++ ) for( i = 0; i < 0x8000; i++ )
discharge[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); discharge[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
channel = stream_create(0, 1, OUTPUT_RATE, 0, bzone_sound_update); channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, bzone_sound_update);
return auto_malloc(1); return auto_malloc(1);
} }

View File

@ -100,7 +100,7 @@ static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sam
CUSTOM_START( cps3_sh_start ) CUSTOM_START( cps3_sh_start )
{ {
/* Allocate the stream */ /* Allocate the stream */
cps3_stream = stream_create(0, 2, clock / 384, NULL, cps3_stream_update); cps3_stream = stream_create(device, 0, 2, clock / 384, NULL, cps3_stream_update);
memset(&chip, 0, sizeof(chip)); memset(&chip, 0, sizeof(chip));

View File

@ -337,14 +337,14 @@ static void exidy_stream_update(void *param, stream_sample_t **inputs, stream_sa
* *
*************************************/ *************************************/
static void *common_sh_start(int clock, const custom_sound_interface *config) static void *common_sh_start(const device_config *device, int clock, const custom_sound_interface *config)
{ {
int sample_rate = SH8253_CLOCK; int sample_rate = SH8253_CLOCK;
sh6840_clocks_per_sample = (int)((double)SH6840_CLOCK / (double)sample_rate * (double)(1 << 24)); sh6840_clocks_per_sample = (int)((double)SH6840_CLOCK / (double)sample_rate * (double)(1 << 24));
/* allocate the stream */ /* allocate the stream */
exidy_stream = stream_create(0, 1, sample_rate, NULL, exidy_stream_update); exidy_stream = stream_create(device, 0, 1, sample_rate, NULL, exidy_stream_update);
return auto_malloc(1); return auto_malloc(1);
} }
@ -356,7 +356,7 @@ CUSTOM_START( exidy_sh6840_sh_start )
has_tms5220 = FALSE; has_tms5220 = FALSE;
has_mc3417 = FALSE; has_mc3417 = FALSE;
return common_sh_start(clock, config); return common_sh_start(device, clock, config);
} }
@ -640,7 +640,7 @@ static void *venture_common_sh_start(const device_config *device, int clock, con
running_machine *machine = device->machine; running_machine *machine = device->machine;
int i; int i;
void *ret = common_sh_start(clock, config); void *ret = common_sh_start(device, clock, config);
riot = device_list_find_by_tag(machine->config->devicelist, RIOT6532, "riot"); riot = device_list_find_by_tag(machine->config->devicelist, RIOT6532, "riot");

View File

@ -161,7 +161,7 @@ static CUSTOM_START( exidy440_sh_start )
channel_frequency[3] = clock/2; channel_frequency[3] = clock/2;
/* get stream channels */ /* get stream channels */
stream = stream_create(0, 2, clock, NULL, channel_update); stream = stream_create(device, 0, 2, clock, NULL, channel_update);
/* allocate the sample cache */ /* allocate the sample cache */
length = memory_region_length(machine, "cvsd") * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); length = memory_region_length(machine, "cvsd") * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);

View File

@ -161,7 +161,7 @@ CUSTOM_START( flower_sh_start )
int i; int i;
/* get stream channels */ /* get stream channels */
stream = stream_create(0, 1, samplerate, 0, flower_update_mono); stream = stream_create(device, 0, 1, samplerate, 0, flower_update_mono);
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate); mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate);

View File

@ -376,7 +376,7 @@ static SAMPLES_START( galaxian_sh_start )
pitch = 0xff; pitch = 0xff;
vol = 0; vol = 0;
tone_stream = stream_create(0,1,SOUND_CLOCK/STEPS,NULL,tone_update); tone_stream = stream_create(device,0,1,SOUND_CLOCK/STEPS,NULL,tone_update);
stream_set_output_gain(tone_stream, 0, TOOTHSAW_VOLUME); stream_set_output_gain(tone_stream, 0, TOOTHSAW_VOLUME);
sample_set_volume(CHANNEL_NOISE,0); sample_set_volume(CHANNEL_NOISE,0);

View File

@ -123,7 +123,7 @@ CUSTOM_START( geebee_sh_start )
decay[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); decay[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
/* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */ /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
channel = stream_create(0, 1, 18432000 / 3 / 2 / 384, NULL, geebee_sound_update); channel = stream_create(device, 0, 1, 18432000 / 3 / 2 / 384, NULL, geebee_sound_update);
vcount = 0; vcount = 0;
volume_timer = timer_alloc(machine, volume_decay, NULL); volume_timer = timer_alloc(machine, volume_decay, NULL);

View File

@ -169,7 +169,7 @@ CUSTOM_START( gomoku_sh_start )
int ch; int ch;
/* get stream channels */ /* get stream channels */
stream = stream_create(0, 1, samplerate, NULL, gomoku_update_mono); stream = stream_create(device, 0, 1, samplerate, NULL, gomoku_update_mono);
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate); mixer_buffer = auto_malloc(2 * sizeof(short) * samplerate);

View File

@ -68,7 +68,7 @@ CUSTOM_START( gridlee_sh_start )
running_machine *machine = device->machine; running_machine *machine = device->machine;
/* allocate the stream */ /* allocate the stream */
gridlee_stream = stream_create(0, 1, machine->sample_rate, NULL, gridlee_stream_update); gridlee_stream = stream_create(device, 0, 1, machine->sample_rate, NULL, gridlee_stream_update);
freq_to_step = (double)(1 << 24) / (double)machine->sample_rate; freq_to_step = (double)(1 << 24) / (double)machine->sample_rate;

View File

@ -79,7 +79,6 @@
#include "driver.h" #include "driver.h"
#include "streams.h" #include "streams.h"
#include "deprecat.h"
#include "cpu/i86/i186intf.h" #include "cpu/i86/i186intf.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "leland.h" #include "leland.h"
@ -141,7 +140,7 @@ CUSTOM_START( leland_sh_start )
dac_bufout[0] = dac_bufout[1] = 0; dac_bufout[0] = dac_bufout[1] = 0;
/* allocate the stream */ /* allocate the stream */
dac_stream = stream_create(0, 1, 256*60, NULL, leland_update); dac_stream = stream_create(device, 0, 1, 256*60, NULL, leland_update);
/* allocate memory */ /* allocate memory */
dac_buffer[0] = auto_malloc(DAC_BUFFER_SIZE); dac_buffer[0] = auto_malloc(DAC_BUFFER_SIZE);
@ -503,9 +502,9 @@ static void leland_80186_extern_update(void *param, stream_sample_t **inputs, st
static TIMER_CALLBACK( internal_timer_int ); static TIMER_CALLBACK( internal_timer_int );
static TIMER_CALLBACK( dma_timer_callback ); static TIMER_CALLBACK( dma_timer_callback );
void *common_sh_start(int clock, const custom_sound_interface *config) static void *common_sh_start(const device_config *device, int clock, const custom_sound_interface *config)
{ {
running_machine *machine = Machine; running_machine *machine = device->machine;
const address_space *dmaspace = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM); const address_space *dmaspace = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
int i; int i;
@ -516,14 +515,14 @@ void *common_sh_start(int clock, const custom_sound_interface *config)
has_ym2151 = 1; has_ym2151 = 1;
/* allocate separate streams for the DMA and non-DMA DACs */ /* allocate separate streams for the DMA and non-DMA DACs */
dma_stream = stream_create(0, 1, OUTPUT_RATE, (void *)dmaspace, leland_80186_dma_update); dma_stream = stream_create(device, 0, 1, OUTPUT_RATE, (void *)dmaspace, leland_80186_dma_update);
nondma_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_dac_update); nondma_stream = stream_create(device, 0, 1, OUTPUT_RATE, NULL, leland_80186_dac_update);
/* if we have a 2151, install an externally driven DAC stream */ /* if we have a 2151, install an externally driven DAC stream */
if (has_ym2151) if (has_ym2151)
{ {
ext_base = memory_region(machine, "dac"); ext_base = memory_region(machine, "dac");
extern_stream = stream_create(0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update); extern_stream = stream_create(device, 0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update);
} }
/* create timers here so they stick around */ /* create timers here so they stick around */
@ -545,13 +544,13 @@ void *common_sh_start(int clock, const custom_sound_interface *config)
CUSTOM_START( leland_80186_sh_start ) CUSTOM_START( leland_80186_sh_start )
{ {
is_redline = 0; is_redline = 0;
return common_sh_start(clock, config); return common_sh_start(device, clock, config);
} }
CUSTOM_START( redline_80186_sh_start ) CUSTOM_START( redline_80186_sh_start )
{ {
is_redline = 1; is_redline = 1;
return common_sh_start(clock, config); return common_sh_start(device, clock, config);
} }

View File

@ -543,7 +543,7 @@ CUSTOM_START( phoenix_sh_start )
poly18[i] = bits; poly18[i] = bits;
} }
channel = stream_create(0, 1, machine->sample_rate, 0, phoenix_sound_update); channel = stream_create(device, 0, 1, machine->sample_rate, 0, phoenix_sound_update);
state_save_register_global_pointer(machine, poly18, (1ul << (18-5)) ); state_save_register_global_pointer(machine, poly18, (1ul << (18-5)) );

View File

@ -478,7 +478,7 @@ static void *common_sh_start(const device_config *device, const custom_sound_int
poly18[i] = bits; poly18[i] = bits;
} }
channel = stream_create(0, 1, machine->sample_rate, NULL, pleiads_sound_update); channel = stream_create(device, 0, 1, machine->sample_rate, NULL, pleiads_sound_update);
/* just a dummy alloc to make the caller happy */ /* just a dummy alloc to make the caller happy */
return auto_malloc(1); return auto_malloc(1);

View File

@ -102,7 +102,7 @@ static void engine_sound_update(void *param, stream_sample_t **inputs, stream_sa
/************************************/ /************************************/
CUSTOM_START( polepos_sh_start ) CUSTOM_START( polepos_sh_start )
{ {
stream = stream_create(0, 1, OUTPUT_RATE, NULL, engine_sound_update); stream = stream_create(device, 0, 1, OUTPUT_RATE, NULL, engine_sound_update);
sample_msb = sample_lsb = 0; sample_msb = sample_lsb = 0;
sample_enable = 0; sample_enable = 0;

View File

@ -171,10 +171,10 @@ static void redbaron_sound_update(void *param, stream_sample_t **inputs, stream_
CUSTOM_START( redbaron_sh_start ) CUSTOM_START( redbaron_sh_start )
{ {
int i; int i;
vol_lookup = (INT16 *)auto_malloc(32768 * sizeof(INT16)); vol_lookup = (INT16 *)auto_malloc(32768 * sizeof(INT16));
for( i = 0; i < 0x8000; i++ ) for( i = 0; i < 0x8000; i++ )
vol_lookup[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096)); vol_lookup[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
for( i = 0; i < 16; i++ ) for( i = 0; i < 16; i++ )
@ -205,9 +205,9 @@ CUSTOM_START( redbaron_sh_start )
r0 = 1.0/r0; r0 = 1.0/r0;
r1 = 1.0/r1; r1 = 1.0/r1;
vol_crash[i] = 32767 * r0 / (r0 + r1); vol_crash[i] = 32767 * r0 / (r0 + r1);
} }
channel = stream_create(0, 1, OUTPUT_RATE, 0, redbaron_sound_update); channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, redbaron_sound_update);
return auto_malloc(1); return auto_malloc(1);
} }

View File

@ -635,7 +635,7 @@ CUSTOM_START( rockola_sh_start )
// 38.99 Hz update (according to schematic) // 38.99 Hz update (according to schematic)
rockola_set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1)); rockola_set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1));
tone_stream = stream_create(0, 1, SAMPLE_RATE, NULL, rockola_tone_update); tone_stream = stream_create(device, 0, 1, SAMPLE_RATE, NULL, rockola_tone_update);
return auto_malloc(1); return auto_malloc(1);
} }

View File

@ -582,7 +582,7 @@ static CUSTOM_START( sega005_custom_start )
running_machine *machine = device->machine; running_machine *machine = device->machine;
/* create the stream */ /* create the stream */
sega005_stream = stream_create(0, 1, SEGA005_COUNTER_FREQ, NULL, sega005_stream_update); sega005_stream = stream_create(device, 0, 1, SEGA005_COUNTER_FREQ, NULL, sega005_stream_update);
/* create a timer for the 555 */ /* create a timer for the 555 */
sega005_sound_timer = timer_alloc(machine, sega005_auto_timer, NULL); sega005_sound_timer = timer_alloc(machine, sega005_auto_timer, NULL);

Some files were not shown because too many files have changed in this diff Show More