diff options
author | Angelo Salese <angelosa@users.noreply.github.com> | 2013-01-08 19:54:52 +0000 |
---|---|---|
committer | Angelo Salese <angelosa@users.noreply.github.com> | 2013-01-08 19:54:52 +0000 |
commit | ddfb6f919b8e1f2b4febd3cbd381d7e08697ba82 (patch) | |
tree | d8071f7636fdb05c95612ca4f7187738e333f780 | |
parent | e29bf515c4a2e4be4349f25a3aca9b908c55da95 (diff) |
Added cdda_get_channel_volume() function to CD-DA device. Fixed volume control display in PC Engine CD system [Angelo Salese]
-rw-r--r-- | src/emu/sound/cdda.c | 16 | ||||
-rw-r--r-- | src/emu/sound/cdda.h | 1 | ||||
-rw-r--r-- | src/mess/machine/pce.c | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c index 202975fcb6f..9e3cb3c06d6 100644 --- a/src/emu/sound/cdda.c +++ b/src/emu/sound/cdda.c @@ -18,6 +18,7 @@ struct cdda_info UINT8 * audio_cache; UINT32 audio_samples; UINT32 audio_bptr; + INT16 audio_volume[2]; }; INLINE cdda_info *get_safe_token(device_t *device) @@ -40,6 +41,8 @@ static STREAM_UPDATE( cdda_update ) { cdda_info *info = (cdda_info *)param; get_audio_data(info, &outputs[0][0], &outputs[1][0], samples); + info->audio_volume[0] = (INT16)outputs[0][0]; + info->audio_volume[1] = (INT16)outputs[1][0]; } @@ -312,6 +315,19 @@ void cdda_set_channel_volume(device_t *device, int channel, int volume) cdda->stream->set_output_gain(channel,volume / 100.0); } + +/*------------------------------------------------- + cdda_get_channel_volume - sets CD-DA volume level + for either speaker, used for volume control display +-------------------------------------------------*/ + +INT16 cdda_get_channel_volume(device_t *device, int channel) +{ + cdda_info *cdda = get_safe_token(device); + + return cdda->audio_volume[channel]; +} + const device_type CDDA = &device_creator<cdda_device>; cdda_device::cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/emu/sound/cdda.h b/src/emu/sound/cdda.h index 5535e4ffebd..c2f22a1d47d 100644 --- a/src/emu/sound/cdda.h +++ b/src/emu/sound/cdda.h @@ -13,6 +13,7 @@ void cdda_stop_audio(device_t *device); void cdda_pause_audio(device_t *device, int pause); void cdda_set_volume(device_t *device, int volume); void cdda_set_channel_volume(device_t *device, int channel, int volume); +INT16 cdda_get_channel_volume(device_t *device, int channel); UINT32 cdda_get_audio_lba(device_t *device); int cdda_audio_active(device_t *device); diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index 3c209f9cbb3..13bdff83e17 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -1612,7 +1612,10 @@ READ8_MEMBER(pce_state::pce_cd_intf_r) case 0x04: /* CD reset */ break; case 0x05: /* Convert PCM data / PCM data */ + data = cdda_get_channel_volume(machine().device( "cdda" ),(pce_cd.regs[0x03] & 2) ? 0 : 1) & 0xff; + break; case 0x06: /* PCM data */ + data = cdda_get_channel_volume(machine().device( "cdda" ),(pce_cd.regs[0x03] & 2) ? 0 : 1) >> 8; break; case 0x07: /* BRAM unlock / CD status */ data = ( pce_cd.bram_locked ? ( data & 0x7F ) : ( data | 0x80 ) ); |