win32: fix sound view to show volumes with datashift builtin optionally, and other misc cleanups

This commit is contained in:
zeromus 2009-06-26 22:32:49 +00:00
parent d3ccd7e968
commit 8a099f51be
6 changed files with 1761 additions and 1757 deletions

View File

@ -52,18 +52,6 @@ int SPU_currentCoreNum = SNDCORE_DUMMY;
static SoundInterface_struct *SNDCore=NULL;
extern SoundInterface_struct *SNDCoreList[];
#define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1
static FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
static FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
}
//const int shift = (FORMAT == 0 ? 2 : 1);
static const int format_shift[] = { 2, 1, 3, 0 };

View File

@ -24,12 +24,24 @@
#define SPU_H
#include "types.h"
#include "matrix.h"
#include <iosfwd>
#include <string>
#include <assert.h>
#define SNDCORE_DEFAULT -1
#define SNDCORE_DUMMY 0
#define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1
static FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
static FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
}
enum SPUInterpolationMode
{
SPUInterpolation_None = 0,

View File

@ -252,12 +252,14 @@
#define IDC_GI_GAMETITLE 1003
#define IDC_MFRAMES 1003
#define IDC_ROTATE0 1003
#define IDC_BUTTON2 1003
#define IDC_ARM9BIOSBROWSE 1004
#define IDC_EDIT11 1004
#define IDC_GI_GAMECODE 1004
#define IDC_MRERECORDCOUNT 1004
#define IDC_ROTATE90 1004
#define IDC_SPU_INTERPOLATION_CB 1004
#define IDC_BUTTON_VOLMODE 1004
#define IDC_ARM7BIOS 1005
#define IDC_EDIT07 1005
#define IDC_MROM 1005
@ -733,7 +735,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40008
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

View File

@ -39,13 +39,16 @@ using namespace std;
typedef struct SoundView_DataStruct
{
SoundView_DataStruct() : viewFirst8Channels(TRUE)
SoundView_DataStruct()
: viewFirst8Channels(TRUE)
, volModeAlternate(FALSE)
{
}
HWND hDlg;
BOOL viewFirst8Channels;
BOOL volModeAlternate;
} SoundView_DataStruct;
SoundView_DataStruct * SoundView_Data = NULL;
@ -107,14 +110,6 @@ HWND SoundView_GetHWnd()
return SoundView_Data ? SoundView_Data->hDlg : NULL;
}
#define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1
static u32 sputrunc(float f) { return u32floor(f); }
static u32 sputrunc(double d) { return u32floor(d); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
}
void SoundView_Refresh()
{
if(SoundView_Data == NULL || SPU_core == NULL)
@ -132,10 +127,14 @@ void SoundView_Refresh()
SendDlgItemMessage(hDlg, IDC_SOUND0PANBAR+chanId, PBM_SETPOS, (WPARAM)spumuldiv7(128, thischan.pan), (LPARAM)0);
if(thischan.status != CHANSTAT_STOPPED)
{
s32 vol = spumuldiv7(128, thischan.vol) >> thischan.datashift;
SendDlgItemMessage(hDlg, IDC_SOUND0VOLBAR+chanId, PBM_SETPOS,
(WPARAM)(spumuldiv7(128, thischan.vol) >> thischan.datashift), (LPARAM)0);
(WPARAM)vol, (LPARAM)0);
sprintf(buf, "%d/%d", thischan.vol, 1 << thischan.datashift);
if(SoundView_Data->volModeAlternate)
sprintf(buf, "%d/%d", thischan.vol, 1 << thischan.datashift);
else
sprintf(buf, "%d", vol);
SetDlgItemText(hDlg, IDC_SOUND0VOL+chanId, buf);
if (thischan.pan == 0)
@ -267,6 +266,9 @@ BOOL CALLBACK SoundView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case IDCANCEL:
SoundView_DlgClose();
return 1;
case IDC_BUTTON_VOLMODE:
data->volModeAlternate = IsDlgButtonChecked(hDlg, IDC_BUTTON_VOLMODE);
return 1;
case IDC_SOUNDVIEW_CHANSWITCH:
{