From a411b9fac170bb13c5d0e2b98a9a44cc5d56040c Mon Sep 17 00:00:00 2001 From: 987123879113 <63495610+987123879113@users.noreply.github.com> Date: Tue, 16 May 2023 01:52:20 +0900 Subject: sound/mp3_audio: Implement save states for MP3 decoder (#11232) --- src/devices/sound/lc82310.cpp | 4 ++++ src/devices/sound/mas3507d.cpp | 2 ++ src/devices/sound/mp3_audio.cpp | 11 +++++++++++ src/devices/sound/mp3_audio.h | 2 ++ 4 files changed, 19 insertions(+) diff --git a/src/devices/sound/lc82310.cpp b/src/devices/sound/lc82310.cpp index 119a12b033b..0693930e23c 100644 --- a/src/devices/sound/lc82310.cpp +++ b/src/devices/sound/lc82310.cpp @@ -35,9 +35,13 @@ void lc82310_device::device_start() save_item(NAME(m_ckctl)); save_item(NAME(m_dictl)); save_item(NAME(m_doctl)); + save_item(NAME(m_ctl_state)); + save_item(NAME(m_ctl_cmd)); save_item(NAME(m_ctl_bits)); save_item(NAME(m_ctl_byte)); save_item(NAME(m_ctl_out_byte)); + + mp3dec->register_save(*this); } void lc82310_device::device_reset() diff --git a/src/devices/sound/mas3507d.cpp b/src/devices/sound/mas3507d.cpp index ddcf0d41b94..4036fba50f2 100644 --- a/src/devices/sound/mas3507d.cpp +++ b/src/devices/sound/mas3507d.cpp @@ -87,6 +87,8 @@ void mas3507d_device::device_start() save_item(NAME(playback_status)); save_item(NAME(frame_channels)); + + mp3dec->register_save(*this); } void mas3507d_device::device_reset() diff --git a/src/devices/sound/mp3_audio.cpp b/src/devices/sound/mp3_audio.cpp index d6a45413e7d..c5ac8797195 100644 --- a/src/devices/sound/mp3_audio.cpp +++ b/src/devices/sound/mp3_audio.cpp @@ -29,6 +29,17 @@ mp3_audio::~mp3_audio() { } +void mp3_audio::register_save(device_t &host) +{ + host.save_item(NAME(m_found_stream)); + host.save_item(NAME(dec->header)); + host.save_item(NAME(dec->reserv_buf)); + host.save_item(NAME(dec->mdct_overlap)); + host.save_item(NAME(dec->qmf_state)); + host.save_item(NAME(dec->reserv)); + host.save_item(NAME(dec->free_format_bytes)); +} + void mp3_audio::clear() { mp3dec_init(dec.get()); diff --git a/src/devices/sound/mp3_audio.h b/src/devices/sound/mp3_audio.h index df75ddd1969..ffafdb1f219 100644 --- a/src/devices/sound/mp3_audio.h +++ b/src/devices/sound/mp3_audio.h @@ -19,6 +19,8 @@ public: mp3_audio(const void *base); ~mp3_audio(); + void register_save(device_t &host); + bool decode_buffer(int &pos, int limit, short *output, int &output_samples, int &sample_rate, int &channels); void clear(); -- cgit v1.2.3