TASEmulators / desmume

DeSmuME is a Nintendo DS emulator
http://desmume.org
GNU General Public License v2.0
2.9k stars 535 forks source link

Fix OpenAL mic #241

Closed v1993 closed 5 years ago

v1993 commented 5 years ago

I try to complete The Legend of Zelda: Spirit Tracks and have HUGE troubles with flute. It's pretty easy to play usual songs, but not special ones (which should be completed on two instruments), I'm stuck on second locomo song (snow one) now. Flute sound suddenly pauses at middle, without any visible way to control it.

In-game mic test show that mic is always max. I build with OpenAL support, mic init succeeds (according to console). I use ALSA/JACK/PulseAudio stack as sound system (yep, it's complicated), with PulseAudio as OpenAL backend.

Simple OpenAL test program work as assumed, successfuly re-playing audio recorded from mic. Disconnecting JACK input from PulseAudio makes silence in test program (as excepted), but mic is still max in in-game test.

If I use ALSA (no OpenAL option) at build time, mic init fails and I have pretty close results.

Is there any way to overcome these issues? In best case that would mean fixing mic input at all (as I know, there is voice input later in game), but only fixing flute will be ok for now too.

Thanks!

v1993 commented 5 years ago

If it isn't clear, I use linux (Ubuntu 18.10 if it matters a lot) and own build from this repo (last commit at moment of writing this, 589524823bd0d900a4f19b673efb76f48d6c4800).

zeromus commented 5 years ago

You will probably never find anyone interested in fixing this. Since youve chosen such a strange hobby of running strange linux audio stacks, maybe you're the person for the job. If your real hobby is playing games instead of hacking your linux install, I suggest you use wine, the windows desmume port, and the mic hotkey along with the samples which are probably on the wiki

v1993 commented 5 years ago

In fact, all interaction with desmume is done via OpenAL, which is cross-platform (does mic work with OpenAL on win/mac?) and not depend on audio stack (it still only use PulseAudio, and test program works perfectly).

This audio stack is weird, I know. I use it because I sometimes just love to play with music, which require JACK/ALSA, but PulseAudio is still required by most apps and good for everyday usage (easy mixing, bluetooth, etc.).

Real question is, are you using OpenAL mic input right? Can it work on clean Ubuntu/Win/Mac? If yes, I'll probably try to look at this issue myself.

P.S.: as you see, my hobby is both playing games and doing some expirements with music, which sometimes may involve hacking linux install a bit.

zeromus commented 5 years ago

mic input in desmume is always flaky. The mic samples feature is better, which I dont think is supported by the linux ports. They do support the microphone noise feature (if compiled with FAKE_MIC) which is also better than the mic input.

Just to clarify--even if your audio stack and openAL are working 100% perfectly, mic input may not work in desmume--it's just that bad.

The mac/win ports dont use openAL

v1993 commented 5 years ago

I've tried enabling FAKE_MIC option manually, but it leads to linkage error.

v1993 commented 5 years ago

Also, OpenAL can be used for all platforms, at least it seems very good choise for mac (and linux too).

zeromus commented 5 years ago

Well, THAT sounds like something for you to fix And: no thanks. The mic input works just fine in mac and windows (at least as well as it ever works in desmume). There's no need for openAL

v1993 commented 5 years ago

It will make it possible to use same code for all platforms, but ok.

Also, there is no legal way to enable fake mic on compilation step, I did that via changing ./configure script.

rogerman commented 5 years ago

For the record, I would NEVER give up CoreAudio's features on Mac in favor of using OpenAL, which is inferior to CoreAudio in every possible way. Latency, audio format compatibility, you name it -- CoreAudio is superior.

Because of this, the Mac version's hardware mic implementation does work in DeSmuME (almost) perfectly, just as long as the frame rate is close to a constant 60 FPS. For example, Nintendogs ONLY works on the Mac version and no other.

As for the fake mic implementation, the Mac version is virtually perfect. You can even assign separate hotkeys for different fake mic sources if you want. I would suggest that if mic support is truly that important for you, then use Mac DeSmuME.

v1993 commented 5 years ago

Well, any suggestions on how to run Mac version on linux?

Or, to be realistic, is it possible do download git windows build for WINE? If this will not solve problems, it still worth a shot.

rogerman commented 5 years ago

@v1993: Your best bet would probably be running an older macOS version, like v10.9 Mavericks, on a virtual machine like VirtualBox.

v1993 commented 5 years ago

Well, I'll probably try this if WINE will not help me. Again, is there any git windows build which can be downloaded and used? Windows users write that they managed to mostly solve mic issues in this game.

P.S.: are .ds file compatible between platform (JIT and all that stuff…), i.e. can I keep my progress between systems?

rogerman commented 5 years ago

You can find our Official Nightly Builds from here: http://desmume.org/download/ You can find the most bleeding edge Nightly Builds from here: https://ci.appveyor.com/project/zeromus/desmume

All DeSmuME files are perfectly cross-compatible between all platforms. The only exception is cross-compatibility between big-endian systems and little-endian systems. If you don't know what I mean by this "endianness" stuff, then don't worry about it -- you can just trust that your DeSmuME files will be cross-compatible.

v1993 commented 5 years ago

@rogerman Ok, thanks! I'll try them.

P.S.: are there still big endian widely used desktops today? I can't remember ones…

rogerman commented 5 years ago

@v1993: AFAIK, there are no widely-used desktop PCs that use big-endian.

However, DeSmuME is intended to be compatible with all hardware, and "all hardware" includes big-endian systems. AFAIK, the following big-endian systems already have DeSmuME ports that can run on them:

Of course, if someone has the will, it is also possible to port DeSmuME to consoles such as the PS3 or Xbox 360, where both systems use PowerPC CPUs. AFAIK, no other NDS emulator can run on big-endian systems.

v1993 commented 5 years ago

Seems that in WINE mic is working pretty ok. Thanks! I also have better framerate and more options are available, so, well, windows version under WINE is better than linux one at almost everything!

But there is still pretty big lag in live mic input. Are there any optins which can fix it and make it smaller? I currently use my own record as input (it's easy with JACK) to get constant sound.

v1993 commented 5 years ago

Also, .ds file loaded succesfully, but one of screens was completely black, and going to other room didn't fixed it. However, resetting game and loading from ordinary save (in-game one) fixed things.

v1993 commented 5 years ago

Is it closed in preference of https://github.com/TASVideos/desmume/issues/209?