Small improvement to sound output options. #6

1. Force 8-bit sound option confused some users who thought it might be an emulation accuracy option instead of selecting output bit depth, replaced it with a drop-down that's consistent with the other sound output options instead (hiding the temptation of setting "8-bit" and thinking that's a desirable thing for an NES emulator).
2. Making the default samplerate 48000, because it is the most common native device rate now.
3. Increasing the AVI output's 1 second buffer size to allow the maximum samplerate of 96000.
This commit is contained in:
Brad Smith 2018-06-02 03:11:33 -04:00 committed by GitHub
parent e90b7e17b7
commit 458eb30f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 21 deletions

View File

@ -86,7 +86,7 @@ static void VRC7SKill(void) {
static void VRC7_ESI(void) {
GameExpSound.RChange = VRC7SC;
GameExpSound.Kill = VRC7SKill;
VRC7Sound = OPLL_new(3579545, FSettings.SndRate ? FSettings.SndRate : 44100);
VRC7Sound = OPLL_new(3579545, FSettings.SndRate ? FSettings.SndRate : 48000);
OPLL_reset(VRC7Sound);
OPLL_reset(VRC7Sound);
}

View File

@ -51,7 +51,7 @@ static struct AVIFile
long tBytes, ByteBuffer;
u8 audio_buffer[44100*2*2]; // ~ 1 second buffer
u8 audio_buffer[96000*2*2]; // ~ 1 second buffer * stereo * 16-bit
int audio_buffer_pos;
} *avi_file = NULL;

View File

@ -132,7 +132,7 @@ int eoptions = EO_BGRUN | EO_FORCEISCALE | EO_BESTFIT | EO_BGCOLOR | EO_SQUAREPI
//global variables
int soundoptions = SO_SECONDARY | SO_GFOCUS;
int soundrate = 44100;
int soundrate = 48000;
int soundbuftime = 50;
int soundquality = 1;

View File

@ -497,9 +497,6 @@ BEGIN
DEFPUSHBUTTON "Close",BTN_CLOSE,280,260,44,14
GROUPBOX "Output/Output Format:",302,10,9,131,93,WS_GROUP
CONTROL "Sound enabled.",CHECK_SOUND_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,22,117,12
CONTROL "Force 8-bit sound.",CHECK_SOUND_8BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,38,117,11
LTEXT "Rate:",65461,17,81,22,10
LTEXT "Hz",65460,108,81,15,9
GROUPBOX "Buffering:",127,150,9,131,93,WS_GROUP
CONTROL "Use Global Focus",124,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,22,100,12
CTEXT "Sound Latency",65459,162,50,107,8
@ -509,9 +506,13 @@ BEGIN
LTEXT "15 ms",65458,160,87,20,8
LTEXT "200 ms",65457,250,87,25,8
LTEXT "ms",65456,211,60,19,8
COMBOBOX COMBO_SOUND_RATE,50,78,53,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX COMBO_SOUND_QUALITY,50,54,67,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Quality:",65455,17,54,27,10
LTEXT "Quality:",65455,17,43,27,10
COMBOBOX COMBO_SOUND_QUALITY,50,40,67,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Rate:",65461,17,64,22,10
COMBOBOX COMBO_SOUND_RATE,50,61,53,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Hz",65460,108,64,15,9
LTEXT "Depth:",65462,17,85,27,10
COMBOBOX COMBO_SOUND_8BIT,50,82,67,45,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Mute frame advance",CHECK_SOUND_MUTEFA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,110,87,11
CONTROL "Mute Turbo",CHECK_SOUND_MUTETURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,111,53,10
GROUPBOX "Triangle",131,70,142,44,93,WS_GROUP

View File

@ -172,7 +172,7 @@
#define IDC_CHECK_LOG_CYCLES_COUNT 120
#define IDC_CHECK_LOG_FRAME_NUMBER3 121
#define IDC_CHECK_LOG_INSTRUCTIONS_COUNT 121
#define CHECK_SOUND_8BIT 122
#define COMBO_SOUND_8BIT 122
#define IDD_DIALOG3 123
#define IDC_CHECK_SYMBOLIC_TRACING 123
#define CHECK_SOUND_GLOBAL_FOCUS 124

View File

