Config->Sound: show 'MEGA Audio' in drop-down menus if it was specified on the cmd line

This commit is contained in:
tomcw 2023-04-12 17:42:58 +01:00
parent e5957beb37
commit 990a1c1531
2 changed files with 32 additions and 4 deletions

View File

@ -44,6 +44,16 @@ const char CPageSound::m_soundCardChoices[] = "Mockingboard\0"
"SAM\0"
"Empty\0";
// Don't reveal MegaAudio card unless it's been specified from the command line.
// The reasons being are that:
// . this card is purely for regression testing against mb-audit
// . it's confusing to offer this to the end user
const char CPageSound::m_soundCardChoicesEx[] = "Mockingboard\0"
"Phasor\0"
"SAM\0"
"Empty\0"
"MEGA Audio\0";
const char CPageSound::m_soundCardChoice_Unavailable[] = "Unavailable\0\0"; // doubly-null terminate
INT_PTR CALLBACK CPageSound::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
@ -105,6 +115,7 @@ INT_PTR CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
case SC_PHASOR: newCard = CT_Phasor; break;
case SC_SAM: newCard = CT_SAM; break;
case SC_EMPTY: newCard = CT_Empty; break;
case SC_MEGAAUDIO: newCard = CT_MegaAudio; break;
default: _ASSERT(0); break;
}
@ -166,28 +177,44 @@ CPageSound::SOUNDCARDCHOICE CPageSound::CardTypeToComboItem(SS_CARDTYPE card)
case CT_Phasor: return SC_PHASOR;
case CT_SAM: return SC_SAM;
case CT_Empty: return SC_EMPTY;
case CT_MegaAudio: return SC_MEGAAUDIO;
default: _ASSERT(0); return SC_EMPTY;
}
}
void CPageSound::InitOptions(HWND hWnd)
{
const SS_CARDTYPE slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
const SS_CARDTYPE slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
const SS_CARDTYPE slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT4];
const SS_CARDTYPE slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5];
bool isSlot4SoundCard = slot4 == CT_MockingboardC || slot4 == CT_Phasor || slot4 == CT_SAM || slot4 == CT_Empty;
bool isSlot5SoundCard = slot5 == CT_MockingboardC || slot5 == CT_Phasor || slot5 == CT_SAM || slot5 == CT_Empty;
bool isSlot4SoundCardEx = slot4 == CT_MegaAudio;
bool isSlot5SoundCardEx = slot5 == CT_MegaAudio;
if (isSlot4SoundCardEx || isSlot5SoundCardEx)
{
isSlot4SoundCardEx = isSlot5SoundCardEx = true; // if MegaAudio is visible in either, then make it available in both menus
isSlot4SoundCard = isSlot5SoundCard = false;
}
if (isSlot4SoundCard)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT4, m_soundCardChoices, (int)CardTypeToComboItem(slot4));
else if (isSlot4SoundCardEx)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT4, m_soundCardChoicesEx, (int)CardTypeToComboItem(slot4));
else
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT4, m_soundCardChoice_Unavailable, 0);
if (isSlot5SoundCard)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT5, m_soundCardChoices, (int)CardTypeToComboItem(slot5));
else if (isSlot5SoundCardEx)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT5, m_soundCardChoicesEx, (int)CardTypeToComboItem(slot5));
else
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT5, m_soundCardChoice_Unavailable, 0);
bool enableMBVolume = slot4 == CT_MockingboardC || slot5 == CT_MockingboardC || slot4 == CT_Phasor || slot5 == CT_Phasor;
bool enableMBVolume = slot4 == CT_MockingboardC || slot5 == CT_MockingboardC
|| slot4 == CT_Phasor || slot5 == CT_Phasor
|| slot4 == CT_MegaAudio || slot5 == CT_MegaAudio;
EnableWindow(GetDlgItem(hWnd, IDC_MB_VOLUME), enableMBVolume ? TRUE : FALSE);
}

View File

@ -28,7 +28,7 @@ protected:
virtual void DlgCANCEL(HWND hWnd){}
private:
enum SOUNDCARDCHOICE { SC_MOCKINGBOARD = 0, SC_PHASOR, SC_SAM, SC_EMPTY, _SOUNDCARD_MAX_CHOICES, SC_UNAVAILABLE };
enum SOUNDCARDCHOICE { SC_MOCKINGBOARD = 0, SC_PHASOR, SC_SAM, SC_EMPTY, SC_MEGAAUDIO };
void InitOptions(HWND hWnd);
SOUNDCARDCHOICE CardTypeToComboItem(SS_CARDTYPE card);
@ -42,5 +42,6 @@ private:
static const UINT VOLUME_MAX = 59;
static const TCHAR m_soundchoices[];
static const char m_soundCardChoices[];
static const char m_soundCardChoicesEx[];
static const char m_soundCardChoice_Unavailable[];
};