diff --git a/lib/ZuluSCSI_platform_RP2040/audio.cpp b/lib/ZuluSCSI_platform_RP2040/audio.cpp index d5c582e6..f85be195 100644 --- a/lib/ZuluSCSI_platform_RP2040/audio.cpp +++ b/lib/ZuluSCSI_platform_RP2040/audio.cpp @@ -142,8 +142,8 @@ static audio_status_code audio_last_status[8] = {ASC_NO_STATUS}; // volume information for targets static volatile uint16_t volumes[8] = { - DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL, - DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL, DEFAULT_VOLUME_LEVEL + DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH, + DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH, DEFAULT_VOLUME_LEVEL_2CH }; static volatile uint16_t channels[8] = { AUDIO_CHANNEL_ENABLE_MASK, AUDIO_CHANNEL_ENABLE_MASK, AUDIO_CHANNEL_ENABLE_MASK, AUDIO_CHANNEL_ENABLE_MASK, diff --git a/src/ZuluSCSI_audio.h b/src/ZuluSCSI_audio.h index 60fc2abf..d42ed2b1 100644 --- a/src/ZuluSCSI_audio.h +++ b/src/ZuluSCSI_audio.h @@ -33,7 +33,9 @@ * This implementation uses the high byte for output port 1 and the low byte * for port 0. The two values are averaged to determine final volume level. */ -#define DEFAULT_VOLUME_LEVEL 0x3F3F +#define DEFAULT_VOLUME_LEVEL 0x3F +#define DEFAULT_VOLUME_LEVEL_2CH DEFAULT_VOLUME_LEVEL << 8 | DEFAULT_VOLUME_LEVEL + /* * Defines the 'enable' masks for the two audio output ports of each device. * If this mask is matched with audio_get_channel() the relevant port will diff --git a/src/ZuluSCSI_disk.cpp b/src/ZuluSCSI_disk.cpp index 291821ea..41957660 100644 --- a/src/ZuluSCSI_disk.cpp +++ b/src/ZuluSCSI_disk.cpp @@ -30,6 +30,9 @@ #include "ZuluSCSI_log.h" #include "ZuluSCSI_config.h" #include "ZuluSCSI_presets.h" +#ifdef ENABLE_AUDIO_OUTPUT +#include "ZuluSCSI_audio.h" +#endif #include "ZuluSCSI_cdrom.h" #include "ImageBackingStore.h" #include "ROMDrive.h" @@ -572,6 +575,11 @@ static void scsiDiskLoadConfig(int target_idx, const char *section) img.reinsert_on_inquiry = ini_getbool(section, "ReinsertCDOnInquiry", img.reinsert_on_inquiry, CONFIGFILE); img.reinsert_after_eject = ini_getbool(section, "ReinsertAfterEject", img.reinsert_after_eject, CONFIGFILE); img.ejectButton = ini_getl(section, "EjectButton", 0, CONFIGFILE); +#ifdef ENABLE_AUDIO_OUTPUT + uint16_t vol = ini_getl(section, "CDAVolume", DEFAULT_VOLUME_LEVEL, CONFIGFILE) & 0xFF; + // Set volume on both channels + audio_set_volume(target_idx, (vol << 8) | vol); +#endif char tmp[32]; memset(tmp, 0, sizeof(tmp));