test: qualify internal devices across DSP, persistence and GUI workflows
This commit is contained in:
parent
f6dcf207ce
commit
e76552e8dd
7 changed files with 389 additions and 8 deletions
|
|
@ -712,6 +712,41 @@ int main(int argc, char **argv)
|
|||
CHECK(!canvas->select_at(-20,-20) && canvas->selected_node() == SIZE_MAX);
|
||||
window.do_callback();
|
||||
}
|
||||
// Internal devices must work without plugin fixture environment variables.
|
||||
for (unsigned int instrument=0;instrument<2;++instrument) {
|
||||
reset(); MainWindow window(false,""); window.show();
|
||||
CHECK(window.create_track(true)==XTC_OK);
|
||||
auto *sequence=timeline(&window); auto *canvas=graph_canvas(&window);
|
||||
uint64_t track=sequence->selected_track();
|
||||
auto *selector=sequence->instrument_choice(track); CHECK(selector);
|
||||
selector->value(static_cast<int>(instrument+1));selector->do_callback();
|
||||
xtc_plugin_spec spec{};
|
||||
CHECK(xtc_project_get_instrument(sequence->project(),track,&spec)==XTC_OK && spec.index==instrument);
|
||||
CHECK(window.undo()==XTC_OK && window.undo(true)==XTC_OK);
|
||||
xtc_connection_info wire{};
|
||||
CHECK(xtc_graph_get_connection(xtc_project_graph(sequence->project()),0,&wire)==XTC_OK);
|
||||
unsigned int effect=instrument+2;size_t id=SIZE_MAX;
|
||||
CHECK(window.insert_plugin(wire,XTC_BUILTIN_PATH,effect,&id)==XTC_OK);
|
||||
CHECK(canvas->select_node(id));
|
||||
CHECK(window.set_plugin_control(id,2,.75f)==XTC_OK);
|
||||
CHECK(window.set_plugin_automation(id,{960,2,0,.4f},false)==XTC_OK);
|
||||
CHECK(window.undo()==XTC_OK && window.undo(true)==XTC_OK);
|
||||
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),id,&spec)==XTC_OK);
|
||||
CHECK(spec.index==effect && spec.values[2]==.75f && spec.point_count==1);
|
||||
xtc_plugin_details details{};xtc_plugin_spec edited{};
|
||||
CHECK(xtc_plugin_describe(&spec,48000,&details)==XTC_OK);
|
||||
Fl::add_timeout(.05,[](void *) {press(find(Fl::first_window(),"Apply"));});
|
||||
CHECK(xtc_edit_plugin(spec,details,edited) && edited.index==effect);
|
||||
CHECK(window.save_project("/tmp/xtc-internal-gui.xtc")==XTC_OK);
|
||||
CHECK(window.new_project()==XTC_OK && window.open_project("/tmp/xtc-internal-gui.xtc")==XTC_OK);
|
||||
CHECK(xtc_project_get_instrument(sequence->project(),track,&spec)==XTC_OK && spec.index==instrument);
|
||||
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),id,&spec)==XTC_OK && spec.index==effect && spec.point_count==1);
|
||||
size_t added=SIZE_MAX;CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect,&added)==XTC_OK);
|
||||
CHECK(added!=id);CHECK(window.undo()==XTC_OK);
|
||||
const xtc_project *before=sequence->project();reserve_result=XTC_ERR_OUT_OF_MEMORY;
|
||||
CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect)==XTC_ERR_OUT_OF_MEMORY && sequence->project()==before);
|
||||
reserve_result=XTC_OK;unlink("/tmp/xtc-internal-gui.xtc");window.do_callback();
|
||||
}
|
||||
if (const char *module = std::getenv("XTC_TEST_PLUGIN")) {
|
||||
reset();
|
||||
MainWindow window(false,"");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "xtc/xtc_realtime.h"
|
||||
#include "xtc/xtc_native.h"
|
||||
#include "xtc/xtc_control.h"
|
||||
#include "xtc/xtc_plugin.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -152,8 +153,29 @@ static void history_reservations(void)
|
|||
xtc_project_destroy(snapshot); xtc_project_destroy(project); xtc_history_destroy(history);
|
||||
}
|
||||
|
||||
static void builtin_failures(void)
|
||||
{
|
||||
unsigned int id;
|
||||
for(id=0;id<4;++id) {
|
||||
int failure, succeeded=0; xtc_plugin_spec spec;
|
||||
assert(xtc_plugin_probe(XTC_BUILTIN_PATH,id,48000,&spec)==XTC_OK);
|
||||
for(failure=0;failure<16;++failure) {
|
||||
xtc_plugin *plugin=NULL; xtc_result result; float in[256]={0},out[256];
|
||||
fail_after=failure;result=xtc_plugin_create(&spec,48000,256,&plugin);fail_after=-1;
|
||||
if(result!=XTC_OK) {assert(result==XTC_ERR_OUT_OF_MEMORY && !plugin);continue;}
|
||||
processing=1;
|
||||
if(id<2) {xtc_midi_event event={0,XTC_MIDI_NOTE_ON,0,60,100};
|
||||
assert(xtc_plugin_process_midi(plugin,&event,1,out,256)==XTC_OK);
|
||||
} else assert(xtc_plugin_process(plugin,in,out,256)==XTC_OK);
|
||||
processing=0;xtc_plugin_destroy(plugin);succeeded=1;break;
|
||||
}
|
||||
assert(succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
builtin_failures();
|
||||
graph_limits();
|
||||
history_reservations();
|
||||
xtc_native_descriptor descriptor = {XTC_NATIVE_ABI_VERSION, sizeof(descriptor),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue