feat: correct MIDI phrases to root-aware major and minor scales
This commit is contained in:
parent
5acd3b65ab
commit
77fc5b4c0e
9 changed files with 48 additions and 8 deletions
|
|
@ -1340,6 +1340,8 @@ int main(int argc, char **argv)
|
|||
CHECK(xtc_project_get_note(s->project(),0,&quantized)==XTC_OK && quantized.length_tick==60);
|
||||
edit.type=XTC_MIDI_TRANSFORM_LEGATO;CHECK(s->transform_midi(edit)==XTC_OK);
|
||||
CHECK(xtc_project_get_note(s->project(),0,&quantized)==XTC_OK && quantized.length_tick==3540);
|
||||
edit.type=XTC_MIDI_TRANSFORM_SCALE;edit.root=0;edit.scale=1;CHECK(s->transform_midi(edit)==XTC_OK);
|
||||
CHECK(xtc_project_get_note(s->project(),0,&quantized)==XTC_OK && quantized.pitch==60);
|
||||
window.do_callback();
|
||||
}
|
||||
if (failures != 0) return 1;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,21 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void test_scale(void)
|
||||
{
|
||||
xtc_project *p=NULL;uint64_t t,c,n;xtc_note_info note;xtc_midi_transform edit={0};
|
||||
assert(xtc_project_create(&p)==XTC_OK && xtc_project_add_track(p,"Track",&t)==XTC_OK);
|
||||
assert(xtc_project_add_midi_clip(p,t,0,960,&c)==XTC_OK);
|
||||
assert(xtc_project_add_note(p,c,0,120,61,100,0,&n)==XTC_OK);
|
||||
edit.type=XTC_MIDI_TRANSFORM_SCALE;edit.scale=1;
|
||||
assert(xtc_project_transform_midi(p,&c,1,&edit)==XTC_OK);
|
||||
assert(xtc_project_get_note(p,0,¬e)==XTC_OK && note.pitch==60 && note.id==n);
|
||||
assert(xtc_project_edit_note(p,n,0,120,0,100,0)==XTC_OK);edit.root=11;
|
||||
assert(xtc_project_transform_midi(p,&c,1,&edit)==XTC_OK);
|
||||
assert(xtc_project_get_note(p,0,¬e)==XTC_OK && note.pitch==1);
|
||||
edit.root=12;assert(xtc_project_transform_midi(p,&c,1,&edit)==XTC_ERR_INVALID_ARGUMENT);
|
||||
xtc_project_destroy(p);
|
||||
}
|
||||
static void test_gate_legato(void)
|
||||
{
|
||||
xtc_project *p=NULL;uint64_t t,c,n;xtc_note_info note;xtc_midi_transform edit={0};
|
||||
|
|
@ -75,7 +90,7 @@ static void test_repeat(void)
|
|||
}
|
||||
int main(void)
|
||||
{
|
||||
test_repeat();test_align_slip();test_swing();test_gate_legato();
|
||||
test_repeat();test_align_slip();test_swing();test_gate_legato();test_scale();
|
||||
xtc_project *p=NULL;uint64_t track,a,b,n,ids[2],out[2]={999,999};xtc_clip_info c;
|
||||
size_t tracks,clips,notes;
|
||||
assert(xtc_project_create(&p)==XTC_OK);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue