mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
tt5665.cpp: Use put_int for update samples
This commit is contained in:
parent
b1784c8e3f
commit
1866f2c1d9
@ -226,9 +226,9 @@ void tt5665_device::sound_stream_update(sound_stream &stream, std::vector<read_s
|
|||||||
if (m_daol_timing <= 0)
|
if (m_daol_timing <= 0)
|
||||||
{
|
{
|
||||||
update_daol = true;
|
update_daol = true;
|
||||||
m_daol_output = 0.0;
|
m_daol_output = 0;
|
||||||
}
|
}
|
||||||
stream_buffer::sample_t daor_output = 0.0;
|
s32 daor_output = 0;
|
||||||
|
|
||||||
for (int b = 0; b < TT5665_VOICES; b++)
|
for (int b = 0; b < TT5665_VOICES; b++)
|
||||||
{
|
{
|
||||||
@ -239,8 +239,8 @@ void tt5665_device::sound_stream_update(sound_stream &stream, std::vector<read_s
|
|||||||
// refresh DAOR output
|
// refresh DAOR output
|
||||||
m_voice[b + 4].generate_adpcm(*this, &daor_output);
|
m_voice[b + 4].generate_adpcm(*this, &daor_output);
|
||||||
}
|
}
|
||||||
outputs[0].put(s, m_daol_output);
|
outputs[0].put_int(s, m_daol_output, 2048);
|
||||||
outputs[1].put(s, daor_output);
|
outputs[1].put_int(s, daor_output, 2048);
|
||||||
if (update_daol)
|
if (update_daol)
|
||||||
{
|
{
|
||||||
update_daol = false;
|
update_daol = false;
|
||||||
@ -414,19 +414,18 @@ tt5665_device::tt5665_voice::tt5665_voice()
|
|||||||
// add them to an output stream
|
// add them to an output stream
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void tt5665_device::tt5665_voice::generate_adpcm(device_rom_interface &rom, stream_buffer::sample_t *buffer)
|
void tt5665_device::tt5665_voice::generate_adpcm(device_rom_interface &rom, s32 *buffer)
|
||||||
{
|
{
|
||||||
// skip if not active
|
// skip if not active
|
||||||
if (!m_playing)
|
if (!m_playing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fetch the next sample byte
|
// fetch the next sample byte
|
||||||
constexpr stream_buffer::sample_t sample_scale = 1.0 / 2048.0;
|
|
||||||
int nibble = rom.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
|
int nibble = rom.read_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
|
||||||
|
|
||||||
// output to the buffer, scaling by the volume
|
// output to the buffer, scaling by the volume
|
||||||
// signal in range -2048..2047, volume in range 2..32 => signal * volume / 2 in range -32768..32767
|
// signal in range -2048..2047; 12 bit built-in DAC
|
||||||
*buffer += m_adpcm.clock(nibble) * sample_scale * m_volume;
|
*buffer += m_adpcm.clock(nibble) * m_volume;
|
||||||
|
|
||||||
// next!
|
// next!
|
||||||
if (++m_sample >= m_count)
|
if (++m_sample >= m_count)
|
||||||
|
@ -74,7 +74,7 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tt5665_voice();
|
tt5665_voice();
|
||||||
void generate_adpcm(device_rom_interface &rom, stream_buffer::sample_t *buffer);
|
void generate_adpcm(device_rom_interface &rom, s32 *buffer);
|
||||||
|
|
||||||
oki_adpcm_state m_adpcm; // current ADPCM state
|
oki_adpcm_state m_adpcm; // current ADPCM state
|
||||||
bool m_playing;
|
bool m_playing;
|
||||||
@ -94,7 +94,7 @@ private:
|
|||||||
tt5665_voice m_voice[TT5665_VOICES * 2]; // separated voice for left and right output
|
tt5665_voice m_voice[TT5665_VOICES * 2]; // separated voice for left and right output
|
||||||
s32 m_command;
|
s32 m_command;
|
||||||
sound_stream* m_stream;
|
sound_stream* m_stream;
|
||||||
stream_buffer::sample_t m_daol_output;
|
s32 m_daol_output;
|
||||||
int m_daol_timing;
|
int m_daol_timing;
|
||||||
|
|
||||||
inline int freq_divider() const { return m_ss_state ? 136 : 170; }
|
inline int freq_divider() const { return m_ss_state ? 136 : 170; }
|
||||||
|
Loading…
Reference in New Issue
Block a user