fix graph compression

This commit is contained in:
2026-04-09 18:02:38 +03:00
parent 377b7913bb
commit 03fbd2bbb5
27 changed files with 325 additions and 222 deletions

View File

@@ -53,5 +53,3 @@ deps = [
subdir('src') subdir('src')
subdir('bin') subdir('bin')
#############################################################

View File

@@ -21,9 +21,9 @@ headers = [
'monitor/utils/var.hpp', 'monitor/utils/var.hpp',
'monitor/utils/func.hpp', 'monitor/utils/func.hpp',
'monitor/utils/plugin.hpp', 'monitor/utils/plugin.hpp',
'monitor/utils/plugins/raw_data.hpp', 'monitor/utils/plugins/raw_data/raw_data.hpp',
'monitor/utils/plugins/magnitude.hpp', 'monitor/utils/plugins/magnitude/magnitude.hpp',
'monitor/utils/plugins/fft.hpp', 'monitor/utils/plugins/fft/fft.hpp',
############ LIBS ############ LIBS
'monitor/libs/audio/audio.hpp', 'monitor/libs/audio/audio.hpp',
@@ -99,6 +99,9 @@ sources = [
############ UTILS ############ UTILS
'monitor/libs/audio/audio.cpp', 'monitor/libs/audio/audio.cpp',
'monitor/libs/gtkfd/gtkfd.cpp', 'monitor/libs/gtkfd/gtkfd.cpp',
'monitor/utils/plugins/raw_data/raw_data.cpp',
'monitor/utils/plugins/magnitude/magnitude.cpp',
'monitor/utils/plugins/fft/fft.cpp',
] ]
lib = library( lib = library(

View File

@@ -4,6 +4,7 @@
#include <harmonica.hpp> #include <harmonica.hpp>
#include "monitor/libs/audio/audio.hpp" #include "monitor/libs/audio/audio.hpp"
#include "monitor/utils/var.hpp" #include "monitor/utils/var.hpp"
#include "monitor/utils/setup.hpp"
namespace monitor::components namespace monitor::components
{ {
@@ -19,13 +20,13 @@ namespace monitor::components
{ {
std::string m_id; std::string m_id;
sf::Time m_current_time; sf::Time m_current_time;
hr::setup m_setup; utils::setup m_setup;
} m_current_audio; } m_current_audio;
std::map<std::string, music> m_audio_data; std::map<std::string, music> m_audio_data;
// это меняющеесе значение в зависимости от плагина, а не
// как может показаться от аудио файла
std::size_t m_compression;
std::vector<std::string> m_domains = { "time", "frequensy"}; std::vector<std::string> m_domains = { "time", "frequensy"};
@@ -38,7 +39,7 @@ namespace monitor::components
void set_pos(double pos); void set_pos(double pos);
private: private:
void init(std::string snapshot_id, hr::setup& setup); void init(std::string snapshot_id, utils::setup& setup);
void change(std::string snapshot_id); void change(std::string snapshot_id);
void callback(sf::Time time); void callback(sf::Time time);
}; };

View File

@@ -31,7 +31,7 @@ namespace monitor::components
m_player.pause(); m_player.pause();
} }
void audio::init(std::string snapshot_id, hr::setup& setup) void audio::init(std::string snapshot_id, utils::setup& setup)
{ {
m_player.stop(); m_player.stop();
m_audio_data[snapshot_id] = music{ .m_id = snapshot_id, .m_current_time = sf::Time(), .m_setup = setup }; m_audio_data[snapshot_id] = music{ .m_id = snapshot_id, .m_current_time = sf::Time(), .m_setup = setup };
@@ -45,19 +45,23 @@ namespace monitor::components
m_current_audio = m_audio_data[snapshot_id]; m_current_audio = m_audio_data[snapshot_id];
m_player.set_file(m_current_audio.m_setup.m_file); m_player.set_file(m_current_audio.m_setup.m_file);
m_player.set_audio_pos(m_current_audio.m_current_time); m_player.set_audio_pos(m_current_audio.m_current_time);
callback(m_current_audio.m_current_time);
} }
void audio::callback(sf::Time time) void audio::callback(sf::Time time)
{ {
m_current_audio.m_current_time = time; m_current_audio.m_current_time = time;
double seconds = time.asSeconds(); double seconds = time.asSeconds();
double current_sample_index = seconds * m_current_audio.m_setup.m_sample_rate / m_compression; double current_sample_index = seconds * m_current_audio.m_setup.m_sample_rate / m_current_audio.m_setup.m_graph_compression;
// send to:: components/markers // send to:: components/markers
VE::event e { utils::event_type::INCREMENT_MARKER_AUDIO_POSITION, current_sample_index }; VE::event e { utils::event_type::SET_MARKER_AUDIO_POSITION, current_sample_index };
EMIT(e); EMIT(e);
} }
// HERE // HERE
// делать нужно, но надо разобраться зачем? // делать нужно, но надо разобраться зачем?
void audio::drop() void audio::drop()

View File

@@ -1,4 +1,3 @@
#include <harmonica.hpp>
#include "monitor/gui/components/audio/audio.hpp" #include "monitor/gui/components/audio/audio.hpp"
#include "monitor/utils/event_type.hpp" #include "monitor/utils/event_type.hpp"
@@ -29,7 +28,7 @@ namespace monitor::components
{ {
case utils::event_type::INIT_AUDIO: case utils::event_type::INIT_AUDIO:
{ {
auto [snapshot_id, setup] = std::any_cast<std::pair<std::string, hr::setup>>(e.m_data); auto [snapshot_id, setup] = std::any_cast<std::pair<std::string, utils::setup>>(e.m_data);
init(snapshot_id, setup); init(snapshot_id, setup);
break; break;
} }
@@ -47,14 +46,6 @@ namespace monitor::components
break; break;
} }
case utils::event_type::SET_COMPRESSION:
{
auto c = std::any_cast<std::size_t>(e.m_data);
m_compression = c;
hack::log()(m_compression);
break;
}
case utils::event_type::SET_AUDIO_POSITION: case utils::event_type::SET_AUDIO_POSITION:
{ {
auto d = std::any_cast<double>(e.m_data); auto d = std::any_cast<double>(e.m_data);

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <VE.hpp> #include <VE.hpp>
#include "monitor/utils/setup.hpp"
#include "monitor/gui/components/graph/graph.hpp" #include "monitor/gui/components/graph/graph.hpp"
#include "monitor/gui/components/fft_scaled/fft_scaled.hpp" #include "monitor/gui/components/fft_scaled/fft_scaled.hpp"
@@ -24,11 +25,11 @@ namespace monitor::components
fft_scaled m_fft_scaled; fft_scaled m_fft_scaled;
private: private:
hr::setup m_setup; utils::setup m_setup;
std::vector<std::shared_ptr<utils::plugin>> m_base_plugins; std::vector<std::shared_ptr<utils::plugin>> m_base_plugins;
public: public:
void init(std::string snapshot_id, hr::setup setup); void init(std::string snapshot_id, utils::setup setup);
private: private:
void calculate_plugin(std::shared_ptr<utils::plugin> plugin); void calculate_plugin(std::shared_ptr<utils::plugin> plugin);

View File

@@ -1,6 +1,6 @@
#include "monitor/gui/components/base_plugins/base_plugins.hpp" #include "monitor/gui/components/base_plugins/base_plugins.hpp"
#include "monitor/utils/plugins/raw_data.hpp" #include "monitor/utils/plugins/raw_data/raw_data.hpp"
#include "monitor/utils/plugins/magnitude.hpp" #include "monitor/utils/plugins/magnitude/magnitude.hpp"
#include "monitor/utils/event_type.hpp" #include "monitor/utils/event_type.hpp"
namespace monitor::components namespace monitor::components
@@ -12,8 +12,8 @@ namespace monitor::components
m_graph.on_attach(); m_graph.on_attach();
m_fft_scaled.on_attach(); m_fft_scaled.on_attach();
m_base_plugins.push_back(std::make_shared<utils::plugin>(utils::plugins::raw_data{})); m_base_plugins.push_back(std::make_shared<utils::plugins::raw_data>());
m_base_plugins.push_back(std::make_shared<utils::plugin>(utils::plugins::magnitude{})); m_base_plugins.push_back(std::make_shared<utils::plugins::magnitude>());
m_size.x = VE::application::get()->get_glfw()->width() - VE::application::get()->get_glfw()->width() / 4.f; m_size.x = VE::application::get()->get_glfw()->width() - VE::application::get()->get_glfw()->width() / 4.f;
m_size.y = VE::application::get()->get_glfw()->height() / 2.f; m_size.y = VE::application::get()->get_glfw()->height() / 2.f;
@@ -32,7 +32,7 @@ namespace monitor::components
m_fft_scaled.update(); m_fft_scaled.update();
} }
void base_plugins::init(std::string snapshot_id, hr::setup setup) void base_plugins::init(std::string snapshot_id, utils::setup setup)
{ {
m_snapshot_id = snapshot_id; m_snapshot_id = snapshot_id;
m_setup = setup; m_setup = setup;
@@ -45,7 +45,7 @@ namespace monitor::components
// m_fft_scaled.init(m_snapshot_id, m_setup); // m_fft_scaled.init(m_snapshot_id, m_setup);
// send to: components/audio // send to: components/audio
VE::event e { utils::event_type::INIT_AUDIO, std::pair<std::string, hr::setup>(m_snapshot_id, m_setup) }; VE::event e { utils::event_type::INIT_AUDIO, std::pair<std::string, utils::setup>(m_snapshot_id, m_setup) };
EMIT(e); EMIT(e);
} }
@@ -77,10 +77,7 @@ namespace monitor::components
std::size_t compression = 1; std::size_t compression = 1;
if (plugin->m_compression) if (plugin->m_compression)
compression = plugin->m_compression_step; compression = plugin->m_compression_step;
m_setup.m_graph_compression = compression;
// send to: components/audio
VE::event e { utils::event_type::SET_COMPRESSION, compression };
EMIT(e);
} }
else else
{ {

View File

@@ -5,6 +5,7 @@
#include "monitor/gui/components/spinner/spinner.hpp" #include "monitor/gui/components/spinner/spinner.hpp"
#include "monitor/gui/components/file_dialog/file_dialog.hpp" #include "monitor/gui/components/file_dialog/file_dialog.hpp"
#include "monitor/utils/var.hpp" #include "monitor/utils/var.hpp"
#include "monitor/utils/setup.hpp"
namespace monitor::components namespace monitor::components
{ {
@@ -18,7 +19,7 @@ namespace monitor::components
components::spinner m_spinner; components::spinner m_spinner;
private: private:
hr::setup m_setup; utils::setup m_setup;
file_dialog m_fd; file_dialog m_fd;
std::filesystem::path m_file_path; std::filesystem::path m_file_path;

View File

@@ -2,7 +2,7 @@
#include <VE.hpp> #include <VE.hpp>
#include <harmonica.hpp> #include <harmonica.hpp>
#include "monitor/utils/plugins/fft.hpp" #include "monitor/utils/plugins/fft/fft.hpp"
namespace monitor::components namespace monitor::components
{ {

View File

@@ -34,13 +34,6 @@ namespace monitor::components
auto type = std::any_cast<utils::event_type>(e.m_type); auto type = std::any_cast<utils::event_type>(e.m_type);
switch (type) switch (type)
{ {
case utils::event_type::INCREMENT_MARKER_AUDIO_POSITION:
{
auto p = std::any_cast<double>(e.m_data);
m_marker_audio_position = p;
break;
}
case utils::event_type::SET_MARKER_AUDIO_POSITION: case utils::event_type::SET_MARKER_AUDIO_POSITION:
{ {
auto pos = std::any_cast<double>(e.m_data); auto pos = std::any_cast<double>(e.m_data);

View File

@@ -26,7 +26,7 @@ namespace monitor::components
m_status = s; m_status = s;
} }
void snapshot::init(hr::setup setup) void snapshot::init(utils::setup setup)
{ {
m_snapshot_id = hack::security::generate_uuid(); m_snapshot_id = hack::security::generate_uuid();
m_setup = setup; m_setup = setup;

View File

@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <VE.hpp> #include <VE.hpp>
#include <harmonica.hpp>
#include "monitor/utils/var.hpp" #include "monitor/utils/var.hpp"
#include "monitor/utils/setup.hpp"
#include "monitor/gui/components/base_plugins/base_plugins.hpp" #include "monitor/gui/components/base_plugins/base_plugins.hpp"
#include "monitor/gui/components/base_controls/base_controls.hpp" #include "monitor/gui/components/base_controls/base_controls.hpp"
@@ -20,7 +20,7 @@ namespace monitor::components
public: public:
std::string m_snapshot_id; std::string m_snapshot_id;
utils::var::STATUS m_status; utils::var::STATUS m_status;
hr::setup m_setup; utils::setup m_setup;
private: private:
ImVec2 m_size = { 0.f, 0.f }; ImVec2 m_size = { 0.f, 0.f };
@@ -49,6 +49,6 @@ namespace monitor::components
public: public:
void set_status(utils::var::STATUS s); void set_status(utils::var::STATUS s);
void init(hr::setup setup); void init(utils::setup setup);
}; };
} }

View File

@@ -22,7 +22,7 @@ namespace monitor::components
for (auto & s : m_snapshots) s->update(); for (auto & s : m_snapshots) s->update();
} }
void tabs::create_snapshot(hr::setup setup) void tabs::create_snapshot(utils::setup setup)
{ {
auto s = std::make_shared<snapshot>(); auto s = std::make_shared<snapshot>();
s->on_attach(); s->on_attach();

View File

@@ -13,7 +13,7 @@ namespace monitor::components
{ {
case utils::event_type::CREATE_SNAPSHOT: case utils::event_type::CREATE_SNAPSHOT:
{ {
auto data = std::any_cast<hr::setup>(e.m_data); auto data = std::any_cast<utils::setup>(e.m_data);
create_snapshot(data); create_snapshot(data);
break; break;
} }

View File

@@ -3,6 +3,7 @@
#include <VE.hpp> #include <VE.hpp>
#include <harmonica.hpp> #include <harmonica.hpp>
#include "monitor/gui/components/snapshot/snapshot.hpp" #include "monitor/gui/components/snapshot/snapshot.hpp"
#include "monitor/utils/setup.hpp"
namespace monitor::components namespace monitor::components
{ {
@@ -18,7 +19,7 @@ namespace monitor::components
std::size_t m_current_open_index = 0; std::size_t m_current_open_index = 0;
private: private:
void create_snapshot(hr::setup setup); void create_snapshot(utils::setup setup);
void change_tab(std::size_t i); void change_tab(std::size_t i);
}; };
} }

View File

@@ -10,7 +10,7 @@ namespace monitor::utils
STATUS_COMPLETED, STATUS_COMPLETED,
INIT_AUDIO, INIT_AUDIO,
CHANGE_AUDIO, CHANGE_AUDIO,
SET_COMPRESSION, SET_MARKER_AUDIO_POSITION,
/// делать /// делать
@@ -18,8 +18,6 @@ namespace monitor::utils
AUDIO_PAUSE, AUDIO_PAUSE,
AUDIO_STOP, AUDIO_STOP,
INCREMENT_MARKER_AUDIO_POSITION,
SET_MARKER_AUDIO_POSITION,
SET_MARKER_MOUSE_POSITION SET_MARKER_MOUSE_POSITION
}; };
} }

View File

@@ -51,76 +51,8 @@ namespace monitor::utils
public: public:
virtual bool empty() { return m_result.empty(); } virtual bool empty() { return m_result.empty(); }
virtual void init() = 0;
// HERE virtual void fill() = 0;
// начинаем тут virtual void set_ox(std::size_t start_pos = 0) = 0;
// перенести это все в папаки с плагинами т.е. код должен быть у каждого плагина
// т.к. m_compression_step у fft и у RAW_DATA работает по разному и это нужно учитывать
virtual void init()
{
try
{
m_compression = m_result.m_size > m_size;
if (!m_compression) m_size = m_result.m_size;
m_line_count = m_result.m_data.size();
m_line_data.reserve(m_line_count);
for (std::size_t i = 0; i < m_line_count; ++i) m_line_data.push_back(hr::fvec_t(m_size, 0.f));
fill_ox();
}
catch(std::exception& e)
{
hack::error()(e.what());
}
}
virtual void fill_ox(std::size_t start_pos = 0)
{
m_ox.reserve(m_size);
for (std::size_t i = start_pos; i < m_size + start_pos; ++i) m_ox.push_back(i);
}
virtual void fill()
{
if (m_compression)
{
m_compression_step = m_result.m_size / m_size;
std::size_t line_count = 0;
for (auto& gd : m_line_data)
{
std::size_t bin_index = 0;
for (auto& g : gd)
{
float tmp_e = 0.f;
for (std::size_t j = bin_index - m_compression_step; j < bin_index; ++j)
{
auto e = m_result.m_data[line_count][j].m_value;
tmp_e = hack::math::max_abs(e, tmp_e);
}
g = tmp_e;
bin_index += m_compression_step;
if (bin_index > m_result.m_size) bin_index = m_result.m_size;
}
m_size = bin_index / m_compression_step;
++line_count;
}
}
else
{
std::size_t line_count = 0;
for (auto el : m_result.m_data)
{
std::size_t bin_index = 0;
for (auto e : el)
{
m_line_data[line_count][bin_index] = e.m_value;
++bin_index;
}
++line_count;
}
}
}
}; };
} }

