add namespace and default values

This commit is contained in:
2025-06-20 18:27:38 +02:00
parent 9d121865d6
commit c6def58726

View File

@@ -1,8 +1,10 @@
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
namespace trnr {
template <typename t_sample> template <typename t_sample>
class audio_buffer { class audio_buffer {
public: public:
@@ -18,7 +20,7 @@ public:
update_channel_ptrs(); update_channel_ptrs();
} }
audio_buffer(int channels, int frames) audio_buffer(int channels = 1, int frames = 1024)
: m_channels(channels) : m_channels(channels)
, m_frames(frames) , m_frames(frames)
, m_data(channels * frames) , m_data(channels * frames)
@@ -71,7 +73,9 @@ private:
} }
std::vector<t_sample> m_data; std::vector<t_sample> m_data;
std::vector<t_sample*> m_channel_ptrs;
int m_channels; int m_channels;
int m_frames; // samples per channel int m_frames; // samples per channel
std::vector<t_sample*> m_channel_ptrs;
}; };
} // namespace trnr