mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-04-19 03:17:24 -05:00
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
44 lines
964 B
C++
Executable File
44 lines
964 B
C++
Executable File
#ifndef __AUDIO_HPP
|
|
#define __AUDIO_HPP
|
|
|
|
#include <SFML/Audio.hpp>
|
|
#include <queue>
|
|
#include "audio_data.hpp"
|
|
#include "utils.hpp"
|
|
|
|
struct Sample {
|
|
Sample(std::int16_t *bytes, std::size_t size, double time) : bytes(bytes), size(size), time(time) {}
|
|
|
|
std::int16_t *bytes;
|
|
std::size_t size;
|
|
double time;
|
|
};
|
|
|
|
class Audio : public sf::SoundStream {
|
|
public:
|
|
volatile bool restart = false;
|
|
std::queue<Sample> samples;
|
|
ConsumerMutex samples_wait;
|
|
|
|
Audio(AudioData *audio_data);
|
|
~Audio();
|
|
void update_volume();
|
|
void start_audio();
|
|
void stop_audio();
|
|
bool hasTooMuchTimeElapsed();
|
|
|
|
private:
|
|
AudioData *audio_data;
|
|
int final_volume = -1;
|
|
volatile bool inside_onGetData = false;
|
|
volatile bool terminate = false;
|
|
int num_consecutive_fast_seek;
|
|
std::int16_t *buffer;
|
|
std::chrono::time_point<std::chrono::high_resolution_clock> clock_time_start;
|
|
|
|
bool onGetData(sf::SoundStream::Chunk &data) override;
|
|
void onSeek(sf::Time timeOffset) override;
|
|
};
|
|
|
|
#endif
|