Enable Config->Sound for slots 4+5 to be individually selected for the 3 soundcard types

This commit is contained in:
tomcw 2023-01-28 17:59:06 +00:00
parent 4efb6e891d
commit dd1573e49c
4 changed files with 64 additions and 119 deletions

View File

@ -168,10 +168,10 @@ BEGIN
LTEXT "&Mockingboard:",IDC_STATIC,49,39,51,8
CONTROL "Slider1",IDC_MB_VOLUME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_VERT | TBS_BOTH | WS_TABSTOP,59,47,25,60
GROUPBOX "Sound Cards",IDC_STATIC,6,122,197,64
CONTROL "Mockingboards (in slots 4 && 5)",IDC_MB_ENABLE,"Button",BS_AUTORADIOBUTTON,10,136,142,8
CONTROL "Phasor (in slot 4)",IDC_PHASOR_ENABLE,"Button",BS_AUTORADIOBUTTON,10,149,92,10
CONTROL "SAM/DAC (in slot 5)",IDC_SAM_ENABLE,"Button",BS_AUTORADIOBUTTON,10,162,95,10
CONTROL "No sound cards",IDC_SOUNDCARD_DISABLE,"Button",BS_AUTORADIOBUTTON,10,175,78,10
LTEXT "Slot &4:",IDC_STATIC,16,136,84,10
COMBOBOX IDC_SOUNDCARD_SLOT4,45,134,100,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Slot &5:",IDC_STATIC,16,152,82,10
COMBOBOX IDC_SOUNDCARD_SLOT5,45,150,100,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_PROPPAGE_DISK DIALOGEX 0, 0, 210, 240

View File

@ -30,7 +30,6 @@
#define IDR_APPLE2_PLUS_ROM 127
#define IDR_APPLE2E_ROM 128
#define IDR_APPLE2E_ENHANCED_ROM 129
#define IDC_MB_ENABLE 130
#define IDD_TFE_SETTINGS_DIALOG 131
#define IDR_PRINTDRVR_FW 132
#define IDD_PROPPAGE_ADVANCED 132
@ -68,9 +67,8 @@
#define IDC_PASTE_FROM_CLIPBOARD 1023
#define IDC_SPIN_XTRIM 1026
#define IDC_SPIN_YTRIM 1027
#define IDC_PHASOR_ENABLE 1029
#define IDC_SAM_ENABLE 1030
#define IDC_SOUNDCARD_DISABLE 1031
#define IDC_SOUNDCARD_SLOT4 1028
#define IDC_SOUNDCARD_SLOT5 1029
#define IDC_TFE_SETTINGS_ENABLE_T 1032
#define IDC_TFE_SETTINGS_ENABLE 1033
#define IDC_TFE_SETTINGS_INTERFACE_T 1034

View File

