-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renderer max_channels | package test mocks (#267)
* refactor * code rev
- Loading branch information
Showing
25 changed files
with
113 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <filesystem> | ||
#include <HyperSonicDrivers/audio/IRenderer.hpp> | ||
#include <HyperSonicDrivers/audio/IMixer.hpp> | ||
#include <HyperSonicDrivers/audio/IAudioStream.hpp> | ||
#include <HyperSonicDrivers/files/WAVFile.hpp> | ||
#include <vector> | ||
#include <memory> | ||
#include <filesystem> | ||
|
||
namespace HyperSonicDrivers::audio::sdl2 | ||
{ | ||
class Renderer : public IRenderer | ||
{ | ||
public: | ||
Renderer(const uint32_t freq, const uint16_t buffer_size); | ||
Renderer(const uint32_t freq, const uint16_t buffer_size, const uint8_t max_channels = 1); | ||
~Renderer() override = default; | ||
|
||
void openOutputFile(const std::filesystem::path& path) override; | ||
void closeOutputFile() noexcept override; | ||
|
||
void renderBuffer(IAudioStream* stream) override; | ||
using IRenderer::renderBuffer; | ||
private: | ||
std::unique_ptr<files::WAVFile> m_out; | ||
std::vector<int16_t> m_buf; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/devices/DeviceMock.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <HyperSonicDrivers/audio/midi/MIDIEvent.hpp> | ||
#include <HyperSonicDrivers/devices/IDevice.hpp> | ||
#include <HyperSonicDrivers/audio/IMixerMock.hpp> | ||
|
||
|
||
namespace HyperSonicDrivers::devices | ||
{ | ||
template<class T> | ||
class DeviceMock : public T | ||
{ | ||
public: | ||
explicit DeviceMock(const std::shared_ptr<audio::IMixer>& mixer) : T(mixer) { | ||
static_assert(std::is_base_of_v<IDevice, T>); | ||
}; | ||
DeviceMock() : T(audio::make_mixer<audio::IMixerMock>()) { | ||
static_assert(std::is_base_of_v<IDevice, T>); | ||
}; | ||
|
||
bool init() noexcept override { return true; }; | ||
bool shutdown() noexcept override { return true; }; | ||
std::optional<uint8_t> getChannelId() const noexcept { return std::nullopt; }; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/devices/SpyDevice.hpp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.