Previous 199869 Revisions Next

r20134 Tuesday 8th January, 2013 at 19:54:52 UTC by Angelo Salese
Added cdda_get_channel_volume() function to CD-DA device. Fixed volume control display in PC Engine CD system [Angelo Salese]
[src/emu/sound]cdda.c cdda.h
[src/mess/machine]pce.c

trunk/src/mess/machine/pce.c
r20133r20134
16121612   case 0x04:   /* CD reset */
16131613      break;
16141614   case 0x05:   /* Convert PCM data / PCM data */
1615      data = cdda_get_channel_volume(machine().device( "cdda" ),(pce_cd.regs[0x03] & 2) ? 0 : 1) & 0xff;
1616      break;
16151617   case 0x06:   /* PCM data */
1618      data = cdda_get_channel_volume(machine().device( "cdda" ),(pce_cd.regs[0x03] & 2) ? 0 : 1) >> 8;
16161619      break;
16171620   case 0x07:   /* BRAM unlock / CD status */
16181621      data = ( pce_cd.bram_locked ? ( data & 0x7F ) : ( data | 0x80 ) );
trunk/src/emu/sound/cdda.c
r20133r20134
1818   UINT8 *            audio_cache;
1919   UINT32            audio_samples;
2020   UINT32            audio_bptr;
21   INT16            audio_volume[2];
2122};
2223
2324INLINE cdda_info *get_safe_token(device_t *device)
r20133r20134
4041{
4142   cdda_info *info = (cdda_info *)param;
4243   get_audio_data(info, &outputs[0][0], &outputs[1][0], samples);
44   info->audio_volume[0] = (INT16)outputs[0][0];
45   info->audio_volume[1] = (INT16)outputs[1][0];
4346}
4447
4548
r20133r20134
312315   cdda->stream->set_output_gain(channel,volume / 100.0);
313316}
314317
318
319/*-------------------------------------------------
320    cdda_get_channel_volume - sets CD-DA volume level
321    for either speaker, used for volume control display
322-------------------------------------------------*/
323
324INT16 cdda_get_channel_volume(device_t *device, int channel)
325{
326   cdda_info *cdda = get_safe_token(device);
327
328   return cdda->audio_volume[channel];
329}
330
315331const device_type CDDA = &device_creator<cdda_device>;
316332
317333cdda_device::cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
trunk/src/emu/sound/cdda.h
r20133r20134
1313void cdda_pause_audio(device_t *device, int pause);
1414void cdda_set_volume(device_t *device, int volume);
1515void cdda_set_channel_volume(device_t *device, int channel, int volume);
16INT16 cdda_get_channel_volume(device_t *device, int channel);
1617
1718UINT32 cdda_get_audio_lba(device_t *device);
1819int cdda_audio_active(device_t *device);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team