View File

@@ -1,63 +0,0 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct fft : public plugin
{
fft()
{
m_type = plugin::TYPE::FFT;
m_display_name = "FFT";
}
virtual void init()
{
try
{
// тут просто берем из первой линии, первые данные, т.к это fft см. реализацию самого плагина в harmonica
auto raw_size = m_result.m_data[0][0].m_values.size();
if (raw_size == 0) throw std::invalid_argument("Error set data in plugin: empty data");
// m_is_scale = raw_size > var::MAX_RENDER_SIZE;
// m_size = std::min(raw_size, var::MAX_RENDER_SIZE);
m_line_count = m_result.m_data.size();
m_line_data.reserve(m_line_count);
m_ox.reserve(m_result.m_grad.size());
for (std::size_t i = 0; i < m_line_count; ++i) m_line_data.push_back(hr::fvec_t(m_size, 0.f));
fill_ox();
}
catch(std::exception& e)
{
hack::error()(e.what());
}
}
virtual void fill_ox(std::size_t start_pos = 0)
{
for (auto x : m_result.m_grad) m_ox.push_back(x);
}
// этот метод запускается один раз при первом рендеринге
// для заполнения начальными данными
virtual void fill()
{
if (m_compression) hack::error()("Данных больше чем можем отрисовать на экране, см. что-то с масштабированием...");
std::size_t line_count = 0;
for (auto el : m_result.m_data)
{
std::size_t index = 0;
for (auto e : el)
{
m_line_data[line_count][index] = e.m_value;
++index;
}
++line_count;
}
}
};
}

