diff options
| author | John Peterson <jpeterson57@gmail.com> | 2008-10-11 14:35:29 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2008-10-11 14:35:29 +0000 |
| commit | ba88ebaecb340b703bc84617a776df109d3dbd78 (patch) | |
| tree | 32980288dffdb6d2b92de1b35303f065b00cec03 /Source | |
| parent | 316527dd6dc71485495d5efb493f24ff6138b2eb (diff) | |
Made the volume setting not dependent on numSamples. It moves around a lot and depends on how fast the game run and this volume setting should probably not depend on that. I'm still unsure about the right volume steps and if pb.mixer_control has the target volume.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@839 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp | 17 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp | 47 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 2 |
3 files changed, 32 insertions, 34 deletions
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp index cf1ab63037..94b4c24707 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp @@ -388,7 +388,11 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) sfbuff = sfbuff + cbuf;
sfbuff = sfbuff + writeMessage(ii, i);
- sfbuff = sfbuff + "\n";
+
+ // write _iSize
+ strcpy(cbuf, ""); sprintf(cbuf, "%i", _iSize);
+ sfbuff = sfbuff + " | _iSize: " + cbuf + "\n";
+
aprintf(ii, (char *)sfbuff.c_str());
}
// --------------
@@ -535,19 +539,11 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) {
if(vector1.at(i).at(j) == 0)
{
- //strcat(buffer, " ");
sbuff = sbuff + " ";
}
else
{
- //sprintf(buffer, "%s%c", buffer, 177); // this will add strange letters if buffer has
- // not been given any string yet
-
sprintf(buffer, "%c", 177);
- //strcat(buffer, tmpbuff);
-
- //strcpy(buffer, "");
- //sprintf(buffer, "%c", 177);
sbuff = sbuff + buffer; strcpy(buffer, "");
}
}
@@ -602,7 +598,8 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a) // =======================================================================================
// Write global values
// ---------------
- sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i %i\n", m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192);
+ sprintf(buffer, "\nThe parameter blocks span from %08x to %08x | distance %i | num. of blocks %i | _iSize %i\n",
+ m_addressPBs, gLastBlock, (gLastBlock-m_addressPBs), (gLastBlock-m_addressPBs) / 192, _iSize);
sbuff = sbuff + buffer; strcpy(buffer, "");
// ===============
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index 93a3c3073e..c490751c73 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -137,26 +137,25 @@ void ADPCM_Loop(AXParamBlock& pb) u16 ADPCM_Vol(u16 vol, u16 delta, u16 mixer_control)
{
int x = vol;
- if (delta && delta < 0x4000)
- x += delta; // unsure what the right step is
- //x ++;
- //x += 8; //?
- else if (delta && delta > 0x4000)
- //x -= (0x8000 - pb.mixer.unknown); // this didn't work
- x--;
+ if (delta && delta < 0x5000)
+ x += delta * 20 * 8; // unsure what the right step is
+ else if (delta && delta > 0x5000)
+ //x -= (0x10000 - delta); // this is to small, it's often 1
+ x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
+ // did not have time to go to zero before the were closed
// make lower limits
- if (x < 0) x = 0;
- // does this make any sense?
- //if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control;
+ if (x < 0) x = 0;
+ //if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make
+ // any sense?
// make upper limits
- if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // I don't know if this is correct
+ //if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also
+ // has a volume target?
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
return x; // update volume
}
-
// ==============
@@ -308,7 +307,8 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) // =======================================================================================
// Handle no-src streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0
// and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This
- // makes samplePos update in the correct way.
+ // makes samplePos update in the correct way. I'm unsure how we are actually supposed to
+ // detect that this setting. Updates did not fix this automatically.
// ---------------------------------------------------------------------------------------
// Stream settings
// src_type = 2 (most other games have src_type = 0)
@@ -329,8 +329,9 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) // =======================================================================================
// Games that use looping to play non-looping music streams - SSBM has info in all
// pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams
- // like any other looping streams the music works. It seems like pb.mixer_control == 0 may
- // identify these types of blocks.
+ // like any other looping streams the music works. I'm unsure how we are actually supposed to
+ // detect that these kinds of blocks should be looping. It seems like pb.mixer_control == 0 may
+ // identify these types of blocks. Updates did not write any looping values.
// --------------
if(
(pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2)
@@ -344,7 +345,8 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) // =======================================================================================
- // Walk through _iSize
+ // Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to
+ // compensate for that. _iSize can be as low as 100 or as high as 2000 some cases.
for (int s = 0; s < _iSize; s++)
{
int sample = 0;
@@ -405,16 +407,10 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) {
int x = pb.vol_env.cur_volume;
x += pb.vol_env.cur_volume_delta; // I'm not sure about this, can anybody find a game
- // that use this?
+ // that use this? Or how does it work?
if (x < 0) x = 0;
if (x >= 0x7fff) x = 0x7fff;
pb.vol_env.cur_volume = x; // maybe not per sample?? :P
-
- if(gVolume) // allow us to turn this off in the debugger
- {
- pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control);
- pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control);
- }
}
int leftmix = pb.mixer.volume_left >> 5;
@@ -446,6 +442,11 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) } // end of the _iSize loop
// ============
+ if(gVolume) // allow us to turn this off in the debugger
+ {
+ pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control);
+ pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control);
+ }
pb.src.cur_addr_frac = (u16)frac;
pb.audio_addr.cur_addr_hi = samplePos >> 16;
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 6346b0e20f..196eb2afbf 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -129,7 +129,7 @@ void OpenConsole() #if defined (_WIN32)
startConsoleWin(155, 100, "Sound Debugging"); // give room for 100 rows
wprintf("OpenConsole > Console opened\n");
- MoveWindow(GetConsoleHwnd(), 0,450, 1280,500, true); // move window, TODO: make this
+ MoveWindow(GetConsoleHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
// adjustable from the debugging window
#endif
}
|
