mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Added cdda_get_channel_volume() function to CD-DA device. Fixed volume control display in PC Engine CD system [Angelo Salese]
This commit is contained in:
parent
e29bf515c4
commit
ddfb6f919b
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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 ) );
|
||||
|
Loading…
Reference in New Issue
Block a user