2017-06-08 14:05:48 +00:00
|
|
|
auto APU::FIFO::sample() -> void {
|
|
|
|
output = active;
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::read() -> void {
|
2012-04-09 06:19:32 +00:00
|
|
|
if(size == 0) return;
|
|
|
|
size--;
|
2017-06-08 14:05:48 +00:00
|
|
|
active = samples[rdoffset++];
|
2012-04-09 06:19:32 +00:00
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::write(int8 byte) -> void {
|
2015-08-02 06:23:13 +00:00
|
|
|
if(size == 32) rdoffset++;
|
|
|
|
else size++;
|
2017-06-08 14:05:48 +00:00
|
|
|
samples[wroffset++] = byte;
|
2012-04-09 06:19:32 +00:00
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::reset() -> void {
|
2017-06-08 14:05:48 +00:00
|
|
|
for(auto& byte : samples) byte = 0;
|
|
|
|
active = 0;
|
2012-04-09 06:19:32 +00:00
|
|
|
output = 0;
|
|
|
|
|
|
|
|
rdoffset = 0;
|
|
|
|
wroffset = 0;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
|
2015-11-16 08:38:05 +00:00
|
|
|
auto APU::FIFO::power() -> void {
|
2012-04-09 06:19:32 +00:00
|
|
|
reset();
|
|
|
|
|
|
|
|
lenable = 0;
|
|
|
|
renable = 0;
|
|
|
|
timer = 0;
|
|
|
|
}
|