feat(transport): set project tempo by tapping a pulse (phase 97)

This commit is contained in:
Johannes Findeisen 2026-11-06 02:09:02 +01:00
commit b7a4a1acd4
9 changed files with 92 additions and 5 deletions

View file

@ -263,6 +263,9 @@ int creative_workflow_tests()
panel->meter()->do_callback();CHECK(!panel->meter()->clipped());
panel->select_track(first_track);CHECK(panel->meter()->left_db()==-90 && !panel->meter()->clipped());
CHECK(window.new_project()==XTC_OK && !panel->clipboard_ready() && panel->paste_chain()==XTC_ERR_NOT_FOUND);
CHECK(find(&window,"Tap"));CHECK(window.tap_tempo(0)==XTC_ERR_NOT_FOUND && window.tap_tempo(.4)==XTC_OK);
CHECK(xtc_project_tempo(s->project())==150000 && window.undo()==XTC_OK && xtc_project_tempo(s->project())==120000);
CHECK(window.new_project()==XTC_OK && window.tap_tempo(.9)==XTC_ERR_NOT_FOUND);
CHECK(!panel->comparison_ready(0) && !panel->comparison_ready(1));
window.do_callback();puts("Creative workflow GUI checks passed.");return failures ? 1 : 0;
}

View file

@ -1,10 +1,26 @@
#include "xtc/xtc_plugin.h"
#include "xtc/xtc_tempo.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
static void tap_tests(void)
{
xtc_tap_tempo s={0},before;unsigned int tempo=999;
assert(xtc_tap_tempo_push(&s,0,&tempo)==XTC_ERR_NOT_FOUND && tempo==999);
assert(xtc_tap_tempo_push(&s,.5,&tempo)==XTC_OK && tempo==120000);
before=s;assert(xtc_tap_tempo_push(&s,.55,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s)) && tempo==120000);
assert(xtc_tap_tempo_push(&s,NAN,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s)));
assert(xtc_tap_tempo_push(&s,.4,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s)));
assert(xtc_tap_tempo_push(&s,1,&tempo)==XTC_OK && xtc_tap_tempo_push(&s,1.5,&tempo)==XTC_OK && xtc_tap_tempo_push(&s,2,&tempo)==XTC_OK);
assert(xtc_tap_tempo_push(&s,2.25,&tempo)==XTC_OK && tempo==137143);
assert(xtc_tap_tempo_push(&s,10,&tempo)==XTC_ERR_NOT_FOUND && tempo==137143 && !s.count);
assert(xtc_tap_tempo_push(&s,10.25,&tempo)==XTC_OK && tempo==240000);
xtc_tap_tempo_reset(&s);assert(!s.started && !s.count);
}
int main(void)
{
tap_tests();
xtc_track_chain c={0},out={0};
c.output_gain=.8f;c.count=1;c.slots[0].enabled=1;c.slots[0].wet=.4f;
assert(xtc_plugin_probe_format(XTC_PLUGIN_BUILTIN,XTC_BUILTIN_PATH,2,48000,&c.slots[0].plugin)==XTC_OK);