@ -394,7 +394,6 @@ static void UpdateSD(HWND hwndDlg)
int t;
CheckDlgButton(hwndDlg,CHECK_SOUND_ENABLED,soundo?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg,CHECK_SOUND_8BIT,(soundoptions&SO_FORCE8BIT)?BST_CHECKED:BST_UNCHECKED);
// The option formerly flagged by SO_SECONDARY can no longer be disabled.
// CheckDlgButton(hwndDlg,123,(soundoptions&SO_SECONDARY)?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg,CHECK_SOUND_GLOBAL_FOCUS,(soundoptions&SO_GFOCUS)?BST_CHECKED:BST_UNCHECKED);
@ -410,15 +409,18 @@ static void UpdateSD(HWND hwndDlg)
else if(soundrate==48000) t=3;
else if(soundrate==96000) t=4;
SendDlgItemMessage(hwndDlg,COMBO_SOUND_RATE,CB_SETCURSEL,t,(LPARAM)(LPSTR)0);
t=0;
if (soundoptions&SO_FORCE8BIT) t=1;
SendDlgItemMessage(hwndDlg,COMBO_SOUND_8BIT,CB_SETCURSEL,t,(LPARAM)(LPSTR)0);
if (!soundo)
{
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_SWAPDUTY),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_MUTETURBO),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_MUTEFA),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_8BIT),FALSE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_QUALITY),FALSE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_RATE),FALSE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_8BIT),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CTL_LATENCY_TRACKBAR),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE),FALSE);
EnableWindow(GetDlgItem(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1),FALSE);
@ -456,9 +458,9 @@ static void UpdateSD(HWND hwndDlg)
{
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_MUTETURBO),TRUE);
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_MUTEFA),TRUE);
EnableWindow(GetDlgItem(hwndDlg,CHECK_SOUND_8BIT),TRUE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_QUALITY),TRUE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_RATE),TRUE);
EnableWindow(GetDlgItem(hwndDlg,COMBO_SOUND_8BIT),TRUE);
EnableWindow(GetDlgItem(hwndDlg,CTL_LATENCY_TRACKBAR),TRUE);
EnableWindow(GetDlgItem(hwndDlg,CTL_VOLUME_TRACKBAR_TRIANGLE),TRUE);
EnableWindow(GetDlgItem(hwndDlg,CTL_VOLUME_TRACKBAR_SQUARE1),TRUE);
@ -555,6 +557,9 @@ case WM_INITDIALOG:
SendDlgItemMessage(hwndDlg,COMBO_SOUND_RATE,CB_ADDSTRING,0,(LPARAM)(LPSTR)"48000");
SendDlgItemMessage(hwndDlg,COMBO_SOUND_RATE,CB_ADDSTRING,0,(LPARAM)(LPSTR)"96000");
SendDlgItemMessage(hwndDlg,COMBO_SOUND_8BIT,CB_ADDSTRING,0,(LPARAM)(LPSTR)"16-Bit");
SendDlgItemMessage(hwndDlg,COMBO_SOUND_8BIT,CB_ADDSTRING,0,(LPARAM)(LPSTR)"8-Bit");
UpdateSD(hwndDlg);
break;
case WM_VSCROLL:
@ -646,20 +651,26 @@ case WM_COMMAND:
if (!turbo) FCEUI_SetSoundQuality(soundquality); //If turbo is running, don't do this call, turbo will handle it instead
UpdateSD(hwndDlg);
break;
case COMBO_SOUND_8BIT:
{
int tmp = SendDlgItemMessage(hwndDlg,COMBO_SOUND_8BIT,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
soundoptions &= ~SO_FORCE8BIT;
if (tmp == 1) soundoptions |= SO_FORCE8BIT;
if(soundo)
{
TrashSoundNow();
soundo=InitSound();
UpdateSD(hwndDlg);
}
}
break;
}
break;
case BN_CLICKED:
switch(LOWORD(wParam))
{
case CHECK_SOUND_8BIT:soundoptions^=SO_FORCE8BIT;
if(soundo)
{
TrashSoundNow();
soundo=InitSound();
UpdateSD(hwndDlg);
}
break;
// The option formerly flagged by SO_SECONDARY can no longer be disabled.
#if 0
case 123:soundoptions^=SO_SECONDARY;