summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/cdda.cpp
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2023-03-19 13:02:02 +0100
committer GitHub <noreply@github.com>2023-03-19 13:02:02 +0100
commit3cf4d60bf1d9473cfe95944fa58366538b70e34d (patch)
treef17f7a70c284cb7026e5064f8983c34b6a5519cb /src/devices/sound/cdda.cpp
parent84140265c47ffaf0cb01c76a5e7f1378def8f1f2 (diff)
hash/pcecd.xml: QA notes (#10956)
* pce_cd.cpp: convert to logmacro, fix regression on stop/repeat conditions, workaround MT#07972 * Delete unnecessary stub files from the other branch * hash/pcecd.xml: QA notes * nec/pce_cd.cpp: fix MT#07972 for good * hash/pcecd.xml: update QA * hash/pcecd.xml, nec/pce_cd.cpp: update QA * nec/pce_cd.cpp: make pregap to have a minimum of 2 seconds, fixes redbook offset * sound/cdda.cpp: add an actual write callback for audio playback end event * nec/pce_cd.cpp: implement CDDA audio end event, fixes redbook repeat with emeraldd * hash/pcecd.xml: update QA * nec/pce_cd.cpp: do not send an irq when start/end redbook commands are issued, fixes macr2036 (MT #5995), jleagt94, iganin * hash/pcecd.xml: QA heavy hitters * hash/pcecd.xml: QA * nec/pce_cd.cpp: unbreak snatcher, unbreak audio CD player * nec/pce_cd.cpp: document crazyhos btanb * nec/pce_cd.cpp: make BRAM to init to a standard scdsys format data * hash/pcecd.xml: acknowledge games using Save-Kun peripheral * nec/pce_cd.cpp: fix cdda get_channel_volume index overflow * sound/cdda.cpp: fix longstanding regression with get_channel_volume, rename it to get_channel_sample * nec/pce_cd.cpp: QA fader * nec/pce_cd.cpp: cancel redbook when audio start + play mode = 0 is issued, fixes ppersia sound when picking up sword * hash/pcecd.xml: finalize QA * nec/pce_cd.cpp: misc cleanups * hash/pcecd.xml: fix neklegbb description tag * hash/pcecd.xml: faussete/traveler description fixes
Diffstat (limited to 'src/devices/sound/cdda.cpp')
-rw-r--r--src/devices/sound/cdda.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp
index 38a4c4736cc..0dd1b3ee449 100644
--- a/src/devices/sound/cdda.cpp
+++ b/src/devices/sound/cdda.cpp
@@ -18,8 +18,6 @@
void cdda_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
get_audio_data(outputs[0], outputs[1]);
- m_audio_volume[0] = outputs[0].get(0);
- m_audio_volume[1] = outputs[1].get(0);
}
//-------------------------------------------------
@@ -42,6 +40,8 @@ void cdda_device::device_start()
m_audio_bptr = 0;
m_disc = nullptr;
+ m_audio_end_cb.resolve_safe();
+
save_item( NAME(m_audio_playing) );
save_item( NAME(m_audio_pause) );
save_item( NAME(m_audio_ended_normally) );
@@ -174,8 +174,10 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf
{
m_audio_playing = false;
m_audio_ended_normally = true;
+ m_audio_end_cb(ASSERT_LINE);
}
+ m_audio_data[0] = m_audio_data[1] = 0;
bufL.fill(0, sampindex);
bufR.fill(0, sampindex);
return;
@@ -190,8 +192,12 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf
for (i = 0; i < samples; i++)
{
/* CD-DA data on the disc is big-endian */
- bufL.put_int(sampindex + i, s16(big_endianize_int16( audio_cache[ m_audio_bptr ] )), 32768); m_audio_bptr++;
- bufR.put_int(sampindex + i, s16(big_endianize_int16( audio_cache[ m_audio_bptr ] )), 32768); m_audio_bptr++;
+ m_audio_data[0] = s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ));
+ bufL.put_int(sampindex + i, m_audio_data[0], 32768);
+ m_audio_bptr++;
+ m_audio_data[1] = s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ));
+ bufR.put_int(sampindex + i, m_audio_data[1], 32768);
+ m_audio_bptr++;
}
sampindex += samples;
@@ -222,13 +228,16 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf
}
/*-------------------------------------------------
- cdda_get_channel_volume - sets CD-DA volume level
- for either speaker, used for volume control display
+ get_channel_sample - reads currently decoded
+ data sample on the stream.
+ Used by PC Engine CD class family for volume
+ metering on audio CD player.
-------------------------------------------------*/
-int16_t cdda_device::get_channel_volume(int channel)
+int16_t cdda_device::get_channel_sample(int channel)
{
- return m_audio_volume[channel];
+ m_stream->update();
+ return m_audio_data[channel];
}
DEFINE_DEVICE_TYPE(CDDA, cdda_device, "cdda", "CD/DA")
@@ -238,5 +247,6 @@ cdda_device::cdda_device(const machine_config &mconfig, const char *tag, device_
, device_sound_interface(mconfig, *this)
, m_disc(nullptr)
, m_stream(nullptr)
+ , m_audio_end_cb(*this)
{
}