27 lines
784 B
C++
27 lines
784 B
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <mutex>
|
|
#include <vector>
|
|
#include "extern.h"
|
|
|
|
class CORE_API audio_buffer {
|
|
public:
|
|
sample_t** get_headers() { return headers_.data(); }
|
|
const std::vector<sample_t*>& get_headers_vector() { return headers_; }
|
|
|
|
[[nodiscard]] uint32_t get_num_channels() const { return buffer_.size(); }
|
|
[[nodiscard]] uint32_t get_num_samples() const { return buffer_[0].size(); }
|
|
|
|
void resize(uint32_t channel_num, uint32_t block_size);
|
|
|
|
void clear();
|
|
void mix(audio_buffer& in_buffer, float percent = 1.f);
|
|
void multiple(float percent);
|
|
|
|
[[nodiscard]] std::vector<sample_t> get_interleaved_buffer();
|
|
private:
|
|
std::vector<std::vector<sample_t>> buffer_;
|
|
std::vector<sample_t*> headers_{};
|
|
std::mutex lock_{};
|
|
};
|