Hello everyone, it feels really weird to be participating in an old style forum again. It's been a while.
Anyway, I'm trying to make an NSF player for my Mega Man engine, and I want to avoid native dll dependencies, so I figured I'll use an all-.net emulator. I found some old project called MyNes and adapted it. I scoured the wiki page on NSF playback and followed all the steps as best as I could. I now have some music playing, but it's... off. The pitches are correct, but it runs a bit too fast, and it sounds choppy and grainy, like someone is playing with the volume slider. The noise channel also sometimes sounds out of sync.
I'm running the emulation on a second thread, because the audio library is polling based, rather than me pushing samples to it, so I can't block the thread. I tried running the emulation during the poll method but that made everything worse, especially adding a lot of lag. I've dug through the source for as many other emulators and nsf players as I could find, but they're mostly too complex to glean any useful information, and I'm very bad at C++.
1. What's the recommended way to control the playback speed? I know what the rate should be, but I can't get it nailed down. If I don't do anything, it runs at about 100-120 FPS. If I add a thread sleep, it's too slow. An empty while loop with a timer also gives inconsistent results.
2. My audio out is set to 44100 rate, 8 bit, 1 channel. Is that all correct?
3. I know I may have to provide code samples, current audio output, or both. Until then, what caveats might I have missed? I saw something about 16x sampling of the noise channel in another post, but I don't know what that means. Might the emulation itself be faulty? Or does the fact that I'm getting recognizable music out mean that the problem is something else?
4. Is multithreading the way to go or should I try the other approach again, where I step the frames when the audio library asks for more buffer?
5. More than one other player had some logic where it only starts a new frame when the cpu's PC reads 0xffff. Mine doesn't do that - it goes to 0 instead. Is that ok or does it mean my cpu implementation is busted?
Thanks everyone.
Anyway, I'm trying to make an NSF player for my Mega Man engine, and I want to avoid native dll dependencies, so I figured I'll use an all-.net emulator. I found some old project called MyNes and adapted it. I scoured the wiki page on NSF playback and followed all the steps as best as I could. I now have some music playing, but it's... off. The pitches are correct, but it runs a bit too fast, and it sounds choppy and grainy, like someone is playing with the volume slider. The noise channel also sometimes sounds out of sync.
I'm running the emulation on a second thread, because the audio library is polling based, rather than me pushing samples to it, so I can't block the thread. I tried running the emulation during the poll method but that made everything worse, especially adding a lot of lag. I've dug through the source for as many other emulators and nsf players as I could find, but they're mostly too complex to glean any useful information, and I'm very bad at C++.
1. What's the recommended way to control the playback speed? I know what the rate should be, but I can't get it nailed down. If I don't do anything, it runs at about 100-120 FPS. If I add a thread sleep, it's too slow. An empty while loop with a timer also gives inconsistent results.
2. My audio out is set to 44100 rate, 8 bit, 1 channel. Is that all correct?
3. I know I may have to provide code samples, current audio output, or both. Until then, what caveats might I have missed? I saw something about 16x sampling of the noise channel in another post, but I don't know what that means. Might the emulation itself be faulty? Or does the fact that I'm getting recognizable music out mean that the problem is something else?
4. Is multithreading the way to go or should I try the other approach again, where I step the frames when the audio library asks for more buffer?
5. More than one other player had some logic where it only starts a new frame when the cpu's PC reads 0xffff. Mine doesn't do that - it goes to 0 instead. Is that ok or does it mean my cpu implementation is busted?
Thanks everyone.
Statistics: Posted by tesserex — Mon Feb 19, 2024 4:00 pm — Replies 4 — Views 220