Dolphin, the GameCube and Wii emulator - Forums

Full Version: [Patch] dspHLE Mario galaxy 1 music
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
I would start looking from this line.

The word "loop" appears way too often in the comments of that file.
it's probably just referring to how dsp code is in annoyingly pipelined loops :p
no wonder it gets dizzy after a while Undecided
Modifications have been made to that code without any improvement and I believe that mostly affects Windwaker, Twilight Princess and Mario Galaxy aren't really affected by that code. If someone could do some actual debugging, then someone else can handle the rest. Just knowing what chunk or line of code is causing the issue would narrow it down enough that anyone semi-knowledgeable with coding could implement a quick fix or hack until something more permanent and accurate is found

It's the AFC code that should be debugged, once we can find where the music is bugging out then maybe a hack or something can be temporarily implemented. I've noticed improvements when I've tinkered with the AFC code and the following code:

Quote:int CUCode_Zelda::ConvertRatio(int pb_ratio)
{
float _ratioFactor = 32000.0f / (float)soundStream->GetMixer()->GetSampleRate();
u32 _ratio = (pb_ratio << 16);
return (u64)((_ratio * _ratioFactor) * 16) >> 16;
}

int CUCode_Zelda::SizeForResampling(ZeldaVoicePB &PB, int size, int ratio) {
// This is the little calculation at the start of every sample decoder
// in the ucode.
return (PB.CurSampleFrac + size * ConvertRatio(PB.RatioInt)) >> 16;
}

The AFC code and the code above is what should be debugged, while playing the game to find out what is happening and what code is causing the music to bug out. I don't know how to debug else I would do this, sometimes I hate how n00bish I am with my lack of understanding coding. Sad
I've got the motivation, and some time. Always helps getting warmly accepted into the community ;-)

I might even learn something from this experience Smile

edit: i will try to debug this, after building dolphin, and maybe a fastdebug

edit2: probably be awhile lol, alot of downloading to do in order to compile 64bit in win7 64x, especially with Visual C++ 2008 Express Edition.

exactly what part of the code was edited in order to extend the amount of time the music looped?

Code:
return (PB.CurSampleFrac + size * ConvertRatio(PB.RatioInt)) >> 16;
?

Some Troubleshooting ingame;

The music keeps playing until one of the tracks end, at which point it cannot loop. If the music is changed (by entering a pipe in a level or going into The Terrace etc) before that track ends, the music keeps playing, until a track reaches its end, at which point all background music ceases and will not work again until Dolphin is restarted. (Perhaps some sort of DSP-HLE soft reset could be issued once track ends, so instead of looping it, it starts all over?) I'm just thinking aloud.

Line 183 in the UCode_Zelda_Voice.cpp
Code:
PB.ResamplerOldData[i] = 0;  // Doesn't belong here, but dunno where to do it.
maybe its interfering with the loop. It's right in the middle of if needs reset, update sample counters and pb.reached end.. seems kind of ominous. though im no expert. this particular line of code is repeated 3 times in the cpp

I would like try removing or commenting out;

Code:
PB.YN1 = PB.LoopYN2;
                        PB.YN2 = PB.LoopYN1;

But im still Downloading Win7 64bit SDK through web installer.. taking forever.

... Let the downloader run overnight still no progress, tried to cancel it, that took forever as well.. ended up forcing the win7 64bit sdk setup to close... might be a firewall problem.
I'll try to find a direct download later today
I think I should point to my old work again: http://pastie.org/1311060
Thats part of RenderVoice_Raw and Decoder21_ReadAudio, ripped out from the numerous changes I got in there. Decoder21_ReadAudio should be a pretty accurate reverse of the DSP Ucode, RenderVoice_Raw might need a few tweaks still (and I hope removing my AFC stuff from the patch didn't break it).

IIRC, it did affect the Wind Waker intro to play just fine, but it only worked when running completely at 100%. Not sure if that part of the changes caused it, or whether some other changes are responsible, but for now I get hangs (code waiting for audio to stop looping) when trying to get to the menu screen after the intro music started playing. My sources are a bit too messy to isolate the problem, and time is always an issue here...
Thanks, I will try playing around with that code and note anything here.

Regarding the AFC code, any idea what line or lines of code cause the music to bug out?
@Jack Frost, the downside right now to removing the PB.StopOnSilence hack is that Windwaker will hang on a black screen for 30 seconds to a minute when loading a save game depending on the area the game was saved in. Is there any way to eliminate the PB.StopOnSilence hack without the game hanging?

And yeah, there is still some crackling so something is still wrong somewhere.
The whole AFC code is a single bug, depending on how you look at it (in particular, its a copy of PCM with some hacks to make-it-work­™) - or just plain wrong if you like.

StopOnSilence shouldn't be in there, but I haven't looked at it in more detail other than reversing whats in the UCode. Maybe we're not handling certain things that should actually cause the loop to break otherwise, like certain mails etc. That would be something one could check out using the LLE plugin and the HandleMail funcs in the HLE plugin/the related UCode file.
BTW, Epic Mickey also has its music cut out after a while (why always the games with the most beautiful soundtrack? -_- ); however, I don't think it's the same issue since it seems the music starts playing again if you enter and exit the Home menu.
Tired of trying to figure this out lol:

Code:
if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0))
                        PB.KeyOff = 1;
            PB.RemLength = 0;
            PB.CurAddr = PB.StartAddr + PB.RestartPos + PB.Length;
            
            while (sampleCount < _RealSize)
                _Buffer[sampleCount++] = 0;
            return;

Quote:if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0))

Without the bolded part "PB.StopOnSilence" in the AFC loop, it kills sound effects and eventually completely kills audio altogether. >_<
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18