notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2daa7c1
)
spu: support master volume
author
notaz
<notasas@gmail.com>
Sun, 4 Sep 2022 23:03:24 +0000
(
02:03
+0300)
committer
notaz
<notasas@gmail.com>
Sun, 4 Sep 2022 23:30:46 +0000
(
02:30
+0300)
plugins/dfsound/externals.h
patch
|
blob
|
blame
|
history
plugins/dfsound/freeze.c
patch
|
blob
|
blame
|
history
plugins/dfsound/registers.c
patch
|
blob
|
blame
|
history
plugins/dfsound/spu.c
patch
|
blob
|
blame
|
history
diff --git
a/plugins/dfsound/externals.h
b/plugins/dfsound/externals.h
index
5cd269e
..
3dea188
100644
(file)
--- a/
plugins/dfsound/externals.h
+++ b/
plugins/dfsound/externals.h
@@
-235,7
+235,9
@@
typedef struct
unsigned short regArea[0x400];
\r
} SPUInfo;
\r
\r
unsigned short regArea[0x400];
\r
} SPUInfo;
\r
\r
-#define regAreaGet(ch,offset) \
\r
+#define regAreaGet(offset) \
\r
+ spu.regArea[((offset) - 0xc00)>>1]
\r
+#define regAreaGetCh(ch, offset) \
\r
spu.regArea[((ch<<4)|(offset))>>1]
\r
\r
///////////////////////////////////////////////////////////
\r
spu.regArea[((ch<<4)|(offset))>>1]
\r
\r
///////////////////////////////////////////////////////////
\r
diff --git
a/plugins/dfsound/freeze.c
b/plugins/dfsound/freeze.c
index
a9843ae
..
4866df8
100644
(file)
--- a/
plugins/dfsound/freeze.c
+++ b/
plugins/dfsound/freeze.c
@@
-145,7
+145,7
@@
static void save_channel(SPUCHAN_orig *d, const SPUCHAN *s, int ch)
d->spos = s->spos;
\r
d->sinc = s->sinc;
\r
memcpy(d->SB, spu.SB + ch * SB_SIZE, sizeof(d->SB[0]) * SB_SIZE);
\r
d->spos = s->spos;
\r
d->sinc = s->sinc;
\r
memcpy(d->SB, spu.SB + ch * SB_SIZE, sizeof(d->SB[0]) * SB_SIZE);
\r
- d->iStart = (regAreaGet
(ch,6)&~1)<<
3;
\r
+ d->iStart = (regAreaGet
Ch(ch, 6) & ~1) <<
3;
\r
d->iCurr = 0; // set by the caller
\r
d->iLoop = 0; // set by the caller
\r
d->bOn = !!(spu.dwChannelsAudible & (1<<ch));
\r
d->iCurr = 0; // set by the caller
\r
d->iLoop = 0; // set by the caller
\r
d->bOn = !!(spu.dwChannelsAudible & (1<<ch));
\r
diff --git
a/plugins/dfsound/registers.c
b/plugins/dfsound/registers.c
index
eba4015
..
6b62247
100644
(file)
--- a/
plugins/dfsound/registers.c
+++ b/
plugins/dfsound/registers.c
@@
-350,7
+350,7
@@
static void SoundOn(int start,int end,unsigned short val)
\r
for(ch=start;ch<end;ch++,val>>=1) // loop channels
\r
{
\r
\r
for(ch=start;ch<end;ch++,val>>=1) // loop channels
\r
{
\r
- if((val&1) && regAreaGet
(ch,6))
// mmm... start has to be set before key on !?!
\r
+ if((val&1) && regAreaGet
Ch(ch, 6))
// mmm... start has to be set before key on !?!
\r
{
\r
spu.s_chan[ch].bIgnoreLoop = 0;
\r
spu.dwNewChannel|=(1<<ch);
\r
{
\r
spu.s_chan[ch].bIgnoreLoop = 0;
\r
spu.dwNewChannel|=(1<<ch);
\r
diff --git
a/plugins/dfsound/spu.c
b/plugins/dfsound/spu.c
index
e629ddb
..
ebc5446
100644
(file)
--- a/
plugins/dfsound/spu.c
+++ b/
plugins/dfsound/spu.c
@@
-247,7
+247,7
@@
static void StartSoundMain(int ch)
s_chan->iSBPos=27;
s_chan->spos=0;
s_chan->iSBPos=27;
s_chan->spos=0;
- s_chan->pCurr = spu.spuMemC
+((regAreaGet(ch,6)&~1)<<
3);
+ s_chan->pCurr = spu.spuMemC
+ ((regAreaGetCh(ch, 6) & ~1) <<
3);
spu.dwNewChannel&=~(1<<ch); // clear new channel bit
spu.dwChannelDead&=~(1<<ch);
spu.dwNewChannel&=~(1<<ch); // clear new channel bit
spu.dwChannelDead&=~(1<<ch);
@@
-1175,7
+1175,8
@@
void do_samples(unsigned int cycles_to, int do_direct)
static void do_samples_finish(int *SSumLR, int ns_to,
int silentch, int decode_pos)
{
static void do_samples_finish(int *SSumLR, int ns_to,
int silentch, int decode_pos)
{
- int volmult = spu_config.iVolume;
+ int vol_l = ((int)regAreaGet(H_SPUmvolL) << 17) >> 17;
+ int vol_r = ((int)regAreaGet(H_SPUmvolR) << 17) >> 17;
int ns;
int d;
int ns;
int d;
@@
-1192,23
+1193,28
@@
static void do_samples_finish(int *SSumLR, int ns_to,
}
MixXA(SSumLR, ns_to, decode_pos);
}
MixXA(SSumLR, ns_to, decode_pos);
-
- if((spu.spuCtrl&0x4000)==0) // muted? (rare, don't optimize for this)
+
+ vol_l = vol_l * spu_config.iVolume >> 10;
+ vol_r = vol_r * spu_config.iVolume >> 10;
+
+ if (!(spu.spuCtrl & 0x4000) || !(vol_l | vol_r))
{
{
+ // muted? (rare)
memset(spu.pS, 0, ns_to * 2 * sizeof(spu.pS[0]));
memset(spu.pS, 0, ns_to * 2 * sizeof(spu.pS[0]));
+ memset(SSumLR, 0, ns_to * 2 * sizeof(SSumLR[0]));
spu.pS += ns_to * 2;
}
else
for (ns = 0; ns < ns_to * 2; )
{
d = SSumLR[ns]; SSumLR[ns] = 0;
spu.pS += ns_to * 2;
}
else
for (ns = 0; ns < ns_to * 2; )
{
d = SSumLR[ns]; SSumLR[ns] = 0;
- d = d * vol
mult >> 10
;
+ d = d * vol
_l >> 15
;
ssat32_to_16(d);
*spu.pS++ = d;
ns++;
d = SSumLR[ns]; SSumLR[ns] = 0;
ssat32_to_16(d);
*spu.pS++ = d;
ns++;
d = SSumLR[ns]; SSumLR[ns] = 0;
- d = d * vol
mult >> 10
;
+ d = d * vol
_r >> 15
;
ssat32_to_16(d);
*spu.pS++ = d;
ns++;
ssat32_to_16(d);
*spu.pS++ = d;
ns++;