View File

@@ -0,0 +1,56 @@
#include "fft.hpp"
namespace monitor::utils::plugins
{
fft::fft()
{
m_type = plugin::TYPE::FFT;
m_display_name = "FFT";
}
void fft::init()
{
try
{
// тут просто берем из первой линии, первые данные, т.к это fft см. реализацию самого плагина в harmonica
auto raw_size = m_result.m_data[0][0].m_values.size();
if (raw_size == 0) throw std::invalid_argument("Error set data in plugin: empty data");
// m_is_scale = raw_size > var::MAX_RENDER_SIZE;
// m_size = std::min(raw_size, var::MAX_RENDER_SIZE);
m_line_count = m_result.m_data.size();
m_line_data.reserve(m_line_count);
m_ox.reserve(m_result.m_grad.size());
for (std::size_t i = 0; i < m_line_count; ++i) m_line_data.push_back(hr::fvec_t(m_size, 0.f));
set_ox();
}
catch(std::exception& e)
{
hack::error()(e.what());
}
}
void fft::set_ox(std::size_t start_pos)
{
for (auto x : m_result.m_grad) m_ox.push_back(x);
}
void fft::fill()
{
if (m_compression) hack::error()("Данных больше чем можем отрисовать на экране, см. что-то с масштабированием...");
std::size_t line_count = 0;
for (auto el : m_result.m_data)
{
std::size_t index = 0;
for (auto e : el)
{
m_line_data[line_count][index] = e.m_value;
++index;
}
++line_count;
}
}
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct fft : public plugin
{
fft();
~fft() = default;
void init() override;
void set_ox(std::size_t start_pos = 0) override;
void fill() override;
};
}

