feat: remove selected audio DC offset with double precision analysis
This commit is contained in:
parent
f528a169f8
commit
9f1ff5f1e4
7 changed files with 20 additions and 8 deletions
|
|
@ -195,6 +195,7 @@ static int sample_editor_tests()
|
|||
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);float before=0,after=0;CHECK(xtc_sample_read(e->sample(),10,&before)==XTC_OK);
|
||||
CHECK(e->process(XTC_SAMPLE_REMOVE_DC)==XTC_OK);CHECK(e->undo_sample()==XTC_OK);
|
||||
CHECK(e->process(XTC_SAMPLE_INVERT)==XTC_OK);CHECK(e->undo_sample()==XTC_OK);
|
||||
CHECK(e->process(XTC_SAMPLE_REVERSE)==XTC_OK);CHECK(e->undo_sample()==XTC_OK);CHECK(xtc_sample_read(e->sample(),10,&after)==XTC_OK && before==after);CHECK(e->undo_sample()==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);
|
||||
|
|
|
|||
|
|
@ -40,5 +40,10 @@ int main(void)
|
|||
assert(xtc_sample_process(q,1,7,XTC_SAMPLE_INVERT,0,&twice)==XTC_OK);
|
||||
for(size_t j=0;j<8;++j){assert(xtc_sample_read(twice,j,&v)==XTC_OK && v==values[j]);}
|
||||
xtc_sample_destroy(q);xtc_sample_destroy(twice);}
|
||||
{xtc_sample *q=NULL;xtc_sample_stats after;assert(xtc_sample_analyze(s,1,7,&stats)==XTC_OK);
|
||||
assert(xtc_sample_process(s,1,7,XTC_SAMPLE_REMOVE_DC,0,&q)==XTC_OK);
|
||||
assert(xtc_sample_analyze(q,1,7,&after)==XTC_OK && fabs(after.mean)<.000001);
|
||||
for(size_t j=0;j<8;++j){assert(xtc_sample_read(q,j,&v)==XTC_OK && fabs(v-(j>=1&&j<7 ? values[j]-stats.mean : values[j]))<.000001);}
|
||||
xtc_sample_destroy(q);}
|
||||
xtc_sample_destroy(s);assert(unlink(path)==0 && rmdir(root)==0);puts("Sample editor core tests passed.");return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue