mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
Complete sound modernization of remaining devices. Legacy callbacks and stream_sample_t removed. (#7297)
* a2mcms/coco_ssc/gus/cassette/floppy/8364_paula/laserdsc/s2636/spg2xx_audio/arcadia/channelf/cmi01a/cps3/dai_snd: Update to new stream callbacks * dsbz80/elan_eu3a05/exidy/exidy440/flower/geebee/gomoku/gridlee: Update to new stream callbacks * hyprolyb/lynx/micro3d/phoenix/pleiads/polepos: Update to new sound stream callback * redbaron/segag80r/segausb/seibu/snk6502/socrates/special/svis_snd: Update to new stream callbacks. * tiamc1/turrett/tvc/tx1/vboy/vc4000: Update to new stream callbacks * warpwarp/wiping/wswan/xavix/esq1/istrebiteli/milton6805/pv1000/mega32x/gic: Update to new stream callback * sound: Remove legacy stream support and stream_sample_t * * gomoku/wiping: Remove silly mixer tables in favor of math * micro3d: Remove tiny vectors in favor of fixed arrays * phoenix: Went back to std::unique_ptr array for LFSR * wiping: Fixed the scale factor.
This commit is contained in:
parent
52514f1acd
commit
7b8913fefa
@ -206,7 +206,7 @@ mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_
|
||||
void mcms_device::device_start()
|
||||
{
|
||||
m_write_irq.resolve();
|
||||
m_stream = stream_alloc_legacy(0, 2, 31250);
|
||||
m_stream = stream_alloc(0, 2, 31250);
|
||||
m_timer = timer_alloc(0, nullptr);
|
||||
m_clrtimer = timer_alloc(1, nullptr);
|
||||
m_enabled = false;
|
||||
@ -252,20 +252,19 @@ void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param,
|
||||
}
|
||||
}
|
||||
|
||||
void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *outL, *outR;
|
||||
int i, v;
|
||||
uint16_t wptr;
|
||||
int8_t sample;
|
||||
int32_t mixL, mixR;
|
||||
|
||||
outL = outputs[1];
|
||||
outR = outputs[0];
|
||||
auto &outL = outputs[1];
|
||||
auto &outR = outputs[0];
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
for (i = 0; i < samples; i++)
|
||||
for (i = 0; i < outL.samples(); i++)
|
||||
{
|
||||
mixL = mixR = 0;
|
||||
|
||||
@ -286,16 +285,14 @@ void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample
|
||||
}
|
||||
}
|
||||
|
||||
outL[i] = (mixL * m_mastervol)>>9;
|
||||
outR[i] = (mixR * m_mastervol)>>9;
|
||||
outL.put_int(i, mixL * m_mastervol, 32768 << 9);
|
||||
outR.put_int(i, mixR * m_mastervol, 32768 << 9);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
outL[i] = outR[i] = 0;
|
||||
}
|
||||
outL.fill(0);
|
||||
outR.fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) 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;
|
||||
|
@ -130,7 +130,7 @@ namespace
|
||||
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:
|
||||
sound_stream* m_stream;
|
||||
@ -535,25 +535,25 @@ cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char
|
||||
|
||||
void cocossc_sac_device::device_start()
|
||||
{
|
||||
m_stream = stream_alloc_legacy(1, 1, machine().sample_rate());
|
||||
m_stream = stream_alloc(1, 1, machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void cocossc_sac_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t const *src = inputs[0];
|
||||
stream_sample_t *dst = outputs[0];
|
||||
auto &src = inputs[0];
|
||||
auto &dst = outputs[0];
|
||||
|
||||
double n = samples;
|
||||
double n = dst.samples();
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < n; sampindex++)
|
||||
{
|
||||
m_rms[m_index] += ( (double)*src * (double)*src );
|
||||
*dst++ = (*src++);
|
||||
m_rms[m_index] += src.get(sampindex) * src.get(sampindex);
|
||||
dst.put(sampindex, src.get(sampindex));
|
||||
}
|
||||
|
||||
m_rms[m_index] = m_rms[m_index] / n;
|
||||
@ -576,7 +576,7 @@ bool cocossc_sac_device::sound_activity_circuit_output()
|
||||
|
||||
average /= 16.0;
|
||||
|
||||
if( average > 10400.0 )
|
||||
if( average > 0.317 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -243,29 +243,26 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param, v
|
||||
}
|
||||
}
|
||||
|
||||
void gf1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int x,y;
|
||||
int x;
|
||||
//uint32_t count;
|
||||
|
||||
stream_sample_t* outputl = outputs[0];
|
||||
stream_sample_t* outputr = outputs[1];
|
||||
memset( outputl, 0x00, samples * sizeof(*outputl) );
|
||||
memset( outputr, 0x00, samples * sizeof(*outputr) );
|
||||
auto &outputl = outputs[0];
|
||||
auto &outputr = outputs[1];
|
||||
|
||||
outputl.fill(0);
|
||||
outputr.fill(0);
|
||||
|
||||
for(x=0;x<32;x++) // for each voice
|
||||
{
|
||||
stream_sample_t* left = outputl;
|
||||
stream_sample_t* right = outputr;
|
||||
uint16_t vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]);
|
||||
for(y=samples-1; y>=0; y--)
|
||||
for (int sampindex = 0; sampindex < outputl.samples(); sampindex++)
|
||||
{
|
||||
uint32_t current = m_voice[x].current_addr >> 9;
|
||||
// TODO: implement proper panning
|
||||
(*left) += ((m_voice[x].sample) * (vol/8192.0));
|
||||
(*right) += ((m_voice[x].sample) * (vol/8192.0));
|
||||
left++;
|
||||
right++;
|
||||
outputl.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192);
|
||||
outputr.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192);
|
||||
if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01))
|
||||
{
|
||||
if(m_voice[x].vol_ramp_ctrl & 0x04)
|
||||
@ -403,7 +400,7 @@ void gf1_device::device_start()
|
||||
m_wave_ram.resize(1024*1024);
|
||||
memset(&m_wave_ram[0], 0, 1024*1024);
|
||||
|
||||
m_stream = stream_alloc_legacy(0,2,clock() / (14 * 16));
|
||||
m_stream = stream_alloc(0,2,clock() / (14 * 16));
|
||||
|
||||
// init timers
|
||||
m_timer1 = timer_alloc(ADLIB_TIMER1);
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) 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;
|
||||
|
||||
protected:
|
||||
// voice-specific registers
|
||||
|
@ -236,7 +236,7 @@ void cassette_image_device::device_start()
|
||||
m_state = m_default_state;
|
||||
m_value = 0;
|
||||
|
||||
stream_alloc_legacy(0, (m_stereo? 2:1), machine().sample_rate());
|
||||
stream_alloc(0, m_stereo? 2:1, machine().sample_rate());
|
||||
}
|
||||
|
||||
image_init_result cassette_image_device::call_create(int format_type, util::option_resolution *format_options)
|
||||
@ -404,37 +404,29 @@ std::string cassette_image_device::call_display()
|
||||
// Cassette sound
|
||||
//-------------------------------------------------
|
||||
|
||||
void cassette_image_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void cassette_image_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;
|
||||
|
||||
if (m_stereo)
|
||||
right_buffer = outputs[1];
|
||||
|
||||
cassette_state state = get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER);
|
||||
|
||||
if (exists() && (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))
|
||||
{
|
||||
cassette_image *cassette = get_image();
|
||||
double time_index = get_position();
|
||||
double duration = ((double) samples) / 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 (m_stereo)
|
||||
cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
|
||||
if (m_samples.size() < outputs[0].samples())
|
||||
m_samples.resize(outputs[0].samples());
|
||||
|
||||
for (int i = samples - 1; i >= 0; i--)
|
||||
for (int ch = 0; ch < outputs.size(); ch++)
|
||||
{
|
||||
left_buffer[i] = ((int16_t *) left_buffer)[i];
|
||||
if (m_stereo)
|
||||
right_buffer[i] = ((int16_t *) right_buffer)[i];
|
||||
cassette_get_samples(cassette, 0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], CASSETTE_WAVEFORM_16BIT);
|
||||
for (int sampindex = 0; sampindex < outputs[ch].samples(); sampindex++)
|
||||
outputs[ch].put_int(sampindex, m_samples[sampindex], 32768);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(left_buffer, 0, sizeof(*left_buffer) * samples);
|
||||
if (m_stereo)
|
||||
memset(right_buffer, 0, sizeof(*right_buffer) * samples);
|
||||
for (int ch = 0; ch < outputs.size(); ch++)
|
||||
outputs[ch].fill(0);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
void seek(double time, int origin);
|
||||
|
||||
// sound stream update overrides
|
||||
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_sound_interface& set_stereo() { m_stereo = true; return *this; }
|
||||
|
||||
protected:
|
||||
@ -133,6 +133,7 @@ private:
|
||||
|
||||
image_init_result internal_load(bool is_create);
|
||||
bool m_stereo;
|
||||
std::vector<s16> m_samples;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -1248,7 +1248,7 @@ void floppy_sound_device::device_start()
|
||||
// If we don't have all samples, don't allocate a stream or access sample data.
|
||||
if (m_loaded)
|
||||
{
|
||||
m_sound = stream_alloc_legacy(0, 1, clock()); // per-floppy stream
|
||||
m_sound = stream_alloc(0, 1, clock()); // per-floppy stream
|
||||
}
|
||||
register_for_save_states();
|
||||
}
|
||||
@ -1369,21 +1369,21 @@ void floppy_sound_device::step(int zone)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - update the sound stream
|
||||
// sound_stream_update - update the sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// We are using only one stream, unlike the parent class
|
||||
// Also, there is no need for interpolation, as we only expect
|
||||
// one sample rate of 44100 for all samples
|
||||
|
||||
int16_t out;
|
||||
stream_sample_t *samplebuffer = outputs[0];
|
||||
auto &samplebuffer = outputs[0];
|
||||
int idx = 0;
|
||||
int sampleend = 0;
|
||||
|
||||
while (samples-- > 0)
|
||||
for (int sampindex = 0; sampindex < samplebuffer.samples(); sampindex++)
|
||||
{
|
||||
out = 0;
|
||||
|
||||
@ -1477,7 +1477,7 @@ void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
}
|
||||
|
||||
// Write to the stream buffer
|
||||
*(samplebuffer++) = out;
|
||||
samplebuffer.put_int(sampindex, out, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ protected:
|
||||
|
||||
private:
|
||||
// device_sound_interface overrides
|
||||
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;
|
||||
sound_stream* m_sound;
|
||||
|
||||
int m_step_base;
|
||||
|
@ -58,7 +58,7 @@ void paula_8364_device::device_start()
|
||||
}
|
||||
|
||||
// create the stream
|
||||
m_stream = stream_alloc_legacy(0, 4, clock() / CLOCK_DIVIDER);
|
||||
m_stream = stream_alloc(0, 4, clock() / CLOCK_DIVIDER);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -159,10 +159,10 @@ void paula_8364_device::dma_reload(audio_channel *chan)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void paula_8364_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int channum, sampoffs = 0;
|
||||
|
||||
@ -176,11 +176,11 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_
|
||||
|
||||
// clear the sample data to 0
|
||||
for (channum = 0; channum < 4; channum++)
|
||||
memset(outputs[channum], 0, sizeof(stream_sample_t) * samples);
|
||||
outputs[channum].fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
samples *= CLOCK_DIVIDER;
|
||||
int samples = outputs[0].samples() * CLOCK_DIVIDER;
|
||||
|
||||
// update the DMA states on each channel and reload if fresh
|
||||
for (channum = 0; channum < 4; channum++)
|
||||
@ -215,7 +215,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_
|
||||
audio_channel *chan = &m_channel[channum];
|
||||
int volume = (nextvol == -1) ? chan->vol : nextvol;
|
||||
int period = (nextper == -1) ? chan->per : nextper;
|
||||
stream_sample_t sample;
|
||||
s32 sample;
|
||||
int i;
|
||||
|
||||
// normalize the volume value
|
||||
@ -247,7 +247,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_
|
||||
|
||||
// fill the buffer with the sample
|
||||
for (i = 0; i < ticks; i += CLOCK_DIVIDER)
|
||||
outputs[channum][(sampoffs + i) / CLOCK_DIVIDER] = sample;
|
||||
outputs[channum].put_int((sampoffs + i) / CLOCK_DIVIDER, sample, 32768);
|
||||
|
||||
// account for the ticks; if we hit 0, advance
|
||||
chan->curticks -= ticks;
|
||||
|
@ -68,7 +68,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:
|
||||
enum
|
||||
|
@ -308,11 +308,11 @@ void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int pa
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - audio streamer for
|
||||
// sound_stream_update - audio streamer for
|
||||
// laserdiscs
|
||||
//-------------------------------------------------
|
||||
|
||||
void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// compute AND values based on the squelch
|
||||
int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff;
|
||||
@ -324,12 +324,12 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
samples_avail += m_audiobufsize;
|
||||
|
||||
// if no attached ld, just clear the buffers
|
||||
stream_sample_t *dst0 = outputs[0];
|
||||
stream_sample_t *dst1 = outputs[1];
|
||||
if (samples_avail < samples)
|
||||
auto &dst0 = outputs[0];
|
||||
auto &dst1 = outputs[1];
|
||||
if (samples_avail < outputs[0].samples())
|
||||
{
|
||||
memset(dst0, 0, samples * sizeof(dst0[0]));
|
||||
memset(dst1, 0, samples * sizeof(dst1[0]));
|
||||
dst0.fill(0);
|
||||
dst1.fill(0);
|
||||
}
|
||||
|
||||
// otherwise, stream from our buffer
|
||||
@ -340,10 +340,11 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
int sampout = m_audiobufout;
|
||||
|
||||
// copy samples, clearing behind us as we go
|
||||
while (sampout != m_audiobufin && samples-- > 0)
|
||||
int sampindex;
|
||||
for (sampindex = 0; sampout != m_audiobufin && sampindex < outputs[0].samples(); sampindex++)
|
||||
{
|
||||
*dst0++ = buffer0[sampout] & leftand;
|
||||
*dst1++ = buffer1[sampout] & rightand;
|
||||
dst0.put_int(sampindex, buffer0[sampout] & leftand, 32768);
|
||||
dst1.put_int(sampindex, buffer1[sampout] & rightand, 32768);
|
||||
buffer0[sampout] = 0;
|
||||
buffer1[sampout] = 0;
|
||||
sampout++;
|
||||
@ -353,16 +354,16 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
m_audiobufout = sampout;
|
||||
|
||||
// clear out the rest of the buffer
|
||||
if (samples > 0)
|
||||
if (sampindex < outputs[0].samples())
|
||||
{
|
||||
sampout = (m_audiobufout == 0) ? m_audiobufsize - 1 : m_audiobufout - 1;
|
||||
stream_sample_t fill0 = buffer0[sampout] & leftand;
|
||||
stream_sample_t fill1 = buffer1[sampout] & rightand;
|
||||
s32 fill0 = buffer0[sampout] & leftand;
|
||||
s32 fill1 = buffer1[sampout] & rightand;
|
||||
|
||||
while (samples-- > 0)
|
||||
for ( ; sampindex < outputs[0].samples(); sampindex++)
|
||||
{
|
||||
*dst0++ = fill0;
|
||||
*dst1++ = fill1;
|
||||
dst0.put_int(sampindex, fill0, 32768);
|
||||
dst1.put_int(sampindex, fill1, 32768);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -762,7 +763,7 @@ void laserdisc_device::init_audio()
|
||||
m_audio_callback.resolve();
|
||||
|
||||
// allocate a stream
|
||||
m_stream = stream_alloc_legacy(0, 2, 48000);
|
||||
m_stream = stream_alloc(0, 2, 48000);
|
||||
|
||||
// allocate audio buffers
|
||||
m_audiomaxsamples = ((uint64_t)m_samplerate * 1000000 + m_fps_times_1million - 1) / m_fps_times_1million;
|
||||
|
@ -220,7 +220,7 @@ protected:
|
||||
virtual void device_validity_check(validity_checker &valid) const 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;
|
||||
|
||||
// subclass helpers
|
||||
void set_audio_squelch(bool squelchleft, bool squelchright) { m_stream->update(); m_audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0); }
|
||||
|
@ -203,7 +203,7 @@ void s2636_device::device_start()
|
||||
save_item(NAME(m_intreq));
|
||||
save_item(NAME(m_intack));
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 1, machine().sample_rate());
|
||||
save_item(NAME(m_sample_cnt));
|
||||
save_item(NAME(m_sound_lvl));
|
||||
|
||||
@ -447,13 +447,14 @@ void s2636_device::write_intack(int state)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - generate audio output
|
||||
// sound_stream_update - generate audio output
|
||||
//-------------------------------------------------
|
||||
|
||||
void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
|
||||
void s2636_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];
|
||||
while (samples--)
|
||||
auto &buffer = outputs[0];
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
if (!m_sample_cnt)
|
||||
{
|
||||
@ -469,7 +470,7 @@ void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl
|
||||
}
|
||||
}
|
||||
|
||||
*buffer++ = m_sound_lvl ? 0x7fff : 0x0000;
|
||||
buffer.put(sampindex, m_sound_lvl ? 1.0 : 0.0);
|
||||
m_sample_cnt--;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,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:
|
||||
enum
|
||||
|
@ -76,7 +76,7 @@ void spg2xx_audio_device::device_start()
|
||||
m_audio_beat = timer_alloc(TIMER_BEAT);
|
||||
m_audio_beat->adjust(attotime::never);
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 2, 281250/4);
|
||||
m_stream = stream_alloc(0, 2, 281250/4);
|
||||
|
||||
m_channel_debug = -1;
|
||||
|
||||
@ -887,12 +887,12 @@ void spg2xx_audio_device::audio_w(offs_t offset, uint16_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void spg2xx_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *out_l = outputs[0];
|
||||
stream_sample_t *out_r = outputs[1];
|
||||
auto &out_l = outputs[0];
|
||||
auto &out_r = outputs[1];
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < out_l.samples(); i++)
|
||||
{
|
||||
int32_t left_total = 0;
|
||||
int32_t right_total = 0;
|
||||
@ -992,8 +992,8 @@ void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
int32_t left_final = (int16_t)((left_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7);
|
||||
int32_t right_final = (int16_t)((right_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7);
|
||||
|
||||
*out_l++ = (int16_t)left_final;
|
||||
*out_r++ = (int16_t)right_final;
|
||||
out_l.put_int(i, int16_t(left_final), 32768);
|
||||
out_r.put_int(i, int16_t(right_final), 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
protected:
|
||||
// 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 audio_beat_tick();
|
||||
void audio_rampdown_tick(const uint32_t channel);
|
||||
|
@ -146,7 +146,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<
|
||||
constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f;
|
||||
for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time)
|
||||
{
|
||||
stream_sample_t cursample = 0;
|
||||
s32 cursample = 0;
|
||||
|
||||
/* compute the number of cycles until the next master oscillator reset */
|
||||
/* or until the next noise boundary */
|
||||
|
@ -79,7 +79,7 @@ void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_st
|
||||
{
|
||||
// get current output level
|
||||
int step_size = (2 << m_chord);
|
||||
stream_sample_t vout = m_level[m_chord] + m_step * step_size;
|
||||
s32 vout = m_level[m_chord] + m_step * step_size;
|
||||
|
||||
// apply sign bit
|
||||
vout *= (m_sb ? +1 : -1);
|
||||
|
@ -1026,7 +1026,7 @@ void discrete_sound_device::device_reset()
|
||||
// discrete_device_process - process a number of
|
||||
// samples.
|
||||
//
|
||||
// input / output buffers are stream_sample_t
|
||||
// input / output buffers are s32
|
||||
// to not to have to convert the buffers.
|
||||
// a "discrete cpu" device will pass nullptr here
|
||||
//-------------------------------------------------
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) 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;
|
||||
|
||||
// device_rom_interface overrides
|
||||
|
@ -50,7 +50,7 @@ template <typename X> constexpr TIME_TYPE MULTIPLY_TIME_BY_INT(TIME_TYPE const &
|
||||
#endif
|
||||
|
||||
|
||||
typedef stream_sample_t FMSAMPLE;
|
||||
typedef s32 FMSAMPLE;
|
||||
/*
|
||||
#if (FM_SAMPLE_BITS==16)
|
||||
typedef int16_t FMSAMPLE;
|
||||
|
@ -16,7 +16,7 @@
|
||||
/* select output bits size of output : 8 or 16 */
|
||||
#define OPL_SAMPLE_BITS 16
|
||||
|
||||
typedef stream_sample_t OPLSAMPLE;
|
||||
typedef s32 OPLSAMPLE;
|
||||
/*
|
||||
#if (OPL_SAMPLE_BITS==16)
|
||||
typedef int16_t OPLSAMPLE;
|
||||
|
@ -443,7 +443,7 @@ void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_
|
||||
/*
|
||||
#ifdef ICS2115_DEBUG
|
||||
u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
|
||||
stream_sample_t sample = get_sample(voice);
|
||||
s32 sample = get_sample(voice);
|
||||
logerror("[%06x=%04x]", curaddr, (s16)sample);
|
||||
#endif
|
||||
*/
|
||||
|
@ -311,7 +311,7 @@ void k053260_device::sound_stream_update(sound_stream &stream, std::vector<read_
|
||||
{
|
||||
for ( int j = 0; j < outputs[0].samples(); j++ )
|
||||
{
|
||||
stream_sample_t buffer[2] = {0, 0};
|
||||
s32 buffer[2] = {0, 0};
|
||||
|
||||
for (auto & voice : m_voice)
|
||||
{
|
||||
@ -435,7 +435,7 @@ void k053260_device::KDSC_Voice::key_off()
|
||||
m_playing = false;
|
||||
}
|
||||
|
||||
void k053260_device::KDSC_Voice::play(stream_sample_t *outputs)
|
||||
void k053260_device::KDSC_Voice::play(s32 *outputs)
|
||||
{
|
||||
m_counter += CLOCKS_PER_SAMPLE;
|
||||
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
inline void update_pan_volume();
|
||||
inline void key_on();
|
||||
inline void key_off();
|
||||
inline void play(stream_sample_t *outputs);
|
||||
inline void play(s32 *outputs);
|
||||
inline bool playing() { return m_playing; }
|
||||
inline u8 read_rom(bool side_effects);
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ void s_dsp_device::sound_stream_update(sound_stream &stream, std::vector<read_st
|
||||
dsp_update(mix);
|
||||
|
||||
/* Update the buffers */
|
||||
outputs[0].put_int(i, (stream_sample_t)mix[0], 32768);
|
||||
outputs[1].put_int(i, (stream_sample_t)mix[1], 32768);
|
||||
outputs[0].put_int(i, (s32)mix[0], 32768);
|
||||
outputs[1].put_int(i, (s32)mix[1], 32768);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
/* select number of output bits: 8 or 16 */
|
||||
#define OPL3_SAMPLE_BITS 16
|
||||
|
||||
typedef stream_sample_t OPL3SAMPLE;
|
||||
typedef s32 OPL3SAMPLE;
|
||||
/*
|
||||
#if (OPL3_SAMPLE_BITS==16)
|
||||
typedef int16_t OPL3SAMPLE;
|
||||
|
@ -66,15 +66,10 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t &
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// stream_alloc_legacy - allocate a stream implicitly
|
||||
// stream_alloc - allocate a stream implicitly
|
||||
// associated with this device
|
||||
//-------------------------------------------------
|
||||
|
||||
sound_stream *device_sound_interface::stream_alloc_legacy(int inputs, int outputs, int sample_rate)
|
||||
{
|
||||
return device().machine().sound().stream_alloc_legacy(*this, inputs, outputs, sample_rate, stream_update_legacy_delegate(&device_sound_interface::sound_stream_update_legacy, this));
|
||||
}
|
||||
|
||||
sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate)
|
||||
{
|
||||
return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS);
|
||||
@ -381,17 +376,6 @@ void device_sound_interface::interface_pre_reset()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - implementation
|
||||
// that should be overridden by legacy devices
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_sound_interface::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
{
|
||||
throw emu_fatalerror("sound_stream_update_legacy called but not overridden by owning class");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - default implementation
|
||||
// that should be overridden
|
||||
|
@ -77,11 +77,9 @@ public:
|
||||
device_sound_interface &reset_routes() { m_route_list.clear(); return *this; }
|
||||
|
||||
// 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);
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
|
||||
|
||||
// stream creation
|
||||
sound_stream *stream_alloc_legacy(int inputs, int outputs, int sample_rate);
|
||||
sound_stream *stream_alloc(int inputs, int outputs, int sample_rate);
|
||||
sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags);
|
||||
|
||||
|
@ -85,9 +85,6 @@ typedef void genf(void);
|
||||
// pen_t is used to represent pixel values in bitmaps
|
||||
typedef u32 pen_t;
|
||||
|
||||
// stream_sample_t is used to represent a single sample in a sound stream
|
||||
typedef s32 stream_sample_t;
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -578,12 +578,10 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output
|
||||
m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0),
|
||||
m_sync_timer(nullptr),
|
||||
m_input(inputs),
|
||||
m_input_array(inputs),
|
||||
m_input_view(inputs),
|
||||
m_empty_buffer(100),
|
||||
m_output_base(output_base),
|
||||
m_output(outputs),
|
||||
m_output_array(outputs),
|
||||
m_output_view(outputs)
|
||||
{
|
||||
sound_assert(outputs > 0);
|
||||
@ -628,21 +626,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream - constructor with old-style
|
||||
// callback
|
||||
//-------------------------------------------------
|
||||
|
||||
sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags) :
|
||||
sound_stream(device, inputs, outputs, output_base, sample_rate, flags)
|
||||
{
|
||||
m_callback = std::move(callback);
|
||||
m_callback_ex = stream_update_delegate(&sound_stream::stream_update_legacy, this);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream - constructor with new-style
|
||||
// callback
|
||||
// sound_stream - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) :
|
||||
@ -847,7 +831,7 @@ void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate)
|
||||
#if (SOUND_DEBUG)
|
||||
void sound_stream::print_graph_recursive(int indent, int index)
|
||||
{
|
||||
osd_printf_info("%c %*s%s Ch.%d @ %d\n", m_callback.isnull() ? ' ' : '!', indent, "", name().c_str(), index + m_output_base, sample_rate());
|
||||
osd_printf_info("%*s%s Ch.%d @ %d\n", indent, "", name().c_str(), index + m_output_base, sample_rate());
|
||||
for (int index = 0; index < m_input.size(); index++)
|
||||
if (m_input[index].valid())
|
||||
{
|
||||
@ -923,57 +907,6 @@ void sound_stream::sync_update(void *, s32)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// stream_update_legacy - new-style callback which
|
||||
// forwards on to the old-style traditional
|
||||
// callback, converting to/from floats
|
||||
//-------------------------------------------------
|
||||
|
||||
void sound_stream::stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// temporary buffer to hold stream_sample_t inputs and outputs
|
||||
stream_sample_t temp_buffer[1024];
|
||||
int chunksize = ARRAY_LENGTH(temp_buffer) / (inputs.size() + outputs.size());
|
||||
int chunknum = 0;
|
||||
|
||||
// create the arrays to pass to the callback
|
||||
stream_sample_t **inputptr = m_input.empty() ? nullptr : &m_input_array[0];
|
||||
stream_sample_t **outputptr = &m_output_array[0];
|
||||
for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++)
|
||||
inputptr[inputnum] = &temp_buffer[chunksize * chunknum++];
|
||||
for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
|
||||
outputptr[outputnum] = &temp_buffer[chunksize * chunknum++];
|
||||
|
||||
// loop until all chunks done
|
||||
for (int baseindex = 0; baseindex < outputs[0].samples(); baseindex += chunksize)
|
||||
{
|
||||
// determine the number of samples to process this time
|
||||
int cursamples = outputs[0].samples() - baseindex;
|
||||
if (cursamples > chunksize)
|
||||
cursamples = chunksize;
|
||||
|
||||
// copy in the input data
|
||||
for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++)
|
||||
{
|
||||
stream_sample_t *dest = inputptr[inputnum];
|
||||
for (int index = 0; index < cursamples; index++)
|
||||
dest[index] = stream_sample_t(inputs[inputnum].get(baseindex + index) * stream_buffer::sample_t(32768.0));
|
||||
}
|
||||
|
||||
// run the callback
|
||||
m_callback(*this, inputptr, outputptr, cursamples);
|
||||
|
||||
// copy out the output data
|
||||
for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++)
|
||||
{
|
||||
stream_sample_t *src = outputptr[outputnum];
|
||||
for (int index = 0; index < cursamples; index++)
|
||||
outputs[outputnum].put(baseindex + index, stream_buffer::sample_t(src[index]) * stream_buffer::sample_t(1.0 / 32768.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// empty_view - return an empty view covering the
|
||||
// given time period as a substitute for invalid
|
||||
@ -1199,23 +1132,6 @@ sound_manager::~sound_manager()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// stream_alloc_legacy - allocate a new stream
|
||||
//-------------------------------------------------
|
||||
|
||||
sound_stream *sound_manager::stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback)
|
||||
{
|
||||
// determine output base
|
||||
u32 output_base = 0;
|
||||
for (auto &stream : m_stream_list)
|
||||
if (&stream->device() == &device)
|
||||
output_base += stream->output_count();
|
||||
|
||||
m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback));
|
||||
return m_stream_list.back().get();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// stream_alloc - allocate a new stream with the
|
||||
// new-style callback and flags
|
||||
|
@ -576,10 +576,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// ======================> stream_update_legacy_delegate/stream_update_delegate
|
||||
|
||||
// old-style callback; eventually should be deprecated
|
||||
using stream_update_legacy_delegate = delegate<void (sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)>;
|
||||
// ======================> stream_update_delegate
|
||||
|
||||
// new-style callback
|
||||
using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>;
|
||||
@ -614,7 +611,6 @@ class sound_stream
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
|
||||
sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS);
|
||||
virtual ~sound_stream();
|
||||
|
||||
@ -680,9 +676,6 @@ private:
|
||||
// timer callback for synchronous streams
|
||||
void sync_update(void *, s32);
|
||||
|
||||
// new callback which wrapps calls through to the old-style callbacks
|
||||
void stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
|
||||
|
||||
// return a view of 0 data covering the given time period
|
||||
read_stream_view empty_view(attotime start, attotime end);
|
||||
|
||||
@ -702,7 +695,6 @@ private:
|
||||
|
||||
// input information
|
||||
std::vector<sound_stream_input> m_input; // list of streams we directly depend upon
|
||||
std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback
|
||||
std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback
|
||||
std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers
|
||||
stream_buffer m_empty_buffer; // empty buffer for invalid inputs
|
||||
@ -710,12 +702,10 @@ private:
|
||||
// output information
|
||||
u32 m_output_base; // base index of our outputs, relative to our device
|
||||
std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us
|
||||
std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback
|
||||
std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback
|
||||
|
||||
// callback information
|
||||
stream_update_legacy_delegate m_callback; // callback function
|
||||
stream_update_delegate m_callback_ex; // extended callback function
|
||||
stream_update_delegate m_callback_ex; // extended callback function
|
||||
};
|
||||
|
||||
|
||||
@ -774,9 +764,6 @@ public:
|
||||
int sample_count() const { return m_samples_this_update; }
|
||||
int unique_id() { return m_unique_id++; }
|
||||
|
||||
// allocate a new stream with the old-style callback
|
||||
sound_stream *stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback);
|
||||
|
||||
// allocate a new stream with a new-style callback
|
||||
sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags);
|
||||
|
||||
|
@ -59,7 +59,7 @@ arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const
|
||||
//-------------------------------------------------
|
||||
void arcadia_sound_device::device_start()
|
||||
{
|
||||
m_channel = stream_alloc_legacy(0, 1, UVI_PAL*OSAMP);
|
||||
m_channel = stream_alloc(0, 1, UVI_PAL*OSAMP);
|
||||
m_lfsr = LFSR_INIT;
|
||||
m_tval = 1;
|
||||
logerror("arcadia_sound start\n");
|
||||
@ -76,18 +76,18 @@ void arcadia_sound_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void arcadia_sound_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 *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
for (i = 0; i < samples; i++, buffer++)
|
||||
for (i = 0; i < buffer.samples(); i++)
|
||||
{
|
||||
*buffer = 0;
|
||||
s32 result = 0;
|
||||
|
||||
//if minimal pitch ?
|
||||
if (m_reg[1]){
|
||||
@ -97,17 +97,17 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
|
||||
//tone only
|
||||
case 1:
|
||||
*buffer = m_volume * m_tval;
|
||||
result = m_volume * m_tval;
|
||||
break;
|
||||
|
||||
//noise only
|
||||
case 2:
|
||||
*buffer = m_volume * m_nval;
|
||||
result = m_volume * m_nval;
|
||||
break;
|
||||
|
||||
//tone AND noise (bitwise and)
|
||||
case 3:
|
||||
*buffer = m_volume * (m_tval & m_nval);
|
||||
result = m_volume * (m_tval & m_nval);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -132,6 +132,7 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
m_pos = 0;
|
||||
}
|
||||
}
|
||||
buffer.put_int(i, result, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ protected:
|
||||
// device-level overrides
|
||||
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;
|
||||
|
||||
sound_stream *m_channel;
|
||||
uint8_t m_reg[3];
|
||||
|
@ -30,7 +30,7 @@ void channelf_sound_device::device_start()
|
||||
{
|
||||
int rate;
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
rate = machine().sample_rate();
|
||||
|
||||
/*
|
||||
@ -67,19 +67,18 @@ void channelf_sound_device::device_start()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void channelf_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
uint32_t mask = 0, target = 0;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
stream_sample_t *sample = buffer;
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
switch( m_sound_mode )
|
||||
{
|
||||
case 0: /* sound off */
|
||||
memset(buffer,0,sizeof(*buffer)*samples);
|
||||
buffer.fill(0);
|
||||
return;
|
||||
|
||||
case 1: /* high tone (2V) - 1000Hz */
|
||||
@ -96,12 +95,12 @@ void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
break;
|
||||
}
|
||||
|
||||
while (samples-- > 0)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound
|
||||
*sample++ = m_envelope;
|
||||
buffer.put_int(sampindex, m_envelope, 32768);
|
||||
else
|
||||
*sample++ = 0;
|
||||
buffer.put(sampindex, 0);
|
||||
m_sample_counter += m_incr;
|
||||
m_envelope *= m_decay_mult;
|
||||
if (m_forced_ontime > 0) // added for improved sound
|
||||
|
@ -20,7 +20,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:
|
||||
// internal state
|
||||
sound_stream *m_channel;
|
||||
|
@ -132,7 +132,7 @@ void cmi01a_device::device_add_mconfig(machine_config &config)
|
||||
}
|
||||
|
||||
|
||||
void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
if (m_run)
|
||||
{
|
||||
@ -140,23 +140,21 @@ void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
int addr = m_segment_cnt;
|
||||
|
||||
uint8_t *wave_ptr = &m_wave_ram[m_segment_cnt & 0x3fff];
|
||||
stream_sample_t *buf = outputs[0];
|
||||
auto &buf = outputs[0];
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < buf.samples(); sampindex++)
|
||||
{
|
||||
const uint8_t sample8 = wave_ptr[addr++ & 0x3fff];
|
||||
int32_t sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch;
|
||||
s32 sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch;
|
||||
if (m_channel == 5) printf("%08x:%02x:%02x:%02x", (uint32_t)sample, sample8, m_env, m_vol_latch);
|
||||
*buf++ = (int16_t)(sample >> 8);
|
||||
buf.put_int(sampindex, (int16_t)(sample >> 8), 32768);
|
||||
}
|
||||
if (m_channel == 5) printf("\n");
|
||||
|
||||
m_segment_cnt = (m_segment_cnt & ~mask) | addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(outputs[0], 0, samples * sizeof(stream_sample_t));
|
||||
}
|
||||
outputs[0].fill(0);
|
||||
}
|
||||
|
||||
void cmi01a_device::device_resolve_objects()
|
||||
@ -175,7 +173,7 @@ void cmi01a_device::device_start()
|
||||
m_zx_timer->adjust(attotime::never);
|
||||
m_eosi_timer->adjust(attotime::never);
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 1, 44100);
|
||||
m_stream = stream_alloc(0, 1, 44100);
|
||||
|
||||
m_ptm->set_external_clocks(clock() / 8, clock() / 4, clock() / 4);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
void write(offs_t offset, uint8_t data);
|
||||
uint8_t read(offs_t offset);
|
||||
|
||||
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;
|
||||
|
||||
protected:
|
||||
virtual void device_resolve_objects() override;
|
||||
|
@ -39,7 +39,7 @@ cps3_sound_device::cps3_sound_device(const machine_config &mconfig, const char *
|
||||
void cps3_sound_device::device_start()
|
||||
{
|
||||
/* Allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 2, clock() / 384);
|
||||
m_stream = stream_alloc(0, 2, clock() / 384);
|
||||
|
||||
save_item(NAME(m_key));
|
||||
for (int i = 0; i < 16; i++)
|
||||
@ -52,14 +52,14 @@ void cps3_sound_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
/* Clear the buffers */
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples*sizeof(*outputs[1]));
|
||||
outputs[0].fill(0);
|
||||
outputs[1].fill(0);
|
||||
|
||||
for (int i = 0; i < 16; i ++)
|
||||
{
|
||||
@ -103,7 +103,7 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_
|
||||
loop -= 0x400000;
|
||||
|
||||
/* Go through the buffer and add voice contributions */
|
||||
for (int j = 0; j < samples; j++)
|
||||
for (int j = 0; j < outputs[0].samples(); j++)
|
||||
{
|
||||
int32_t sample;
|
||||
|
||||
@ -127,8 +127,8 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_
|
||||
sample = m_base[BYTE4_XOR_LE(start + pos)];
|
||||
frac += step;
|
||||
|
||||
outputs[0][j] += ((sample * vol_l) >> 8);
|
||||
outputs[1][j] += ((sample * vol_r) >> 8);
|
||||
outputs[0].add_int(j, sample * vol_l, 32768 << 8);
|
||||
outputs[1].add_int(j, sample * vol_r, 32768 << 8);
|
||||
}
|
||||
|
||||
vptr->pos = pos;
|
||||
|
@ -46,7 +46,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:
|
||||
sound_stream *m_stream;
|
||||
|
@ -33,7 +33,7 @@ dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *ta
|
||||
|
||||
void dai_sound_device::device_start()
|
||||
{
|
||||
m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_mixer_channel = stream_alloc(0, 2, machine().sample_rate());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -115,27 +115,27 @@ WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void dai_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void dai_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *sample_left = outputs[0];
|
||||
stream_sample_t *sample_right = outputs[1];
|
||||
auto &sample_left = outputs[0];
|
||||
auto &sample_right = outputs[1];
|
||||
|
||||
int16_t channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]];
|
||||
int16_t channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]];
|
||||
int16_t channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]];
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < sample_left.samples(); sampindex++)
|
||||
{
|
||||
int16_t noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume];
|
||||
|
||||
/* channel 0 + channel 1 + noise */
|
||||
*sample_left++ = channel_0_signal + channel_1_signal + noise;
|
||||
sample_left.put_int(sampindex, channel_0_signal + channel_1_signal + noise, 32768);
|
||||
|
||||
/* channel 1 + channel 2 + noise */
|
||||
*sample_right++ = channel_1_signal + channel_2_signal + noise;
|
||||
sample_right.put_int(sampindex, channel_1_signal + channel_2_signal + noise, 32768);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ protected:
|
||||
// device-level overrides
|
||||
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:
|
||||
sound_stream * m_mixer_channel;
|
||||
|
@ -85,7 +85,7 @@ void dsbz80_device::device_start()
|
||||
m_rxd_handler.resolve_safe();
|
||||
uint8_t *rom_base = machine().root_device().memregion("mpeg")->base();
|
||||
decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0);
|
||||
stream_alloc_legacy(0, 2, 32000);
|
||||
stream_alloc(0, 2, 32000);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -232,11 +232,13 @@ void dsbz80_device::mpeg_stereo_w(uint8_t data)
|
||||
mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels
|
||||
}
|
||||
|
||||
void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *out_l = outputs[0];
|
||||
stream_sample_t *out_r = outputs[1];
|
||||
auto &out_l = outputs[0];
|
||||
auto &out_r = outputs[1];
|
||||
|
||||
int samples = out_l.samples();
|
||||
int sampindex = 0;
|
||||
for(;;)
|
||||
{
|
||||
while(samples && audio_pos < audio_avail)
|
||||
@ -244,18 +246,21 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
switch (mp_pan)
|
||||
{
|
||||
case 0: // stereo
|
||||
*out_l++ = audio_buf[audio_pos*2];
|
||||
*out_r++ = audio_buf[audio_pos*2+1];
|
||||
out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768);
|
||||
out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768);
|
||||
sampindex++;
|
||||
break;
|
||||
|
||||
case 1: // left only
|
||||
*out_l++ = audio_buf[audio_pos*2];
|
||||
*out_r++ = audio_buf[audio_pos*2];
|
||||
out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768);
|
||||
out_r.put_int(sampindex, audio_buf[audio_pos*2], 32768);
|
||||
sampindex++;
|
||||
break;
|
||||
|
||||
case 2: // right only
|
||||
*out_l++ = audio_buf[audio_pos*2+1];
|
||||
*out_r++ = audio_buf[audio_pos*2+1];
|
||||
out_l.put_int(sampindex, audio_buf[audio_pos*2+1], 32768);
|
||||
out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768);
|
||||
sampindex++;
|
||||
break;
|
||||
}
|
||||
audio_pos++;
|
||||
@ -269,11 +274,8 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp
|
||||
|
||||
if(mp_state == 0)
|
||||
{
|
||||
for(int i=0; i != samples; i++)
|
||||
{
|
||||
*out_l++ = 0;
|
||||
*out_r++ = 0;
|
||||
}
|
||||
out_l.fill(0, sampindex);
|
||||
out_r.fill(0, sampindex);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) 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:
|
||||
mpeg_audio *decoder;
|
||||
|
@ -54,7 +54,7 @@ void elan_eu3a05_sound_device::map(address_map &map)
|
||||
void elan_eu3a05_sound_device::device_start()
|
||||
{
|
||||
m_space_read_cb.resolve_safe(0);
|
||||
m_stream = stream_alloc_legacy(0, 1, 8000);
|
||||
m_stream = stream_alloc(0, 1, 8000);
|
||||
|
||||
m_sound_end_cb.resolve_all_safe();
|
||||
|
||||
@ -92,18 +92,19 @@ void elan_eu3a05_sound_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// reset the output stream
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
outputs[0].fill(0);
|
||||
|
||||
int volume = m_volumes[0] | (m_volumes[1] << 8);
|
||||
|
||||
int outpos = 0;
|
||||
// loop while we still have samples to generate
|
||||
int samples = outputs[0].samples();
|
||||
while (samples-- != 0)
|
||||
{
|
||||
int total = 0;
|
||||
@ -142,7 +143,7 @@ void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream,
|
||||
//LOGMASKED( LOG_AUDIO, "m_isstopped %02x channel %d is NOT active %08x %06x\n", m_isstopped, channel, m_sound_byte_address[channel], m_sound_current_nib_pos[channel]);
|
||||
}
|
||||
}
|
||||
outputs[0][outpos] = total / 6;
|
||||
outputs[0].put_int(outpos, total, 32768 * 6);
|
||||
outpos++;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,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;
|
||||
virtual space_config_vector memory_space_config() const override;
|
||||
const address_space_config m_space_config;
|
||||
|
||||
|
@ -180,7 +180,7 @@ void exidy_sound_device::common_sh_start()
|
||||
m_sh6840_clocks_per_sample = (int)(SH6840_CLOCK.dvalue() / (double)sample_rate * (double)(1 << 24));
|
||||
|
||||
/* allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 1, sample_rate);
|
||||
m_stream = stream_alloc(0, 1, sample_rate);
|
||||
|
||||
sh6840_register_state_globals();
|
||||
}
|
||||
@ -239,23 +239,23 @@ void exidy_sound_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void exidy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
sh6840_timer_channel *sh6840_timer = m_sh6840_timer;
|
||||
|
||||
/* hack to skip the expensive lfsr noise generation unless at least one of the 3 channels actually depends on it being generated */
|
||||
int noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0);
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
/* loop over samples */
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
sh6840_timer_channel *t;
|
||||
int clocks;
|
||||
stream_sample_t sample = 0;
|
||||
s32 sample = 0;
|
||||
|
||||
/* determine how many 6840 clocks this sample */
|
||||
m_sh6840_clock_count += m_sh6840_clocks_per_sample;
|
||||
@ -310,19 +310,19 @@ void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream
|
||||
sample += generate_music_sample();
|
||||
|
||||
/* stash */
|
||||
*buffer++ = sample;
|
||||
buffer.put_int(sampindex, sample, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
stream_sample_t exidy_sound_device::generate_music_sample()
|
||||
s32 exidy_sound_device::generate_music_sample()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream_sample_t exidy_sh8253_sound_device::generate_music_sample()
|
||||
s32 exidy_sh8253_sound_device::generate_music_sample()
|
||||
{
|
||||
sh8253_timer_channel *c;
|
||||
stream_sample_t sample = 0;
|
||||
s32 sample = 0;
|
||||
|
||||
/* music channel 0 */
|
||||
c = &m_sh8253_timer[0];
|
||||
|
@ -54,8 +54,8 @@ protected:
|
||||
void sh6840_register_state_globals();
|
||||
|
||||
// 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 stream_sample_t generate_music_sample();
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
virtual s32 generate_music_sample();
|
||||
|
||||
static inline void sh6840_apply_clock(sh6840_timer_channel *t, int clocks);
|
||||
|
||||
@ -102,7 +102,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual stream_sample_t generate_music_sample() override;
|
||||
virtual s32 generate_music_sample() override;
|
||||
|
||||
void r6532_porta_w(uint8_t data);
|
||||
uint8_t r6532_porta_r();
|
||||
|
@ -74,8 +74,6 @@ exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, cons
|
||||
m_samples(*this, "samples"),
|
||||
m_sound_command(0),
|
||||
m_sound_command_ack(0),
|
||||
m_mixer_buffer_left(nullptr),
|
||||
m_mixer_buffer_right(nullptr),
|
||||
m_sound_cache(nullptr),
|
||||
m_sound_cache_end(nullptr),
|
||||
m_sound_cache_max(nullptr),
|
||||
@ -146,7 +144,7 @@ void exidy440_sound_device::device_start()
|
||||
m_channel_frequency[3] = clock()/2;
|
||||
|
||||
/* get stream channels */
|
||||
m_stream = stream_alloc_legacy(0, 2, clock());
|
||||
m_stream = stream_alloc(0, 2, clock());
|
||||
|
||||
/* allocate the sample cache */
|
||||
length = m_samples.bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
|
||||
@ -157,8 +155,8 @@ void exidy440_sound_device::device_start()
|
||||
reset_sound_cache();
|
||||
|
||||
/* allocate the mixer buffer */
|
||||
m_mixer_buffer_left = make_unique_clear<int32_t[]>(clock());
|
||||
m_mixer_buffer_right = make_unique_clear<int32_t[]>(clock());
|
||||
m_mixer_buffer_left.resize(clock()/50);
|
||||
m_mixer_buffer_right.resize(clock()/50);
|
||||
|
||||
if (SOUND_LOG)
|
||||
m_debuglog = fopen("sound.log", "w");
|
||||
@ -224,24 +222,15 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void exidy440_sound_device::mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right)
|
||||
void exidy440_sound_device::mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right)
|
||||
{
|
||||
int32_t *mixer_left = m_mixer_buffer_left.get();
|
||||
int32_t *mixer_right = m_mixer_buffer_right.get();
|
||||
int i, clippers = 0;
|
||||
int32_t *mixer_left = &m_mixer_buffer_left[0];
|
||||
int32_t *mixer_right = &m_mixer_buffer_right[0];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
for (int i = 0; i < dest_left.samples(); i++)
|
||||
{
|
||||
int32_t sample_left = *mixer_left++;
|
||||
int32_t sample_right = *mixer_right++;
|
||||
|
||||
if (sample_left < -32768) { sample_left = -32768; clippers++; }
|
||||
else if (sample_left > 32767) { sample_left = 32767; clippers++; }
|
||||
if (sample_right < -32768) { sample_right = -32768; clippers++; }
|
||||
else if (sample_right > 32767) { sample_right = 32767; clippers++; }
|
||||
|
||||
*dest_left++ = sample_left;
|
||||
*dest_right++ = sample_right;
|
||||
dest_left.put_int_clamp(i, *mixer_left++, 32768);
|
||||
dest_right.put_int_clamp(i, *mixer_right++, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
@ -836,22 +825,22 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int ch;
|
||||
|
||||
/* reset the mixer buffers */
|
||||
memset(m_mixer_buffer_left.get(), 0, samples * sizeof(int32_t));
|
||||
memset(m_mixer_buffer_right.get(), 0, samples * sizeof(int32_t));
|
||||
std::fill_n(&m_mixer_buffer_left[0], outputs[0].samples(), 0);
|
||||
std::fill_n(&m_mixer_buffer_right[0], outputs[0].samples(), 0);
|
||||
|
||||
/* loop over channels */
|
||||
for (ch = 0; ch < 4; ch++)
|
||||
{
|
||||
sound_channel_data *channel = &m_sound_channel[ch];
|
||||
int length, volume, left = samples;
|
||||
int length, volume, left = outputs[0].samples();
|
||||
int effective_offset;
|
||||
|
||||
/* if we're not active, bail */
|
||||
@ -864,12 +853,12 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
/* get a pointer to the sample data and copy to the left */
|
||||
volume = m_sound_volume[2 * ch + 0];
|
||||
if (volume)
|
||||
add_and_scale_samples(ch, m_mixer_buffer_left.get(), length, volume);
|
||||
add_and_scale_samples(ch, &m_mixer_buffer_left[0], length, volume);
|
||||
|
||||
/* get a pointer to the sample data and copy to the left */
|
||||
volume = m_sound_volume[2 * ch + 1];
|
||||
if (volume)
|
||||
add_and_scale_samples(ch, m_mixer_buffer_right.get(), length, volume);
|
||||
add_and_scale_samples(ch, &m_mixer_buffer_right[0], length, volume);
|
||||
|
||||
/* update our counters */
|
||||
channel->offset += length;
|
||||
@ -889,5 +878,5 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
}
|
||||
|
||||
/* all done, time to mix it */
|
||||
mix_to_16(samples, outputs[0], outputs[1]);
|
||||
mix_to_16(outputs[0], outputs[1]);
|
||||
}
|
||||
|
@ -29,7 +29,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:
|
||||
void exidy440_audio_map(address_map &map);
|
||||
@ -76,8 +76,8 @@ private:
|
||||
uint8_t m_sound_banks[4];
|
||||
//uint8_t m_m6844_data[0x20];
|
||||
uint8_t m_sound_volume[0x10];
|
||||
std::unique_ptr<int32_t[]> m_mixer_buffer_left;
|
||||
std::unique_ptr<int32_t[]> m_mixer_buffer_right;
|
||||
std::vector<int32_t> m_mixer_buffer_left;
|
||||
std::vector<int32_t> m_mixer_buffer_right;
|
||||
sound_cache_entry *m_sound_cache;
|
||||
sound_cache_entry *m_sound_cache_end;
|
||||
sound_cache_entry *m_sound_cache_max;
|
||||
@ -111,7 +111,7 @@ private:
|
||||
void fir_filter(int32_t *input, int16_t *output, int count);
|
||||
|
||||
void add_and_scale_samples(int ch, int32_t *dest, int samples, int volume);
|
||||
void mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right);
|
||||
void mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right);
|
||||
|
||||
uint8_t sound_command_r();
|
||||
uint8_t sound_volume_r(offs_t offset);
|
||||
|
@ -48,9 +48,7 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch
|
||||
device_memory_interface(mconfig, *this),
|
||||
m_io_space_config("io", ENDIANNESS_LITTLE, 8, 7, 0, address_map_constructor(FUNC(flower_sound_device::regs_map), this)),
|
||||
m_stream(nullptr),
|
||||
m_mixer_table(nullptr),
|
||||
m_mixer_lookup(nullptr),
|
||||
m_mixer_buffer(nullptr),
|
||||
m_last_channel(nullptr)
|
||||
{
|
||||
}
|
||||
@ -63,9 +61,9 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch
|
||||
void flower_sound_device::device_start()
|
||||
{
|
||||
m_iospace = &space(AS_IO);
|
||||
m_stream = stream_alloc_legacy(0, 1, clock()/2);
|
||||
m_stream = stream_alloc(0, 1, clock()/2);
|
||||
|
||||
m_mixer_buffer = make_unique_clear<short[]>(clock()/2);
|
||||
m_mixer_buffer.resize(clock()/50);
|
||||
make_mixer_table(MAX_VOICES, defgain);
|
||||
|
||||
m_last_channel = m_channel_list + MAX_VOICES;
|
||||
@ -94,10 +92,10 @@ void flower_sound_device::device_start()
|
||||
void flower_sound_device::make_mixer_table(int voices, int gain)
|
||||
{
|
||||
/* allocate memory */
|
||||
m_mixer_table = make_unique_clear<int16_t[]>(256 * voices);
|
||||
m_mixer_table.resize(256 * voices);
|
||||
|
||||
/* find the middle of the table */
|
||||
m_mixer_lookup = m_mixer_table.get() + (128 * voices);
|
||||
m_mixer_lookup = &m_mixer_table[128 * voices];
|
||||
|
||||
/* fill in the table - 16 bit case */
|
||||
for (int i = 0; i < voices * 128; i++)
|
||||
@ -127,13 +125,13 @@ void flower_sound_device::device_reset()
|
||||
}
|
||||
}
|
||||
|
||||
void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void flower_sound_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];
|
||||
short *mix;
|
||||
uint8_t raw_sample;
|
||||
|
||||
memset(m_mixer_buffer.get(), 0, samples * sizeof(short));
|
||||
std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0);
|
||||
|
||||
for (fl_sound_channel *voice = m_channel_list; voice < m_last_channel; voice++)
|
||||
{
|
||||
@ -143,9 +141,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
if (voice->enable == false)
|
||||
continue;
|
||||
|
||||
mix = m_mixer_buffer.get();
|
||||
mix = &m_mixer_buffer[0];
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < buffer.samples(); i++)
|
||||
{
|
||||
if (voice->repeat == true)
|
||||
{
|
||||
@ -174,9 +172,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
}
|
||||
|
||||
/* mix it down */
|
||||
mix = m_mixer_buffer.get();
|
||||
for (int i = 0; i < samples; i++)
|
||||
*buffer++ = m_mixer_lookup[*mix++];
|
||||
mix = &m_mixer_buffer[0];
|
||||
for (int i = 0; i < buffer.samples(); i++)
|
||||
buffer.put_int(i, m_mixer_lookup[*mix++], 32768);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual space_config_vector memory_space_config() const 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;
|
||||
|
||||
address_space *m_iospace;
|
||||
private:
|
||||
@ -50,9 +50,9 @@ private:
|
||||
static constexpr unsigned MAX_VOICES = 8;
|
||||
static constexpr int defgain = 48;
|
||||
|
||||
std::unique_ptr<int16_t[]> m_mixer_table;
|
||||
std::vector<int16_t> m_mixer_table;
|
||||
int16_t *m_mixer_lookup;
|
||||
std::unique_ptr<short[]> m_mixer_buffer;
|
||||
std::vector<short> m_mixer_buffer;
|
||||
|
||||
struct fl_sound_channel
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ void geebee_sound_device::device_start()
|
||||
m_decay[0x7fff - i] = (int16_t) (0x7fff/exp(1.0*i/4096));
|
||||
|
||||
/* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
|
||||
m_channel = stream_alloc_legacy(0, 1, clock() / 3 / 2 / 384);
|
||||
m_channel = stream_alloc(0, 1, clock() / 3 / 2 / 384);
|
||||
m_vcount = 0;
|
||||
|
||||
m_volume_timer = timer_alloc(TIMER_VOLUME_DECAY);
|
||||
@ -103,16 +103,16 @@ void geebee_sound_device::sound_w(u8 data)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void geebee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
{
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
void geebee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
*buffer++ = m_sound_signal;
|
||||
buffer.put_int(sampindex, m_sound_signal, 32768);
|
||||
/* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
|
||||
{
|
||||
m_vcount++;
|
||||
|
@ -22,7 +22,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;
|
||||
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
|
@ -32,10 +32,6 @@ gomoku_sound_device::gomoku_sound_device(const machine_config &mconfig, const ch
|
||||
, m_sound_rom(*this, DEVICE_SELF)
|
||||
, m_sound_enable(0)
|
||||
, m_stream(nullptr)
|
||||
, m_mixer_table(nullptr)
|
||||
, m_mixer_lookup(nullptr)
|
||||
, m_mixer_buffer(nullptr)
|
||||
, m_mixer_buffer_2(nullptr)
|
||||
{
|
||||
std::fill(std::begin(m_soundregs1), std::end(m_soundregs1), 0);
|
||||
std::fill(std::begin(m_soundregs2), std::end(m_soundregs2), 0);
|
||||
@ -52,14 +48,10 @@ void gomoku_sound_device::device_start()
|
||||
int ch;
|
||||
|
||||
// get stream channels
|
||||
m_stream = stream_alloc_legacy(0, 1, clock());
|
||||
m_stream = stream_alloc(0, 1, clock());
|
||||
|
||||
// allocate a pair of buffers to mix into - 1 second's worth should be more than enough
|
||||
m_mixer_buffer = std::make_unique<short[]>(2 * clock());
|
||||
m_mixer_buffer_2 = m_mixer_buffer.get() + clock(); // this is never used?
|
||||
|
||||
// build the mixer table
|
||||
make_mixer_table(8, DEFGAIN);
|
||||
// allocate a buffer to mix into - 1 second's worth should be more than enough
|
||||
m_mixer_buffer.resize(clock()/50);
|
||||
|
||||
// start with sound enabled, many games don't have a sound enable register
|
||||
m_sound_enable = 1;
|
||||
@ -76,7 +68,6 @@ void gomoku_sound_device::device_start()
|
||||
|
||||
save_item(NAME(m_soundregs1));
|
||||
save_item(NAME(m_soundregs2));
|
||||
save_pointer(NAME(m_mixer_buffer), 2 * clock());
|
||||
// save_item(NAME(m_sound_enable)); // set to 1 at device start and never updated?
|
||||
save_item(STRUCT_MEMBER(m_channel_list, channel));
|
||||
save_item(STRUCT_MEMBER(m_channel_list, frequency));
|
||||
@ -87,12 +78,12 @@ void gomoku_sound_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update in mono
|
||||
// sound_stream_update - handle a stream update in mono
|
||||
//-------------------------------------------------
|
||||
|
||||
void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void gomoku_sound_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];
|
||||
sound_channel *voice;
|
||||
short *mix;
|
||||
int ch;
|
||||
@ -100,12 +91,12 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
// if no sound, we're done
|
||||
if (m_sound_enable == 0)
|
||||
{
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
buffer.fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// zap the contents of the mixer buffer
|
||||
memset(m_mixer_buffer.get(), 0, samples * sizeof(short));
|
||||
std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0);
|
||||
|
||||
// loop over each voice and add its contribution
|
||||
for (ch = 0, voice = std::begin(m_channel_list); voice < std::end(m_channel_list); ch++, voice++)
|
||||
@ -124,10 +115,10 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
else
|
||||
w_base = 0x100 * (m_soundregs2[0x1d] & 0x0f);
|
||||
|
||||
mix = m_mixer_buffer.get();
|
||||
mix = &m_mixer_buffer[0];
|
||||
|
||||
// add our contribution
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < buffer.samples(); i++)
|
||||
{
|
||||
c += f;
|
||||
|
||||
@ -167,31 +158,9 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
}
|
||||
|
||||
// mix it down
|
||||
mix = m_mixer_buffer.get();
|
||||
for (int i = 0; i < samples; i++)
|
||||
*buffer++ = m_mixer_lookup[*mix++];
|
||||
}
|
||||
|
||||
|
||||
// build a table to divide by the number of voices; gain is specified as gain*16
|
||||
void gomoku_sound_device::make_mixer_table(int voices, int gain)
|
||||
{
|
||||
int count = voices * 128;
|
||||
|
||||
// allocate memory
|
||||
m_mixer_table = std::make_unique<int16_t[]>(256 * voices);
|
||||
|
||||
// find the middle of the table
|
||||
m_mixer_lookup = m_mixer_table.get() + (128 * voices);
|
||||
|
||||
// fill in the table - 16 bit case
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int val = i * gain * 16 / voices;
|
||||
if (val > 32767) val = 32767;
|
||||
m_mixer_lookup[ i] = val;
|
||||
m_mixer_lookup[-i] = -val;
|
||||
}
|
||||
mix = &m_mixer_buffer[0];
|
||||
for (int i = 0; i < buffer.samples(); i++)
|
||||
buffer.put_int(i, *mix++, 128 * MAX_VOICES);
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,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:
|
||||
void make_mixer_table(int voices, int gain);
|
||||
@ -52,10 +52,7 @@ private:
|
||||
sound_stream *m_stream;
|
||||
|
||||
// mixer tables and internal buffers
|
||||
std::unique_ptr<int16_t[]> m_mixer_table;
|
||||
int16_t *m_mixer_lookup;
|
||||
std::unique_ptr<short[]> m_mixer_buffer;
|
||||
short *m_mixer_buffer_2;
|
||||
std::vector<short> m_mixer_buffer;
|
||||
|
||||
uint8_t m_soundregs1[0x20];
|
||||
uint8_t m_soundregs2[0x20];
|
||||
|
@ -43,26 +43,26 @@ gridlee_sound_device::gridlee_sound_device(const machine_config &mconfig, const
|
||||
void gridlee_sound_device::device_start()
|
||||
{
|
||||
/* allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 1, machine().sample_rate());
|
||||
|
||||
m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void gridlee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void gridlee_sound_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];
|
||||
|
||||
/* loop over samples */
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
/* tone channel */
|
||||
m_tone_fraction += m_tone_step;
|
||||
*buffer++ = (m_tone_fraction & 0x0800000) ? (m_tone_volume << 6) : 0;
|
||||
buffer.put_int(sampindex, (m_tone_fraction & 0x0800000) ? m_tone_volume : 0, 32768 >> 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ DEFINE_DEVICE_TYPE(HYPROLYB_ADPCM, hyprolyb_adpcm_device, "hyprolyb_adpcm", "Hyp
|
||||
|
||||
hyprolyb_adpcm_device::hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, HYPROLYB_ADPCM, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
, m_audiocpu(*this, ":audiocpu")
|
||||
, m_soundlatch2(*this, ":soundlatch2")
|
||||
, m_msm(*this, ":msm")
|
||||
@ -80,13 +79,3 @@ void hyprolyb_adpcm_device::vck_callback( int st )
|
||||
{
|
||||
m_vck_ready = 0x80;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void hyprolyb_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
{
|
||||
// should never get here
|
||||
fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
class hyprolyb_adpcm_device : public device_t, public device_sound_interface
|
||||
class hyprolyb_adpcm_device : public device_t
|
||||
{
|
||||
public:
|
||||
hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
@ -27,9 +27,6 @@ protected:
|
||||
virtual void device_start() override;
|
||||
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;
|
||||
|
||||
private:
|
||||
// internal state
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
|
@ -172,7 +172,7 @@ void lynx_sound_device::init()
|
||||
|
||||
void lynx_sound_device::device_start()
|
||||
{
|
||||
m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_mixer_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
m_usec_per_sample = 1000000 / machine().sample_rate();
|
||||
m_timer_delegate.resolve();
|
||||
init();
|
||||
@ -182,7 +182,7 @@ void lynx_sound_device::device_start()
|
||||
|
||||
void lynx2_sound_device::device_start()
|
||||
{
|
||||
m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_mixer_channel = stream_alloc(0, 2, machine().sample_rate());
|
||||
m_usec_per_sample = 1000000 / machine().sample_rate();
|
||||
m_timer_delegate.resolve();
|
||||
init();
|
||||
@ -467,39 +467,41 @@ void lynx_sound_device::write(offs_t offset, uint8_t data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void lynx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int v;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
for (int i = 0; i < samples; i++, buffer++)
|
||||
for (int i = 0; i < buffer.samples(); i++)
|
||||
{
|
||||
*buffer = 0;
|
||||
s32 result = 0;
|
||||
for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++)
|
||||
{
|
||||
execute(channel);
|
||||
v = m_audio[channel].reg.output;
|
||||
*buffer += v * 15; // where does the *15 come from?
|
||||
result += v * 15; // where does the *15 come from?
|
||||
}
|
||||
buffer.put_int(i, result, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void lynx2_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *left=outputs[0], *right=outputs[1];
|
||||
auto &left=outputs[0];
|
||||
auto &right=outputs[1];
|
||||
int v;
|
||||
|
||||
for (int i = 0; i < samples; i++, left++, right++)
|
||||
for (int i = 0; i < left.samples(); i++)
|
||||
{
|
||||
*left = 0;
|
||||
*right= 0;
|
||||
s32 lsum = 0;
|
||||
s32 rsum = 0;
|
||||
for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++)
|
||||
{
|
||||
execute(channel);
|
||||
@ -507,17 +509,19 @@ void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream
|
||||
if (!(m_master_enable & (0x10 << channel)))
|
||||
{
|
||||
if (m_attenuation_enable & (0x10 << channel))
|
||||
*left += v * (m_audio[channel].attenuation >> 4);
|
||||
lsum += v * (m_audio[channel].attenuation >> 4);
|
||||
else
|
||||
*left += v * 15;
|
||||
lsum += v * 15;
|
||||
}
|
||||
if (!(m_master_enable & (1 << channel)))
|
||||
{
|
||||
if (m_attenuation_enable & (1 << channel))
|
||||
*right += v * (m_audio[channel].attenuation & 0xf);
|
||||
rsum += v * (m_audio[channel].attenuation & 0xf);
|
||||
else
|
||||
*right += v * 15;
|
||||
rsum += v * 15;
|
||||
}
|
||||
}
|
||||
left.put_int(i, lsum, 32768);
|
||||
right.put_int(i, rsum, 32768);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,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;
|
||||
|
||||
void reset_channel(LYNX_AUDIO *channel);
|
||||
void shift(int chan_nr);
|
||||
@ -75,7 +75,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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,9 +68,9 @@ void micro3d_sound_device::lp_filter::init(double fsval)
|
||||
proto_coef[1].b1 = 1.847759;
|
||||
proto_coef[1].b2 = 1.0;
|
||||
|
||||
coef = make_unique_clear<float[]>(4 * 2 + 1);
|
||||
std::fill(std::begin(coef), std::end(coef), 0);
|
||||
fs = fsval;
|
||||
history = make_unique_clear<float[]>(2 * 2);
|
||||
std::fill(std::begin(history), std::end(history), 0);
|
||||
}
|
||||
|
||||
static void prewarp(double *a0, double *a1, double *a2,double fc, double fs)
|
||||
@ -104,7 +104,7 @@ static void bilinear(double a0, double a1, double a2,
|
||||
|
||||
void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc)
|
||||
{
|
||||
float *c = coef.get() + 1;
|
||||
float *c = &coef[1];
|
||||
|
||||
for (int nInd = 0; nInd < 2; nInd++)
|
||||
{
|
||||
@ -182,7 +182,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const
|
||||
void micro3d_sound_device::device_start()
|
||||
{
|
||||
/* Allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 2, machine().sample_rate());
|
||||
m_filter.init(machine().sample_rate());
|
||||
|
||||
m_noise_filters[0].configure(2.7e3 + 2.7e3, 1.0e-6);
|
||||
@ -206,20 +206,20 @@ void micro3d_sound_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
lp_filter *iir = &m_filter;
|
||||
float pan_l, pan_r;
|
||||
|
||||
stream_sample_t *fl = &outputs[0][0];
|
||||
stream_sample_t *fr = &outputs[1][0];
|
||||
auto &fl = outputs[0];
|
||||
auto &fr = outputs[1];
|
||||
|
||||
/* Clear the buffers */
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples * sizeof(*outputs[1]));
|
||||
fl.fill(0);
|
||||
fr.fill(0);
|
||||
|
||||
if (m_gain == 0)
|
||||
return;
|
||||
@ -227,7 +227,7 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
pan_l = (float)(255 - m_dac[PAN]) / 255.0f;
|
||||
pan_r = (float)(m_dac[PAN]) / 255.0f;
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
|
||||
{
|
||||
unsigned int i;
|
||||
float *hist1_ptr,*hist2_ptr,*coef_ptr;
|
||||
@ -255,9 +255,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
input += white;
|
||||
input *= 200.0f;
|
||||
|
||||
coef_ptr = iir->coef.get();
|
||||
coef_ptr = &iir->coef[0];
|
||||
|
||||
hist1_ptr = iir->history.get();
|
||||
hist1_ptr = &iir->history[0];
|
||||
hist2_ptr = hist1_ptr + 1;
|
||||
|
||||
/* 1st number of coefficients array is overall input scale factor, * or filter gain */
|
||||
@ -279,15 +279,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
hist1_ptr++;
|
||||
hist2_ptr++;
|
||||
}
|
||||
output *= 3.5f;
|
||||
output *= 3.5f / 32768.f;
|
||||
|
||||
/* Clip */
|
||||
if (output > 32767)
|
||||
output = 32767;
|
||||
else if (output < -32768)
|
||||
output = -32768;
|
||||
|
||||
*fl++ = output * pan_l;
|
||||
*fr++ = output * pan_r;
|
||||
fl.put_clamp(sampindex, output * pan_l, 1.0);
|
||||
fr.put_clamp(sampindex, output * pan_r, 1.0);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,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:
|
||||
enum dac_registers {
|
||||
@ -45,8 +45,8 @@ private:
|
||||
void init(double fs);
|
||||
void recompute(double k, double q, double fc);
|
||||
|
||||
std::unique_ptr<float[]> history;
|
||||
std::unique_ptr<float[]> coef;
|
||||
float history[2 * 2];
|
||||
float coef[4 * 2 + 1];
|
||||
double fs;
|
||||
biquad proto_coef[2];
|
||||
};
|
||||
|
@ -89,7 +89,7 @@ void phoenix_sound_device::device_start()
|
||||
m_poly18[i] = bits;
|
||||
}
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
|
||||
save_item(NAME(m_sound_latch_a));
|
||||
save_item(NAME(m_c24_state.counter));
|
||||
@ -101,7 +101,6 @@ void phoenix_sound_device::device_start()
|
||||
save_item(NAME(m_noise_state.polyoffs));
|
||||
save_item(NAME(m_noise_state.lowpass_counter));
|
||||
save_item(NAME(m_noise_state.lowpass_polybit));
|
||||
save_pointer(NAME(m_poly18), (1ul << (18-5)));
|
||||
}
|
||||
|
||||
int phoenix_sound_device::update_c24(int samplerate)
|
||||
@ -520,18 +519,18 @@ void phoenix_sound_device::control_b_w(uint8_t data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void phoenix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void phoenix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int samplerate = machine().sample_rate();
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
int samplerate = buffer.sample_rate();
|
||||
|
||||
while( samples-- > 0 )
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int sum = 0;
|
||||
sum = noise(samplerate) / 2;
|
||||
*buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767;
|
||||
buffer.put_int_clamp(sampindex, sum, 32768);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,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 c_state
|
||||
@ -46,7 +46,7 @@ private:
|
||||
struct n_state m_noise_state;
|
||||
uint8_t m_sound_latch_a;
|
||||
sound_stream * m_channel;
|
||||
std::unique_ptr<uint32_t[]> m_poly18;
|
||||
std::unique_ptr<uint32_t[]> m_poly18;
|
||||
required_device<discrete_device> m_discrete;
|
||||
required_device<tms36xx_device> m_tms;
|
||||
|
||||
|
@ -642,7 +642,7 @@ void pleiads_sound_device::common_start()
|
||||
m_poly18[i] = bits;
|
||||
}
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
|
||||
save_item(NAME(m_sound_latch_a));
|
||||
save_item(NAME(m_sound_latch_b));
|
||||
@ -691,27 +691,27 @@ void pleiads_sound_device::common_start()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void pleiads_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void pleiads_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int rate = machine().sample_rate();
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
int rate = buffer.sample_rate();
|
||||
|
||||
while( samples-- > 0 )
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate);
|
||||
*buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767;
|
||||
buffer.put_int_clamp(sampindex, sum, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
void naughtyb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void naughtyb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
|
||||
pleiads_sound_device::sound_stream_update(stream, inputs, outputs);
|
||||
}
|
||||
|
||||
void popflame_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void popflame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples);
|
||||
pleiads_sound_device::sound_stream_update(stream, inputs, outputs);
|
||||
}
|
||||
|
@ -51,7 +51,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 common_start();
|
||||
inline int tone1(int samplerate);
|
||||
@ -105,7 +105,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;
|
||||
};
|
||||
|
||||
|
||||
@ -119,7 +119,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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -225,7 +225,7 @@ polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const
|
||||
|
||||
void polepos_sound_device::device_start()
|
||||
{
|
||||
m_stream = stream_alloc_legacy(0, 1, OUTPUT_RATE);
|
||||
m_stream = stream_alloc(0, 1, OUTPUT_RATE);
|
||||
m_sample_msb = m_sample_lsb = 0;
|
||||
m_sample_enable = 0;
|
||||
|
||||
@ -251,21 +251,21 @@ void polepos_sound_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void polepos_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
uint32_t step, clock, slot;
|
||||
uint8_t *base;
|
||||
double volume, i_total;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
int loop;
|
||||
|
||||
/* if we're not enabled, just fill with 0 */
|
||||
if (!m_sample_enable)
|
||||
{
|
||||
memset(buffer, 0, samples * sizeof(*buffer));
|
||||
buffer.fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
base = &machine().root_device().memregion("engine")->base()[slot * 0x800];
|
||||
|
||||
/* fill in the sample */
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
m_filter_engine[0].x0 = (3.4 / 255 * base[(m_current_position >> 12) & 0x7ff] - 2) * volume;
|
||||
m_filter_engine[1].x0 = m_filter_engine[0].x0;
|
||||
@ -296,9 +296,9 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
|
||||
i_total += m_filter_engine[loop].y0 / r_filt_out[loop];
|
||||
}
|
||||
i_total *= r_filt_total * 32000/2; /* now contains voltage adjusted by final gain */
|
||||
i_total *= r_filt_total/2; /* now contains voltage adjusted by final gain */
|
||||
|
||||
*buffer++ = (int)i_total;
|
||||
buffer.put(sampindex, i_total);
|
||||
m_current_position += step;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,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;
|
||||
|
||||
public:
|
||||
DECLARE_WRITE_LINE_MEMBER(clson_w);
|
||||
|
@ -102,19 +102,19 @@ void redbaron_sound_device::device_start()
|
||||
m_vol_crash[i] = 32767 * r0 / (r0 + r1);
|
||||
}
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, OUTPUT_RATE);
|
||||
m_channel = stream_alloc(0, 1, OUTPUT_RATE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void redbaron_sound_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];
|
||||
while( samples-- )
|
||||
auto &buffer = outputs[0];
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int sum = 0;
|
||||
|
||||
@ -214,7 +214,7 @@ void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
if( m_squeal_out )
|
||||
sum += 32767 * 40 / 100;
|
||||
|
||||
*buffer++ = sum;
|
||||
buffer.put_int(sampindex, sum, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,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:
|
||||
std::unique_ptr<int16_t[]> m_vol_lookup;
|
||||
|
@ -46,7 +46,7 @@ void sega005_sound_device::device_start()
|
||||
segag80r_state *state = machine().driver_data<segag80r_state>();
|
||||
|
||||
/* create the stream */
|
||||
m_sega005_stream = stream_alloc_legacy(0, 1, SEGA005_COUNTER_FREQ);
|
||||
m_sega005_stream = stream_alloc(0, 1, SEGA005_COUNTER_FREQ);
|
||||
|
||||
/* create a timer for the 555 */
|
||||
m_sega005_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega005_sound_device::sega005_auto_timer), this));
|
||||
@ -57,17 +57,17 @@ void sega005_sound_device::device_start()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void sega005_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
segag80r_state *state = machine().driver_data<segag80r_state>();
|
||||
const uint8_t *sound_prom = state->memregion("proms")->base();
|
||||
int i;
|
||||
|
||||
/* no implementation yet */
|
||||
for (i = 0; i < samples; i++)
|
||||
for (i = 0; i < outputs[0].samples(); i++)
|
||||
{
|
||||
if (!(state->m_sound_state[1] & 0x10) && (++state->m_square_count & 0xff) == 0)
|
||||
{
|
||||
@ -78,7 +78,7 @@ void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
state->m_square_state += 2;
|
||||
}
|
||||
|
||||
outputs[0][i] = (state->m_square_state & 2) ? 0x7fff : 0x0000;
|
||||
outputs[0].put(i, (state->m_square_state & 2) ? 1.0 : 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ void usb_sound_device::device_start()
|
||||
|
||||
#else
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 1, USB_2MHZ_CLOCK);
|
||||
m_stream = stream_alloc(0, 1, USB_2MHZ_CLOCK);
|
||||
|
||||
m_noise_shift = 0x15555;
|
||||
|
||||
@ -451,15 +451,15 @@ void usb_sound_device::env_w(int which, u8 offset, u8 data)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void usb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *dest = outputs[0];
|
||||
auto &dest = outputs[0];
|
||||
|
||||
// iterate over samples
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < dest.samples(); sampindex++)
|
||||
{
|
||||
/*----------------
|
||||
Noise Source
|
||||
@ -590,7 +590,7 @@ void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
WEIGHT
|
||||
|
||||
*/
|
||||
*dest++ = 3000 * m_final_filter.step_cr(sample);
|
||||
dest.put(sampindex, 0.1 * m_final_filter.step_cr(sample));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ protected:
|
||||
|
||||
#if (!ENABLE_SEGAUSB_NETLIST)
|
||||
// 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;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -385,7 +385,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char
|
||||
void seibu_adpcm_device::device_start()
|
||||
{
|
||||
m_playing = 0;
|
||||
m_stream = stream_alloc_legacy(0, 1, clock());
|
||||
m_stream = stream_alloc(0, 1, clock());
|
||||
m_adpcm.reset();
|
||||
|
||||
save_item(NAME(m_current));
|
||||
@ -443,14 +443,15 @@ void seibu_adpcm_device::ctl_w(u8 data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void seibu_adpcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *dest = outputs[0];
|
||||
auto &dest = outputs[0];
|
||||
|
||||
while (m_playing && samples > 0)
|
||||
int sampindex;
|
||||
for (sampindex = 0; m_playing && sampindex < dest.samples(); sampindex++)
|
||||
{
|
||||
int val = (m_base[m_current] >> m_nibble) & 15;
|
||||
|
||||
@ -462,12 +463,7 @@ void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream
|
||||
m_playing = 0;
|
||||
}
|
||||
|
||||
*dest++ = m_adpcm.clock(val) << 4;
|
||||
samples--;
|
||||
}
|
||||
while (samples > 0)
|
||||
{
|
||||
*dest++ = 0;
|
||||
samples--;
|
||||
dest.put_int(sampindex, m_adpcm.clock(val), 32768 >> 4);
|
||||
}
|
||||
dest.fill(0, sampindex);
|
||||
}
|
||||
|
@ -145,7 +145,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:
|
||||
// internal state
|
||||
|
@ -165,7 +165,7 @@ void snk6502_sound_device::device_start()
|
||||
// 38.99 Hz update (according to schematic)
|
||||
set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1));
|
||||
|
||||
m_tone_stream = stream_alloc_legacy(0, 1, SAMPLE_RATE);
|
||||
m_tone_stream = stream_alloc(0, 1, SAMPLE_RATE);
|
||||
|
||||
for (int i = 0; i < NUM_CHANNELS; i++)
|
||||
{
|
||||
@ -509,17 +509,17 @@ void snk6502_sound_device::speech_w(uint8_t data, const uint16_t *table, int sta
|
||||
*/
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void snk6502_sound_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];
|
||||
|
||||
for (int i = 0; i < NUM_CHANNELS; i++)
|
||||
validate_tone_channel(i);
|
||||
|
||||
while (samples-- > 0)
|
||||
for (int sampindex = 0; sampindex < buffer.samples(); sampindex++)
|
||||
{
|
||||
int32_t data = 0;
|
||||
|
||||
@ -541,7 +541,7 @@ void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
}
|
||||
}
|
||||
|
||||
*buffer++ = data;
|
||||
buffer.put_int(sampindex, data, 3768);
|
||||
|
||||
m_tone_clock += FRAC_ONE;
|
||||
if (m_tone_clock >= m_tone_clock_expire)
|
||||
|
@ -40,7 +40,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:
|
||||
static constexpr unsigned NUM_CHANNELS = 3;
|
||||
|
@ -43,20 +43,20 @@ void socrates_snd_device::device_start()
|
||||
m_DAC_output = 0x00; /* output */
|
||||
m_state[0] = m_state[1] = m_state[2] = 0;
|
||||
m_accum[0] = m_accum[1] = m_accum[2] = 0xFF;
|
||||
m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 1, clock() ? clock() : machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void socrates_snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void socrates_snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
for (int i = 0; i < samples; i++)
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
{
|
||||
snd_clock();
|
||||
outputs[0][i] = ((int)m_DAC_output<<4);
|
||||
outputs[0].put_int(i, (int)m_DAC_output, 32768 >> 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,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:
|
||||
void snd_clock();
|
||||
static const uint8_t s_volumeLUT[];
|
||||
|
@ -41,41 +41,24 @@ specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const
|
||||
void specimx_sound_device::device_start()
|
||||
{
|
||||
m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0;
|
||||
m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_mixer_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void specimx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void specimx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int16_t channel_0_signal;
|
||||
int16_t channel_1_signal;
|
||||
int16_t channel_2_signal;
|
||||
auto &sample_left = outputs[0];
|
||||
|
||||
stream_sample_t *sample_left = outputs[0];
|
||||
stream_buffer::sample_t channel_0_signal = m_specimx_input[0] ? 0.1 : -0.1;
|
||||
stream_buffer::sample_t channel_1_signal = m_specimx_input[1] ? 0.1 : -0.1;
|
||||
stream_buffer::sample_t channel_2_signal = m_specimx_input[2] ? 0.1 : -0.1;
|
||||
stream_buffer::sample_t sum = channel_0_signal + channel_1_signal + channel_2_signal;
|
||||
|
||||
channel_0_signal = m_specimx_input[0] ? 3000 : -3000;
|
||||
channel_1_signal = m_specimx_input[1] ? 3000 : -3000;
|
||||
channel_2_signal = m_specimx_input[2] ? 3000 : -3000;
|
||||
|
||||
while (samples--)
|
||||
{
|
||||
*sample_left = 0;
|
||||
|
||||
/* music channel 0 */
|
||||
*sample_left += channel_0_signal;
|
||||
|
||||
/* music channel 1 */
|
||||
*sample_left += channel_1_signal;
|
||||
|
||||
/* music channel 2 */
|
||||
*sample_left += channel_2_signal;
|
||||
|
||||
sample_left++;
|
||||
}
|
||||
sample_left.fill(sum);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,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:
|
||||
sound_stream *m_mixer_channel;
|
||||
|
@ -45,22 +45,23 @@ void svision_sound_device::device_start()
|
||||
memset(&m_noise, 0, sizeof(m_noise));
|
||||
memset(m_channel, 0, sizeof(m_channel));
|
||||
|
||||
m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_mixer_channel = stream_alloc(0, 2, machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void svision_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *left=outputs[0], *right=outputs[1];
|
||||
auto &left=outputs[0];
|
||||
auto &right=outputs[1];
|
||||
|
||||
for (int i = 0; i < samples; i++, left++, right++)
|
||||
for (int i = 0; i < left.samples(); i++)
|
||||
{
|
||||
*left = 0;
|
||||
*right = 0;
|
||||
s32 lsum = 0;
|
||||
s32 rsum = 0;
|
||||
for (int j = 0; j < ARRAY_LENGTH(m_channel); j++)
|
||||
{
|
||||
CHANNEL &channel(m_channel[j]);
|
||||
@ -88,9 +89,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
{
|
||||
int16_t s = on ? channel.volume << 8 : 0;
|
||||
if (j == 0)
|
||||
*right += s;
|
||||
rsum += s;
|
||||
else
|
||||
*left += s;
|
||||
lsum += s;
|
||||
}
|
||||
}
|
||||
channel.pos++;
|
||||
@ -103,9 +104,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
int16_t s = (m_noise.value ? 1 << 8: 0) * m_noise.volume;
|
||||
int b1, b2;
|
||||
if (m_noise.left)
|
||||
*left += s;
|
||||
lsum += s;
|
||||
if (m_noise.right)
|
||||
*right += s;
|
||||
rsum += s;
|
||||
m_noise.pos += m_noise.step;
|
||||
if (m_noise.pos >= 1.0)
|
||||
{
|
||||
@ -146,9 +147,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
s = (sample & 0xf0) >> 4;
|
||||
s <<= 8;
|
||||
if (m_dma.left)
|
||||
*left += s;
|
||||
lsum += s;
|
||||
if (m_dma.right)
|
||||
*right += s;
|
||||
rsum += s;
|
||||
m_dma.pos += m_dma.step;
|
||||
if (m_dma.pos >= m_dma.size)
|
||||
{
|
||||
@ -157,6 +158,8 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre
|
||||
m_irq_cb(1);
|
||||
}
|
||||
}
|
||||
left.put_int(i, lsum, 32768);
|
||||
right.put_int(i, rsum, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,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 NOISE
|
||||
|
@ -77,7 +77,7 @@ void tiamc1_sound_device::device_start()
|
||||
timer8253_reset(&m_timer0);
|
||||
timer8253_reset(&m_timer1);
|
||||
|
||||
m_channel = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER);
|
||||
m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER);
|
||||
|
||||
m_timer1_divider = 0;
|
||||
|
||||
@ -104,14 +104,14 @@ void tiamc1_sound_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int count, o0, o1, o2, len, orval = 0;
|
||||
|
||||
len = samples * CLOCK_DIVIDER;
|
||||
len = outputs[0].samples() * CLOCK_DIVIDER;
|
||||
|
||||
for (count = 0; count < len; count++)
|
||||
{
|
||||
@ -140,7 +140,7 @@ void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, strea
|
||||
|
||||
if ((count + 1) % CLOCK_DIVIDER == 0)
|
||||
{
|
||||
outputs[0][count / CLOCK_DIVIDER] = orval ? 0x2828 : 0;
|
||||
outputs[0].put(count / CLOCK_DIVIDER, orval ? 0.3 : 0.0);
|
||||
orval = 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 timer8253chan
|
||||
|
@ -34,7 +34,6 @@ locomotn_audio_device::locomotn_audio_device(const machine_config &mconfig, cons
|
||||
|
||||
timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
, m_soundcpu(*this, "tpsound")
|
||||
, m_soundlatch(*this, "soundlatch")
|
||||
, m_filter_0(*this, "filter.0.%u", 0)
|
||||
@ -226,13 +225,3 @@ void locomotn_audio_device::device_add_mconfig(machine_config &config)
|
||||
/* basic machine hardware */
|
||||
m_soundcpu->set_addrmap(AS_PROGRAM, &locomotn_audio_device::locomotn_sound_map);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void timeplt_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
{
|
||||
// should never get here
|
||||
fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/flt_rc.h"
|
||||
|
||||
class timeplt_audio_device : public device_t, public device_sound_interface
|
||||
class timeplt_audio_device : public device_t
|
||||
{
|
||||
public:
|
||||
timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 14'318'181);
|
||||
@ -26,9 +26,6 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
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;
|
||||
|
||||
void filter_w(offs_t offset, uint8_t data);
|
||||
uint8_t portB_r();
|
||||
|
||||
|
@ -15,7 +15,6 @@ DEFINE_DEVICE_TYPE(TRACKFLD_AUDIO, trackfld_audio_device, "trackfld_audio", "Tra
|
||||
|
||||
trackfld_audio_device::trackfld_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, TRACKFLD_AUDIO, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
, m_audiocpu(*this, finder_base::DUMMY_TAG)
|
||||
, m_vlm(*this, finder_base::DUMMY_TAG)
|
||||
, m_last_addr(0)
|
||||
@ -130,13 +129,3 @@ WRITE_LINE_MEMBER(trackfld_audio_device::sh_irqtrigger_w)
|
||||
|
||||
m_last_irq = state;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void trackfld_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
{
|
||||
// should never get here
|
||||
fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n");
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "sound/vlm5030.h"
|
||||
#include "cpu/m6800/m6800.h"
|
||||
|
||||
class trackfld_audio_device : public device_t, public device_sound_interface
|
||||
class trackfld_audio_device : public device_t
|
||||
{
|
||||
public:
|
||||
template <typename T, typename U>
|
||||
@ -33,9 +33,6 @@ protected:
|
||||
virtual void device_start() override;
|
||||
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;
|
||||
|
||||
private:
|
||||
optional_device<cpu_device> m_audiocpu;
|
||||
optional_device<vlm5030_device> m_vlm;
|
||||
|
@ -47,7 +47,7 @@ void turrett_device::device_start()
|
||||
space().cache(m_cache);
|
||||
|
||||
// Create the sound stream
|
||||
m_stream = stream_alloc_legacy(0, 2, 44100);
|
||||
m_stream = stream_alloc(0, 2, 44100);
|
||||
|
||||
// Create the volume table
|
||||
for (int i = 0; i < 0x4f; ++i)
|
||||
@ -78,20 +78,17 @@ void turrett_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - update sound stream
|
||||
// sound_stream_update - update sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
// Silence the buffers
|
||||
memset(outputs[0], 0x00, sizeof(stream_sample_t) * samples);
|
||||
memset(outputs[1], 0x00, sizeof(stream_sample_t) * samples);
|
||||
outputs[0].fill(0);
|
||||
outputs[1].fill(0);
|
||||
|
||||
for (int ch = 0; ch < SOUND_CHANNELS; ++ch)
|
||||
{
|
||||
stream_sample_t *l = outputs[0];
|
||||
stream_sample_t *r = outputs[1];
|
||||
|
||||
if (m_channels[ch].m_playing)
|
||||
{
|
||||
uint32_t &addr = m_channels[ch].m_address;
|
||||
@ -104,7 +101,7 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
// Channels 30 and 31 expect interleaved stereo samples
|
||||
uint32_t incr = (ch >= 30) ? 2 : 1;
|
||||
|
||||
for (int s = 0; s < samples; ++s)
|
||||
for (int s = 0; s < outputs[0].samples(); ++s)
|
||||
{
|
||||
int16_t sample = m_cache.read_word(addr << 1);
|
||||
|
||||
@ -116,8 +113,8 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
|
||||
addr += incr;
|
||||
|
||||
*l++ += (sample * lvol) >> 17;
|
||||
*r++ += (sample * rvol) >> 17;
|
||||
outputs[0].add_int(s, (sample * lvol) >> 17, 32768);
|
||||
outputs[1].add_int(s, (sample * rvol) >> 17, 32768);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ void tvc_sound_device::device_start()
|
||||
// resolve callbacks
|
||||
m_write_sndint.resolve_safe();
|
||||
|
||||
m_stream = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 1, machine().sample_rate());
|
||||
m_sndint_timer = timer_alloc(TIMER_SNDINT);
|
||||
}
|
||||
|
||||
@ -58,19 +58,19 @@ void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int pa
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tvc_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
int rate = machine().sample_rate() / 2;
|
||||
stream_sample_t *output = outputs[0];
|
||||
auto &output = outputs[0];
|
||||
int rate = output.sample_rate() / 2;
|
||||
if (m_enabled && m_freq)
|
||||
{
|
||||
while( samples-- > 0 )
|
||||
for (int sampindex = 0; sampindex < output.samples(); sampindex++)
|
||||
{
|
||||
*output++ = m_signal * (m_volume * 0x0800);
|
||||
output.put_int(sampindex, m_signal * m_volume, 32768 / 0x0800);
|
||||
m_incr -= m_freq;
|
||||
while(m_incr < 0)
|
||||
{
|
||||
@ -82,7 +82,7 @@ void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
else
|
||||
{
|
||||
// fill output with 0 if the sound is disabled
|
||||
memset(output, 0, samples * sizeof(stream_sample_t));
|
||||
output.fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) 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:
|
||||
static const device_timer_id TIMER_SNDINT = 0;
|
||||
|
@ -111,7 +111,7 @@ void tx1_sound_device::device_start()
|
||||
|
||||
|
||||
/* Allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 2, machine().sample_rate());
|
||||
m_freq_to_step = (double)(1 << TX1_FRAC) / (double)machine().sample_rate();
|
||||
|
||||
/* Compute the engine resistor weights */
|
||||
@ -356,20 +356,16 @@ static inline void update_engine(int eng[4])
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
uint32_t step_0, step_1, step_2;
|
||||
double /*gain_0, gain_1,*/ gain_2, gain_3;
|
||||
|
||||
stream_sample_t *fl = &outputs[0][0];
|
||||
stream_sample_t *fr = &outputs[1][0];
|
||||
|
||||
/* Clear the buffers */
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples * sizeof(*outputs[1]));
|
||||
auto &fl = outputs[0];
|
||||
auto &fr = outputs[1];
|
||||
|
||||
/* 8253 outputs for the player/opponent engine sounds. */
|
||||
step_0 = m_pit8253.counts[0].val ? (TX1_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0;
|
||||
@ -381,7 +377,7 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
gain_2 = tx1_engine_gains[m_ay_outputb & 0xf];
|
||||
gain_3 = BIT(m_ay_outputb, 5) ? 1.0f : 1.5f;
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
|
||||
{
|
||||
if (m_step0 & ((1 << TX1_FRAC)))
|
||||
{
|
||||
@ -404,8 +400,8 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s
|
||||
m_step2 &= ((1 << TX1_FRAC) - 1);
|
||||
}
|
||||
|
||||
*fl++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2;
|
||||
*fr++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2;
|
||||
fl.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
|
||||
fr.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768);
|
||||
|
||||
m_step0 += step_0;
|
||||
m_step1 += step_1;
|
||||
@ -662,7 +658,7 @@ void buggyboy_sound_device::device_start()
|
||||
m_eng_voltages[i] = combine_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3));
|
||||
|
||||
/* Allocate the stream */
|
||||
m_stream = stream_alloc_legacy(0, 2, machine().sample_rate());
|
||||
m_stream = stream_alloc(0, 2, machine().sample_rate());
|
||||
m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate();
|
||||
}
|
||||
|
||||
@ -763,10 +759,10 @@ void buggyboy_sound_device::ym2_b_w(uint8_t data)
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
/* This is admittedly a bit of a hack job... */
|
||||
|
||||
@ -774,12 +770,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
int n1_en, n2_en;
|
||||
double gain0, gain1_l, gain1_r;
|
||||
|
||||
stream_sample_t *fl = &outputs[0][0];
|
||||
stream_sample_t *fr = &outputs[1][0];
|
||||
|
||||
/* Clear the buffers */
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
memset(outputs[1], 0, samples * sizeof(*outputs[1]));
|
||||
auto &fl = outputs[0];
|
||||
auto &fr = outputs[1];
|
||||
|
||||
/* 8253 outputs for the player/opponent buggy engine sounds. */
|
||||
step_0 = m_pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0;
|
||||
@ -796,10 +788,10 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
gain1_l = bb_engine_gains[m_ym2_outputa >> 4] * 5;
|
||||
gain1_r = bb_engine_gains[m_ym2_outputa & 0xf] * 5;
|
||||
|
||||
while (samples--)
|
||||
for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
|
||||
{
|
||||
int i;
|
||||
stream_sample_t pit0, pit1, n1, n2;
|
||||
s32 pit0, pit1, n1, n2;
|
||||
pit0 = m_eng_voltages[(m_step0 >> 24) & 0xf];
|
||||
pit1 = m_eng_voltages[(m_step1 >> 24) & 0xf];
|
||||
|
||||
@ -839,8 +831,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str
|
||||
else
|
||||
n2 = 8192;
|
||||
|
||||
*fl++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l);
|
||||
*fr++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r);
|
||||
fl.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l), 32768);
|
||||
fr.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r), 32768);
|
||||
|
||||
m_step0 += step_0;
|
||||
m_step1 += step_1;
|
||||
|
@ -73,7 +73,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;
|
||||
|
||||
void tx1_sound_io(address_map &map);
|
||||
void tx1_sound_prg(address_map &map);
|
||||
@ -104,9 +104,9 @@ protected:
|
||||
uint8_t m_ppi_latch_b = 0;
|
||||
uint32_t m_ts = 0;
|
||||
|
||||
stream_sample_t m_pit0 = 0;
|
||||
stream_sample_t m_pit1 = 0;
|
||||
stream_sample_t m_pit2 = 0;
|
||||
s32 m_pit0 = 0;
|
||||
s32 m_pit1 = 0;
|
||||
s32 m_pit2 = 0;
|
||||
|
||||
double m_weights0[4] = { 0, 0, 0, 0 };
|
||||
double m_weights1[3] = { 0, 0, 0 };
|
||||
@ -155,7 +155,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;
|
||||
|
||||
void ym1_a_w(uint8_t data);
|
||||
|
||||
|
@ -209,7 +209,7 @@ void vboysnd_device::device_start()
|
||||
{
|
||||
uint32_t rate = clock() / 120;
|
||||
// create the stream
|
||||
m_stream = stream_alloc_legacy(0, 2, rate);
|
||||
m_stream = stream_alloc(0, 2, rate);
|
||||
|
||||
m_timer = timer_alloc(0, nullptr);
|
||||
m_timer->adjust(attotime::zero, 0, rate ? attotime::from_hz(rate / 4) : attotime::never);
|
||||
@ -265,19 +265,18 @@ void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int par
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle update requests for
|
||||
// sound_stream_update - handle update requests for
|
||||
// our sound stream
|
||||
//-------------------------------------------------
|
||||
|
||||
void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void vboysnd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
stream_sample_t *outL, *outR;
|
||||
int len, i, j, channel;
|
||||
|
||||
outL = outputs[0];
|
||||
outR = outputs[1];
|
||||
auto &outL = outputs[0];
|
||||
auto &outR = outputs[1];
|
||||
|
||||
len = samples;
|
||||
len = outL.samples();
|
||||
|
||||
// if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg
|
||||
// goto end;
|
||||
@ -384,13 +383,9 @@ void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sam
|
||||
// scale to 16 bits
|
||||
note_left = (note_left << 5) | ((note_left >> 6) & 0x1f);
|
||||
note_right = (note_right << 5) | ((note_right >> 6) & 0x1f);
|
||||
if (note_left < -32767) note_left = -32767;
|
||||
if (note_left > 32767) note_left = 32767;
|
||||
if (note_right < -32767) note_right = -32767;
|
||||
if (note_right > 32767) note_right = 32767;
|
||||
|
||||
*(outL++) = ((int16_t)note_left);
|
||||
*(outR++) = ((int16_t)note_right);
|
||||
outL.put_int_clamp(j, (int16_t)note_left, 32768);
|
||||
outR.put_int_clamp(j, (int16_t)note_right, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) 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;
|
||||
|
||||
s_snd_channel snd_channel[5];
|
||||
|
||||
|
@ -31,26 +31,22 @@ vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const ch
|
||||
|
||||
void vc4000_sound_device::device_start()
|
||||
{
|
||||
m_channel = stream_alloc_legacy(0, 1, machine().sample_rate());
|
||||
m_channel = stream_alloc(0, 1, machine().sample_rate());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update_legacy - handle a stream update
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void vc4000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
|
||||
void vc4000_sound_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 *buffer = outputs[0];
|
||||
auto &buffer = outputs[0];
|
||||
|
||||
for (i = 0; i < samples; i++, buffer++)
|
||||
for (i = 0; i < buffer.samples(); i++)
|
||||
{
|
||||
*buffer = 0;
|
||||
if (m_reg[0] && m_pos <= m_size / 2)
|
||||
{
|
||||
*buffer = 0x7fff;
|
||||
}
|
||||
buffer.put(i, (m_reg[0] && m_pos <= m_size / 2) ? 1.0 : 0.0);
|
||||
if (m_pos <= m_size)
|
||||
m_pos++;
|
||||
if (m_pos > m_size)
|
||||
|
@ -28,7 +28,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:
|
||||
void soundport_w(int mode, int data);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user