-
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.
Refactor build script for Linux and MacOS in CI workflow
- Loading branch information
Showing
8 changed files
with
96 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
#pragma once | ||
|
||
#define SDL_MAIN_HANDLED | ||
#include <SDL.h> | ||
|
||
#include <atomic> | ||
#include <cstdint> | ||
#include <vector> | ||
#include <mutex> | ||
|
||
class AudioCapture { | ||
public: | ||
AudioCapture(int buffer_duration_ms); | ||
~AudioCapture(); | ||
AudioCapture(int buffer_duration_ms); | ||
~AudioCapture(); | ||
|
||
bool initialize(int device_index, int sample_rate); | ||
bool startCapture(); | ||
bool stopCapture(); | ||
bool resetBuffer(); | ||
bool initialize(int device_index, int sample_rate); | ||
bool startCapture(); | ||
bool stopCapture(); | ||
bool resetBuffer(); | ||
|
||
void processAudio(uint8_t* stream, int length); | ||
void getAudioData(int duration_ms, std::vector<float>& output); | ||
void processAudio(uint8_t *stream, int length); | ||
void getAudioData(int duration_ms, std::vector<float> &output); | ||
|
||
private: | ||
SDL_AudioDeviceID device_id = 0; | ||
int buffer_duration_ms = 0; | ||
int sample_rate = 0; | ||
std::atomic_bool is_capturing; | ||
std::mutex buffer_mutex; | ||
std::vector<float> audio_buffer; | ||
size_t write_position = 0; | ||
size_t buffer_size = 0; | ||
SDL_AudioDeviceID device_id = 0; | ||
int buffer_duration_ms = 0; | ||
int sample_rate = 0; | ||
std::atomic_bool is_capturing; | ||
std::mutex buffer_mutex; | ||
std::vector<float> audio_buffer; | ||
size_t write_position = 0; | ||
size_t buffer_size = 0; | ||
}; | ||
|
||
bool handleSDLEvents(); |
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
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