feat: plan composition phases and persist named arrangement markers
This commit is contained in:
parent
1b668068de
commit
64e5ab170f
19 changed files with 323 additions and 9 deletions
|
|
@ -1309,6 +1309,7 @@ int main(int argc, char **argv)
|
|||
unlink(path.c_str());
|
||||
}
|
||||
}
|
||||
if(!std::getenv("XTC_TEST_NEXT_DAW_ONLY")) {
|
||||
reset();
|
||||
{
|
||||
MainWindow window(false,"");window.show();CHECK(window.create_track(true)==XTC_OK);
|
||||
|
|
@ -1359,6 +1360,17 @@ int main(int argc, char **argv)
|
|||
CHECK(window.new_project()==XTC_OK && window.mix_snapshot(0,false)==XTC_ERR_NOT_FOUND);
|
||||
window.do_callback();
|
||||
}
|
||||
}
|
||||
reset();
|
||||
{
|
||||
MainWindow window(false,"");window.show();CHECK(window.create_track(true)==XTC_OK);
|
||||
auto *s=timeline(&window);s->position(960);CHECK(s->marker("Verse")==XTC_OK);
|
||||
size_t markers=0;xtc_project_marker_count(s->project(),&markers);CHECK(markers==1);
|
||||
CHECK(window.undo()==XTC_OK);xtc_project_marker_count(s->project(),&markers);CHECK(markers==0);
|
||||
CHECK(window.undo(true)==XTC_OK);xtc_project_marker_count(s->project(),&markers);CHECK(markers==1);
|
||||
window.detach_editor(0,true);pump();window.detach_editor(0,false);
|
||||
window.do_callback();
|
||||
}
|
||||
if (failures != 0) return 1;
|
||||
std::printf("GUI controls/errors/views/timers/cleanup passed: %u opens, %u closes.\n", opens, closes);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def main():
|
|||
run([str(binaries / 'xtc-check'), '--inspect', str(resources / 'xtc/examples/modern-session.xtc')])
|
||||
assert (docs / 'WORKSPACE.md').is_file()
|
||||
diagnose = subprocess.check_output([str(binaries / 'xtc-check'), '--diagnose'], text=True)
|
||||
assert 'Project formats: 1..15' in diagnose and 'JACK compiled:' in diagnose
|
||||
assert 'Project formats: 1..16' in diagnose and 'JACK compiled:' in diagnose
|
||||
# Replacing a file symlink must not overwrite an unrelated target.
|
||||
protected = stage / 'unrelated-target'
|
||||
protected.write_text('keep unrelated target\n')
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ with tempfile.TemporaryDirectory(prefix="xtc-inspect-") as directory:
|
|||
project.write_text(malformed)
|
||||
check("--validate", project, 1)
|
||||
for text, messages in [
|
||||
(base.replace("XTC_PROJECT 10", "XTC_PROJECT 999"), ("line 1", "999", "1..15")),
|
||||
(base.replace("XTC_PROJECT 10", "XTC_PROJECT 999"), ("line 1", "999", "1..16")),
|
||||
("XTC_PROJECT 10\n", ("line 2", "APP")),
|
||||
(base.replace("TEMPO 120000", "TEMPO 0"), ("line 3", "TEMPO")),
|
||||
(base + "OPTIONAL_FUTURE 1\n", ("Unknown fields",)),
|
||||
|
|
|
|||
|
|
@ -167,8 +167,8 @@ static void editable(void)
|
|||
assert(xtc_plugin_preset_save(&legacy,path)==XTC_OK);
|
||||
{FILE *f=fopen(path,"r");char lines[32768],line[2048];size_t used=0;assert(f);
|
||||
while(fgets(line,sizeof(line),f)) {
|
||||
if(!strncmp(line,"SAMPLE ",7) || !strncmp(line,"INSTRUMENT_CONTROLS",19) || !strncmp(line,"INSTRUMENT_AUTOMATION",21))continue;
|
||||
if(!strncmp(line,"XTC_PROJECT 15",14))strcpy(line,"XTC_PROJECT 13\n");
|
||||
if(!strncmp(line,"MARKERS ",8) || !strncmp(line,"SAMPLE ",7) || !strncmp(line,"INSTRUMENT_CONTROLS",19) || !strncmp(line,"INSTRUMENT_AUTOMATION",21))continue;
|
||||
if(!strncmp(line,"XTC_PROJECT 16",14))strcpy(line,"XTC_PROJECT 13\n");
|
||||
assert(used+strlen(line)<sizeof(lines));strcpy(lines+used,line);used+=strlen(line);
|
||||
}fclose(f);f=fopen(path,"w");assert(f && fwrite(lines,1,used,f)==used);fclose(f);}
|
||||
assert(xtc_plugin_preset_load(path,&t)==XTC_OK && !t.control_count && t.index==0);
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ int main(void)
|
|||
fputc('\n',legacy); continue;
|
||||
}
|
||||
if (strncmp(line, "MIX ", 4) && strncmp(line, "AUTOMATION ", 11) &&
|
||||
strncmp(line, "POINT ", 6) && strncmp(line, "AUDIO ", 6) && strncmp(line, "ROUTE ", 6) && strncmp(line,"CONTROL_MAPS ",13) && strncmp(line,"MAP ",4) && strncmp(line,"TRACK_INSTRUMENTS ",18) && strncmp(line,"LIVE_INSTRUMENT ",16))
|
||||
strncmp(line, "POINT ", 6) && strncmp(line, "AUDIO ", 6) && strncmp(line, "ROUTE ", 6) && strncmp(line,"CONTROL_MAPS ",13) && strncmp(line,"MAP ",4) && strncmp(line,"TRACK_INSTRUMENTS ",18) && strncmp(line,"LIVE_INSTRUMENT ",16) && strncmp(line,"MARKERS ",8) && strncmp(line,"MARKER ",7))
|
||||
assert(fputs(line, legacy) >= 0);
|
||||
}
|
||||
assert(fclose(f) == 0 && fclose(legacy) == 0);
|
||||
|
|
|
|||
34
tests/unit/test_next_daw.c
Normal file
34
tests/unit/test_next_daw.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "xtc/xtc_editing.h"
|
||||
#include "xtc/xtc_mixer.h"
|
||||
#include "xtc/xtc_audio.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void markers(void)
|
||||
{
|
||||
xtc_project *p=NULL,*q=NULL;xtc_marker m;size_t count;char path[]="/tmp/xtc-sections-XXXXXX";
|
||||
int fd=mkstemp(path);assert(fd>=0 && close(fd)==0);
|
||||
assert(xtc_project_create(&p)==XTC_OK && xtc_project_create(&q)==XTC_OK);
|
||||
assert(xtc_project_set_marker(p,3840,"Chorus")==XTC_OK);
|
||||
assert(xtc_project_set_marker(p,0,"Intro")==XTC_OK);
|
||||
assert(xtc_project_set_marker(p,0,"Intro ä")==XTC_OK);
|
||||
assert(xtc_project_get_marker(p,0,&m)==XTC_OK && !strcmp(m.name,"Intro ä"));
|
||||
assert(xtc_project_set_marker(p,1,"Bad\n")==XTC_ERR_INVALID_ARGUMENT);
|
||||
assert(xtc_project_save(p,path)==XTC_OK && xtc_project_load(q,path)==XTC_OK);
|
||||
assert(xtc_project_marker_count(q,&count)==XTC_OK && count==2);
|
||||
assert(xtc_project_get_marker(q,1,&m)==XTC_OK && m.tick==3840 && !strcmp(m.name,"Chorus"));
|
||||
assert(xtc_project_remove_marker(q,0)==XTC_OK && xtc_project_remove_marker(q,0)==XTC_ERR_NOT_FOUND);
|
||||
for(size_t i=1;i<127;++i)assert(xtc_project_set_marker(p,i,"M")==XTC_OK);
|
||||
assert(xtc_project_set_marker(p,999,"Full")==XTC_ERR_CAPACITY);
|
||||
/* Malformed marker ordering rejects transactionally. */
|
||||
{FILE *f=fopen(path,"r");char data[32768];size_t n;assert(f);n=fread(data,1,sizeof(data)-1,f);data[n]=0;fclose(f);
|
||||
char *at=strstr(data,"MARKER 3840");assert(at);memcpy(at+7,"0000",4);
|
||||
f=fopen(path,"w");assert(f && fwrite(data,1,n,f)==n && fclose(f)==0);
|
||||
assert(xtc_project_load(q,path)==XTC_ERR_FORMAT);assert(xtc_project_marker_count(q,&count)==XTC_OK && count==1);}
|
||||
xtc_project_destroy(p);xtc_project_destroy(q);assert(unlink(path)==0);
|
||||
}
|
||||
int main(void){markers();puts("Next DAW workflow tests passed.");return 0;}
|
||||
|
|
@ -81,7 +81,7 @@ int main(void)
|
|||
}
|
||||
write_text(bad,"XTC_PROJECT 999\n");
|
||||
assert(xtc_project_load_diagnostic(loaded,bad,&diagnostic) == XTC_ERR_UNSUPPORTED && diagnostic.line == 1 &&
|
||||
diagnostic.format_version == 999 && !strcmp(diagnostic.record,"XTC_PROJECT") && strstr(diagnostic.message,"1..15"));
|
||||
diagnostic.format_version == 999 && !strcmp(diagnostic.record,"XTC_PROJECT") && strstr(diagnostic.message,"1..16"));
|
||||
write_text(bad,"XTC_PROJECT 10\nAPP 0 1 0\nTEMPO nope\n");
|
||||
assert(xtc_project_load_diagnostic(loaded,bad,&diagnostic) == XTC_ERR_FORMAT && diagnostic.line == 3 &&
|
||||
!strcmp(diagnostic.record,"TEMPO"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue