Adding renderer to APU to play the samples generated

This commit is contained in:
Melefo
2021-02-02 15:46:30 +01:00
parent 0ee4575512
commit 694ea7f9d4
15 changed files with 517 additions and 376 deletions
+9
View File
@@ -36,6 +36,11 @@ namespace ComSquare::Renderer
sf::Sprite _sprite;
//! @brief The texture to render the array of pixels
sf::Texture _texture;
//! @brief The buffer containing samples to be played
sf::SoundBuffer _soundBuffer;
//! @brief the sound played
sf::Sound _sound;
public:
//! @brief Tells to the program if the window has been closed, and therefore if he should stop
bool shouldExit = false;
@@ -49,6 +54,10 @@ namespace ComSquare::Renderer
//! @param Y vertical index.
//! @param rgba The color of the pixel.
void putPixel(unsigned y, unsigned x, uint32_t rgba) override;
//! @brief Playing all samples from buffer
//! @param samples Buffer containing samples
//! @param sampleCount number of samples inside buffer
void playAudio(int16_t *samples, uint64_t sampleCount) override;
//! @brief Get the inputs from the Window
void getEvents();
//! @brief Use this function to create the window.