@ -40,6 +40,13 @@ const TCHAR CPageSound::m_soundchoices[] = TEXT("Disabled\0")
TEXT("Sound Card\0");
const char CPageSound::m_soundCardChoices[] = "Mockingboard\0"
"Phasor\0"
"SAM\0"
"Empty\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)
{
// Switch from static func to our instance
@ -85,21 +92,25 @@ INT_PTR CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
break;
case IDC_MB_VOLUME:
break;
case IDC_MB_ENABLE:
if (NewSoundcardConfigured(hWnd, wparam, CT_MockingboardC))
InitOptions(hWnd); // re-init
break;
case IDC_PHASOR_ENABLE:
if (NewSoundcardConfigured(hWnd, wparam, CT_Phasor))
InitOptions(hWnd); // re-init
break;
case IDC_SAM_ENABLE:
if (NewSoundcardConfigured(hWnd, wparam, CT_SAM))
InitOptions(hWnd); // re-init
break;
case IDC_SOUNDCARD_DISABLE:
if (NewSoundcardConfigured(hWnd, wparam, CT_Empty))
InitOptions(hWnd); // re-init
case IDC_SOUNDCARD_SLOT4:
case IDC_SOUNDCARD_SLOT5:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
UINT slot = (LOWORD(wparam) == IDC_SOUNDCARD_SLOT4) ? SLOT4 : SLOT5;
DWORD newChoiceItem = (DWORD)SendDlgItemMessage(hWnd, LOWORD(wparam), CB_GETCURSEL, 0, 0);
SS_CARDTYPE newCard = CT_Empty;
switch (newChoiceItem)
{
case SC_MOCKINGBOARD: newCard = CT_MockingboardC; break;
case SC_PHASOR: newCard = CT_Phasor; break;
case SC_SAM: newCard = CT_SAM; break;
case SC_EMPTY: newCard = CT_Empty; break;
default: _ASSERT(0); break;
}
m_PropertySheetHelper.GetConfigNew().m_Slot[slot] = newCard;
}
break;
}
break;
@ -118,18 +129,6 @@ INT_PTR CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0);
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPOS,1, GetCardMgr().GetMockingboardCardMgr().GetVolume());
if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
{
m_NewCardType = CT_SAM;
}
else
{
// Reinit 1st time page is activated (fires before PSN_SETACTIVE)
//m_NewCardType = MB_GetSoundcardType();
m_NewCardType = GetCardMgr().QuerySlot(SLOT4); // FIXME: mimic the old static MB/Phasor behaviour
// NB. This doesn't scale for MB/Phasor in slots other than SLOT4, nor for mixed sound cards (eg. MB/s4+Phasor/s5)
}
InitOptions(hWnd);
break;
@ -160,87 +159,36 @@ void CPageSound::DlgOK(HWND hWnd)
m_PropertySheetHelper.PostMsgAfterClose(hWnd, m_Page);
}
CPageSound::SOUNDCARDCHOICE CPageSound::CardTypeToComboItem(SS_CARDTYPE card)
{
switch (card)
{
case CT_MockingboardC: return SC_MOCKINGBOARD;
case CT_Phasor: return SC_PHASOR;
case CT_SAM: return SC_SAM;
case CT_Empty: return SC_EMPTY;
default: _ASSERT(0); return SC_EMPTY;
}
}
void CPageSound::InitOptions(HWND hWnd)
{
// CheckRadioButton
if(m_NewCardType == CT_MockingboardC)
m_nCurrentIDCheckButton = IDC_MB_ENABLE;
else if(m_NewCardType == CT_Phasor)
m_nCurrentIDCheckButton = IDC_PHASOR_ENABLE;
else if(m_NewCardType == CT_SAM)
m_nCurrentIDCheckButton = IDC_SAM_ENABLE;
const SS_CARDTYPE slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
const SS_CARDTYPE slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
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;
if (isSlot4SoundCard)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT4, m_soundCardChoices, (int)CardTypeToComboItem(slot4));
else
m_nCurrentIDCheckButton = IDC_SOUNDCARD_DISABLE;
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT4, m_soundCardChoice_Unavailable, 0);
CheckRadioButton(hWnd, IDC_MB_ENABLE, IDC_SOUNDCARD_DISABLE, m_nCurrentIDCheckButton);
//
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
const bool bIsSlot4Empty = Slot4 == CT_Empty;
const bool bIsSlot5Empty = Slot5 == CT_Empty;
// Phasor button
{
const BOOL bEnable = bIsSlot4Empty || Slot4 == CT_MockingboardC || Slot4 == CT_Phasor;
EnableWindow(GetDlgItem(hWnd, IDC_PHASOR_ENABLE), bEnable); // Disable Phasor (slot 4)
}
// Mockingboard button
{
const BOOL bEnable = (bIsSlot4Empty || Slot4 == CT_Phasor || Slot4 == CT_MockingboardC) &&
(bIsSlot5Empty || Slot5 == CT_SAM || Slot5 == CT_MockingboardC);
EnableWindow(GetDlgItem(hWnd, IDC_MB_ENABLE), bEnable); // Disable Mockingboard (slot 4 & 5)
}
// SAM button
{
const BOOL bEnable = bIsSlot5Empty || Slot5 == CT_MockingboardC || Slot5 == CT_SAM;
EnableWindow(GetDlgItem(hWnd, IDC_SAM_ENABLE), bEnable); // Disable SAM (slot 5)
}
EnableWindow(GetDlgItem(hWnd, IDC_MB_VOLUME), (m_nCurrentIDCheckButton != IDC_SOUNDCARD_DISABLE) ? TRUE : FALSE);
}
bool CPageSound::NewSoundcardConfigured(HWND hWnd, WPARAM wparam, SS_CARDTYPE NewCardType)
{
if (HIWORD(wparam) != BN_CLICKED)
return false;
if (LOWORD(wparam) == m_nCurrentIDCheckButton)
return false;
m_NewCardType = NewCardType;
const SS_CARDTYPE Slot4 = m_PropertySheetHelper.GetConfigNew().m_Slot[4];
const SS_CARDTYPE Slot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[5];
if (NewCardType == CT_MockingboardC)
{
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_MockingboardC;
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_MockingboardC;
}
else if (NewCardType == CT_Phasor)
{
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Phasor;
if ((Slot5 == CT_MockingboardC) || (Slot5 == CT_SAM))
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Empty;
}
else if (NewCardType == CT_SAM)
{
if ((Slot4 == CT_MockingboardC) || (Slot4 == CT_Phasor))
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Empty;
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_SAM;
}
if (isSlot5SoundCard)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT5, m_soundCardChoices, (int)CardTypeToComboItem(slot5));
else
{
if ((Slot4 == CT_MockingboardC) || (Slot4 == CT_Phasor))
m_PropertySheetHelper.GetConfigNew().m_Slot[4] = CT_Empty;
if ((Slot5 == CT_MockingboardC) || (Slot5 == CT_SAM))
m_PropertySheetHelper.GetConfigNew().m_Slot[5] = CT_Empty;
}
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SOUNDCARD_SLOT5, m_soundCardChoice_Unavailable, 0);
return true;
bool enableMBVolume = slot4 == CT_MockingboardC || slot5 == CT_MockingboardC || slot4 == CT_Phasor || slot5 == CT_Phasor;
EnableWindow(GetDlgItem(hWnd, IDC_MB_VOLUME), enableMBVolume ? TRUE : FALSE);
}