View File

@@ -1,17 +0,0 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct magnitude : public plugin
{
magnitude()
{
m_type = plugin::TYPE::MAGNITUDE;
m_display_name = "Magnitude";
}
};
}

View File

@@ -0,0 +1,79 @@
#include "magnitude.hpp"
namespace monitor::utils::plugins
{
magnitude::magnitude()
{
m_type = plugin::TYPE::MAGNITUDE;
m_display_name = "Magnitude";
}
void magnitude::init()
{
try
{
m_compression = m_result.m_size > m_size;
if (!m_compression) m_size = m_result.m_size;
m_line_count = m_result.m_data.size();
m_line_data.reserve(m_line_count);
for (std::size_t i = 0; i < m_line_count; ++i) m_line_data.push_back(hr::fvec_t(m_size, 0.f));
set_ox();
}
catch(std::exception& e)
{
hack::error()(e.what());
}
}
void magnitude::fill()
{
if (m_compression)
{
m_compression_step = m_result.m_size / m_size;
std::size_t line_count = 0;
for (auto& gd : m_line_data)
{
std::size_t bin_index = 0;
for (auto& g : gd)
{
float tmp_e = 0.f;
for (std::size_t j = bin_index - m_compression_step; j < bin_index; ++j)
{
auto e = m_result.m_data[line_count][j].m_value;
tmp_e = hack::math::max_abs(e, tmp_e);
}
g = tmp_e;
bin_index += m_compression_step;
if (bin_index > m_result.m_size) bin_index = m_result.m_size;
}
m_size = bin_index / m_compression_step;
++line_count;
}
}
else
{
std::size_t line_count = 0;
for (auto el : m_result.m_data)
{
std::size_t bin_index = 0;
for (auto e : el)
{
m_line_data[line_count][bin_index] = e.m_value;
++bin_index;
}
++line_count;
}
}
}
void magnitude::set_ox(std::size_t start_pos)
{
m_ox.reserve(m_size);
for (std::size_t i = start_pos; i < m_size + start_pos; ++i) m_ox.push_back(i);
}
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct magnitude : public plugin
{
magnitude();
~magnitude() = default;
void init() override;
void fill() override;
void set_ox(std::size_t start_pos = 0) override;
};
}

