Chilly Willy wrote: ↑Thu May 11, 2023 8:35 pm
If the release flags have -O1 for hardware files, that's probably what you want for real hardware. Not sure why you'd use something different for debug...
As to noise in the sound, that could be due to many issues:
Filling/playing the wrong buffer. If you look at my code, I tend to fill the first buffer with silence, then call the dma done callback function to simulate the dma being done on the previous buffer. That will start the callback function playing the filled buffer, then calling the sound update callback to fill the next buffer. If you have the wrong buffers being played vs filled, you're racing the sound by writing into the buffer that is being played rather than the one PREVIOUSLY filled and ready to play.
Filling too much/little of the buffer, or playing too much/little of the buffer. Either case winds up with noise due to missing samples.
Mixing samples incorrectly. Many different errors could be here. Maybe mixing too many samples... or too few... or looping incorrectly... or adding the sample to an old buffer without clearing it first... or mixing from the wrong place... or mixing in the wrong format...
Hey chilly! Thanks for the reply! I'm eyeballs deep trouble shooting this SFX issue. I sent you a private message with a link to the repo. If you have a moment (but zero pressure) i'd greatly appreciate more eyes on what i might be doing wrong here. Vic started looking at it as well. From the surface, it looks like the code seems fine but it maybe within the function S_StartSoundReal within marssound.c. Within there i'm not using any of the WAD functionality (due to my ignorance with it tbh) and simply assigning md_data to my wave files that are from the cart. I'm using a simple switch statement to determine which one I assign. We suspect that it "could" be there due to when Vic took one of my sample wave files and tried it in the D32xr code....the wave file played just fine (in Fusion...he hadn't tried realhardware, but from the sound of the wave file he suspected that it would).
Here's the crazy thing, as stated earlier. My waves work just fine within Fusion 3.64 (c) that i'm using currently. Well, i shouldn't say (just fine) if you listen closely there is a difference in the sound of them being played in the demo game vs just playing them on say windows media player. So, perhaps there's still something going on even with the emulator playing of the sound but somehow its just enough to play something?
As per Vic's request for me to test a certain area in the code to determine if my wave file is even being identified properly within the S_StartSoundReal function, I can testify it does through some print statements I put in that function (all done locally not checked into the repo).
Lastly, Vic mentioned that perhaps i should consider using WAD to solve this, going back to my ignorance, i thought WAD was only for DOOM and even if I knew anything about WAD file system I couldn't use it do to copyright (but Vic cleared that up with me saying that it is something i can use). So perhaps thats the answer but two issues with that i see:
1) I don't know where to start with WAD. I'm guessing there is some .c files that I can use that's part of D32xr? But then how do i compress my .wav files into a WAD format? And then how do i point my code to read from that? So many questions there.
2) The fact that md_data assignment to my wave file gets me through the S_StartSoundReal properly identified, makes me wonder if that shouldn't work and that my problem is somewhere else. perhaps like what you said earlier chilly, perhaps its "how/when" i'm calling the S_StartSound(NULL, sound); function throught my game?
EDIT: So this is crazy. Works one way on the emulator and another on realhardware according to my display messages
when ran in Fusion it can identify that it's a wave file and all its properties just fine and lands right in the PCM if statement of the S_StartSoundReal function. but when ran on real hardware it never passes the if (length == 0x52494646) { // RIFF
Any ideas?