2012-03-23 10:43:39 +00:00
|
|
|
struct APU : Thread {
|
2015-12-05 05:44:49 +00:00
|
|
|
APU();
|
2011-09-12 10:30:44 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
static auto Main() -> void;
|
|
|
|
auto main() -> void;
|
|
|
|
auto tick() -> void;
|
|
|
|
auto set_irq_line() -> void;
|
|
|
|
auto set_sample(int16 sample) -> void;
|
2011-09-12 10:30:44 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto power() -> void;
|
|
|
|
auto reset() -> void;
|
2011-09-12 10:30:44 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto read(uint16 addr) -> uint8;
|
|
|
|
auto write(uint16 addr, uint8 data) -> void;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
2011-09-15 12:33:26 +00:00
|
|
|
|
2011-09-26 11:38:57 +00:00
|
|
|
struct Filter {
|
2015-12-05 05:44:49 +00:00
|
|
|
auto run_hipass_strong(int sample) -> int;
|
|
|
|
auto run_hipass_weak(int sample) -> int;
|
|
|
|
auto run_lopass(int sample) -> int;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
|
|
|
enum : int { HiPassStrong = 225574, HiPassWeak = 57593, LoPass = 86322413 };
|
2011-09-26 11:38:57 +00:00
|
|
|
|
|
|
|
int64 hipass_strong;
|
|
|
|
int64 hipass_weak;
|
|
|
|
int64 lopass;
|
2015-12-05 05:44:49 +00:00
|
|
|
};
|
2011-09-26 11:38:57 +00:00
|
|
|
|
Update to v082r33 release.
byuu says:
Added MMC2, MMC4, VRC4, VRC7 (no audio.)
Split NES audio code up into individual modules.
Fixed libsnes to compile: Themaister, can you please test to make sure
it works? I don't have a libsnes client on my work PC to test it.
Added about / license information to bottom of advanced settings screen
for now (better than nothing, I guess.)
Blocked PPU reads/writes while rendering for now, easier than coming up
with a bus address locking thing :/
I can't seem to fix MMC5 graphics during the intro to Uchuu Keibitai.
Without that, trying to implement vertical-split screen mode doesn't
make sense.
So as far as special audio chips go ...
* VRC6 is completed
* Sunsoft 5B has everything the only game to use it uses, but there are
more unused channels I'd like to support anyway (they aren't
documented, though.)
* MMC5 audio unsupported for now
* VRC7 audio unsupported, probably for a long time (hardest audio driver
of all. More complex than core NES APU.)
* audio PCM games (Moero Pro Yakyuu!) I probably won't ever support
(they require external WAV packs.)
2011-10-12 12:03:58 +00:00
|
|
|
#include "envelope.hpp"
|
|
|
|
#include "sweep.hpp"
|
|
|
|
#include "pulse.hpp"
|
|
|
|
#include "triangle.hpp"
|
|
|
|
#include "noise.hpp"
|
|
|
|
#include "dmc.hpp"
|
2011-09-15 12:33:26 +00:00
|
|
|
|
|
|
|
struct FrameCounter {
|
2015-12-05 05:44:49 +00:00
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
|
|
|
enum : uint { NtscPeriod = 14915 }; //~(21.477MHz / 6 / 240hz)
|
2011-09-16 11:44:07 +00:00
|
|
|
|
|
|
|
bool irq_pending;
|
|
|
|
|
2011-09-15 12:33:26 +00:00
|
|
|
uint2 mode;
|
|
|
|
uint2 counter;
|
2015-12-05 05:44:49 +00:00
|
|
|
int divider;
|
|
|
|
};
|
2011-09-23 11:13:57 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
auto clock_frame_counter() -> void;
|
|
|
|
auto clock_frame_counter_divider() -> void;
|
2011-09-15 12:33:26 +00:00
|
|
|
|
2015-12-05 05:44:49 +00:00
|
|
|
Filter filter;
|
|
|
|
FrameCounter frame;
|
2011-09-15 12:33:26 +00:00
|
|
|
|
|
|
|
uint8 enabled_channels;
|
2011-09-26 11:27:06 +00:00
|
|
|
int16 cartridge_sample;
|
2011-09-15 12:33:26 +00:00
|
|
|
|
Update to v082r33 release.
byuu says:
Added MMC2, MMC4, VRC4, VRC7 (no audio.)
Split NES audio code up into individual modules.
Fixed libsnes to compile: Themaister, can you please test to make sure
it works? I don't have a libsnes client on my work PC to test it.
Added about / license information to bottom of advanced settings screen
for now (better than nothing, I guess.)
Blocked PPU reads/writes while rendering for now, easier than coming up
with a bus address locking thing :/
I can't seem to fix MMC5 graphics during the intro to Uchuu Keibitai.
Without that, trying to implement vertical-split screen mode doesn't
make sense.
So as far as special audio chips go ...
* VRC6 is completed
* Sunsoft 5B has everything the only game to use it uses, but there are
more unused channels I'd like to support anyway (they aren't
documented, though.)
* MMC5 audio unsupported for now
* VRC7 audio unsupported, probably for a long time (hardest audio driver
of all. More complex than core NES APU.)
* audio PCM games (Moero Pro Yakyuu!) I probably won't ever support
(they require external WAV packs.)
2011-10-12 12:03:58 +00:00
|
|
|
int16 pulse_dac[32];
|
2011-09-15 12:33:26 +00:00
|
|
|
int16 dmc_triangle_noise_dac[128][16][16];
|
|
|
|
|
|
|
|
static const uint8 length_counter_table[32];
|
|
|
|
static const uint16 ntsc_dmc_period_table[16];
|
|
|
|
static const uint16 pal_dmc_period_table[16];
|
2011-09-15 12:41:49 +00:00
|
|
|
static const uint16 ntsc_noise_period_table[16];
|
|
|
|
static const uint16 pal_noise_period_table[16];
|
2011-09-12 10:30:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern APU apu;
|