View File

@@ -1,17 +0,0 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct raw_data : public plugin
{
raw_data()
{
m_type = plugin::TYPE::RAW_DATA;
m_display_name = "Raw Data";
}
};
}

View File

@@ -0,0 +1,77 @@
#include "raw_data.hpp"
namespace monitor::utils::plugins
{
raw_data::raw_data()
{
m_type = plugin::TYPE::RAW_DATA;
m_display_name = "Raw Data";
}
void raw_data::init()
{
try
{
m_compression = m_result.m_size > m_size;
if (!m_compression) m_size = m_result.m_size;
m_line_count = m_result.m_data.size();
m_line_data.reserve(m_line_count);
for (std::size_t i = 0; i < m_line_count; ++i) m_line_data.push_back(hr::fvec_t(m_size, 0.f));
set_ox();
}
catch(std::exception& e)
{
hack::error()(e.what());
}
}
void raw_data::fill()
{
if (m_compression)
{
m_compression_step = m_result.m_size / m_size;
std::size_t line_count = 0;
for (auto& gd : m_line_data)
{
std::size_t bin_index = 0;
for (auto& g : gd)
{
float tmp_e = 0.f;
for (std::size_t j = bin_index - m_compression_step; j < bin_index; ++j)
{
auto e = m_result.m_data[line_count][j].m_value;
tmp_e = hack::math::max_abs(e, tmp_e);
}
g = tmp_e;
bin_index += m_compression_step;
if (bin_index > m_result.m_size) bin_index = m_result.m_size;
}
m_size = bin_index / m_compression_step;
++line_count;
}
}
else
{
std::size_t line_count = 0;
for (auto el : m_result.m_data)
{
std::size_t bin_index = 0;
for (auto e : el)
{
m_line_data[line_count][bin_index] = e.m_value;
++bin_index;
}
++line_count;
}
}
}
void raw_data::set_ox(std::size_t start_pos)
{
m_ox.reserve(m_size);
for (std::size_t i = start_pos; i < m_size + start_pos; ++i) m_ox.push_back(i);
}
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "monitor/utils/plugin.hpp"
namespace monitor::utils::plugins
{
struct raw_data : public plugin
{
raw_data();
~raw_data() = default;
void init() override;
void fill() override;
void set_ox(std::size_t start_pos = 0) override;
};
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include <harmonica.hpp>
namespace monitor::utils
{
struct setup : public hr::setup
{
// это меняющеесе значение в зависимости от плагина, а не
// как может показаться от аудио файла
std::size_t m_graph_compression = 0;
};
}