Nebuleon Fumika
927d456306
Merge branch 'master' into 8bitsound
...
Conflicts:
source/nds/entry.cpp
2013-02-08 05:50:22 -05:00
Nebuleon Fumika
d4fcf2697c
Require one audio buffer to be free again. Otherwise, if the 4 buffers get full, it's already game over, and getAudiobuff becomes NULL for about 400 milliseconds, stopping all emulation.
2013-02-08 03:22:27 -05:00
Nebuleon Fumika
4676a520e1
Synchronise fractions of a hertz correctly in the audio output timing code to avoid buffer overruns. Buffer overruns pause the game for about half a second.
2013-02-07 22:27:44 -05:00
Nebuleon Fumika
703d522c4c
Remove remnants of a failed auto-CPU implementation. Changing CPU speeds on-the-fly is just not stable on the DSTwo.
2013-02-07 20:08:44 -05:00
Nebuleon Fumika
5e3426d0d2
Remove 320 KiB of memory allocations in APU emulation that were completely unused but constantly re-zeroed.
...
Frees up 320 KiB for other uses, and saves ~4 milliseconds at emulator startup, when resetting the APU and when loading a new game.
2013-02-06 19:07:39 -05:00
Nebuleon Fumika
3dc6668107
Raise the sound frequency from 22050 Hz to 32000 Hz, which is like the SNES. Use sound interpolation to make it sound even more like the SNES.
2013-02-06 05:59:22 -05:00
Nebuleon Fumika
772e24ae50
Reinstate frame skipping options 0 and 1, but keep the new meaning (>= 2 equivalent skip level) for automatic frame skipping. Remove the automatic CPU frequency option, which was making audio emit 0.25 second of silence every so often.
2013-02-06 03:46:48 -05:00
Nebuleon Fumika
b08a201ea2
Allow all audio buffers to get full again before declaring underflow.
2013-02-06 02:53:53 -05:00
BassAceGold
ea330e8f79
Fix settings not getting loaded with a ROM provided by plugin arguments.
2013-02-06 02:05:03 -05:00
Nebuleon Fumika
8c5f5ba182
Document the auto CPU behavior a bit.
2013-02-06 00:43:21 -05:00
Nebuleon Fumika
9e87a7a2b2
Implement automatic CPU frequency switching, which improves battery life if playing games that don't use all of the MIPS CPU. If all of it is indeed needed, then the game will constantly play at 396 MHz.
2013-02-06 00:34:01 -05:00
Nebuleon Fumika
f2adea7bb2
Force both manual and automatic frameskipping to be at or above 2. Resets the default value for all games which previously had this value configured.
2013-02-05 19:39:09 -05:00
Nebuleon Fumika
3cd1e03278
Change the upper screen updates to be double-buffered. Require that one audio buffer be free (1 out of 4).
2013-02-05 16:05:16 -05:00
Nebuleon Fumika
d1a7bf5eb5
Fully integrate BassAceGold's libraries, finally. The README still states that 1.2 is required to overwrite 0.13's stuff; really, 0.13 is needed only for gcc
. So the sequence goes 0.13's gcc
-> 1.2 -> BassAceGold's libraries -> make libds2a.a
.
...
DMA function names changed to match BassAceGold's.
2013-02-04 23:45:44 -05:00
Nebuleon Fumika
b3a7f8f1fc
Synchronise the controller status more spread out inside a rendered frame:
...
* before rendering a background;
* before rendering sprites;
* while rendering more than 128 samples of audio at once ("Prefer fluid video");
* after every 16 scanlines of CPU execution instead of every 1;
* while waiting for an audio buffer to become available;
* while killing time between frames with fast-forward disabled.
Controller presses and releases are now combined in a DS button bitfield using a shorter 32-bit algorithm. See entry.cpp:NDSSFCAccumulateJoypad and #define ACCUMULATE_JOYPAD in the source.
This is still not suitable for playing platformers frame-perfectly, but it's much better than half a second of latency to press or release a button, and one still needs to press buttons a bit more than just light taps. I'd say 50 milliseconds is the latency now. Platformers requiring more precision can be played with frameskip 0.
DMA does not require double-buffered displaying, so synchronise the controller more often by disabling double-buffered displaying again.
2013-02-03 19:26:34 -05:00
Nebuleon Fumika
1ddc8b53fe
Faking out the sound synchronisation with a buffer of silence wasn't necessary.
2013-02-03 16:17:06 -05:00
Nebuleon Fumika
538718997f
Write back the data cache before using DMA to draw emulated frames.
2013-02-03 15:52:45 -05:00
Nebuleon Fumika
9b75c09a7f
Force waiting for a screen to be transferred (update mode 1) because otherwise the next screen can go into DMA.
...
Use channel 1 instead of channel 5, which must be busy for some reason.
2013-02-03 06:25:12 -05:00
Nebuleon Fumika
461f240655
Fix a name clash between Snes9x's dma.h and the DS2 dma.h by renaming the DS2 dma.h to ds2_dma.h.
...
Add preliminary support for drawing emulated screens with DS2 DMA.
2013-02-03 05:59:48 -05:00
Nebuleon Fumika
02f8184fe0
Make it easier to change the "high" and "low" CPU frequencies, as well as to switch to the user's chosen frequency for the game.
...
Conflicts:
source/nds/ds2_main.c
source/nds/entry.cpp
source/nds/gui.c
2013-02-03 03:20:47 -05:00
Nebuleon Fumika
7aeebe97e7
Fix an oddity in the sound when returning from a global mute. Fixes music loading in Super Mario World.
2013-02-02 02:21:52 -05:00
Nebuleon Fumika
91d7bf5b91
Correct overzealous detection of buffer overruns. It was making the sound crackle constantly, like a record player. Most audible with earphones.
2013-02-02 01:37:16 -05:00
Nebuleon Fumika
d4dd98e8c1
Add an option that controls which element should be more fluid, per game: video or audio.
...
This makes most games playable, but the player can choose to get fluid audio instead of fluid video in sound-test modes or games with epic soundtracks.
2013-02-01 20:09:24 -05:00
Nebuleon Fumika
30fe9eaf6a
While killing time between frames, process audio instead of doing nothing. Also correctly fill the buffer with silence when returning from pause. This reduces or eliminates crackling.
...
The emulator kills time in two circumstances:
* In automatic frameskip mode, without fast forwarding, the emulator kills time if it rendered a frame early.
* In manual frameskip mode, without fast forwarding, the emulator kills time to wait for the next rendered frame.
2013-02-01 18:27:03 -05:00
Nebuleon Fumika
58948ffd1d
Make the audio timing more precise.
...
* Fake out the buffer timing by sending a buffer full of silence when returning from pause. Reduces crackling introduced by the next point.
* Send buffers only once every 23.22 milliseconds, not up to four buffers at once (92.88 milliseconds) and randomly thereafter. Reduces note-length jumpiness.
* Audio may have trouble catching up if external jitter reaches 11.61 milliseconds. That happens if Mode 7 images or filtered modes take a long time to render, or if chips take a long time to execute.
2013-02-01 06:11:59 -05:00
Nebuleon Fumika
58a3dc9b17
Hook fast-forward into Settings.TurboSkipFrames.
2013-02-01 06:10:57 -05:00
Nebuleon Fumika
60f6ffcc70
When starting CATSFC, assume the backlights are both on, so don't delay 100 milliseconds and set both backlights to on.
2013-02-01 00:36:51 -05:00
Nebuleon Fumika
dded216137
Turn off the lower screen's backlight when returning from suspend during emulation.
2013-01-26 20:31:11 -05:00
Nebuleon Fumika
433749b6ef
Merge branch 'master' into 8bitsound
2013-01-23 20:16:46 -05:00
Nebuleon Fumika
2cf733eef4
Add three hotkeys: temporary fast-forward, sound toggle and return to menu. These hotkeys can be overridden per game so that the global version of the hotkey can be ignored.
...
* Language file fixups related to \n (newlines).
* Pictochat fixups: shorten START and SELECT to ST and SEL. Should still be recognisable.
2013-01-22 04:16:15 -05:00
Nebuleon Fumika
7d788578b2
Initial 8-bit sound commit. For the lulz!
2013-01-20 22:26:24 -05:00
Nebuleon Fumika
88135c52f8
Remove unneeded volatility, enabling more optimisations. Sound volatility is #define'd away, GUI volatility is simply removed.
2013-01-19 20:28:17 -05:00
Nebuleon Fumika
2bb2ee8c0a
Prepare code to ask for a hotkey. Prepare a temporary fast-forward switch.
2013-01-19 02:24:37 -05:00
Nebuleon Fumika
76e5f4b571
Return to CPU level 0 after emitting sound if we're delaying for early frames.
2013-01-18 03:36:35 -05:00
Nebuleon Fumika
0d5be16895
Revert "Reinstate timer-interrupt audio."
...
This reverts commit 944d9a7294
.
Conflicts:
source/nds/entry.cpp
2013-01-18 03:33:14 -05:00
Nebuleon Fumika
bf5cb54162
Fix multiple compiler warnings: forward declaration, implicit declaration, unused variable, variable used uninitialised, unused function (when not used anywhere else with a #define).
2013-01-18 02:41:32 -05:00
Nebuleon Fumika
5c4e96b326
Remove some unused functions. Raise the CPU frequency for sound mixing if auto frameskip is delaying because it's early.
2013-01-18 01:50:28 -05:00
Nebuleon Fumika
944d9a7294
Reinstate timer-interrupt audio.
...
This reverts commit 0d048d05ee
.
2013-01-17 18:52:22 -05:00
Nebuleon Fumika
0d048d05ee
Revert timer-interrupt audio, but not optimisations done since then. Get the controller status every scanline again.
2013-01-13 05:00:47 -05:00
Nebuleon Fumika
7cfc6b8bf8
Stop using the deprecated function S9xMixSamplesO and use S9xMixSamples instead.
...
Wrap the offset into the audio buffer less often.
2013-01-12 21:02:30 -05:00
Nebuleon Fumika
99b19abca3
Remove 2 extraneous delays. The 100-millisecond delays before ds2_setBacklight() MUST STAY, however, otherwise the emulator can crash with the bottom backlight off if a touch is recognised twice in a row. That happens with some broken styluses, so it's not unexpected.
2013-01-12 20:35:47 -05:00
Nebuleon Fumika
253902a30d
Fix a buffer overflow in audio handling code that corrupted memory used to carry the state of the GUI.
2013-01-12 20:34:15 -05:00
Nebuleon Fumika
7896e83aa9
Stop constantly testing for 16-bit and stereo in sound handlers. Define FOREVER_16_BIT_SOUND and FOREVER_STEREO and use them throughout the code.
...
This is essentially commit 6b36e79013
, but for sound instead of graphics.
2013-01-11 19:22:59 -05:00
Nebuleon Fumika
0028091d0f
Fix the interrupts glitching sound. Put the sound back at 22050 Hz.
2013-01-11 03:31:03 -05:00
Nebuleon Fumika
3a1708474f
Reinstate some delays needed by the code to avoid crashing, and actually explain in code comments why they're needed.
...
I know ds2_setBacklight(unsigned int) needs a delay before it, otherwise if done too close to another call, it crashes.
This partially reverts commit 8951fdff1a
.
2013-01-11 03:28:59 -05:00
Nebuleon Fumika
03a0d3457b
Attempt to fix the crashing with sound interrupts, part 2: Stop the timer before the menu, and restart it after it ends.
2013-01-09 03:21:44 -05:00
Nebuleon Fumika
8872841ad1
Try fixing a crash in the sound interrupt.
2013-01-08 23:53:31 -05:00
Nebuleon Fumika
4f9bd94497
Configurable interrupt interval for the sound timer. Right now, only 22050 Hz audio at 2000-microsecond intervals works.
2013-01-08 15:08:53 -05:00
Nebuleon Fumika
12c5afbe60
GLORIOUS interrupt-based sound playback. Now, the note-length-hopping problem isn't as apparent anymore, and automatic frame skipping doesn't go to 8 FPS all the time in Super Mario World. Thank the deities!
...
Reverses the auto frameskip synchronisation from commit dac11c74ac
, because that doesn't play well with interrupts.
2013-01-08 03:23:55 -05:00
Nebuleon Fumika
7d57e5aa45
Require auto_equivalent_skip to be greater than 0 before decrementing it if the code is drawing a frame early in automatic frame skip mode. Otherwise, overflow occurs, and we skip 4 billion images.
2013-01-07 20:46:10 -05:00