mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
t6721a/t6w28/tc8830f/tia/tms36xx/tms5110/upd1771/upd7752/upd934g/vlm5030/vrc6/vrender0/wave/x1_010: update to new stream callbacks
This commit is contained in:
parent
71565b91dd
commit
ecd3333757
@ -862,7 +862,7 @@ discrete_device::~discrete_device(void)
|
||||
void discrete_device::device_start()
|
||||
{
|
||||
// create the stream
|
||||
//m_stream = stream_alloc_legacy(0, 2, 22257);
|
||||
//m_stream = stream_alloc(0, 2, 22257);
|
||||
|
||||
const discrete_block *intf_start = m_intf;
|
||||
|
||||
|
@ -95,6 +95,7 @@ void dspv_device::snd_w(offs_t offset, u16 data)
|
||||
|
||||
void dspv_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
void dspv_device::device_start()
|
||||
|
@ -92,6 +92,7 @@ void iop_spu_device::dma_done(int bank)
|
||||
void iop_spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// TODO
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(iop_spu_device::autodma_done_timer_hack)
|
||||
|
@ -177,6 +177,7 @@ void lmc1992_device::device_start()
|
||||
|
||||
void lmc1992_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ namco_63701x_device::namco_63701x_device(const machine_config &mconfig, const ch
|
||||
|
||||
void namco_63701x_device::device_start()
|
||||
{
|
||||
m_stream = stream_alloc_legacy(0, 2, clock()/1000);
|
||||
m_stream = stream_alloc(0, 2, clock()/1000);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
@ -61,16 +61,16 @@ void namco_63701x_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void namco_63701x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int ch;
|
||||
|
||||
for (ch = 0;ch < 2;ch++)
|
||||
{
|
||||
stream_sample_t *buf = outputs[ch];
|
||||
auto &buf = outputs[ch];
|
||||
voice_63701x *v = &m_voices[ch];
|
||||
|
||||
if (v->playing)
|
||||
@ -80,12 +80,12 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
int vol = vol_table[v->volume];
|
||||
int p;
|
||||
|
||||
for (p = 0;p < samples;p++)
|
||||
for (p = 0;p < buf.samples();p++)
|
||||
{
|
||||
if (v->silence_counter)
|
||||
{
|
||||
v->silence_counter--;
|
||||
*(buf++) = 0;
|
||||
buf.put(p, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,17 +94,18 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
if (data == 0xff) /* end of sample */
|
||||
{
|
||||
v->playing = 0;
|
||||
buf.fill(0, p);
|
||||
break;
|
||||
}
|
||||
else if (data == 0x00) /* silence compression */
|
||||
{
|
||||
data = base[(pos++) & 0xffff];
|
||||
v->silence_counter = data;
|
||||
*(buf++) = 0;
|
||||
buf.put(p, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(buf++) = vol * (data - 0x80);
|
||||
buf.put_int(p, vol * (data - 0x80), 32768);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,7 +113,7 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
v->position = pos;
|
||||
}
|
||||
else
|
||||
memset(buf, 0, samples * sizeof(*buf));
|
||||
buf.fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
struct voice_63701x
|
||||
|
@ -54,4 +54,5 @@ void pcd3311_device::device_start()
|
||||
|
||||
void pcd3311_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
@ -71,5 +71,6 @@ void swp20_device::snd_w(offs_t offset, u8 data)
|
||||
|
||||
void swp20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
|
@ -56,17 +56,18 @@ void t6721a_device::device_start()
|
||||
m_write_apd.resolve_safe();
|
||||
|
||||
// create sound stream
|
||||
m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 1, machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void t6721a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void t6721a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_sound_interface overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -101,14 +101,14 @@ void t6w28_device::write(offs_t offset, uint8_t data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int i;
|
||||
stream_sample_t *buffer0 = outputs[0];
|
||||
stream_sample_t *buffer1 = outputs[1];
|
||||
auto &buffer0 = outputs[0];
|
||||
auto &buffer1 = outputs[1];
|
||||
|
||||
|
||||
/* If the volume is 0, increase the counter */
|
||||
@ -119,11 +119,11 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl
|
||||
/* 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 (m_count[i] <= samples*STEP) m_count[i] += samples*STEP;
|
||||
if (m_count[i] <= buffer0.samples()*STEP) m_count[i] += buffer0.samples()*STEP;
|
||||
}
|
||||
}
|
||||
|
||||
while (samples > 0)
|
||||
for (int sampindex = 0; sampindex < buffer0.samples(); sampindex++)
|
||||
{
|
||||
int vol[8];
|
||||
unsigned int out0, out1;
|
||||
@ -252,10 +252,8 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl
|
||||
if (out0 > MAX_OUTPUT * STEP) out0 = MAX_OUTPUT * STEP;
|
||||
if (out1 > MAX_OUTPUT * STEP) out1 = MAX_OUTPUT * STEP;
|
||||
|
||||
*(buffer0++) = out0 / STEP;
|
||||
*(buffer1++) = out1 / STEP;
|
||||
|
||||
samples--;
|
||||
buffer0.put_int(sampindex, out0 / STEP, 32768);
|
||||
buffer1.put_int(sampindex, out1 / STEP, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +294,7 @@ void t6w28_device::device_start()
|
||||
int i;
|
||||
|
||||
m_sample_rate = clock() / 16;
|
||||
m_channel = stream_alloc_legacy(0, 2, m_sample_rate);
|
||||
m_channel = stream_alloc(0, 2, m_sample_rate);
|
||||
|
||||
for (i = 0;i < 8;i++) m_volume[i] = 0;
|
||||
|
||||
|
@ -18,7 +18,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
void set_gain(int gain);
|
||||
|
||||
|
@ -46,7 +46,7 @@ tc8830f_device::tc8830f_device(const machine_config &mconfig, const char *tag, d
|
||||
void tc8830f_device::device_start()
|
||||
{
|
||||
// create the stream
|
||||
m_stream = stream_alloc_legacy(0, 1, clock() / 0x10);
|
||||
m_stream = stream_alloc(0, 1, clock() / 0x10);
|
||||
|
||||
// register for savestates
|
||||
save_item(NAME(m_playing));
|
||||
@ -79,11 +79,11 @@ void tc8830f_device::device_clock_changed()
|
||||
|
||||
|
||||
|
||||
void tc8830f_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tc8830f_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int32_t mix = 0;
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
{
|
||||
if (m_playing)
|
||||
{
|
||||
@ -125,7 +125,7 @@ void tc8830f_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
mix = m_output;
|
||||
}
|
||||
|
||||
outputs[0][i] = mix;
|
||||
outputs[0].put_int(i, mix, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
virtual void device_post_load() override;
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
sound_stream *m_stream;
|
||||
|
@ -31,7 +31,7 @@ tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t
|
||||
|
||||
void tia_device::device_start()
|
||||
{
|
||||
m_channel = stream_alloc_legacy(0, 1, clock());
|
||||
m_channel = stream_alloc(0, 1, clock());
|
||||
m_chip = tia_sound_init(this, clock(), clock(), 16);
|
||||
if (!m_chip)
|
||||
throw emu_fatalerror("tia_device(%s): Error creating TIA chip", tag());
|
||||
@ -49,12 +49,12 @@ void tia_device::device_stop()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tia_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tia_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
tia_process(m_chip, outputs[0], samples);
|
||||
tia_process(m_chip, outputs[0]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ protected:
|
||||
virtual void device_stop() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
sound_stream *m_channel;
|
||||
|
@ -264,7 +264,7 @@ void tia_write(void *_chip, offs_t offset, uint8_t data)
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void tia_process(void *_chip, stream_sample_t *buffer, int length)
|
||||
void tia_process(void *_chip, write_stream_view &buffer)
|
||||
{
|
||||
struct tia *chip = (struct tia *)_chip;
|
||||
uint8_t audc0, audc1;
|
||||
@ -286,7 +286,7 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length)
|
||||
div_n_cnt1 = chip->Div_n_cnt[1];
|
||||
|
||||
/* loop until the buffer is filled */
|
||||
while (length > 0)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); )
|
||||
{
|
||||
/* Process channel 0 */
|
||||
if (div_n_cnt0 > 1)
|
||||
@ -482,10 +482,7 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length)
|
||||
chip->Samp_n_cnt += chip->Samp_n_max;
|
||||
|
||||
/* calculate the latest output value and place in buffer */
|
||||
*buffer++ = outvol_0 + outvol_1;
|
||||
|
||||
/* and indicate one less byte to process */
|
||||
length--;
|
||||
buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -496,10 +493,9 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length)
|
||||
* byte contains the fractional part */
|
||||
chip->Samp_n_cnt -= 256;
|
||||
/* calculate the latest output value and place in buffer */
|
||||
*buffer++ = outvol_0 + outvol_1;
|
||||
length--;
|
||||
buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768);
|
||||
}
|
||||
while ((chip->Samp_n_cnt >= 256) && (length > 0));
|
||||
while ((chip->Samp_n_cnt >= 256) && (sampindex < buffer.samples()));
|
||||
|
||||
/* adjust the sample counter if necessary */
|
||||
if (chip->Samp_n_cnt < 256)
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain);
|
||||
void tia_sound_free(void *chip);
|
||||
void tia_process(void *chip, stream_sample_t *buffer, int length);
|
||||
void tia_process(void *chip, write_stream_view &buffer);
|
||||
void tia_write(void *chip, offs_t offset, uint8_t data);
|
||||
|
||||
#endif // MAME_SOUND_TIASOUND_H
|
||||
|
@ -46,7 +46,7 @@ void tms3615_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
|
@ -355,7 +355,7 @@ void tms36xx_device::device_start()
|
||||
{
|
||||
int enable = 0;
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, clock() * 64);
|
||||
m_channel = stream_alloc(0, 1, clock() * 64);
|
||||
m_samplerate = clock() * 64;
|
||||
m_basefreq = clock();
|
||||
|
||||
@ -394,23 +394,22 @@ void tms36xx_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tms36xx_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tms36xx_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int samplerate = m_samplerate;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
/* no tune played? */
|
||||
if( !tunes[m_tune_num] || m_voices == 0 )
|
||||
{
|
||||
while (--samples >= 0)
|
||||
buffer[samples] = 0;
|
||||
buffer.fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
while( samples-- > 0 )
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int sum = 0;
|
||||
|
||||
@ -444,7 +443,7 @@ void tms36xx_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
TONE( 0) TONE( 1) TONE( 2) TONE( 3) TONE( 4) TONE( 5)
|
||||
TONE( 6) TONE( 7) TONE( 8) TONE( 9) TONE(10) TONE(11)
|
||||
|
||||
*buffer++ = sum / m_voices;
|
||||
buffer.put_int(sampindex, sum, 32768 * m_voices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
public:
|
||||
// MM6221AA interface functions
|
||||
|
@ -1048,7 +1048,7 @@ void tms5110_device::device_start()
|
||||
m_data_cb.resolve();
|
||||
|
||||
/* initialize a stream */
|
||||
m_stream = stream_alloc_legacy(0, 1, clock() / 80);
|
||||
m_stream = stream_alloc(0, 1, clock() / 80);
|
||||
|
||||
m_state = CTL_STATE_INPUT; /* most probably not defined */
|
||||
m_romclk_hack_timer = timer_alloc(0);
|
||||
@ -1220,27 +1220,25 @@ int tms5110_device::romclk_hack_r()
|
||||
******************************************************************************/
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tms5110_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tms5110_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int16_t sample_data[MAX_SAMPLE_CHUNK];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
/* loop while we still have samples to generate */
|
||||
while (samples)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); )
|
||||
{
|
||||
int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
|
||||
int index;
|
||||
int length = buffer.samples() - sampindex;
|
||||
if (length > MAX_SAMPLE_CHUNK)
|
||||
length = MAX_SAMPLE_CHUNK;
|
||||
|
||||
/* generate the samples and copy to the target buffer */
|
||||
process(sample_data, length);
|
||||
for (index = 0; index < length; index++)
|
||||
*buffer++ = sample_data[index];
|
||||
|
||||
/* account for the samples */
|
||||
samples -= length;
|
||||
for (int index = 0; index < length; index++)
|
||||
buffer.put_int(sampindex++, sample_data[index], 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
uint8_t TALK_STATUS() const { return m_SPEN | m_TALKD; }
|
||||
|
||||
|
@ -255,7 +255,7 @@ void upd1771c_device::device_start()
|
||||
|
||||
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this));
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, clock() / 4);
|
||||
m_channel = stream_alloc(0, 1, clock() / 4);
|
||||
|
||||
save_item(NAME(m_packet));
|
||||
save_item(NAME(m_index));
|
||||
@ -476,12 +476,12 @@ TIMER_CALLBACK_MEMBER( upd1771c_device::ack_callback )
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void upd1771c_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
switch (m_state)
|
||||
{
|
||||
@ -489,9 +489,9 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa
|
||||
//logerror( "upd1771_STATE_TONE samps:%d %d %d %d %d %d\n",(int)samples,
|
||||
// (int)m_t_timbre,(int)m_t_offset,(int)m_t_volume,(int)m_t_period,(int)m_t_tpos);
|
||||
|
||||
while (--samples >= 0)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
*buffer++ = (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume * 2;
|
||||
buffer.put_int(sampindex, (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume, 32768 / 2);
|
||||
|
||||
m_t_ppos++;
|
||||
if (m_t_ppos >= m_t_period)
|
||||
@ -506,10 +506,8 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa
|
||||
break;
|
||||
|
||||
case STATE_NOISE:
|
||||
while (--samples >= 0)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
*buffer = 0;
|
||||
|
||||
//"wavetable-LFSR" component
|
||||
int wlfsr_val = ((int)noise_tbl[m_nw_tpos]) - 127;//data too wide
|
||||
|
||||
@ -535,23 +533,18 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa
|
||||
}
|
||||
}
|
||||
//not quite, but close.
|
||||
*buffer+= (
|
||||
buffer.put_int(sampindex,
|
||||
(wlfsr_val * m_nw_volume) |
|
||||
(res[0] * m_n_volume[0]) |
|
||||
(res[1] * m_n_volume[1]) |
|
||||
(res[2] * m_n_volume[2])
|
||||
) ;
|
||||
|
||||
buffer++;
|
||||
(res[2] * m_n_volume[2]),
|
||||
32768) ;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//fill buffer with silence
|
||||
while (--samples >= 0)
|
||||
{
|
||||
*buffer++ = 0;
|
||||
}
|
||||
buffer.fill(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
static constexpr unsigned MAX_PACKET_SIZE = 0x8000;
|
||||
|
@ -72,7 +72,7 @@ device_memory_interface::space_config_vector upd7752_device::memory_space_config
|
||||
void upd7752_device::device_start()
|
||||
{
|
||||
/* TODO: clock */
|
||||
m_stream = stream_alloc_legacy(0, 1, clock() / 64);
|
||||
m_stream = stream_alloc(0, 1, clock() / 64);
|
||||
|
||||
m_status = 0;
|
||||
}
|
||||
@ -96,11 +96,12 @@ void upd7752_device::device_stop()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd7752_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void upd7752_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -30,7 +30,7 @@ protected:
|
||||
virtual void device_stop() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
virtual space_config_vector memory_space_config() const override;
|
||||
|
||||
private:
|
||||
|
@ -49,7 +49,7 @@ upd934g_device::upd934g_device(const machine_config &mconfig, const char *tag, d
|
||||
void upd934g_device::device_start()
|
||||
{
|
||||
// create sound stream
|
||||
m_stream = stream_alloc_legacy(0, 4, 20000);
|
||||
m_stream = stream_alloc(0, 4, 20000);
|
||||
|
||||
// resolve callbacks
|
||||
m_data_cb.resolve_safe(0);
|
||||
@ -81,32 +81,33 @@ void upd934g_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd934g_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
for (unsigned ch = 0; ch < 4; ch++)
|
||||
{
|
||||
std::fill(&outputs[ch][0], &outputs[ch][samples], 0);
|
||||
|
||||
if (m_ready && m_channel[ch].playing != -1)
|
||||
{
|
||||
uint16_t end = m_addr[m_channel[ch].playing + 1] - 1;
|
||||
|
||||
for (unsigned i = 0; i < samples; i++)
|
||||
for (unsigned i = 0; i < outputs[ch].samples(); i++)
|
||||
{
|
||||
int8_t raw = static_cast<int8_t>(m_data_cb(m_channel[ch].pos));
|
||||
outputs[ch][i] = raw * (m_channel[ch].volume + 1) * 64;
|
||||
outputs[ch].put_int(i, raw * (m_channel[ch].volume + 1), 32768 / 64);
|
||||
|
||||
if (++m_channel[ch].pos >= end)
|
||||
{
|
||||
m_channel[ch].playing = -1;
|
||||
outputs[ch].fill(0, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
outputs[ch].fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
devcb_read8 m_data_cb;
|
||||
|
@ -214,7 +214,7 @@ void vlm5030_device::device_start()
|
||||
device_reset();
|
||||
m_phase = PH_IDLE;
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, clock() / 440);
|
||||
m_channel = stream_alloc(0, 1, clock() / 440);
|
||||
|
||||
save_item(NAME(m_address));
|
||||
save_item(NAME(m_pin_BSY));
|
||||
@ -491,22 +491,22 @@ if( m_interp_step != 1)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void vlm5030_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int buf_count=0;
|
||||
int interp_effect;
|
||||
int i;
|
||||
int u[11];
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
/* running */
|
||||
int sampindex = 0;
|
||||
if( m_phase == PH_RUN || m_phase == PH_STOP )
|
||||
{
|
||||
/* playing speech */
|
||||
while (samples > 0)
|
||||
for ( ; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int current_val;
|
||||
|
||||
@ -592,13 +592,7 @@ void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
m_x[0] = u[0];
|
||||
|
||||
/* clipping, buffering */
|
||||
if (u[0] > 511)
|
||||
buffer[buf_count] = 511<<6;
|
||||
else if (u[0] < -511)
|
||||
buffer[buf_count] = uint32_t(-511)<<6;
|
||||
else
|
||||
buffer[buf_count] = (u[0] << 6);
|
||||
buf_count++;
|
||||
buffer.put_int_clamp(sampindex, u[0], 512);
|
||||
|
||||
/* sample count */
|
||||
m_sample_count--;
|
||||
@ -607,7 +601,6 @@ void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
if (m_pitch_count >= m_current_pitch )
|
||||
m_pitch_count = 0;
|
||||
/* size */
|
||||
samples--;
|
||||
}
|
||||
/* return;*/
|
||||
}
|
||||
@ -616,7 +609,7 @@ phase_stop:
|
||||
switch( m_phase )
|
||||
{
|
||||
case PH_SETUP:
|
||||
if( m_sample_count <= samples)
|
||||
if( m_sample_count <= buffer.samples())
|
||||
{
|
||||
m_sample_count = 0;
|
||||
/* logerror("VLM5030 BSY=H\n" ); */
|
||||
@ -625,11 +618,11 @@ phase_stop:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sample_count -= samples;
|
||||
m_sample_count -= buffer.samples();
|
||||
}
|
||||
break;
|
||||
case PH_END:
|
||||
if( m_sample_count <= samples)
|
||||
if( m_sample_count <= buffer.samples())
|
||||
{
|
||||
m_sample_count = 0;
|
||||
/* logerror("VLM5030 BSY=L\n" ); */
|
||||
@ -638,13 +631,9 @@ phase_stop:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sample_count -= samples;
|
||||
m_sample_count -= buffer.samples();
|
||||
}
|
||||
}
|
||||
/* silent buffering */
|
||||
while (samples > 0)
|
||||
{
|
||||
buffer[buf_count++] = 0x00;
|
||||
samples--;
|
||||
}
|
||||
buffer.fill(0, sampindex);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ protected:
|
||||
virtual void device_post_load() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
// device_rom_interface overrides
|
||||
virtual void rom_bank_updated() override;
|
||||
|
@ -45,7 +45,7 @@ vrc6snd_device::vrc6snd_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
void vrc6snd_device::device_start()
|
||||
{
|
||||
m_stream = stream_alloc_legacy(0, 1, clock());
|
||||
m_stream = stream_alloc(0, 1, clock());
|
||||
|
||||
m_freqctrl = m_pulsectrl[0] = m_pulsectrl[1] = 0;
|
||||
m_pulsefrql[0] = m_pulsefrql[1] = m_pulsefrqh[0] = m_pulsefrqh[1] = 0;
|
||||
@ -89,19 +89,20 @@ void vrc6snd_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void vrc6snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void vrc6snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
std::fill_n(&outputs[0][0], samples, 0);
|
||||
|
||||
// check global halt bit
|
||||
if (m_freqctrl & 1)
|
||||
{
|
||||
outputs[0].fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
{
|
||||
// update pulse1
|
||||
if (m_pulsefrqh[0] & 0x80)
|
||||
@ -198,9 +199,8 @@ void vrc6snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
|
||||
// sum 2 4-bit pulses, 1 5-bit saw = unsigned 6 bit output
|
||||
s16 tmp = (s16)(u8)(m_output[0] + m_output[1] + m_output[2]);
|
||||
tmp <<= 8;
|
||||
|
||||
outputs[0][i] = tmp;
|
||||
outputs[0].put_int(i, tmp, 128);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
u8 m_freqctrl, m_pulsectrl[2], m_sawrate, m_master_freq;
|
||||
|
@ -148,7 +148,7 @@ void vr0sound_device::device_start()
|
||||
for (auto &elem : m_channel)
|
||||
elem.Cache = &m_fbcache;
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 2, clock() / 972); // TODO : Correct source / divider?
|
||||
m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider?
|
||||
|
||||
save_item(STRUCT_MEMBER(m_channel, CurSAddr));
|
||||
save_item(STRUCT_MEMBER(m_channel, EnvVol));
|
||||
@ -208,13 +208,13 @@ device_memory_interface::space_config_vector vr0sound_device::memory_space_confi
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests
|
||||
// sound_stream_update - handle update requests
|
||||
// for our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void vr0sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void vr0sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
VR0_RenderAudio(samples, outputs[0], outputs[1]);
|
||||
VR0_RenderAudio(outputs[0], outputs[1]);
|
||||
}
|
||||
|
||||
u16 vr0sound_device::channel_r(offs_t offset)
|
||||
@ -500,7 +500,7 @@ void vr0sound_device::channel_t::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
}
|
||||
}
|
||||
|
||||
void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_sample_t *r)
|
||||
void vr0sound_device::VR0_RenderAudio(write_stream_view &l, write_stream_view &r)
|
||||
{
|
||||
int div;
|
||||
if (m_ChnClkNum)
|
||||
@ -508,7 +508,7 @@ void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_s
|
||||
else
|
||||
div = 1 << 16;
|
||||
|
||||
for (int s = 0; s < nsamples; s++)
|
||||
for (int s = 0; s < l.samples(); s++)
|
||||
{
|
||||
s32 lsample = 0, rsample = 0;
|
||||
for (int i = 0; i <= m_MaxChn; i++)
|
||||
@ -590,7 +590,7 @@ void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_s
|
||||
lsample += (sample * channel->LChnVol) >> 8;
|
||||
rsample += (sample * channel->RChnVol) >> 8;
|
||||
}
|
||||
l[s] = std::max(-32768, std::min(32767, lsample));
|
||||
r[s] = std::max(-32768, std::min(32767, rsample));
|
||||
l.put_int_clamp(s, lsample, 32768);
|
||||
r.put_int_clamp(s, rsample, 32768);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ protected:
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
// device_memory_interface configuration
|
||||
virtual space_config_vector memory_space_config() const override;
|
||||
@ -151,7 +151,7 @@ private:
|
||||
u8 m_MaxChn = 0x1f; // Max Channels - 1
|
||||
u8 m_ChnClkNum = 0; // Clock Number per Channel
|
||||
u16 m_Ctrl = 0; // 0x602 Control Functions
|
||||
void VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_sample_t *r);
|
||||
void VR0_RenderAudio(write_stream_view &l, write_stream_view &r);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(SOUND_VRENDER0, vr0sound_device)
|
||||
|
@ -40,51 +40,36 @@ wave_device::wave_device(const machine_config &mconfig, const char *tag, device_
|
||||
|
||||
void wave_device::device_start()
|
||||
{
|
||||
speaker_device_iterator spkiter(*owner());
|
||||
int speakers = spkiter.count();
|
||||
if (speakers > 1)
|
||||
stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
else
|
||||
stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
stream_alloc(0, 2, machine().sample_rate());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void wave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void wave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *left_buffer = outputs[0];
|
||||
stream_sample_t *right_buffer = nullptr;
|
||||
|
||||
speaker_device_iterator spkiter(*owner());
|
||||
int speakers = spkiter.count();
|
||||
if (speakers > 1)
|
||||
right_buffer = outputs[1];
|
||||
|
||||
cassette_state state = m_cass->get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER);
|
||||
|
||||
if (m_cass->exists() && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))))
|
||||
{
|
||||
cassette_image *cassette = m_cass->get_image();
|
||||
double time_index = m_cass->get_position();
|
||||
double duration = double(samples) / m_cass->machine().sample_rate();
|
||||
double duration = double(outputs[0].samples()) / outputs[0].sample_rate();
|
||||
|
||||
cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT);
|
||||
if (speakers > 1)
|
||||
cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
|
||||
if (m_sample_buf.size() < outputs[0].samples())
|
||||
m_sample_buf.resize(outputs[0].samples());
|
||||
|
||||
for (int i = samples - 1; i >= 0; i--)
|
||||
for (int ch = 0; ch < 2; ch++)
|
||||
{
|
||||
left_buffer[i] = ((int16_t *) left_buffer)[i];
|
||||
if (speakers > 1)
|
||||
right_buffer[i] = ((int16_t *) right_buffer)[i];
|
||||
cassette_get_samples(cassette, ch, time_index, duration, outputs[ch].samples(), 2, &m_sample_buf[0], CASSETTE_WAVEFORM_16BIT);
|
||||
for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++)
|
||||
outputs[ch].put_int(sampindex, m_sample_buf[sampindex], 32768);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(left_buffer, 0, sizeof(*left_buffer) * samples);
|
||||
if (speakers > 1)
|
||||
memset(right_buffer, 0, sizeof(*right_buffer) * samples);
|
||||
outputs[0].fill(0);
|
||||
outputs[1].fill(0);
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,11 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
private:
|
||||
required_device<cassette_image_device> m_cass;
|
||||
std::vector<s16> m_sample_buf;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(WAVE, wave_device)
|
||||
|
@ -119,7 +119,7 @@ void x1_010_device::device_start()
|
||||
LOG_SOUND("masterclock = %d rate = %d\n", clock(), m_rate);
|
||||
|
||||
/* get stream channels */
|
||||
m_stream = stream_alloc_legacy(0, 2, m_rate);
|
||||
m_stream = stream_alloc(0, 2, m_rate);
|
||||
|
||||
m_reg = make_unique_clear<u8[]>(0x2000);
|
||||
m_HI_WORD_BUF = make_unique_clear<u8[]>(0x2000);
|
||||
@ -204,14 +204,14 @@ void x1_010_device::word_w(offs_t offset, u16 data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// mixer buffer zero clear
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[1]));
|
||||
outputs[0].fill(0);
|
||||
outputs[1].fill(0);
|
||||
|
||||
// if (m_sound_enable == 0) return;
|
||||
|
||||
@ -220,8 +220,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]);
|
||||
if ((reg->status & 1) != 0) // Key On
|
||||
{
|
||||
stream_sample_t *bufL = outputs[0];
|
||||
stream_sample_t *bufR = outputs[1];
|
||||
auto &bufL = outputs[0];
|
||||
auto &bufR = outputs[1];
|
||||
const int div = (reg->status & 0x80) ? 1 : 0;
|
||||
if ((reg->status & 2) == 0) // PCM sampling
|
||||
{
|
||||
@ -240,7 +240,7 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
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 (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < bufL.samples(); i++)
|
||||
{
|
||||
const u32 delta = smp_offs >> 4;
|
||||
// sample ended?
|
||||
@ -250,8 +250,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
break;
|
||||
}
|
||||
const s8 data = (s8)(read_byte(start+delta));
|
||||
*bufL++ += (data * volL / 256);
|
||||
*bufR++ += (data * volR / 256);
|
||||
bufL.add_int(i, data * volL, 32768 * 256);
|
||||
bufR.add_int(i, data * volR, 32768 * 256);
|
||||
smp_offs += smp_step;
|
||||
}
|
||||
m_smp_offset[ch] = smp_offs;
|
||||
@ -272,7 +272,7 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
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 (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < bufL.samples(); i++)
|
||||
{
|
||||
const u32 delta = env_offs >> 10;
|
||||
// Envelope one shot mode
|
||||
@ -285,8 +285,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
const int volL = ((vol >> 4) & 0xf) * VOL_BASE;
|
||||
const int volR = ((vol >> 0) & 0xf) * VOL_BASE;
|
||||
const s8 data = (s8)(m_reg[start + ((smp_offs >> 10) & 0x7f)]);
|
||||
*bufL++ += (data * volL / 256);
|
||||
*bufR++ += (data * volR / 256);
|
||||
bufL.add_int(i, data * volL, 32768 * 256);
|
||||
bufR.add_int(i, data * volR, 32768 * 256);
|
||||
smp_offs += smp_step;
|
||||
env_offs += env_step;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ protected:
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
// device_rom_interface overrides
|
||||
virtual void rom_bank_updated() override;
|
||||
|
Loading…
Reference in New Issue
Block a user