View File

@ -11,9 +11,7 @@ class CPageSound : private IPropertySheetPage
public:
CPageSound(CPropertySheetHelper& PropertySheetHelper) :
m_Page(PG_SOUND),
m_PropertySheetHelper(PropertySheetHelper),
m_NewCardType(CT_Empty),
m_nCurrentIDCheckButton(0)
m_PropertySheetHelper(PropertySheetHelper)
{
CPageSound::ms_this = this;
}
@ -30,8 +28,10 @@ protected:
virtual void DlgCANCEL(HWND hWnd){}
private:
enum SOUNDCARDCHOICE { SC_MOCKINGBOARD = 0, SC_PHASOR, SC_SAM, SC_EMPTY, _SOUNDCARD_MAX_CHOICES, SC_UNAVAILABLE };
void InitOptions(HWND hWnd);
bool NewSoundcardConfigured(HWND hWnd, WPARAM wparam, SS_CARDTYPE NewCardType);
SOUNDCARDCHOICE CardTypeToComboItem(SS_CARDTYPE card);
static CPageSound* ms_this;
@ -41,7 +41,6 @@ private:
static const UINT VOLUME_MIN = 0;
static const UINT VOLUME_MAX = 59;
static const TCHAR m_soundchoices[];
SS_CARDTYPE m_NewCardType;
int m_nCurrentIDCheckButton;
static const char m_soundCardChoices[];
static const char m_soundCardChoice_Unavailable[];
};