/* SPDX-License-Identifier: GPL-3.0-only */ #define main hostsim_main #include "hostsim.c" #undef main #include static uint32_t into_s(const track_t *t) /* samples into the step the clock is in */ { uint32_t into, len; trk_grid(t, &into, &len); return into / (uint32_t)song.g[G_BPM]; } int main(int argc,char **argv) { uint32_t i,j,k,v,total=0; uint64_t energy[DRUM_KITS]={0}; int32_t out[CTL*2]; dstep_t step={{0}}; host_tracks_init(); for(i=0;i>2)&3u); /* SLOOP 2.0: all 16 lanes in one step */ assert(dstep_mask(&step)==0xFFFFu); for(i=0;i>2)&3u)); dstep_clr(&step,5);assert(!dstep_has(&step,5) && dstep_has(&step,4) && dstep_has(&step,6) && dstep_lvl(&step,6)==2u); for(i=0;i<27u;i++)assert(lane_of_key(i)p[P_E0]=(int16_t)i; drum_on(36,110);drum_on(38,100);drum_on(46,80); for(j=0;j-131072 && l[k]<131072);energy[i]+=l[k]<0?-l[k]:l[k];} } assert(energy[i]>10000); for(k=0;k100)loud++;} } transport_req=2;events_block(CTL); if(v==0||v==2)assert(hits==4 && loud==1); else assert(hits==0 && drums.age==age0); } /* LIVE record start. Stopped and armed, a project with notes: the first note starts the * loop and is step 1 */ { uint32_t period, b, k0 = 7u, half, c; /* key 7 = C4 */ host_tracks_init();song.g[G_BPM]=120;song.g[G_CLOCK]=0;song.sel=0;song.playing=0; for(c=0;cdstep[3],0,LV_NORM,0); rec_wait=1; for(b=0;b<10;b++)mix_block(out,CTL); /* nothing happens while it waits */ assert(!song.playing && !song.rec && rec_wait==1 && !ft_on); fm1_in.notes=1u<time==ST_NOTE && st->n==1 && st->note[0]==KN[(j/4u)&3u]); } else if(j==5u) { assert(st->time==ST_TIE); /* the held note: 2 steps */ } else { assert(!st->n && st->time!=ST_NOTE && st->time!=ST_TIE); } } for(j=len;j1?fopen(argv[1],"wb"):0; if(f)wav_hdr(f,total); host_tracks_init();song.g[G_BPM]=120;song.rec=1u;transport_req=1; for(j=0;j