This commit is contained in:
AnonymusRaccoon
2020-01-31 10:53:20 +01:00
4 changed files with 20 additions and 3 deletions
+3
View File
@@ -45,6 +45,9 @@ add_executable(unit_tests
target_link_libraries(unit_tests criterion -lgcov)
target_compile_options(unit_tests PUBLIC -fprofile-arcs -ftest-coverage)
#include SFML
add_link_options(-lsfml-graphics -lsfml-window -lsfml-audio -lsfml-network -lsfml-system)
# make app
add_executable(ComSquare
main.cpp
+2 -2
View File
@@ -106,9 +106,9 @@ namespace ComSquare::APU
class APU : public Memory::IMemory {
private:
//! @brief All the registers of the APU CPU
Registers _registers;
Registers _registers{};
//! @brief Internal registers of the CPU (accessible from the bus via addr $4200 to $421F).
InternalRegisters _internalRegisters;
InternalRegisters _internalRegisters{};
//! @brief The DSP component used to produce sound
std::shared_ptr<DSP::DSP> _dsp;
+7 -1
View File
@@ -8,7 +8,13 @@
namespace ComSquare::APU::DSP
{
DSP::DSP()
{ }
{
for (auto & _channel : this->_channels) {
_channel.setBuffer(this->_soundBuffer);
_channel.setLoop(true);
_channel.play();
}
}
uint8_t DSP::read(uint24_t addr)
{
+8
View File
@@ -6,6 +6,7 @@
#define COMSQUARE_DSP_HPP
#include <cstdint>
#include <SFML/Audio.hpp>
#include "../Memory/IMemory.hpp"
namespace ComSquare::APU::DSP
@@ -155,7 +156,14 @@ namespace ComSquare::APU::DSP
class DSP : public Memory::IMemory {
private:
//! @brief All registers of the DSP
Registers _registers{};
//! @brief 8x channels of sample used to make sound
sf::Sound _channels[8];
//! @brief A buffer containing current wave
sf::SoundBuffer _soundBuffer;
public:
explicit DSP();