feat: add bounded audio sample editor with waveform selection and source statistics

This commit is contained in:
Johannes Findeisen 2026-11-06 01:01:37 +01:00
commit 7a04c6d922
12 changed files with 364 additions and 8 deletions

View file

@ -1,4 +1,5 @@
#include "../../src/gui/main_window.hpp"
#include "../../src/gui/sample_editor.hpp"
#include "../../src/gui/graph_widget.hpp"
#include "../../src/gui/sequencer_widget.hpp"
#include "../../src/gui/piano_roll.hpp"
@ -188,8 +189,17 @@ xtc_result xtc_backend_set_recorder(xtc_backend *, xtc_recorder *recorder)
void xtc_backend_collect(xtc_backend *backend)
{ CHECK(backend == &handle && alive == 1U); ++collects; }
}
static int sample_editor_tests()
{
reset();
MainWindow window(false,"");window.show();auto *s=timeline(&window);char path[4096];CHECK(realpath("examples/projects/original-pluck.wav",path));
CHECK(window.import_audio(path)==XTC_OK);
Fl::add_timeout(.1,[](void *){auto *e=dynamic_cast<SampleEditor *>(Fl::modal());CHECK(e!=nullptr);if(e){CHECK(e->select(10,100)==XTC_OK);CHECK(e->select(100,10)==XTC_ERR_INVALID_ARGUMENT);CHECK(e->view(10,8)==XTC_OK);CHECK(e->view(e->frames(),1)==XTC_ERR_INVALID_ARGUMENT);e->hide();}},nullptr);
CHECK(window.open_sample_editor()==XTC_OK);CHECK(s->selected_clip()!=UINT64_MAX);window.do_callback();return failures ? 1 : 0;
}
int main(int argc, char **argv)
{
if(std::getenv("XTC_TEST_SAMPLE_EDITOR_ONLY"))return sample_editor_tests();
if(!std::getenv("XTC_TEST_MODERN_EDITING_ONLY")) {
reset();
{