├── .gitignore ├── Makefile.in ├── README ├── builtin.c ├── builtin.h ├── configure ├── cons.c ├── cons.h ├── conv.c ├── conv.h ├── data.c ├── data.h ├── defs.h ├── ev.c ├── ev.h ├── exec.c ├── exec.h ├── filt.c ├── filt.h ├── frame.c ├── frame.h ├── help.c ├── help.h ├── main.c ├── manual.html ├── mdep.c ├── mdep_alsa.c ├── mdep_raw.c ├── mdep_sndio.c ├── metro.c ├── metro.h ├── mididev.c ├── mididev.h ├── midish.1 ├── midishrc ├── mixout.c ├── mixout.h ├── mux.c ├── mux.h ├── name.c ├── name.h ├── node.c ├── node.h ├── norm.c ├── norm.h ├── parse.c ├── parse.h ├── pool.c ├── pool.h ├── regress ├── bad1.msh ├── bank.msh ├── bend1.msh ├── bend2.msh ├── bend_e1.msh ├── bend_e2.msh ├── bend_e3.msh ├── bend_e4.msh ├── bend_e5.msh ├── bend_e6.msh ├── bend_s1.msh ├── bend_s2.msh ├── bend_s3.msh ├── bend_s4.msh ├── bend_s5.msh ├── bend_s6.msh ├── blank_a0.cmd ├── blank_a0.res ├── blank_a1.cmd ├── blank_a1.res ├── blank_a2.cmd ├── blank_a2.res ├── blank_a3.cmd ├── blank_a3.res ├── blank_b0.cmd ├── blank_b0.res ├── blank_b1.cmd ├── blank_b1.res ├── blank_b2.cmd ├── blank_b2.res ├── blank_b3.cmd ├── blank_b3.res ├── blank_c0.cmd ├── blank_c0.res ├── blank_c1.cmd ├── blank_c1.res ├── blank_c2.cmd ├── blank_c2.res ├── blank_c3.cmd ├── blank_c3.res ├── blank_d0.cmd ├── blank_d0.res ├── blank_d1.cmd ├── blank_d1.res ├── blank_d2.cmd ├── blank_d2.res ├── blank_d3.cmd ├── blank_d3.res ├── check.cmd ├── check.res ├── confev_0.cmd ├── confev_0.res ├── copy_a0.cmd ├── copy_a0.res ├── copy_a1.cmd ├── copy_a1.res ├── copy_a2.cmd ├── copy_a2.res ├── copy_a3.cmd ├── copy_a3.res ├── copy_b0.cmd ├── copy_b0.res ├── copy_b1.cmd ├── copy_b1.res ├── copy_b2.cmd ├── copy_b2.res ├── copy_b3.cmd ├── copy_b3.res ├── copy_c0.cmd ├── copy_c0.res ├── copy_c1.cmd ├── copy_c1.res ├── copy_c2.cmd ├── copy_c2.res ├── copy_c3.cmd ├── copy_c3.res ├── copy_d0.cmd ├── copy_d0.res ├── copy_d1.cmd ├── copy_d1.res ├── copy_d2.cmd ├── copy_d2.res ├── copy_d3.cmd ├── copy_d3.res ├── ctl.msh ├── ctl_e1.msh ├── cut_a0.cmd ├── cut_a0.res ├── cut_a1.cmd ├── cut_a1.res ├── cut_a2.cmd ├── cut_a2.res ├── cut_a3.cmd ├── cut_a3.res ├── cut_b0.cmd ├── cut_b0.res ├── cut_b1.cmd ├── cut_b1.res ├── cut_b2.cmd ├── cut_b2.res ├── cut_b3.cmd ├── cut_b3.res ├── cut_c0.cmd ├── cut_c0.res ├── cut_c1.cmd ├── cut_c1.res ├── cut_c2.cmd ├── cut_c2.res ├── cut_c3.cmd ├── cut_c3.res ├── cut_d0.cmd ├── cut_d0.res ├── cut_d1.cmd ├── cut_d1.res ├── cut_d2.cmd ├── cut_d2.res ├── cut_d3.cmd ├── cut_d3.res ├── filt.msh ├── fmap_a0.cmd ├── fmap_a0.res ├── fmap_a1.cmd ├── fmap_a1.res ├── fmap_a3.cmd ├── fmap_a3.res ├── fnew.cmd ├── fnew.res ├── help.cmd ├── help.res ├── insert_a0.cmd ├── insert_a0.res ├── insert_a1.cmd ├── insert_a1.res ├── insert_a2.cmd ├── insert_a2.res ├── insert_a3.cmd ├── insert_a3.res ├── insert_b0.cmd ├── insert_b0.res ├── insert_b1.cmd ├── insert_b1.res ├── insert_b2.cmd ├── insert_b2.res ├── insert_b3.cmd ├── insert_b3.res ├── insert_c0.cmd ├── insert_c0.res ├── insert_c1.cmd ├── insert_c1.res ├── insert_c2.cmd ├── insert_c2.res ├── insert_c3.cmd ├── insert_c3.res ├── insert_d0.cmd ├── insert_d0.res ├── insert_d1.cmd ├── insert_d1.res ├── insert_d2.cmd ├── insert_d2.res ├── insert_d3.cmd ├── insert_d3.res ├── mcut_a0.cmd ├── mcut_a0.res ├── mcut_a1.cmd ├── mcut_a1.res ├── mcut_a2.cmd ├── mcut_a2.res ├── mdup_a0.cmd ├── mdup_a0.res ├── mdup_a1.cmd ├── mdup_a1.res ├── mdup_a2.cmd ├── mdup_a2.res ├── mdup_a3.cmd ├── mdup_a3.res ├── mdup_a4.cmd ├── mdup_a4.res ├── mdup_b0.cmd ├── mdup_b0.res ├── mdup_b1.cmd ├── mdup_b1.res ├── mdup_b2.cmd ├── mdup_b2.res ├── mdup_b3.cmd ├── mdup_b3.res ├── mdup_b4.cmd ├── mdup_b4.res ├── mergebend_e1.cmd ├── mergebend_e1.res ├── mergebend_e2.cmd ├── mergebend_e2.res ├── mergebend_e3.cmd ├── mergebend_e3.res ├── mergebend_e4.cmd ├── mergebend_e4.res ├── mergebend_e5.cmd ├── mergebend_e5.res ├── mergebend_e6.cmd ├── mergebend_e6.res ├── mergebend_s1.cmd ├── mergebend_s1.res ├── mergebend_s2.cmd ├── mergebend_s2.res ├── mergebend_s3.cmd ├── mergebend_s3.res ├── mergebend_s4.cmd ├── mergebend_s4.res ├── mergebend_s5.cmd ├── mergebend_s5.res ├── mergebend_s6.cmd ├── mergebend_s6.res ├── mergectl_e1.cmd ├── mergectl_e1.res ├── mergenote_e1.cmd ├── mergenote_e1.res ├── mergenote_e2.cmd ├── mergenote_e2.res ├── mergenote_e3.cmd ├── mergenote_e3.res ├── mergenote_e4.cmd ├── mergenote_e4.res ├── mergenote_e5.cmd ├── mergenote_e5.res ├── mergenote_e6.cmd ├── mergenote_e6.res ├── mergenote_s1.cmd ├── mergenote_s1.res ├── mergenote_s2.cmd ├── mergenote_s2.res ├── mergenote_s3.cmd ├── mergenote_s3.res ├── mergenote_s4.cmd ├── mergenote_s4.res ├── mergenote_s5.cmd ├── mergenote_s5.res ├── mergenote_s6.cmd ├── mergenote_s6.res ├── mins_a0.cmd ├── mins_a0.res ├── mins_a1.cmd ├── mins_a1.res ├── mins_a2.cmd ├── mins_a2.res ├── mins_a3.cmd ├── mins_a3.res ├── mins_a4.cmd ├── mins_a4.res ├── note.msh ├── note2.msh ├── note_e1.msh ├── note_e2.msh ├── note_e3.msh ├── note_e4.msh ├── note_e5.msh ├── note_e6.msh ├── note_s1.msh ├── note_s2.msh ├── note_s3.msh ├── note_s4.msh ├── note_s5.msh ├── note_s6.msh ├── quant.cmd ├── quant.msh ├── quant.res ├── quant_m.msh ├── quant_ovr.msh ├── quanta_ovr.cmd ├── quanta_ovr.res ├── quantf.cmd ├── quantf.res ├── quantf_m.cmd ├── quantf_m.res ├── quantf_ovr.cmd ├── quantf_ovr.res ├── run-test ├── sign.msh ├── sign2.msh ├── sign3.msh ├── tempo.cmd ├── tempo.res ├── tevmap.msh ├── tevmap_a0.cmd ├── tevmap_a0.res ├── tevmap_a1.cmd ├── tevmap_a1.res ├── tevmap_a2.cmd ├── tevmap_a2.res ├── tevmap_a3.cmd ├── tevmap_a3.res ├── tevmap_a4.cmd ├── tevmap_a4.res ├── tevmap_a5.cmd ├── tevmap_a5.res ├── tevmap_a6.cmd ├── tevmap_a6.res ├── tevmap_a7.cmd ├── tevmap_a7.res ├── tevmap_a8.cmd ├── tevmap_a8.res ├── tevmap_a9.cmd ├── tevmap_a9.res ├── time.msh ├── timeins.cmd ├── timeins.res ├── timerm.cmd ├── timerm.res ├── timesig.cmd ├── timesig.res ├── tundo.msh ├── tundo_d0.cmd ├── tundo_d0.res ├── tundo_d1.cmd ├── tundo_d1.res ├── tundo_d2.cmd ├── tundo_d2.res ├── tundo_i0.cmd ├── tundo_i0.res ├── tundo_i1.cmd ├── tundo_i1.res ├── tundo_i2.cmd ├── tundo_i2.res ├── tundo_i3.cmd ├── tundo_i3.res ├── tundo_i4.cmd ├── tundo_i4.res ├── tundo_i5.cmd ├── tundo_i5.res ├── tundo_n.cmd ├── tundo_n.res └── update-test ├── sample.msh ├── saveload.c ├── saveload.h ├── smf.c ├── smf.h ├── smfplay ├── smfplay.1 ├── smfrec ├── smfrec.1 ├── song.c ├── song.h ├── state.c ├── state.h ├── str.c ├── str.h ├── sysex.c ├── sysex.h ├── textio.c ├── textio.h ├── timo.c ├── timo.h ├── track.c ├── track.h ├── tty.c ├── tty.h ├── undo.c ├── undo.h ├── user.c ├── user.h ├── utils.c └── utils.h /.gitignore: -------------------------------------------------------------------------------- 1 | # CVS default ignores begin 2 | tags 3 | TAGS 4 | .make.state 5 | .nse_depinfo 6 | *~ 7 | #* 8 | .#* 9 | ,* 10 | _$* 11 | *$ 12 | *.old 13 | *.bak 14 | *.BAK 15 | *.orig 16 | *.rej 17 | .del-* 18 | *.a 19 | *.olb 20 | *.o 21 | *.obj 22 | *.so 23 | *.exe 24 | *.Z 25 | *.elc 26 | *.ln 27 | core 28 | # CVS default ignores end 29 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Midish is an open-source MIDI sequencer/filter for Unix-like operating 2 | systems. Implemented as a simple command-line interpreter, it's intended to 3 | be lightweight, fast and reliable for real-time performance. 4 | 5 | Important features: 6 | - multiple MIDI devices handling 7 | - synchronization to external audio/MIDI hardware/software 8 | - real-time MIDI filtering/routing (controller 9 | mapping, keyboard splitting, ...) 10 | - track recording, metronome 11 | - basic track editing (insert, copy, delete, ...) 12 | - progressive track quantisation 13 | - import and export of standard MIDI files 14 | - tempo and time-signature changes 15 | - system exclusive messages handling 16 | - unlimited undo 17 | 18 | Contents: 19 | - midish - the sequencer/filter 20 | - smfplay, smfrec - MIDI file player and recorder 21 | 22 | See also the user manual (manual.html). 23 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # defaults 5 | # 6 | prefix=/usr/local # where to install midish 7 | alsa=no # do we want alsa support ? 8 | sndio=no # do we want sndio support ? 9 | vars= # variables definitions passed as-is 10 | bindir= # path where to install binaries 11 | datadir= # path where to install doc and examples 12 | mandir= # path where to install man pages 13 | defs= # no extra #defines 14 | lib= # extra path to libraries 15 | include= # extra path to header files 16 | rt_ldadd= # extra -l's for posix real-time extensions 17 | sndio_ldadd= # extra -l's for sndio(7) 18 | alsa_ldadd= # extra -l's for ALSA 19 | 20 | # 21 | # few OS-specific tweaks 22 | # 23 | case `uname` in 24 | Linux) 25 | alsa=yes 26 | rt_ldadd="-lrt" 27 | ;; 28 | OpenBSD) 29 | sndio=yes 30 | ;; 31 | esac 32 | 33 | # 34 | # display help screeen 35 | # 36 | help() { 37 | cat << END 38 | Usage: configure [options] 39 | --prefix=DIR set install prefix to DIR [$prefix] 40 | --bindir=DIR install executables in DIR [\$prefix/bin] 41 | --datadir=DIR install read-only data in DIR [\$prefix/share] 42 | --mandir=DIR install man pages in DIR [\$prefix/man] 43 | --enable-alsa enable alsa sequencer backend [$alsa] 44 | --disable-alsa disable alsa sequencer backend 45 | --enable-sndio enable libsndio backend [$sndio] 46 | --disable-sndio disable libsndio backend 47 | END 48 | } 49 | 50 | # shell word separator (none) 51 | IFS='' 52 | 53 | # sed-quoted new-line 54 | nl='\ 55 | ' 56 | 57 | for i; do 58 | case "$i" in 59 | --prefix=*) 60 | prefix="${i#--prefix=}" 61 | shift;; 62 | --bindir=*) 63 | bindir="${i#--bindir=}" 64 | shift;; 65 | --datadir=*) 66 | datadir="${i#--datadir=}" 67 | shift;; 68 | --mandir=*) 69 | mandir="${i#--mandir=}" 70 | shift;; 71 | --enable-alsa) 72 | alsa=yes 73 | shift;; 74 | --disable-alsa) 75 | alsa=no 76 | shift;; 77 | --enable-sndio) 78 | sndio=yes 79 | shift;; 80 | --disable-sndio) 81 | sndio=no 82 | shift;; 83 | CC=*|CFLAGS=*|LDFLAGS=*) 84 | vars="$vars$i$nl" 85 | shift;; 86 | *) 87 | help 88 | exit 1 89 | ;; 90 | esac 91 | done 92 | 93 | bindir="${bindir:-$prefix/bin}" 94 | datadir="${datadir:-$prefix/share}" 95 | mandir="${mandir:-$prefix/man}" 96 | 97 | # 98 | # add parameters specific to backends 99 | # 100 | if [ $sndio = yes ]; then 101 | defs="$defs -DUSE_SNDIO" 102 | sndio_ldadd="-lsndio" 103 | alsa=no 104 | elif [ $alsa = yes ]; then 105 | defs="$defs -DUSE_ALSA" 106 | alsa_ldadd="-lasound" 107 | else 108 | defs="$defs -DUSE_RAW" 109 | fi 110 | 111 | echo "configure: creating Makefile" 112 | sed \ 113 | -e "s:@bindir@:$bindir:" \ 114 | -e "s:@datadir@:$datadir:" \ 115 | -e "s:@mandir@:$mandir:" \ 116 | -e "s:@defs@:$defs:" \ 117 | -e "s:@include@:$include:" \ 118 | -e "s:@lib@:$lib:" \ 119 | -e "s:@rt_ldadd@:$rt_ldadd:" \ 120 | -e "s:@sndio_ldadd@:$sndio_ldadd:" \ 121 | -e "s:@alsa_ldadd@:$alsa_ldadd:" \ 122 | -e "s:@vars@:$vars:" \ 123 | < Makefile.in >Makefile 124 | 125 | if [ ! -e version.h ]; then 126 | echo "#define VERSION \"midish (unknown release)\"" >version.h 127 | fi 128 | 129 | echo 130 | echo "bindir................... $bindir" 131 | echo "datadir.................. $datadir" 132 | echo "mandir................... $mandir" 133 | echo "alsa..................... $alsa" 134 | echo "sndio.................... $sndio" 135 | echo 136 | echo "Do \"make && make install\" to compile and install midish" 137 | echo 138 | 139 | 140 | -------------------------------------------------------------------------------- /cons.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "utils.h" 21 | #include "textio.h" 22 | #include "cons.h" 23 | #include "tty.h" 24 | #include "user.h" 25 | 26 | /* 27 | * print song position 28 | */ 29 | void 30 | cons_putpos(unsigned measure, unsigned beat, unsigned tic) 31 | { 32 | char buf[32]; 33 | 34 | if (user_flag_verb) { 35 | fprintf(stdout, "+pos %u %u %u\n", measure, beat, tic); 36 | fflush(stdout); 37 | } 38 | if (cons_isatty && tic == 0) { 39 | snprintf(buf, sizeof(buf), "[%04u:%02u]> ", measure, beat); 40 | el_setprompt(buf); 41 | } 42 | } 43 | 44 | /* 45 | * print song position 46 | */ 47 | void 48 | cons_puttag(char *tag) 49 | { 50 | if (user_flag_verb) { 51 | fprintf(stdout, "+%s\n", tag); 52 | fflush(stdout); 53 | } 54 | } 55 | 56 | /* 57 | * print "+ready" 58 | */ 59 | void 60 | cons_ready(void) 61 | { 62 | if (user_flag_verb) { 63 | fprintf(stdout, "+ready\n"); 64 | fflush(stdout); 65 | } 66 | } 67 | 68 | /* 69 | * follows routines that report user non-fatal errors please use them 70 | * instead of log_xxx (the latter are only for debugging) 71 | */ 72 | 73 | void 74 | cons_err(char *mesg) 75 | { 76 | log_puts(mesg); 77 | log_puts("\n"); 78 | } 79 | 80 | void 81 | cons_errs(char *s, char *mesg) 82 | { 83 | log_puts(s); 84 | log_puts(": "); 85 | log_puts(mesg); 86 | log_puts("\n"); 87 | } 88 | 89 | void 90 | cons_erru(unsigned long u, char *mesg) 91 | { 92 | log_putu(u); 93 | log_puts(": "); 94 | log_puts(mesg); 95 | log_puts("\n"); 96 | } 97 | 98 | void 99 | cons_errss(char *s0, char *s1, char *mesg) 100 | { 101 | log_puts(s0); 102 | log_puts(": "); 103 | log_puts(s1); 104 | log_puts(": "); 105 | log_puts(mesg); 106 | log_puts("\n"); 107 | } 108 | 109 | void 110 | cons_errsu(char *s, unsigned long u, char *mesg) 111 | { 112 | log_puts(s); 113 | log_puts(": "); 114 | log_putu(u); 115 | log_puts(": "); 116 | log_puts(mesg); 117 | log_puts("\n"); 118 | } 119 | 120 | void 121 | cons_erruu(unsigned long u0, unsigned long u1, char *mesg) 122 | { 123 | log_putu(u0); 124 | log_puts(": "); 125 | log_putu(u1); 126 | log_puts(": "); 127 | log_puts(mesg); 128 | log_puts("\n"); 129 | } 130 | -------------------------------------------------------------------------------- /cons.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_CONS_H 18 | #define MIDISH_CONS_H 19 | 20 | #include "tty.h" 21 | 22 | void cons_init(struct el_ops *, void *); 23 | void cons_done(void); 24 | void cons_putpos(unsigned, unsigned, unsigned); 25 | void cons_puttag(char *); 26 | void cons_ready(void); 27 | 28 | void cons_err(char *); 29 | void cons_errs(char *, char *); 30 | void cons_erru(unsigned long, char *); 31 | void cons_errss(char *, char *, char *); 32 | void cons_errsu(char *, unsigned long, char *); 33 | void cons_erruu(unsigned long, unsigned long, char *); 34 | 35 | extern int cons_isatty; 36 | 37 | #endif /* MIDISH_CONS_H */ 38 | -------------------------------------------------------------------------------- /conv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_CONV_H 18 | #define MIDISH_CONV_H 19 | 20 | #include "ev.h" 21 | 22 | #define CONV_NUMREV 4 23 | 24 | /* 25 | * constants to define a set of packed events 26 | */ 27 | #define CONV_XPC (1 << EV_XPC) 28 | #define CONV_NRPN (1 << EV_NRPN) 29 | #define CONV_RPN (1 << EV_RPN) 30 | 31 | struct ev; 32 | struct statelist; 33 | 34 | unsigned conv_packev(struct statelist *, unsigned, unsigned, 35 | struct ev *, struct ev *); 36 | unsigned conv_unpackev(struct statelist *, unsigned, unsigned, 37 | struct ev *, struct ev *); 38 | 39 | #endif /* MIDISH_CONV_H */ 40 | -------------------------------------------------------------------------------- /data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_DATA_H 18 | #define MIDISH_DATA_H 19 | 20 | 21 | #define DATA_MAXNITEMS 4096 22 | 23 | struct name; 24 | 25 | /* 26 | * the following represents a "value" for the interpreter. all types 27 | * use the same strucure 28 | */ 29 | struct data { 30 | #define DATA_NIL 0 31 | #define DATA_LONG 1 32 | #define DATA_STRING 2 33 | #define DATA_REF 3 34 | #define DATA_LIST 4 35 | #define DATA_USER 5 36 | #define DATA_RANGE 6 37 | unsigned type; /* type of the value */ 38 | union { 39 | char *str; /* if string */ 40 | long num; /* if a number */ 41 | struct data *list; /* if a list of values */ 42 | char *ref; /* if a reference (name) */ 43 | void *user; /* user defined */ 44 | struct { /* a range */ 45 | long min; 46 | long max; 47 | } range; 48 | } val; 49 | struct data *next; 50 | }; 51 | 52 | struct data *data_newnil(void); 53 | struct data *data_newlong(long); 54 | struct data *data_newstring(char *); 55 | struct data *data_newref(char *); 56 | struct data *data_newlist(struct data *); 57 | struct data *data_newuser(void *); 58 | struct data *data_newrange(long, long); 59 | void data_delete(struct data *); 60 | void data_setfield(struct data *, char *); 61 | void data_log(struct data *); 62 | void data_listadd(struct data *, struct data *); 63 | void data_listremove(struct data *, struct data *); 64 | struct data *data_listlookup(struct data *, struct name *); 65 | 66 | void data_assign(struct data *, struct data *); 67 | unsigned data_eval(struct data *); 68 | unsigned data_id(struct data *, struct data *); 69 | 70 | unsigned data_not(struct data *); 71 | unsigned data_and(struct data *, struct data *); 72 | unsigned data_or(struct data *, struct data *); 73 | unsigned data_eq(struct data *, struct data *); 74 | unsigned data_neq(struct data *, struct data *); 75 | unsigned data_lt(struct data *, struct data *); 76 | unsigned data_le(struct data *, struct data *); 77 | unsigned data_gt(struct data *, struct data *); 78 | unsigned data_ge(struct data *, struct data *); 79 | unsigned data_add(struct data *, struct data *); 80 | unsigned data_sub(struct data *, struct data *); 81 | unsigned data_neg(struct data *); 82 | unsigned data_mul(struct data *, struct data *); 83 | unsigned data_div(struct data *, struct data *); 84 | unsigned data_mod(struct data *, struct data *); 85 | unsigned data_lshift(struct data *, struct data *); 86 | unsigned data_rshift(struct data *, struct data *); 87 | unsigned data_bitand(struct data *, struct data *); 88 | unsigned data_bitor(struct data *, struct data *); 89 | unsigned data_bitxor(struct data *, struct data *); 90 | unsigned data_bitnot(struct data *); 91 | 92 | #endif /* MIDISH_DATA_H */ 93 | -------------------------------------------------------------------------------- /exec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_EXEC_H 18 | #define MIDISH_EXEC_H 19 | 20 | #include "name.h" 21 | 22 | enum RESULT { 23 | RESULT_ERR = 0, 24 | RESULT_OK, RESULT_BREAK, RESULT_CONTINUE, RESULT_RETURN, RESULT_EXIT 25 | }; 26 | 27 | struct data; 28 | struct var; 29 | struct proc; 30 | struct node; 31 | struct tree; 32 | struct exec; 33 | 34 | /* 35 | * a variable is a (identifier, value) pair 36 | */ 37 | struct var { 38 | struct name name; /* name (identifier) */ 39 | struct data *data; /* value, see data.h */ 40 | }; 41 | 42 | #define VAR_FOREACH(i,list) \ 43 | for (i = (struct var *)(list); \ 44 | i != NULL; \ 45 | i = (struct var *)(i->name.next)) 46 | 47 | 48 | /* 49 | * a procedure is a name, a list of argument names 50 | * and a the actual code (tree) 51 | */ 52 | struct proc { 53 | struct name name; 54 | struct name *args; 55 | struct node *code; 56 | }; 57 | 58 | #define PROC_FOREACH(i,list) \ 59 | for (i = (struct proc *)(list); \ 60 | i != NULL; \ 61 | i = (struct proc *)(i->name.next)) 62 | 63 | /* 64 | * exec is the interpreter's environment 65 | */ 66 | 67 | struct exec { 68 | struct name *globals; /* list of global variables */ 69 | struct name **locals; /* pointer to list of local variables */ 70 | struct name *procs; /* list of user and built-in procs */ 71 | char *procname; /* current proc name, for err messages */ 72 | #define EXEC_MAXDEPTH 40 73 | unsigned depth; /* max depth of nested proc calls */ 74 | unsigned result; /* result of last operation */ 75 | }; 76 | 77 | struct var *var_new(struct name **, char *, struct data *); 78 | void var_delete(struct name **, struct var *); 79 | void var_log(struct var *); 80 | void var_empty(struct name **); 81 | 82 | struct exec *exec_new(void); 83 | void exec_delete(struct exec *); 84 | struct proc *exec_proclookup(struct exec *, char *); 85 | struct var *exec_varlookup(struct exec *, char *); 86 | 87 | void exec_newbuiltin(struct exec *, char *, unsigned (*)(struct exec *, struct data **), struct name *); 88 | void exec_newvar(struct exec *, char *, struct data *); 89 | void exec_dumpprocs(struct exec *); 90 | void exec_dumpvars(struct exec *); 91 | unsigned exec_lookupname(struct exec *, char *, char **); 92 | unsigned exec_lookupstring(struct exec *, char *, char **); 93 | unsigned exec_lookuplong(struct exec *, char *, long *); 94 | unsigned exec_lookuplist(struct exec *, char *, struct data **); 95 | unsigned exec_lookupbool(struct exec *, char *, long *); 96 | 97 | struct proc *proc_new(char *); 98 | void proc_delete(struct proc *); 99 | void proc_empty(struct name **); 100 | void proc_log(struct proc *); 101 | 102 | #endif /* MIDISH_EXEC_H */ 103 | -------------------------------------------------------------------------------- /filt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_FILT_H 18 | #define MIDISH_FILT_H 19 | 20 | #include "ev.h" 21 | 22 | /* 23 | * source against which the input event is matched 24 | */ 25 | struct filtnode { 26 | struct evspec es; /* events handled by this branch */ 27 | struct filtnode *dstlist; /* destinations for this source */ 28 | struct filtnode *next; /* next source in the list */ 29 | union { 30 | struct { 31 | unsigned nweight; 32 | } vel; 33 | struct { 34 | int plus; 35 | } transp; 36 | } u; 37 | }; 38 | 39 | #define FILT_MAXNRULES 32 40 | 41 | struct filt { 42 | struct filtnode *map; /* root of map rules */ 43 | struct filtnode *vcurve; /* root of vcurve rules */ 44 | struct filtnode *transp; /* root of transp rules */ 45 | }; 46 | 47 | unsigned vcurve(unsigned, unsigned); 48 | 49 | void filt_init(struct filt *); 50 | void filt_done(struct filt *); 51 | void filt_reset(struct filt *); 52 | unsigned filt_do(struct filt *, struct ev *, struct ev *); 53 | void filt_mapnew(struct filt *, struct evspec *, struct evspec *); 54 | void filt_mapdel(struct filt *, struct evspec *, struct evspec *); 55 | void filt_chgin(struct filt *, struct evspec *, struct evspec *, int); 56 | void filt_chgout(struct filt *, struct evspec *, struct evspec *, int); 57 | void filt_transp(struct filt *, struct evspec *, int); 58 | void filt_vcurve(struct filt *, struct evspec *, int); 59 | unsigned filt_evcnt(struct filt *, unsigned); 60 | 61 | struct filtnode *filtnode_new(struct evspec *, struct filtnode **); 62 | void filtnode_del(struct filtnode **); 63 | 64 | extern unsigned filt_debug; 65 | 66 | #endif /* MIDISH_FILT_H */ 67 | -------------------------------------------------------------------------------- /frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_FRAME_H 18 | #define MIDISH_FRAME_H 19 | 20 | #include "state.h" 21 | 22 | struct seqptr { 23 | struct statelist statelist; 24 | struct seqptr *link; /* opposite direction seqptr */ 25 | struct seqev *pos; /* next event (current position) */ 26 | unsigned delta; /* tics until the next event */ 27 | unsigned tic; /* absolute tic of the current pos */ 28 | }; 29 | 30 | struct track; 31 | struct evspec; 32 | 33 | void seqptr_pool_init(unsigned); 34 | void seqptr_pool_done(void); 35 | struct seqptr *seqptr_new(struct track *); 36 | void seqptr_del(struct seqptr *); 37 | void seqptr_link(struct seqptr *, struct seqptr *); 38 | int seqptr_eot(struct seqptr *); 39 | struct state *seqptr_evget(struct seqptr *); 40 | struct state *seqptr_evdel(struct seqptr *, struct statelist *); 41 | struct state *seqptr_evput(struct seqptr *, struct ev *); 42 | unsigned seqptr_ticskip(struct seqptr *, unsigned); 43 | unsigned seqptr_ticdel(struct seqptr *, unsigned, 44 | struct statelist *); 45 | void seqptr_ticput(struct seqptr *, unsigned); 46 | unsigned seqptr_skip(struct seqptr *, unsigned); 47 | void seqptr_seek(struct seqptr *, unsigned); 48 | struct state *seqptr_getsign(struct seqptr *, unsigned *, unsigned *); 49 | struct state *seqptr_gettempo(struct seqptr *, unsigned long *); 50 | unsigned seqptr_skipmeasure(struct seqptr *, unsigned); 51 | struct state *seqptr_evmerge1(struct seqptr *, struct state *); 52 | unsigned seqptr_evmerge2(struct seqptr *, 53 | struct statelist *, struct ev *, struct ev *); 54 | 55 | void track_merge(struct track *, struct track *); 56 | unsigned track_findmeasure(struct track *, unsigned); 57 | void track_timeinfo(struct track *, unsigned, unsigned *, 58 | unsigned long *, unsigned *, unsigned *); 59 | void track_settempo(struct track *, unsigned, unsigned); 60 | void track_move(struct track *, unsigned, unsigned, 61 | struct evspec *, struct track *, 62 | unsigned, unsigned); 63 | void track_quantize(struct track *, struct evspec *, 64 | unsigned, unsigned, 65 | unsigned, unsigned, unsigned); 66 | void track_quantize_frame(struct track *, struct evspec *, 67 | unsigned, unsigned, 68 | unsigned, unsigned, unsigned); 69 | void track_prescale(struct track *, unsigned, unsigned); 70 | void track_scale(struct track *, unsigned, unsigned); 71 | void track_transpose(struct track *, unsigned, unsigned, 72 | struct evspec *, int); 73 | void track_evmap(struct track *, unsigned, unsigned, 74 | struct evspec *, struct evspec *, struct evspec *); 75 | void track_vcurve(struct track *, unsigned, unsigned, 76 | struct evspec *, int); 77 | void track_check(struct track *); 78 | void track_rewrite(struct track *); 79 | void track_confev(struct track *, struct ev *); 80 | void track_unconfev(struct track *, struct evspec *); 81 | void track_ins(struct track *, unsigned, unsigned); 82 | void track_cut(struct track *, unsigned, unsigned); 83 | 84 | #endif /* MIDISH_FRAME_H */ 85 | -------------------------------------------------------------------------------- /help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_HELP_H 18 | #define MIDISH_HELP_H 19 | 20 | struct help { 21 | char *key; 22 | char *text; 23 | }; 24 | 25 | extern struct help help_list[]; 26 | 27 | void help_fmt(char *); 28 | 29 | #endif /* MIDISH_HELP_H */ 30 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "utils.h" 21 | #include "str.h" 22 | #include "cons.h" 23 | #include "ev.h" 24 | #include "mux.h" 25 | #include "track.h" 26 | #include "frame.h" 27 | #include "song.h" 28 | #include "user.h" 29 | #include "filt.h" 30 | #include "mididev.h" 31 | #include "defs.h" 32 | #include "sysex.h" 33 | #include "textio.h" 34 | 35 | int 36 | main(int argc, char **argv) 37 | { 38 | int ch; 39 | unsigned exitcode; 40 | 41 | while ((ch = getopt(argc, argv, "bv")) != -1) { 42 | switch (ch) { 43 | case 'b': 44 | user_flag_batch = 1; 45 | break; 46 | case 'v': 47 | user_flag_verb = 1; 48 | break; 49 | default: 50 | goto err; 51 | } 52 | } 53 | argc -= optind; 54 | argv += optind; 55 | if (argc >= 1) { 56 | err: 57 | fputs("usage: midish [-bv]\n", stderr); 58 | return 0; 59 | } 60 | 61 | exitcode = user_mainloop(); 62 | 63 | return exitcode ? 0 : 1; 64 | } 65 | -------------------------------------------------------------------------------- /mdep_raw.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifdef USE_RAW 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "utils.h" 23 | #include "cons.h" 24 | #include "mididev.h" 25 | #include "str.h" 26 | 27 | struct raw { 28 | struct mididev mididev; /* device stuff */ 29 | char *path; /* eg. "/dev/rmidi3" */ 30 | int fd; /* file desc. */ 31 | }; 32 | 33 | void raw_open(struct mididev *); 34 | unsigned raw_read(struct mididev *, unsigned char *, unsigned); 35 | unsigned raw_write(struct mididev *, unsigned char *, unsigned); 36 | unsigned raw_nfds(struct mididev *); 37 | unsigned raw_pollfd(struct mididev *, struct pollfd *, int); 38 | int raw_revents(struct mididev *, struct pollfd *); 39 | void raw_close(struct mididev *); 40 | void raw_del(struct mididev *); 41 | 42 | struct devops raw_ops = { 43 | raw_open, 44 | raw_read, 45 | raw_write, 46 | raw_nfds, 47 | raw_pollfd, 48 | raw_revents, 49 | raw_close, 50 | raw_del 51 | }; 52 | 53 | struct mididev * 54 | raw_new(char *path, unsigned mode) 55 | { 56 | struct raw *dev; 57 | 58 | if (path == NULL) { 59 | cons_err("path must be set for raw devices"); 60 | return NULL; 61 | } 62 | dev = xmalloc(sizeof(struct raw), "raw"); 63 | mididev_init(&dev->mididev, &raw_ops, mode); 64 | dev->path = str_new(path); 65 | return (struct mididev *)&dev->mididev; 66 | } 67 | 68 | void 69 | raw_del(struct mididev *addr) 70 | { 71 | struct raw *dev = (struct raw *)addr; 72 | 73 | mididev_done(&dev->mididev); 74 | str_delete(dev->path); 75 | xfree(dev); 76 | } 77 | 78 | void 79 | raw_open(struct mididev *addr) 80 | { 81 | struct raw *dev = (struct raw *)addr; 82 | int mode; 83 | 84 | if (dev->mididev.mode == MIDIDEV_MODE_IN) { 85 | mode = O_RDONLY; 86 | } else if (dev->mididev.mode == MIDIDEV_MODE_OUT) { 87 | mode = O_WRONLY; 88 | } else if (dev->mididev.mode == (MIDIDEV_MODE_IN | MIDIDEV_MODE_OUT)) { 89 | mode = O_RDWR; 90 | } else { 91 | log_puts("raw_open: not allowed mode\n"); 92 | panic(); 93 | mode = 0; 94 | } 95 | dev->fd = open(dev->path, mode, 0666); 96 | if (dev->fd < 0) { 97 | log_perror(dev->path); 98 | dev->mididev.eof = 1; 99 | return; 100 | } 101 | } 102 | 103 | void 104 | raw_close(struct mididev *addr) 105 | { 106 | struct raw *dev = (struct raw *)addr; 107 | 108 | if (dev->fd < 0) 109 | return; 110 | (void)close(dev->fd); 111 | dev->fd = -1; 112 | } 113 | 114 | unsigned 115 | raw_read(struct mididev *addr, unsigned char *buf, unsigned count) 116 | { 117 | struct raw *dev = (struct raw *)addr; 118 | ssize_t res; 119 | 120 | res = read(dev->fd, buf, count); 121 | if (res < 0) { 122 | log_perror(dev->path); 123 | dev->mididev.eof = 1; 124 | return 0; 125 | } 126 | return res; 127 | } 128 | 129 | unsigned 130 | raw_write(struct mididev *addr, unsigned char *buf, unsigned count) 131 | { 132 | struct raw *dev = (struct raw *)addr; 133 | ssize_t res; 134 | 135 | res = write(dev->fd, buf, count); 136 | if (res < 0) { 137 | log_perror(dev->path); 138 | dev->mididev.eof = 1; 139 | return 0; 140 | } 141 | return res; 142 | } 143 | 144 | unsigned 145 | raw_nfds(struct mididev *addr) 146 | { 147 | return 1; 148 | } 149 | 150 | unsigned 151 | raw_pollfd(struct mididev *addr, struct pollfd *pfd, int events) 152 | { 153 | struct raw *dev = (struct raw *)addr; 154 | 155 | pfd->fd = dev->fd; 156 | pfd->events = events; 157 | pfd->revents = 0; 158 | return 1; 159 | } 160 | 161 | int 162 | raw_revents(struct mididev *addr, struct pollfd *pfd) 163 | { 164 | return pfd->revents; 165 | } 166 | #endif 167 | -------------------------------------------------------------------------------- /mdep_sndio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifdef USE_SNDIO 17 | #include 18 | #include 19 | #include "utils.h" 20 | #include "cons.h" 21 | #include "mididev.h" 22 | #include "str.h" 23 | 24 | struct sndio { 25 | struct mididev mididev; /* device stuff */ 26 | struct mio_hdl *hdl; /* sndio handle */ 27 | char *path; /* eg. "/dev/rmidi3" */ 28 | }; 29 | 30 | void sndio_open(struct mididev *); 31 | unsigned sndio_read(struct mididev *, unsigned char *, unsigned); 32 | unsigned sndio_write(struct mididev *, unsigned char *, unsigned); 33 | unsigned sndio_nfds(struct mididev *); 34 | unsigned sndio_pollfd(struct mididev *, struct pollfd *, int); 35 | int sndio_revents(struct mididev *, struct pollfd *); 36 | void sndio_close(struct mididev *); 37 | void sndio_del(struct mididev *); 38 | 39 | struct devops sndio_ops = { 40 | sndio_open, 41 | sndio_read, 42 | sndio_write, 43 | sndio_nfds, 44 | sndio_pollfd, 45 | sndio_revents, 46 | sndio_close, 47 | sndio_del 48 | }; 49 | 50 | struct mididev * 51 | sndio_new(char *path, unsigned mode) 52 | { 53 | struct sndio *dev; 54 | 55 | if (path == NULL) { 56 | cons_err("path must be set for raw devices"); 57 | return NULL; 58 | } 59 | dev = xmalloc(sizeof(struct sndio), "sndio"); 60 | mididev_init(&dev->mididev, &sndio_ops, mode); 61 | dev->path = str_new(path); 62 | return (struct mididev *)&dev->mididev; 63 | } 64 | 65 | void 66 | sndio_del(struct mididev *addr) 67 | { 68 | struct sndio *dev = (struct sndio *)addr; 69 | 70 | mididev_done(&dev->mididev); 71 | str_delete(dev->path); 72 | xfree(dev); 73 | } 74 | 75 | void 76 | sndio_open(struct mididev *addr) 77 | { 78 | struct sndio *dev = (struct sndio *)addr; 79 | int mode = 0; 80 | 81 | if (dev->mididev.mode & MIDIDEV_MODE_OUT) 82 | mode |= MIO_OUT; 83 | if (dev->mididev.mode & MIDIDEV_MODE_IN) 84 | mode |= MIO_IN; 85 | dev->hdl = mio_open(dev->path, mode, 0); 86 | if (dev->hdl == NULL) { 87 | log_puts("sndio_open: "); 88 | log_puts(dev->path); 89 | log_puts(": failed to open device\n"); 90 | dev->mididev.eof = 1; 91 | return; 92 | } 93 | } 94 | 95 | void 96 | sndio_close(struct mididev *addr) 97 | { 98 | struct sndio *dev = (struct sndio *)addr; 99 | 100 | if (dev->hdl == NULL) 101 | return; 102 | mio_close(dev->hdl); 103 | dev->hdl = NULL; 104 | } 105 | 106 | unsigned 107 | sndio_read(struct mididev *addr, unsigned char *buf, unsigned count) 108 | { 109 | struct sndio *dev = (struct sndio *)addr; 110 | size_t res; 111 | 112 | res = mio_read(dev->hdl, buf, count); 113 | if (res == 0 && mio_eof(dev->hdl)) { 114 | log_puts("sndio_read: "); 115 | log_puts(dev->path); 116 | log_puts(": read failed\n"); 117 | dev->mididev.eof = 1; 118 | return 0; 119 | } 120 | return res; 121 | } 122 | 123 | unsigned 124 | sndio_write(struct mididev *addr, unsigned char *buf, unsigned count) 125 | { 126 | struct sndio *dev = (struct sndio *)addr; 127 | size_t res; 128 | 129 | res = mio_write(dev->hdl, buf, count); 130 | if (res < count) { 131 | log_puts("sndio_write: "); 132 | log_puts(dev->path); 133 | log_puts(": short write\n"); 134 | dev->mididev.eof = 1; 135 | return 0; 136 | } 137 | return res; 138 | } 139 | 140 | unsigned 141 | sndio_nfds(struct mididev *addr) 142 | { 143 | struct sndio *dev = (struct sndio *)addr; 144 | 145 | return mio_nfds(dev->hdl); 146 | } 147 | 148 | unsigned 149 | sndio_pollfd(struct mididev *addr, struct pollfd *pfd, int events) 150 | { 151 | struct sndio *dev = (struct sndio *)addr; 152 | 153 | return mio_pollfd(dev->hdl, pfd, events); 154 | } 155 | 156 | int 157 | sndio_revents(struct mididev *addr, struct pollfd *pfd) 158 | { 159 | struct sndio *dev = (struct sndio *)addr; 160 | 161 | return mio_revents(dev->hdl, pfd); 162 | } 163 | #endif 164 | -------------------------------------------------------------------------------- /metro.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #include "utils.h" 18 | #include "mux.h" 19 | #include "metro.h" 20 | #include "song.h" 21 | 22 | void metro_tocb(void *); 23 | 24 | /* 25 | * initialize the metronome with some defaults 26 | */ 27 | void 28 | metro_init(struct metro *o) 29 | { 30 | o->mode = 0; 31 | o->mask = (1 << SONG_REC); 32 | o->hi.cmd = EV_NON; 33 | o->hi.dev = DEFAULT_METRO_DEV; 34 | o->hi.ch = DEFAULT_METRO_CHAN; 35 | o->hi.note_num = DEFAULT_METRO_HI_NOTE; 36 | o->hi.note_vel = DEFAULT_METRO_HI_VEL; 37 | o->lo.cmd = EV_NON; 38 | o->lo.dev = DEFAULT_METRO_DEV; 39 | o->lo.ch = DEFAULT_METRO_CHAN; 40 | o->lo.note_num = DEFAULT_METRO_LO_NOTE; 41 | o->lo.note_vel = DEFAULT_METRO_LO_VEL; 42 | o->ev = NULL; 43 | timo_set(&o->to, metro_tocb, o); 44 | } 45 | 46 | /* 47 | * free the metronome 48 | */ 49 | void 50 | metro_done(struct metro *o) 51 | { 52 | /* nothing for now */ 53 | } 54 | 55 | /* 56 | * callback that sends the note-off event of the click 57 | */ 58 | void 59 | metro_tocb(void *addr) 60 | { 61 | struct metro *o = (struct metro *)addr; 62 | struct ev ev; 63 | 64 | if (o->ev == NULL) { 65 | log_puts("metro_tocb: no click sounding\n"); 66 | panic(); 67 | } 68 | ev.cmd = EV_NOFF; 69 | ev.dev = o->ev->dev; 70 | ev.ch = o->ev->ch; 71 | ev.note_num = o->ev->note_num; 72 | ev.note_vel = EV_NOFF_DEFAULTVEL; 73 | mux_putev(&ev); 74 | o->ev = NULL; 75 | } 76 | 77 | /* 78 | * if the position pointer is on the first tic 79 | * of a beat then send a "click" to the midi output 80 | * note: the output is not flushed 81 | */ 82 | void 83 | metro_tic(struct metro *o, unsigned beat, unsigned tic) 84 | { 85 | if ((o->mask & (1 << o->mode)) && tic == 0) { 86 | /* 87 | * if the last metronome click is sounding 88 | * abord the timeout and stop the click 89 | */ 90 | if (o->ev) { 91 | log_puts("metro_tic: nested clicks\n"); 92 | timo_del(&o->to); 93 | metro_tocb(o); 94 | } 95 | if (beat == 0) { 96 | o->ev = &o->hi; 97 | } else { 98 | o->ev = &o->lo; 99 | } 100 | mux_putev(o->ev); 101 | /* 102 | * schedule the corrsponding note off in 30ms 103 | */ 104 | timo_add(&o->to, DEFAULT_METRO_CLICKLEN); 105 | } 106 | } 107 | 108 | /* 109 | * send the note off event of the click (if any) 110 | */ 111 | void 112 | metro_shut(struct metro *o) 113 | { 114 | if (o->ev) { 115 | timo_del(&o->to); 116 | metro_tocb(o); 117 | } 118 | } 119 | 120 | /* 121 | * set the mode of the metronome 122 | */ 123 | void 124 | metro_setmode(struct metro *o, unsigned mode) 125 | { 126 | if ((o->mask & (1 << o->mode)) && !(o->mask & (1 << mode))) 127 | metro_shut(o); 128 | o->mode = mode; 129 | } 130 | 131 | /* 132 | * change the current mask 133 | */ 134 | void 135 | metro_setmask(struct metro *o, unsigned mask) 136 | { 137 | if ((o->mask & (1 << o->mode)) && !(mask & (1 << o->mode))) 138 | metro_shut(o); 139 | o->mask = mask; 140 | } 141 | 142 | unsigned 143 | metro_str2mask(struct metro *o, char *mstr, unsigned *rmask) 144 | { 145 | unsigned mask; 146 | 147 | if (str_eq(mstr, "on")) { 148 | mask = (1 << SONG_PLAY) + (1 << SONG_REC); 149 | } else if (str_eq(mstr, "rec")) { 150 | mask = (1 << SONG_REC); 151 | } else if (str_eq(mstr, "off")) { 152 | mask = 0; 153 | } else { 154 | return 0; 155 | } 156 | *rmask = mask; 157 | return 1; 158 | } 159 | 160 | -------------------------------------------------------------------------------- /metro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_METRO_H 18 | #define MIDISH_METRO_H 19 | 20 | #include "ev.h" 21 | #include "timo.h" 22 | 23 | struct metro { 24 | unsigned mode; /* same as song->mode */ 25 | unsigned mask; /* enabled if (mask | mode) != 0 */ 26 | struct ev hi, lo; /* high and low click note-on events */ 27 | struct ev *ev; /* event currently sounding (or NULL) */ 28 | struct timo to; /* timeout for the noteoff */ 29 | }; 30 | 31 | void metro_init(struct metro *); 32 | void metro_done(struct metro *); 33 | void metro_tic(struct metro *, unsigned, unsigned); 34 | void metro_shut(struct metro *); 35 | void metro_setmode(struct metro *, unsigned); 36 | void metro_setmask(struct metro *, unsigned); 37 | unsigned metro_str2mask(struct metro *, char *, unsigned *); 38 | 39 | #endif /* MIDISH_METRO_H */ 40 | -------------------------------------------------------------------------------- /midish.1: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright (c) 2003-2010 Alexandre Ratchov 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this software for any 5 | .\" purpose with or without fee is hereby granted, provided that the above 6 | .\" copyright notice and this permission notice appear in all copies. 7 | .\" 8 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | .\" 16 | .Dd June 25, 2006 17 | .Dt MIDISH 1 18 | .Os 19 | .Sh NAME 20 | .Nm midish 21 | .Nd MIDI sequencer and filter 22 | .Sh SYNOPSIS 23 | .Nm midish 24 | .Op Fl bhv 25 | .Sh DESCRIPTION 26 | Midish is a MIDI sequencer/filter implemented as an interactive 27 | command-line interpreter. 28 | It supports: 29 | .Pp 30 | .Bl -bullet -offset indent -compact 31 | .It 32 | Multiple MIDI devices handling 33 | .It 34 | Synchronisation to external MIDI devices 35 | .It 36 | Filtering/routing (controller mapping, keyboard splitting, ...) 37 | .It 38 | Track recording, editing, quantisation 39 | .It 40 | Import and export of standard MIDI files 41 | .It 42 | Tempo and time-signature changes, user configurable metronome 43 | .It 44 | System exclusive messages handling 45 | .El 46 | .Pp 47 | The options are as follows: 48 | .Bl -tag -width Ds 49 | .It Fl b 50 | Do not process 51 | .Pa "$HOME/.midishrc" 52 | or 53 | .Pa "/etc/midishrc" 54 | and stop on the first error on the standard input. 55 | Useful for scripting. 56 | .It Fl h 57 | Print usage information. 58 | .It Fl v 59 | Print additional info before each line of input, useful to 60 | front-ends and for debugging. 61 | .El 62 | .Pp 63 | Once midish started, the interpreter 64 | processes the 65 | .Pa "$HOME/.midishrc" 66 | file (or 67 | .Pa "/etc/midishrc" 68 | if the latter doesn't exist) 69 | and starts prompting for commands. 70 | For further information about the syntax of 71 | .Nm 72 | refer to the 73 | .Dq Midish user's manual . 74 | .Sh FILES 75 | .Bl -tag -width "$HOME/.midishrc" -compact 76 | .It Pa "$HOME/.midishrc" 77 | startup script 78 | .It Pa "/etc/midishrc" 79 | startup script (if 80 | .Pa "$HOME/.midishrc" 81 | doesn't exist) 82 | .El 83 | .Sh SEE ALSO 84 | .Xr midiplay 1 , 85 | .Xr smfplay 1 , 86 | .Xr midi 4 87 | .Pp 88 | .Lk http://www.midish.org/manual.html User's manual and tutorial 89 | -------------------------------------------------------------------------------- /midishrc: -------------------------------------------------------------------------------- 1 | # 2 | # midi devices config 3 | # 4 | #dnew 0 "/dev/rmidi4" rw 5 | #dnew 1 "/dev/rmidi3" rw 6 | # 7 | # 8 | 9 | 10 | # 11 | # function to make the current filter drop controller number ``ictl'' 12 | # on the current input 13 | # 14 | proc ctldrop ctlno { 15 | for i in [ilist] { 16 | fmap {ctl $i $ctlno} {none} 17 | } 18 | } 19 | 20 | 21 | # 22 | # function to make the current filter route controller number ``ictl'' 23 | # on the current input to controller ``octl'' on the current output 24 | # 25 | proc ctlmap ic oc { 26 | for i in [ilist] { 27 | fmap {ctl $i $ic} {ctl [getc] $oc} 28 | } 29 | } 30 | 31 | # 32 | # unmute all tracks 33 | # 34 | proc nomute { 35 | for i in [tlist] { 36 | unmute $i 37 | } 38 | } 39 | 40 | # 41 | # mute all tracks but current 42 | # 43 | proc solo { 44 | for i in [tlist] { 45 | mute $i 46 | } 47 | unmute [gett] 48 | } 49 | 50 | # 51 | # function to add a sysex that turns on general midi 52 | # 53 | proc gmon devnum { 54 | xnew gmon 55 | xadd $devnum { 0xF0 0x7E 0x7F 0x09 0x01 0xF7 } 56 | } 57 | 58 | # 59 | # function to set program number of the current output to th given 60 | # general midi program number 61 | # 62 | proc gmp patch { 63 | oaddev { pc [geto] ($patch - 1) } 64 | } 65 | 66 | # 67 | # set volume (controller number 7) of the current output 68 | # 69 | proc vol val { 70 | oaddev {ctl [geto] 7 $val} 71 | } 72 | 73 | # 74 | # set pan (controller number 10) of the current output 75 | # 76 | proc pan val { 77 | oaddev {ctl [geto] 10 $val} 78 | } 79 | 80 | # 81 | # set reverb (controller number 91) of the current output 82 | # 83 | proc reverb val { 84 | oaddev {ctl [geto] 91 $val}; 85 | } 86 | 87 | # 88 | # set chorus (controller number 93) of the current output 89 | # 90 | proc chorus val { 91 | oaddev {ctl [geto] 93 $val}; 92 | } 93 | 94 | # 95 | # set RPN to the given value for the current output 96 | # 97 | proc rpn addr val { 98 | oaddev {rpn [geto] $addr $val} 99 | } 100 | 101 | # 102 | # set NRPN to the given value for the current output 103 | # 104 | proc nrpn addr val { 105 | oaddev {nrpn [geto] $addr $val} 106 | } 107 | 108 | # 109 | # XV-2020 specific macros 110 | # 111 | # configures a instrument with the given bank/patch or bank rhythm 112 | # bank 0,1,2,3 corresponds to preset A, B, C and D 113 | # patches/rhythms are counted from 0 to 127 114 | # 115 | proc xvp bank patch { 116 | oaddev { xpc [geto] ($patch) (11200 + $bank) } 117 | } 118 | proc xvr bank patch { 119 | oaddev { xpc [geto] ($patch) (11072 + $bank) } 120 | } 121 | 122 | # 123 | # generate a sysex message that set parameter on 124 | # address (a0,a1,a2,a3) to val 125 | # 126 | proc xvparam a0 a1 a2 a3 val { 127 | return { \ 128 | 0xf0 0x41 0x7f 0x00 0x10 0x12 $a0 $a1 $a2 $a3 $val \ 129 | 128 - ($a0 + $a1 + $a2 + $a3 + $val) % 128 \ 130 | 0xf7 } 131 | } 132 | 133 | -------------------------------------------------------------------------------- /mixout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_MIXOUT_H 18 | #define MIDISH_MIXOUT_H 19 | 20 | #include "state.h" 21 | #include "timo.h" 22 | 23 | void mixout_start(void); 24 | void mixout_stop(void); 25 | void mixout_putev(struct ev *, unsigned); 26 | 27 | extern unsigned mixout_debug; 28 | 29 | #endif /* MIDISH_FILT_H */ 30 | -------------------------------------------------------------------------------- /mux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_MUX_H 18 | #define MIDISH_MUX_H 19 | 20 | #define MUX_STARTWAIT 0 /* waiting for a start event */ 21 | #define MUX_START 1 /* just got a start */ 22 | #define MUX_FIRST 2 /* just got the first tic */ 23 | #define MUX_NEXT 3 /* just got the next tic */ 24 | #define MUX_STOP 4 /* nothing to do */ 25 | 26 | #define MUX_LINESIZE 1024 27 | 28 | struct ev; 29 | struct sysex; 30 | 31 | /* 32 | * modules are chained as follows: mux -> norm -> filt -> song -> output 33 | * each module calls call-backs of the next module of the chain. In 34 | * theory we should use function pointers to "connect" modules to 35 | * each other... 36 | * 37 | * But since connection between various modules are hardcoded and not 38 | * user configurable, we don't use function pointers and other 39 | * over-engineered stuff. We just call the following call-backs. We 40 | * save 3 layers of indirection 41 | */ 42 | struct song; 43 | extern struct song *usong; 44 | extern unsigned mux_isopen; 45 | extern unsigned mux_manualstart; 46 | extern unsigned long mux_wallclock; 47 | 48 | void song_startcb(struct song *); 49 | void song_stopcb(struct song *); 50 | void song_movecb(struct song *); 51 | void song_evcb(struct song *, struct ev *); 52 | void song_sysexcb(struct song *, struct sysex *); 53 | unsigned song_gotocb(struct song *, int, unsigned); 54 | 55 | struct norm; 56 | void norm_evcb(struct ev *); 57 | 58 | struct filt; 59 | void filt_evcb(struct filt *, struct ev *); 60 | 61 | /* 62 | * public functions usable in the rest of the code to send/receive 63 | * events and to manipulate the clock 64 | */ 65 | void mux_open(void); 66 | void mux_close(void); 67 | void mux_run(void); 68 | void mux_sleep(unsigned); 69 | void mux_flush(void); 70 | void mux_shut(void); 71 | void mux_putev(struct ev *); 72 | void mux_sendraw(unsigned, unsigned char *, unsigned); 73 | unsigned mux_getphase(void); 74 | struct sysex *mux_getsysex(void); 75 | void mux_chgtempo(unsigned long); 76 | void mux_chgticrate(unsigned); 77 | void mux_startreq(int); 78 | void mux_stopreq(void); 79 | void mux_gotoreq(unsigned); 80 | int mux_mdep_wait(int); /* XXX: hide this prototype */ 81 | 82 | /* 83 | * call-backs called by midi device drivers 84 | */ 85 | void mux_timercb(unsigned long); 86 | void mux_startcb(void); 87 | void mux_stopcb(void); 88 | void mux_ticcb(void); 89 | void mux_ackcb(unsigned); 90 | void mux_evcb(unsigned, struct ev *); 91 | void mux_sysexcb(unsigned, struct sysex *); 92 | void mux_errorcb(unsigned); 93 | 94 | void mux_mtcstart(unsigned); 95 | void mux_mtctick(unsigned); 96 | void mux_mtcstop(void); 97 | 98 | #endif /* MIDISH_MUX_H */ 99 | -------------------------------------------------------------------------------- /name.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /* 18 | * name is a singly-linked list of strings 19 | */ 20 | 21 | #include "utils.h" 22 | #include "name.h" 23 | 24 | void 25 | name_init(struct name *o, char *name) 26 | { 27 | o->str = str_new(name); 28 | } 29 | 30 | void 31 | name_done(struct name *o) 32 | { 33 | str_delete(o->str); 34 | } 35 | 36 | struct name * 37 | name_new(char *name) 38 | { 39 | struct name *o; 40 | 41 | o = xmalloc(sizeof(struct name), "name"); 42 | name_init(o, name); 43 | return o; 44 | } 45 | 46 | struct name * 47 | name_newarg(char *name, struct name *next) 48 | { 49 | struct name *o; 50 | o = name_new(name); 51 | o->next = next; 52 | return o; 53 | } 54 | 55 | void 56 | name_delete(struct name *o) 57 | { 58 | name_done(o); 59 | xfree(o); 60 | } 61 | 62 | void 63 | name_log(struct name *o) 64 | { 65 | for (; o != NULL; o = o->next) { 66 | str_log(o->str); 67 | if (o->next) { 68 | log_puts("."); 69 | } 70 | } 71 | } 72 | 73 | void 74 | name_insert(struct name **first, struct name *i) 75 | { 76 | i->next = *first; 77 | *first = i; 78 | } 79 | 80 | void 81 | name_add(struct name **first, struct name *v) 82 | { 83 | struct name **i; 84 | 85 | i = first; 86 | while (*i != NULL) { 87 | i = &(*i)->next; 88 | } 89 | v->next = NULL; 90 | *i = v; 91 | } 92 | 93 | void 94 | name_remove(struct name **first, struct name *v) 95 | { 96 | struct name **i; 97 | 98 | i = first; 99 | while (*i != NULL) { 100 | if (*i == v) { 101 | *i = v->next; 102 | v->next = NULL; 103 | return; 104 | } 105 | i = &(*i)->next; 106 | } 107 | log_puts("name_remove: not found\n"); 108 | panic(); 109 | } 110 | 111 | void 112 | name_empty(struct name **first) 113 | { 114 | struct name *i, *inext; 115 | 116 | for (i = *first; i != NULL; i = inext) { 117 | inext = i->next; 118 | name_delete(i); 119 | } 120 | *first = NULL; 121 | } 122 | 123 | void 124 | name_cat(struct name **dst, struct name **src) 125 | { 126 | while (*dst != NULL) { 127 | dst = &(*dst)->next; 128 | } 129 | while (*src != NULL) { 130 | *dst = name_new((*src)->str); 131 | dst = &(*dst)->next; 132 | src = &(*src)->next; 133 | } 134 | } 135 | 136 | unsigned 137 | name_eq(struct name **first1, struct name **first2) 138 | { 139 | struct name *n1 = *first1, *n2 = *first2; 140 | 141 | for (;;) { 142 | if (n1 == NULL && n2 == NULL) { 143 | return 1; 144 | } else if (n1 == NULL || n2 == NULL || !str_eq(n1->str, n2->str)) { 145 | return 0; 146 | } 147 | n1 = n1->next; 148 | n2 = n2->next; 149 | } 150 | } 151 | 152 | struct name * 153 | name_lookup(struct name **first, char *str) 154 | { 155 | struct name *i; 156 | 157 | for (i = *first; i != NULL; i = i->next) { 158 | if (i->str == NULL) 159 | continue; 160 | if (str_eq(i->str, str)) 161 | return i; 162 | } 163 | return 0; 164 | } 165 | -------------------------------------------------------------------------------- /name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_NAME_H 18 | #define MIDISH_NAME_H 19 | 20 | #include "str.h" 21 | 22 | /* 23 | * a name is an entry in a simple list of strings the string buffer is 24 | * owned by the name, so it need not to be allocated if name_xxx 25 | * routines are used 26 | */ 27 | struct name { 28 | char *str; 29 | struct name *next; 30 | }; 31 | 32 | void name_init(struct name *, char *); 33 | void name_done(struct name *); 34 | struct name *name_new(char *); 35 | struct name *name_newarg(char *, struct name *); 36 | void name_log(struct name *); 37 | void name_delete(struct name *); 38 | void name_insert(struct name **, struct name *); 39 | void name_add(struct name **, struct name *); 40 | void name_remove(struct name **, struct name *); 41 | void name_empty(struct name **); 42 | void name_cat(struct name **, struct name **); 43 | unsigned name_eq(struct name **, struct name **); 44 | struct name *name_lookup(struct name **, char *); 45 | 46 | #endif /* MIDISH_NAME_H */ 47 | -------------------------------------------------------------------------------- /node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_NODE_H 18 | #define MIDISH_NODE_H 19 | 20 | struct node; 21 | struct node_vmt; 22 | struct exec; 23 | 24 | struct node { 25 | struct node_vmt *vmt; 26 | struct data *data; 27 | struct node *next, *list; 28 | }; 29 | 30 | struct node_vmt { 31 | char *name; 32 | unsigned (*exec)(struct node *, struct exec *, struct data **); 33 | }; 34 | 35 | struct node *node_new(struct node_vmt *, struct data *); 36 | void node_delete(struct node *); 37 | void node_log(struct node *, unsigned); 38 | void node_insert(struct node **, struct node *); 39 | void node_replace(struct node **, struct node *); 40 | unsigned node_exec(struct node *, struct exec *, struct data **); 41 | 42 | 43 | extern struct node_vmt 44 | node_vmt_proc, node_vmt_slist, 45 | node_vmt_call, node_vmt_elist, node_vmt_builtin, 46 | node_vmt_cst, node_vmt_var, node_vmt_list, node_vmt_range, 47 | node_vmt_eq, node_vmt_neq, node_vmt_le, 48 | node_vmt_lt, node_vmt_ge, node_vmt_gt, 49 | node_vmt_ignore, node_vmt_if, node_vmt_for, 50 | node_vmt_return, node_vmt_exit, node_vmt_assign, node_vmt_nop, 51 | node_vmt_and, node_vmt_or, node_vmt_not, 52 | node_vmt_neg, node_vmt_add, node_vmt_sub, 53 | node_vmt_mul, node_vmt_div, node_vmt_mod, 54 | node_vmt_lshift, node_vmt_rshift, 55 | node_vmt_bitand, node_vmt_bitor, node_vmt_bitxor, node_vmt_bitnot; 56 | 57 | #endif /* MIDISH_NODE_H */ 58 | -------------------------------------------------------------------------------- /norm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_NORM_H 18 | #define MIDISH_NORM_H 19 | 20 | #define NORM_MAXEV 1 /* max events per time slice */ 21 | 22 | struct filt; 23 | struct ev; 24 | 25 | void norm_start(void); 26 | void norm_shut(void); 27 | void norm_stop(void); 28 | void norm_putev(struct ev *); 29 | 30 | void norm_evcb(struct ev *); 31 | void norm_timercb(void); 32 | 33 | extern unsigned norm_debug; 34 | 35 | #endif /* MIDISH_NORM_H */ 36 | -------------------------------------------------------------------------------- /parse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifndef MIDISH_PARSE_H 17 | #define MIDISH_PARSE_H 18 | 19 | enum TOK_ID { 20 | TOK_EOF = 1, TOK_ERR, 21 | /* data */ 22 | TOK_IDENT, TOK_NUM, TOK_STRING, 23 | /* operators */ 24 | TOK_ASSIGN, 25 | TOK_PLUS, TOK_MINUS, TOK_STAR, TOK_SLASH, TOK_PCT, 26 | TOK_LSHIFT, TOK_RSHIFT, TOK_BITAND, TOK_BITOR, TOK_BITXOR, TOK_TILDE, 27 | TOK_EQ, TOK_NEQ, TOK_GE, TOK_GT, TOK_LE, TOK_LT, 28 | TOK_EXCLAM, TOK_AND, TOK_OR, 29 | TOK_LPAR, TOK_RPAR, TOK_LBRACE, TOK_RBRACE, TOK_LBRACKET, TOK_RBRACKET, 30 | TOK_COMMA, TOK_DOT, TOK_SEMICOLON, TOK_COLON, TOK_RANGE, TOK_ELLIPSIS, 31 | TOK_AT, TOK_DOLLAR, TOK_ENDLINE, 32 | /* keywords */ 33 | TOK_IF, TOK_ELSE, TOK_WHILE, TOK_DO, TOK_FOR, TOK_IN, 34 | TOK_PROC, TOK_LET, TOK_RETURN, TOK_EXIT, TOK_NIL 35 | }; 36 | 37 | #define IDENT_MAXSZ 32 38 | #define STRING_MAXSZ 1024 39 | 40 | #define IS_SPACE(c) ((c) == ' ' || (c) == '\r' || (c) == '\t') 41 | #define IS_PRINTABLE(c) ((c) >= ' ' && (c) != 0x7f) 42 | #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') 43 | #define IS_ALPHA(c) (((c) >= 'A' && (c) <= 'Z') || \ 44 | ((c) >= 'a' && (c) <= 'z')) 45 | #define IS_IDFIRST(c) (IS_ALPHA(c) || (c) == '_') 46 | #define IS_IDNEXT(c) (IS_IDFIRST(c) || IS_DIGIT(c)) 47 | #define IS_QUOTE(c) ((c) == '"') 48 | 49 | 50 | struct node; 51 | struct exec; 52 | 53 | struct pst { 54 | unsigned pstate; /* backup of pstate */ 55 | struct node **pnode; /* backup of node */ 56 | }; 57 | 58 | struct parse { 59 | /* 60 | * lexical analyser 61 | */ 62 | unsigned lstate; 63 | unsigned base; 64 | unsigned opindex; 65 | unsigned used; 66 | void (*tokcb)(void *, unsigned, unsigned long); 67 | void *tokarg; 68 | char buf[STRING_MAXSZ]; 69 | unsigned line, col; 70 | char *filename; 71 | 72 | /* 73 | * parser 74 | */ 75 | #define PARSE_STACKLEN 64 76 | struct pst stack[PARSE_STACKLEN]; 77 | struct pst *sp; 78 | struct node *root; /* root of the tree */ 79 | struct exec *exec; 80 | void (*cb)(struct exec *, struct node *); 81 | }; 82 | 83 | void lex_init(struct parse *, char *, 84 | void (*)(void *, unsigned, unsigned long), void *); 85 | void lex_done(struct parse *); 86 | void lex_handle(struct parse *, int); 87 | void lex_toklog(unsigned, unsigned long); 88 | 89 | void parse_init(struct parse *, 90 | struct exec *, void (*)(struct exec *, struct node *)); 91 | void parse_done(struct parse *); 92 | void parse_cb(void *, unsigned, unsigned long); 93 | 94 | #endif /* !defined(MIDISH_PARSE_H) */ 95 | -------------------------------------------------------------------------------- /pool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_POOL_H 18 | #define MIDISH_POOL_H 19 | 20 | /* 21 | * entry from the pool. Any real pool entry is cast to this structure 22 | * by the pool code. The actual size of a pool entry is in 'itemsize' 23 | * field of the pool structure 24 | */ 25 | struct poolent { 26 | struct poolent *next; 27 | }; 28 | 29 | /* 30 | * the pool is a linked list of 'itemnum' blocks of size 31 | * 'itemsize'. The pool name is for debugging prurposes only 32 | */ 33 | struct pool { 34 | unsigned char *data; /* memory block of the pool */ 35 | struct poolent *first; /* head of linked list */ 36 | #ifdef POOL_DEBUG 37 | unsigned maxused; /* max pool usage */ 38 | unsigned used; /* current pool usage */ 39 | unsigned newcnt; /* current items allocated */ 40 | #endif 41 | unsigned itemnum; /* total number of entries */ 42 | unsigned itemsize; /* size of a sigle entry */ 43 | char *name; /* name of the pool */ 44 | }; 45 | 46 | void pool_init(struct pool *, char *, unsigned, unsigned); 47 | void pool_done(struct pool *); 48 | 49 | void *pool_new(struct pool *); 50 | void pool_del(struct pool *, void *); 51 | 52 | #endif /* MIDISH_POOL_H */ 53 | -------------------------------------------------------------------------------- /regress/bad1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | kat {0 0} 65 64 6 | 96 7 | kat {0 0} 65 65 8 | 48 9 | non {0 0} 65 66 10 | 48 11 | kat {0 0} 65 67 12 | 48 13 | kat {0 0} 65 68 14 | 48 15 | 16 | 17 | non {0 0} 65 69 18 | 48 19 | noff {0 0} 65 70 20 | 48 21 | 22 | 23 | 24 | 25 | 26 | 27 | noff {0 0} 65 71 28 | 29 | 48 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /regress/bank.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | ctl {0 0} 0 65 6 | 48 7 | 8 | 48 9 | ctl {0 0} 32 66 10 | 48 11 | 12 | 48 13 | pc {0 0} 67 14 | 48 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /regress/bend1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | 48 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /regress/bend2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/bend_e1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | bend {0 0} 0 64 7 | } 8 | } 9 | songtrk t { 10 | track { 11 | 96 12 | 96 13 | bend {0 0} 0 100 14 | 96 15 | 96 16 | bend {0 0} 0 124 17 | 96 18 | bend {0 0} 0 64 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /regress/bend_e2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | 96 7 | bend {0 0} 0 64 8 | } 9 | } 10 | songtrk t { 11 | track { 12 | 96 13 | 96 14 | bend {0 0} 0 100 15 | 96 16 | 96 17 | bend {0 0} 0 124 18 | 96 19 | bend {0 0} 0 64 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /regress/bend_e3.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | 96 7 | 96 8 | bend {0 0} 0 64 9 | } 10 | } 11 | songtrk t { 12 | track { 13 | 96 14 | 96 15 | bend {0 0} 0 100 16 | 96 17 | 96 18 | bend {0 0} 0 124 19 | 96 20 | bend {0 0} 0 64 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /regress/bend_e4.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | songtrk t { 13 | track { 14 | 96 15 | 96 16 | bend {0 0} 0 100 17 | 96 18 | 96 19 | bend {0 0} 0 124 20 | 96 21 | bend {0 0} 0 64 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /regress/bend_e5.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | bend {0 0} 0 64 11 | } 12 | } 13 | songtrk t { 14 | track { 15 | 96 16 | 96 17 | bend {0 0} 0 100 18 | 96 19 | 96 20 | bend {0 0} 0 124 21 | 96 22 | bend {0 0} 0 64 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /regress/bend_e6.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | 96 11 | bend {0 0} 0 64 12 | } 13 | } 14 | songtrk t { 15 | track { 16 | 96 17 | 96 18 | bend {0 0} 0 100 19 | 96 20 | 96 21 | bend {0 0} 0 124 22 | 96 23 | bend {0 0} 0 64 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /regress/bend_s1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | bend {0 0} 0 50 6 | 96 7 | 96 8 | 96 9 | 96 10 | 96 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/bend_s2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | bend {0 0} 0 50 7 | 96 8 | 96 9 | 96 10 | 96 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/bend_s3.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | bend {0 0} 0 50 8 | 96 9 | 96 10 | 96 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/bend_s4.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | bend {0 0} 0 50 9 | 96 10 | 96 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/bend_s5.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | 96 9 | bend {0 0} 0 50 10 | 96 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/bend_s6.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | bend {0 0} 0 50 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | bend {0 0} 0 100 20 | 96 21 | 96 22 | bend {0 0} 0 124 23 | 96 24 | bend {0 0} 0 64 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/blank_a0.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 0; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_a1.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 1; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 64 8 | 96 9 | bend {0 0} 0 66 10 | 48 11 | bend {0 0} 0 64 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/blank_a2.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 2; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_a3.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 3; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_b0.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 0; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_b0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_b1.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 1; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_b1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/blank_b2.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 2; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_b2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_b3.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 3; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_b3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/blank_c0.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 0; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_c0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/blank_c1.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 1; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_c1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/blank_c2.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 2; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_c2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/blank_c3.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 3; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_c3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/blank_d0.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 0; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_d0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/blank_d1.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 1; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_d1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/blank_d2.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 2; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_d2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/blank_d3.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 3; sel 1; tclr 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/blank_d3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/check.cmd: -------------------------------------------------------------------------------- 1 | load "bad1.msh" 2 | ct t 3 | tcheck 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/check.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | non {0 0} 65 66 6 | 48 7 | kat {0 0} 65 67 8 | 48 9 | kat {0 0} 65 68 10 | 144 11 | noff {0 0} 65 71 12 | 48 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/confev_0.cmd: -------------------------------------------------------------------------------- 1 | onew c {1 9} 2 | oaddev {ctl c 70 1} 3 | oaddev {ctl c 71 2} 4 | oaddev {xpc c 255 64} 5 | oaddev {xctl c 7 1023} 6 | oaddev {nrpn c 1 10} 7 | oaddev {rpn c 2 20} 8 | oaddev {nrpn c 3 30} 9 | oaddev {nrpn c 4 40} 10 | g 0; sel 0; ct nil; ci nil; co nil 11 | -------------------------------------------------------------------------------- /regress/confev_0.res: -------------------------------------------------------------------------------- 1 | { 2 | songchan c { 3 | chan {1 9} 4 | conf { 5 | ctl {1 9} 70 1 6 | ctl {1 9} 71 2 7 | xpc {1 9} 64 255 8 | xctl {1 9} 7 1023 9 | nrpn {1 9} 1 10 10 | rpn {1 9} 2 20 11 | nrpn {1 9} 3 30 12 | nrpn {1 9} 4 40 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/copy_a0.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | tnew u 3 | ct t; g 0; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 64 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/copy_a1.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | tnew u 3 | ct t; g 1; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | bend {0 0} 0 65 5 | 48 6 | bend {0 0} 0 66 7 | 48 8 | bend {0 0} 0 64 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/copy_a2.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | tnew u 3 | ct t; g 2; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | bend {0 0} 0 66 5 | 48 6 | bend {0 0} 0 64 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/copy_a3.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | tnew u 3 | ct t; g 3; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_b0.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | tnew u 3 | ct t; g 0; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_b0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_b1.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | tnew u 3 | ct t; g 1; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_b1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | bend {0 0} 0 65 5 | 48 6 | bend {0 0} 0 66 7 | 48 8 | bend {0 0} 0 64 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/copy_b2.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | tnew u 3 | ct t; g 2; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_b2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_b3.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | tnew u 3 | ct t; g 3; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_b3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_c0.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | tnew u 3 | ct t; g 0; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_c0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/copy_c1.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | tnew u 3 | ct t; g 1; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_c1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_c2.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | tnew u 3 | ct t; g 2; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_c2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_c3.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | tnew u 3 | ct t; g 3; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_c3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_d0.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | tnew u 3 | ct t; g 0; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_d0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_d1.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | tnew u 3 | ct t; g 1; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_d1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | ctl {0 0} 7 65 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /regress/copy_d2.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | tnew u 3 | ct t; g 2; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_d2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/copy_d3.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | tnew u 3 | ct t; g 3; sel 1; tcopy; ct u; g 0; tpaste; g 0; sel 0 4 | ct t; tdel 5 | g 0; sel 0; ct nil; ci nil; co nil 6 | -------------------------------------------------------------------------------- /regress/copy_d3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk u { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/ctl.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/ctl_e1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | ctl {0 0} 7 50 6 | } 7 | } 8 | songtrk t { 9 | track { 10 | ctl {0 0} 7 50 11 | 96 12 | ctl {0 0} 7 64 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/cut_a0.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 0; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 65 5 | 48 6 | bend {0 0} 0 66 7 | 96 8 | bend {0 0} 0 64 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/cut_a1.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 1; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_a2.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 2; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_a3.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 3; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_b0.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 0; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_b0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | mute 0 4 | track { 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_b1.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 1; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_b1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/cut_b2.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 2; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_b2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_b3.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 3; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_b3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/cut_c0.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 0; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_c0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/cut_c1.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 1; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_c1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/cut_c2.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 2; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_c2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/cut_c3.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 3; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_c3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/cut_d0.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 0; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_d0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | ctl {0 0} 7 65 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /regress/cut_d1.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 1; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_d1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/cut_d2.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 2; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_d2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/cut_d3.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 3; sel 1; tcut 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/cut_d3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/filt.msh: -------------------------------------------------------------------------------- 1 | { 2 | songfilt f { 3 | filt { 4 | evmap any {7 4..15} > any {3 0..11} 5 | evmap any {7 9} > any {3 8} 6 | evmap note {7 9} 0..65 > note {3 8} 10..75 7 | } 8 | } 9 | curfilt f 10 | } 11 | -------------------------------------------------------------------------------- /regress/fmap_a0.cmd: -------------------------------------------------------------------------------- 1 | load "filt.msh" 2 | fmap {any {0 0}} {any {1 1}} 3 | -------------------------------------------------------------------------------- /regress/fmap_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songfilt f { 3 | filt { 4 | evmap any {7 4..15} > any {3 0..11} 5 | evmap any {7 9} > any {3 8} 6 | evmap note {7 9} 0..65 > note {3 8} 10..75 7 | evmap any {0 0} > any {1 1} 8 | } 9 | } 10 | curfilt f 11 | } 12 | -------------------------------------------------------------------------------- /regress/fmap_a1.cmd: -------------------------------------------------------------------------------- 1 | load "filt.msh" 2 | fmap {any {0 0}} {any {3 8}} 3 | -------------------------------------------------------------------------------- /regress/fmap_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songfilt f { 3 | filt { 4 | evmap any {7 4..15} > any {3 0..11} 5 | evmap any {7 9} > any {3 8} 6 | evmap note {7 9} 0..65 > note {3 8} 10..75 7 | evmap any {0 0} > any {3 8} 8 | } 9 | } 10 | curfilt f 11 | } 12 | -------------------------------------------------------------------------------- /regress/fmap_a3.cmd: -------------------------------------------------------------------------------- 1 | load "filt.msh" 2 | fmap {any {7 9}} {any {0 1}} 3 | -------------------------------------------------------------------------------- /regress/fmap_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songfilt f { 3 | filt { 4 | evmap any {7 4..15} > any {3 0..11} 5 | evmap any {7 9} > any {3 8} 6 | evmap any {7 9} > any {0 1} 7 | } 8 | } 9 | curfilt f 10 | } 11 | -------------------------------------------------------------------------------- /regress/fnew.cmd: -------------------------------------------------------------------------------- 1 | fnew f 2 | fmap {any {7 4..15}} {any {3 0..11}} 3 | fmap {any {7 9}} {any {3 8}} 4 | fmap {note {7 9} 0..65} {note {3 8} 10..75} 5 | -------------------------------------------------------------------------------- /regress/fnew.res: -------------------------------------------------------------------------------- 1 | { 2 | songfilt f { 3 | filt { 4 | evmap any {7 4..15} > any {3 0..11} 5 | evmap any {7 9} > any {3 8} 6 | evmap note {7 9} 0..65 > note {3 8} 10..75 7 | } 8 | } 9 | curfilt f 10 | } 11 | -------------------------------------------------------------------------------- /regress/help.cmd: -------------------------------------------------------------------------------- 1 | for i in [builtinlist] { h $i; } 2 | -------------------------------------------------------------------------------- /regress/help.res: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /regress/insert_a0.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 0; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 144 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_a1.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 1; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 64 8 | 96 9 | bend {0 0} 0 65 10 | 48 11 | bend {0 0} 0 66 12 | 96 13 | bend {0 0} 0 64 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /regress/insert_a2.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 2; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | 96 11 | bend {0 0} 0 66 12 | 48 13 | bend {0 0} 0 64 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /regress/insert_a3.cmd: -------------------------------------------------------------------------------- 1 | load "bend1.msh" 2 | ct t; g 3; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | bend {0 0} 0 65 6 | 96 7 | bend {0 0} 0 66 8 | 96 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_b0.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 0; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_b0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_b1.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 1; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_b1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_b2.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 2; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_b2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_b3.cmd: -------------------------------------------------------------------------------- 1 | load "bend2.msh" 2 | ct t; g 3; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_b3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 65 6 | 48 7 | bend {0 0} 0 66 8 | 48 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/insert_c0.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 0; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_c0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 144 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/insert_c1.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 1; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_c1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/insert_c2.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 2; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_c2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/insert_c3.cmd: -------------------------------------------------------------------------------- 1 | load "note.msh" 2 | ct t; g 3; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_c3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/insert_d0.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 0; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_d0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/insert_d1.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 1; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_d1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/insert_d2.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 2; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_d2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/insert_d3.cmd: -------------------------------------------------------------------------------- 1 | load "ctl.msh" 2 | ct t; g 3; tins 1 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/insert_d3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | ctl {0 0} 7 65 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/mcut_a0.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 0 3 | sel 1 4 | mcut 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mcut_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 2 24 5 | 96 6 | timesig 4 24 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/mcut_a1.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 1 3 | sel 1 4 | mcut 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mcut_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 6 | timesig 2 24 7 | 48 8 | timesig 4 24 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mcut_a2.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 1 3 | sel 2 4 | mcut 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mcut_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /regress/mdup_a0.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 1 4 | mdup 6 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 576 10 | timesig 6 12 11 | 144 12 | timesig 4 24 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/mdup_a1.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 1 4 | mdup 7 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 576 10 | timesig 6 12 11 | 144 12 | timesig 4 24 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/mdup_a2.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 1 4 | mdup 8 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 72 12 | timesig 4 24 13 | 96 14 | timesig 6 12 15 | 72 16 | timesig 4 24 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /regress/mdup_a3.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 1 4 | mdup 9 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 144 # 8:0:0 -> 2 meas 6/8 12 | timesig 4 24 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/mdup_a4.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 1 4 | mdup 10 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_a4.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 144 # 8:0:0 -> 2 meas 6/8 12 | timesig 4 24 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/mdup_b0.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 2 4 | mdup 5 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_b0.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 10 | timesig 2 24 11 | 48 12 | timesig 4 24 13 | 96 14 | timesig 6 12 15 | 144 16 | timesig 4 24 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /regress/mdup_b1.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 2 4 | mdup 6 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_b1.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 576 10 | timesig 2 24 11 | 48 12 | timesig 6 12 13 | 144 # 8:0:0 -> 2 meas 6/8 14 | timesig 4 24 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /regress/mdup_b2.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 2 4 | mdup 7 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_b2.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 72 12 | timesig 4 24 13 | 96 14 | timesig 2 24 15 | 48 16 | timesig 6 12 17 | 72 18 | timesig 4 24 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /regress/mdup_b3.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 2 4 | mdup 8 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_b3.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 144 # 8:0:0 -> 2 meas 6/8 12 | timesig 4 24 13 | 96 14 | timesig 2 24 15 | 48 16 | timesig 4 24 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /regress/mdup_b4.cmd: -------------------------------------------------------------------------------- 1 | load "sign3.msh" 2 | g 0 3 | sel 2 4 | mdup 9 5 | g 0; sel 0 6 | -------------------------------------------------------------------------------- /regress/mdup_b4.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 144 # 8:0:0 -> 2 meas 6/8 12 | timesig 4 24 13 | 192 14 | timesig 2 24 15 | 48 16 | timesig 4 24 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /regress/mergebend_e1.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e1.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 96 6 | bend {0 0} 0 64 7 | 96 8 | bend {0 0} 0 100 9 | 192 10 | bend {0 0} 0 124 11 | 96 12 | bend {0 0} 0 64 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/mergebend_e2.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e2.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 192 6 | bend {0 0} 0 100 7 | 192 8 | bend {0 0} 0 124 9 | 96 10 | bend {0 0} 0 64 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /regress/mergebend_e3.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e3.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 288 6 | bend {0 0} 0 100 7 | 96 8 | bend {0 0} 0 124 9 | 96 10 | bend {0 0} 0 64 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /regress/mergebend_e4.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e4.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 384 6 | bend {0 0} 0 124 7 | 96 8 | bend {0 0} 0 64 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/mergebend_e5.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e5.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 480 6 | bend {0 0} 0 64 7 | } 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /regress/mergebend_e6.cmd: -------------------------------------------------------------------------------- 1 | load "bend_e6.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_e6.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | bend {0 0} 0 50 5 | 576 6 | bend {0 0} 0 64 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergebend_s1.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s1.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | bend {0 0} 0 50 6 | 576 7 | bend {0 0} 0 64 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergebend_s2.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s2.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 50 6 | 480 7 | bend {0 0} 0 64 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergebend_s3.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s3.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 100 6 | 96 7 | bend {0 0} 0 50 8 | 384 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/mergebend_s4.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s4.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 100 6 | 192 7 | bend {0 0} 0 50 8 | 288 9 | bend {0 0} 0 64 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/mergebend_s5.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s5.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 100 6 | 192 7 | bend {0 0} 0 124 8 | 96 9 | bend {0 0} 0 50 10 | 192 11 | bend {0 0} 0 64 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/mergebend_s6.cmd: -------------------------------------------------------------------------------- 1 | load "bend_s6.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergebend_s6.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | bend {0 0} 0 100 6 | 192 7 | bend {0 0} 0 124 8 | 96 9 | bend {0 0} 0 64 10 | 96 11 | bend {0 0} 0 50 12 | 96 13 | bend {0 0} 0 64 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /regress/mergectl_e1.cmd: -------------------------------------------------------------------------------- 1 | load "ctl_e1.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergectl_e1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | ctl {0 0} 7 50 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /regress/mergenote_e1.cmd: -------------------------------------------------------------------------------- 1 | load "note_e1.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | noff {0 0} 65 50 7 | 96 8 | non {0 0} 65 100 9 | 192 10 | kat {0 0} 65 124 11 | 96 12 | noff {0 0} 65 100 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/mergenote_e2.cmd: -------------------------------------------------------------------------------- 1 | load "note_e2.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 192 6 | noff {0 0} 65 50 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergenote_e3.cmd: -------------------------------------------------------------------------------- 1 | load "note_e3.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 288 6 | noff {0 0} 65 50 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergenote_e4.cmd: -------------------------------------------------------------------------------- 1 | load "note_e4.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 384 6 | noff {0 0} 65 50 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergenote_e5.cmd: -------------------------------------------------------------------------------- 1 | load "note_e5.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 480 6 | noff {0 0} 65 50 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergenote_e6.cmd: -------------------------------------------------------------------------------- 1 | load "note_e6.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_e6.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | non {0 0} 65 50 5 | 576 6 | noff {0 0} 65 50 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /regress/mergenote_s1.cmd: -------------------------------------------------------------------------------- 1 | load "note_s1.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | non {0 0} 65 50 6 | 576 7 | noff {0 0} 65 50 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergenote_s2.cmd: -------------------------------------------------------------------------------- 1 | load "note_s2.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | non {0 0} 65 50 6 | 480 7 | noff {0 0} 65 50 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergenote_s3.cmd: -------------------------------------------------------------------------------- 1 | load "note_s3.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 288 5 | non {0 0} 65 50 6 | 384 7 | noff {0 0} 65 50 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergenote_s4.cmd: -------------------------------------------------------------------------------- 1 | load "note_s4.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 384 5 | non {0 0} 65 50 6 | 288 7 | noff {0 0} 65 50 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/mergenote_s5.cmd: -------------------------------------------------------------------------------- 1 | load "note_s5.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | non {0 0} 65 100 6 | 192 7 | kat {0 0} 65 124 8 | 96 9 | noff {0 0} 65 100 10 | non {0 0} 65 50 11 | 192 12 | noff {0 0} 65 50 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/mergenote_s6.cmd: -------------------------------------------------------------------------------- 1 | load "note_s6.msh" 2 | ct t2; tmerge t 3 | ct t2; tdel 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/mergenote_s6.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 192 5 | non {0 0} 65 100 6 | 192 7 | kat {0 0} 65 124 8 | 96 9 | noff {0 0} 65 100 10 | 96 11 | non {0 0} 65 50 12 | 96 13 | noff {0 0} 65 50 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /regress/mins_a0.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 0 3 | mins 1 {6 8} 4 | -------------------------------------------------------------------------------- /regress/mins_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | timesig 6 12 4 | tempo 400000 5 | 72 6 | timesig 4 24 7 | 96 # 0:0:0 -> 1 meas. 4/4 8 | timesig 2 24 9 | 96 # 1:0:0 -> 2 meas. 2/4 10 | timesig 4 24 11 | } 12 | curlen 1 13 | } 14 | -------------------------------------------------------------------------------- /regress/mins_a1.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 1 3 | mins 1 {6 8} 4 | g 0 5 | -------------------------------------------------------------------------------- /regress/mins_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 6 | timesig 6 12 7 | 72 8 | timesig 2 24 9 | 96 10 | timesig 4 24 11 | } 12 | curlen 1 13 | } 14 | -------------------------------------------------------------------------------- /regress/mins_a2.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 2 3 | mins 1 {6 8} 4 | g 0 5 | -------------------------------------------------------------------------------- /regress/mins_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 6 | timesig 2 24 7 | 48 8 | timesig 6 12 9 | 72 10 | timesig 2 24 11 | 48 12 | timesig 4 24 13 | } 14 | curlen 1 15 | } 16 | -------------------------------------------------------------------------------- /regress/mins_a3.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 3 3 | mins 1 {6 8} 4 | g 0 5 | -------------------------------------------------------------------------------- /regress/mins_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 6 12 9 | 72 10 | timesig 4 24 11 | } 12 | curlen 1 13 | } 14 | -------------------------------------------------------------------------------- /regress/mins_a4.cmd: -------------------------------------------------------------------------------- 1 | load "sign2.msh" 2 | g 4 3 | mins 1 {6 8} 4 | g 0 5 | -------------------------------------------------------------------------------- /regress/mins_a4.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 96 10 | timesig 6 12 11 | 72 12 | timesig 4 24 13 | } 14 | curlen 1 15 | } 16 | -------------------------------------------------------------------------------- /regress/note.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 48 7 | kat {0 0} 65 123 8 | 96 9 | kat {0 0} 65 124 10 | 48 11 | noff {0 0} 65 100 12 | 48 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /regress/note2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | 96 6 | non {0 0} 65 100 7 | 96 8 | 96 9 | kat {0 0} 65 124 10 | 96 11 | noff {0 0} 65 100 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/note_e1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | noff {0 0} 65 50 7 | } 8 | } 9 | songtrk t { 10 | track { 11 | 96 12 | 96 13 | non {0 0} 65 100 14 | 96 15 | 96 16 | kat {0 0} 65 124 17 | 96 18 | noff {0 0} 65 100 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /regress/note_e2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | 96 7 | noff {0 0} 65 50 8 | } 9 | } 10 | songtrk t { 11 | track { 12 | 96 13 | 96 14 | non {0 0} 65 100 15 | 96 16 | 96 17 | kat {0 0} 65 124 18 | 96 19 | noff {0 0} 65 100 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /regress/note_e3.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | 96 7 | 96 8 | noff {0 0} 65 50 9 | } 10 | } 11 | songtrk t { 12 | track { 13 | 96 14 | 96 15 | non {0 0} 65 100 16 | 96 17 | 96 18 | kat {0 0} 65 124 19 | 96 20 | noff {0 0} 65 100 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /regress/note_e4.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | noff {0 0} 65 50 10 | } 11 | } 12 | songtrk t { 13 | track { 14 | 96 15 | 96 16 | non {0 0} 65 100 17 | 96 18 | 96 19 | kat {0 0} 65 124 20 | 96 21 | noff {0 0} 65 100 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /regress/note_e5.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | noff {0 0} 65 50 11 | } 12 | } 13 | songtrk t { 14 | track { 15 | 96 16 | 96 17 | non {0 0} 65 100 18 | 96 19 | 96 20 | kat {0 0} 65 124 21 | 96 22 | noff {0 0} 65 100 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /regress/note_e6.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | non {0 0} 65 50 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | 96 11 | noff {0 0} 65 50 12 | } 13 | } 14 | songtrk t { 15 | track { 16 | 96 17 | 96 18 | non {0 0} 65 100 19 | 96 20 | 96 21 | kat {0 0} 65 124 22 | 96 23 | noff {0 0} 65 100 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /regress/note_s1.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | non {0 0} 65 50 6 | 96 7 | 96 8 | 96 9 | 96 10 | 96 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/note_s2.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | non {0 0} 65 50 7 | 96 8 | 96 9 | 96 10 | 96 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/note_s3.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | non {0 0} 65 50 8 | 96 9 | 96 10 | 96 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/note_s4.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | non {0 0} 65 50 9 | 96 10 | 96 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/note_s5.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | 96 9 | non {0 0} 65 50 10 | 96 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/note_s6.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t2 { 3 | track { 4 | 96 5 | 96 6 | 96 7 | 96 8 | 96 9 | 96 10 | non {0 0} 65 50 11 | 96 12 | noff {0 0} 65 50 13 | } 14 | } 15 | songtrk t { 16 | track { 17 | 96 18 | 96 19 | non {0 0} 65 100 20 | 96 21 | 96 22 | kat {0 0} 65 124 23 | 96 24 | noff {0 0} 65 100 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /regress/quant.cmd: -------------------------------------------------------------------------------- 1 | load "quant.msh" 2 | g 0 3 | ct t 4 | sel 16 5 | setq 24 6 | tquanta 100 7 | sel 0 8 | setq nil 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/quant.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 60 100 6 | 48 7 | noff {0 0} 60 100 8 | 9 | 49 10 | non {0 0} 61 100 11 | 47 12 | noff {0 0} 61 100 13 | 14 | 50 15 | non {0 0} 62 100 16 | 46 17 | noff {0 0} 62 100 18 | 19 | 51 20 | non {0 0} 63 100 21 | 45 22 | noff {0 0} 63 100 23 | 24 | 47 25 | non {0 0} 59 100 26 | 49 27 | noff {0 0} 59 100 28 | 29 | 46 30 | non {0 0} 58 100 31 | 50 32 | noff {0 0} 58 100 33 | 34 | 45 35 | non {0 0} 57 100 36 | 51 37 | noff {0 0} 57 100 38 | 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /regress/quant.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 60 100 6 | 48 7 | noff {0 0} 60 100 8 | 48 9 | non {0 0} 61 100 10 | 48 11 | noff {0 0} 61 100 12 | 52 13 | non {0 0} 62 100 14 | 44 15 | noff {0 0} 62 100 16 | 52 17 | non {0 0} 63 100 18 | 44 19 | noff {0 0} 63 100 20 | 48 21 | non {0 0} 59 100 22 | 48 23 | noff {0 0} 59 100 24 | 48 25 | non {0 0} 58 100 26 | 48 27 | noff {0 0} 58 100 28 | 44 29 | non {0 0} 57 100 30 | 52 31 | noff {0 0} 57 100 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /regress/quant_m.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 1 5 | non {0 0} 60 100 6 | 94 7 | non {0 0} 61 100 8 | 98 9 | non {0 0} 62 100 10 | 94 11 | non {0 0} 63 100 12 | 98 13 | noff {0 0} 60 100 14 | 94 15 | noff {0 0} 61 100 16 | 98 17 | noff {0 0} 62 100 18 | 94 19 | noff {0 0} 63 100 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /regress/quant_ovr.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | 4 6 | non {0 0} 60 100 7 | 40 8 | noff {0 0} 60 100 9 | 4 10 | 11 | 4 12 | non {0 0} 60 50 13 | 40 14 | noff {0 0} 60 100 15 | 4 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /regress/quanta_ovr.cmd: -------------------------------------------------------------------------------- 1 | load "quant_ovr.msh" 2 | g 0 3 | ct t 4 | sel 16 5 | setq 1 6 | tquanta 100 7 | sel 0 8 | setq nil 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/quanta_ovr.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | non {0 0} 60 100 6 | noff {0 0} 60 100 7 | non {0 0} 60 50 8 | noff {0 0} 60 100 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/quantf.cmd: -------------------------------------------------------------------------------- 1 | load "quant.msh" 2 | g 0 3 | ct t 4 | sel 16 5 | setq 24 6 | tquantf 100 7 | sel 0 8 | setq nil 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/quantf.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 60 100 6 | 48 7 | noff {0 0} 60 100 8 | 48 9 | non {0 0} 61 100 10 | 47 11 | noff {0 0} 61 100 12 | 53 13 | non {0 0} 62 100 14 | 46 15 | noff {0 0} 62 100 16 | 50 17 | non {0 0} 63 100 18 | 45 19 | noff {0 0} 63 100 20 | 47 21 | non {0 0} 59 100 22 | 49 23 | noff {0 0} 59 100 24 | 47 25 | non {0 0} 58 100 26 | 50 27 | noff {0 0} 58 100 28 | 42 29 | non {0 0} 57 100 30 | 51 31 | noff {0 0} 57 100 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /regress/quantf_m.cmd: -------------------------------------------------------------------------------- 1 | load "quant_m.msh" 2 | ct t 3 | g 2 4 | sel 3 5 | setq 4 6 | tquantf 100 7 | sel 0 8 | setq nil 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/quantf_m.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 1 5 | non {0 0} 60 100 6 | 94 7 | non {0 0} 61 100 8 | 97 9 | non {0 0} 62 100 10 | 96 11 | non {0 0} 63 100 12 | 97 13 | noff {0 0} 60 100 14 | 94 15 | noff {0 0} 61 100 16 | 97 17 | noff {0 0} 62 100 18 | 96 19 | noff {0 0} 63 100 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /regress/quantf_ovr.cmd: -------------------------------------------------------------------------------- 1 | load "quant_ovr.msh" 2 | g 0 3 | ct t 4 | sel 16 5 | setq 1 6 | tquantf 100 7 | sel 0 8 | setq nil 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/quantf_ovr.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | non {0 0} 60 100 6 | 40 7 | noff {0 0} 60 100 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/run-test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # For each command-line argument, run the corresponding test as follows: 5 | # 6 | # - Load the expected result $testname.res and save it in $testname.tmp1 7 | # 8 | # - Run $testname.cmd and save the actual result in $testname.tmp2 9 | # 10 | # - Check that there are no differences between the actual and the 11 | # expected results. If there are, the resulting $testname.diff and 12 | # and $testname.log files are kept. 13 | # 14 | 15 | if [ -z "$*" ]; then 16 | set -- *.cmd 17 | fi 18 | 19 | echo 1..$# 20 | 21 | # 22 | # loop over all tests 23 | # 24 | for i; do 25 | i=${i%.cmd} 26 | (echo load \"$i.res\"\; \ 27 | save \"$i.tmp1\"\; \ 28 | reset \; \ 29 | exec \"$i.cmd\"\; \ 30 | save \"$i.tmp2\"\; \ 31 | | ../midish -b >$i.log 2>&1 ) \ 32 | && \ 33 | diff -u $i.tmp1 $i.tmp2 >$i.diff 2>>$i.log 34 | if [ "$?" -eq 0 ]; then 35 | echo ok $i 36 | rm -- $i.tmp1 $i.tmp2 $i.diff $i.log 37 | else 38 | echo not ok $i 39 | failed="$failed $i" 40 | fi 41 | done 42 | 43 | # 44 | # print summary, and set exit code 45 | # 46 | echo >&2 47 | if [ -n "$failed" ]; then 48 | echo Tests failed: $failed >&2 49 | exit 1 50 | else 51 | echo Tests passed 52 | exit 0 53 | fi 54 | -------------------------------------------------------------------------------- /regress/sign.msh: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | 96 4 | timesig 3 24 5 | 48 6 | timesig 4 24 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /regress/sign2.msh: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /regress/sign3.msh: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | tempo 400000 4 | timesig 4 24 5 | 96 # 0:0:0 -> 1 meas. 4/4 6 | timesig 2 24 7 | 96 # 1:0:0 -> 2 meas. 2/4 8 | timesig 4 24 9 | 480 # 3:0:0 -> 1 + 5 meas. 4/4 10 | timesig 6 12 11 | 144 # 8:0:0 -> 2 meas 6/8 12 | timesig 4 24 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tempo.cmd: -------------------------------------------------------------------------------- 1 | g 0 2 | t 240 3 | g 1 4 | t 120 5 | g 2 6 | t 240 7 | g 1 8 | t 240 9 | g 0; sel 0; ct nil; ci nil; co nil 10 | -------------------------------------------------------------------------------- /regress/tempo.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | timesig 4 24 4 | tempo 250000 5 | 192 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /regress/tevmap.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | ctl {0 0} 7 64 18 | 48 19 | ctl {0 0} 7 65 20 | 48 21 | ctl {0 1} 10 64 22 | 48 23 | ctl {0 1} 10 65 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a0.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {note {0 0}} {note {1 1}} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {1 1} 65 100 6 | 96 7 | kat {1 1} 65 123 8 | 48 9 | noff {1 1} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a1.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {note {} 66..106} {note {} 60..100} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 60 100 12 | 96 13 | kat {0 1} 60 123 14 | 48 15 | noff {0 1} 60 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a2.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {ctl {0 0}} {ctl {1 1}} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {1 1} 7 8192 18 | 48 19 | xctl {1 1} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a3.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {ctl {} 7..8} {ctl {} 10..11} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 10 8192 18 | 48 19 | xctl {0 0} 10 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a4.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {cat {0 0}} {cat {1 1}} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {1 1} 64 26 | 48 27 | cat {1 1} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a5.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {xpc {0 0}} {xpc {1 1}} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {1 1} 1 64 34 | 48 35 | xpc {1 1} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a6.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {xpc {} 64 1} {xpc {} 64 5} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a6.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 5 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a7.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {xpc {} 64..74 1} {xpc {} 24..34 1} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a7.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 24 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a8.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {nrpn {0 0} 1 64} {nrpn {1 1} 2 34} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a8.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {1 1} 2 34 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {0 0} 0 0 46 | 48 47 | bend {0 0} 0 64 48 | 48 49 | bend {0 1} 63 63 50 | 48 51 | bend {0 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/tevmap_a9.cmd: -------------------------------------------------------------------------------- 1 | load "tevmap.msh" 2 | ct t; g 0; sel 100; tevmap {bend {0 0..15}} {bend {1 0..15}} 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tevmap_a9.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 48 5 | non {0 0} 65 100 6 | 96 7 | kat {0 0} 65 123 8 | 48 9 | noff {0 0} 65 100 10 | 48 11 | non {0 1} 66 100 12 | 96 13 | kat {0 1} 66 123 14 | 48 15 | noff {0 1} 66 100 16 | 48 17 | xctl {0 0} 7 8192 18 | 48 19 | xctl {0 0} 7 8320 20 | 48 21 | xctl {0 1} 10 8192 22 | 48 23 | xctl {0 1} 10 8320 24 | 48 25 | cat {0 0} 64 26 | 48 27 | cat {0 0} 0 28 | 48 29 | cat {0 1} 64 30 | 48 31 | cat {0 1} 0 32 | 48 33 | xpc {0 0} 1 64 34 | 48 35 | xpc {0 0} 2 65 36 | 48 37 | nrpn {0 0} 1 64 38 | 48 39 | nrpn {0 0} 2 65 40 | 48 41 | rpn {0 0} 3 66 42 | 48 43 | rpn {0 0} 4 67 44 | 48 45 | bend {1 0} 0 0 46 | 48 47 | bend {1 0} 0 64 48 | 48 49 | bend {1 1} 63 63 50 | 48 51 | bend {1 1} 0 64 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /regress/time.msh: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | timesig 5 12 4 | 600 5 | timesig 5 24 6 | 1200 7 | timesig 5 12 8 | 600 9 | timesig 4 24 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /regress/timeins.cmd: -------------------------------------------------------------------------------- 1 | g 0 2 | mins 1 {8 8} 3 | mins 1 {2 2} 4 | g 1 5 | mins 1 {4 4} 6 | g 0; sel 0; ct nil; ci nil; co nil 7 | -------------------------------------------------------------------------------- /regress/timeins.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | timesig 2 48 4 | tempo 500000 5 | 96 6 | timesig 4 24 7 | 96 8 | timesig 8 12 9 | 96 10 | timesig 4 24 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /regress/timerm.cmd: -------------------------------------------------------------------------------- 1 | load "time.msh" 2 | g 10 3 | sel 10; mcut 4 | g 0; sel 0; ct nil; ci nil; co nil 5 | -------------------------------------------------------------------------------- /regress/timerm.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | timesig 5 12 4 | 1200 5 | timesig 4 24 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /regress/timesig.cmd: -------------------------------------------------------------------------------- 1 | load "sign.msh" 2 | g 1 3 | t 60 4 | g 2 5 | t 120 6 | g 3 7 | t 240 8 | g 0; sel 0; ct nil; ci nil; co nil 9 | -------------------------------------------------------------------------------- /regress/timesig.res: -------------------------------------------------------------------------------- 1 | { 2 | meta { 3 | 96 4 | timesig 3 24 5 | tempo 1000000 6 | 48 7 | timesig 4 24 8 | 24 9 | tempo 500000 10 | 96 11 | tempo 250000 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /regress/tundo.msh: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_d0.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; sel 1; tclr; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_d0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_d1.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 1; sel 1; tclr; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_d1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_d2.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 3; sel 2; tcut; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_d2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i0.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; tins 1; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i0.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i1.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 2; sel 2; tcopy; g 5; tpaste; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i1.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i2.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; taddev 0 0 0 {xctl {0 0} 7 0}; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i2.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i3.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; taddev 0 1 0 {xctl {0 0} 7 0}; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i3.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i4.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; taddev 1 1 0 {xctl {0 0} 7 0}; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i4.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_i5.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; taddev 5 0 0 {xctl {0 0} 7 0}; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_i5.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/tundo_n.cmd: -------------------------------------------------------------------------------- 1 | load "tundo.msh" 2 | ct t; g 0; tcheck; u 3 | g 0; sel 0; ct nil; ci nil; co nil 4 | -------------------------------------------------------------------------------- /regress/tundo_n.res: -------------------------------------------------------------------------------- 1 | { 2 | songtrk t { 3 | track { 4 | 96 5 | xctl {0 0} 7 1 6 | 96 7 | xctl {0 0} 7 2 8 | 96 9 | xctl {0 0} 7 3 10 | 96 11 | xctl {0 0} 7 4 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /regress/update-test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # patch .res files with diff files generated by failed tests 5 | # so that tests will no more fail 6 | # 7 | 8 | if [ -n "$*" ]; then 9 | list=$* 10 | else 11 | list=*.cmd 12 | fi 13 | 14 | for i in $list; do 15 | i=${i%.cmd} 16 | patch -F1 $i.res <$i.diff 17 | done 18 | -------------------------------------------------------------------------------- /saveload.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_SAVELOAD_H 18 | #define MIDISH_SAVELOAD_H 19 | 20 | struct textout; 21 | struct ev; 22 | struct evctl; 23 | struct track; 24 | struct filt; 25 | struct rule; 26 | struct songchan; 27 | struct songtrk; 28 | struct songfilt; 29 | struct songsx; 30 | struct song; 31 | 32 | void ev_output(struct ev *, struct textout *); 33 | void evspec_output(struct evspec *, struct textout *); 34 | void evpat_output(struct textout *); 35 | void track_output(struct track *, struct textout *); 36 | void rule_output(struct rule *, struct textout *); 37 | void filt_output(struct filt *, struct textout *); 38 | void songtrk_output(struct songtrk *, struct textout *); 39 | void songchan_output(struct songchan *, struct textout *); 40 | void songfilt_output(struct songfilt *, struct textout *); 41 | void songsx_output(struct songsx *, struct textout *); 42 | void evctltab_output(struct evctl *, struct textout *); 43 | void song_output(struct song *, struct textout *); 44 | 45 | void track_save(struct track *, char *); 46 | unsigned track_load(struct track *, char *); 47 | 48 | void song_save(struct song *, char *); 49 | unsigned song_load(struct song *, char *); 50 | 51 | 52 | #endif /* MIDISH_SAVELOAD_H */ 53 | -------------------------------------------------------------------------------- /smf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_SMF_H 18 | #define MIDISH_SMF_H 19 | 20 | struct song; 21 | 22 | unsigned song_exportsmf(struct song *, char *); 23 | struct song *song_importsmf(char *); 24 | 25 | int syx_import(char *, struct sysexlist *, int); 26 | int syx_export(char *, struct sysexlist *); 27 | 28 | #endif /* MIDISH_SMF_H */ 29 | -------------------------------------------------------------------------------- /smfplay: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { 4 | echo "usage: smfplay [-mxy] [-d device] [-i device] midifile" 5 | exit 2 6 | } 7 | 8 | extclock=0 9 | sendrt=0 10 | input="" 11 | device=$MIDIDEV 12 | metronome="off" 13 | tempo=0 14 | pos=0 15 | 16 | while getopts mxyd:i:g: optname; do 17 | case "$optname" in 18 | m) 19 | metronome="on";; 20 | x) 21 | extclock=1;; 22 | y) 23 | sendrt=1;; 24 | d) 25 | device=$OPTARG;; 26 | i) 27 | input=$OPTARG;; 28 | g) 29 | pos=$OPTARG;; 30 | esac 31 | done 32 | shift $(($OPTIND - 1)) 33 | if [ "$#" != "1" -o -z "$1" ]; then 34 | usage; 35 | fi 36 | 37 | exec midish -b < 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this software for any 5 | .\" purpose with or without fee is hereby granted, provided that the above 6 | .\" copyright notice and this permission notice appear in all copies. 7 | .\" 8 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | .\" 16 | .Dd August 22, 2005 17 | .Dt SMFPLAY 1 18 | .Os 19 | .Sh NAME 20 | .Nm smfplay 21 | .Nd play a standard MIDI file 22 | .Sh SYNOPSIS 23 | .Nm smfplay 24 | .Op Fl mxy 25 | .Op Fl g Ar measure 26 | .Op Fl d Ar devname 27 | .Op Fl i Ar devname 28 | midifile 29 | .Sh DESCRIPTION 30 | The 31 | .Nm 32 | utility plays a MIDI file. 33 | While playing, it can route events from one 34 | .Xr midi 4 35 | device to another. 36 | To stop performance, send an interrupt signal to 37 | .Nm 38 | (for instance by pressing control ^C on the terminal). 39 | The options are as follows: 40 | .Bl -tag -width "-i devname " 41 | .It Fl m 42 | Use metronome. 43 | The metronome will follow tempo changes and time signature 44 | changes in the midi file. 45 | .It Fl x 46 | Synchronise to an external 47 | .Xr midi 4 48 | device. 49 | If the 50 | .Fl i 51 | flag is used then playback will be synchronised to the input device 52 | else it will be synchronised to the default device. 53 | .It Fl y 54 | Send midi timing information to the default device. 55 | Useful if the output device is a slave MIDI sequencer. 56 | .It Fl g Ar measure 57 | Start playback at the given measure number. 58 | .It Fl d Ar filename 59 | Default 60 | .Xr midi 4 61 | device on which to play the midi file. 62 | If not specified, the content of the 63 | .Ev MIDIDEV 64 | environment variable will be used instead. 65 | .It Fl i Ar filename 66 | Alternate input 67 | .Xr midi 4 68 | device. 69 | Voice events (notes, controllers, etc) received on the input device 70 | will be sent as-is to the default device. 71 | Without this flag, the default device will be used for input. 72 | .El 73 | .Pp 74 | The 75 | .Nm 76 | utility is an interface to 77 | .Xr midish 1 . 78 | If more specific features are needed, the user may consider using 79 | .Xr midish 1 . 80 | .Sh EXAMPLES 81 | The following will play 82 | .Pa mysong.mid 83 | on device 84 | .Pa /dev/rmidi4 85 | and will use metronome. 86 | .Pp 87 | .Dl $ smfplay -m -d /dev/rmidi4 mysong.mid 88 | .Sh SEE ALSO 89 | .Xr midiplay 1 , 90 | .Xr midish 1 , 91 | .Xr smfrec 1 , 92 | .Xr midi 4 93 | -------------------------------------------------------------------------------- /smfrec: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { 4 | echo "usage: smfrec [-amxy] [-d device] [-i device] midifile" 5 | exit 2 6 | } 7 | 8 | extclock=0 9 | sendrt=0 10 | input="" 11 | device=$MIDIDEV 12 | metronome="off" 13 | tempo=0 14 | append=0 15 | pos=0 16 | 17 | while getopts amxyd:i:g: optname; do 18 | case "$optname" in 19 | a) 20 | append=1;; 21 | m) 22 | metronome="on";; 23 | x) 24 | extclock=1;; 25 | y) 26 | sendrt=1;; 27 | d) 28 | device="$OPTARG";; 29 | i) 30 | input="$OPTARG";; 31 | g) 32 | pos=$OPTARG;; 33 | esac 34 | done 35 | shift $(($OPTIND - 1)) 36 | if [ "$#" != "1" -o -z "$1" ]; then 37 | usage; 38 | fi 39 | 40 | exec midish -b < 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this software for any 5 | .\" purpose with or without fee is hereby granted, provided that the above 6 | .\" copyright notice and this permission notice appear in all copies. 7 | .\" 8 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | .\" 16 | .Dd August 27, 2005 17 | .Dt SMFREC 1 18 | .Os 19 | .Sh NAME 20 | .Nm smfrec 21 | .Nd record a standard MIDI file 22 | .Sh SYNOPSIS 23 | .Nm smfrec 24 | .Op Fl amxy 25 | .Op Fl g Ar measure 26 | .Op Fl d Ar devname 27 | .Op Fl i Ar devname 28 | midifile 29 | .Sh DESCRIPTION 30 | The 31 | .Nm 32 | utility records a MIDI file. 33 | It can add recorded events on top of an existing midi file. 34 | To stop performance, send an interrupt signal to 35 | .Nm 36 | (for instance by pressing control ^C on the terminal). 37 | The options are as follows: 38 | .Bl -tag -width "-i devname " 39 | .It Fl a 40 | Append mode. 41 | Play the given midi file and append to it a new 42 | track containing recorded events. 43 | .It Fl m 44 | Use metronome. 45 | .It Fl x 46 | Synchronise to the default 47 | .Xr midi 4 48 | device instead of using an internal clock source. 49 | .It Fl y 50 | Send midi timing information to the default device. 51 | Useful if it is a slave MIDI sequencer. 52 | .It Fl g Ar measure 53 | Start playback and recording at the given measure number. 54 | .It Fl d Ar filename 55 | Default 56 | .Xr midi 4 57 | device from which to record and on which to send midi events. 58 | If not specified, the content of the 59 | .Ev MIDIDEV 60 | environment variable will be used instead. 61 | .It Fl i Ar filename 62 | Alternate input 63 | .Xr midi 4 64 | device. 65 | Voice events (notes, controllers, etc) received on the input device 66 | will be recorded and sent as-is to the default device. 67 | Without this flag, the default device will be used for input. 68 | .El 69 | .Pp 70 | The 71 | .Nm 72 | utility is an interface to 73 | .Xr midish 1 . 74 | If more specific features are needed, the user may consider using 75 | .Xr midish 1 . 76 | .Sh EXAMPLES 77 | The following will play 78 | .Pa mysong.mid 79 | and append to it recorded events 80 | from device 81 | .Pa /dev/rmidi4 ; 82 | metronome will be used. 83 | .Pp 84 | .Dl $ smfrec -a -m -d /dev/rmidi4 mysong.mid 85 | .Sh SEE ALSO 86 | .Xr midish 1 , 87 | .Xr smfplay 1 , 88 | .Xr midi 4 89 | -------------------------------------------------------------------------------- /state.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_STATE_H 18 | #define MIDISH_STATE_H 19 | 20 | #include "ev.h" 21 | #include "utils.h" 22 | 23 | struct seqev; 24 | struct statelist; 25 | 26 | struct state { 27 | struct state *next, **prev; /* for statelist */ 28 | struct ev ev; /* last event */ 29 | unsigned phase; /* current phase (of the 'ev' field) */ 30 | /* 31 | * the following flags are set by statelist_update() and 32 | * statelist_outdate() and can be read by other routines, 33 | * but shouldn't be changed 34 | */ 35 | #define STATE_NEW 1 /* just created, never updated */ 36 | #define STATE_CHANGED 2 /* updated within the current tick */ 37 | #define STATE_BOGUS 4 /* frame detected as bogus */ 38 | #define STATE_NESTED 8 /* nested frame */ 39 | unsigned flags; /* bitmap of above */ 40 | unsigned nevents; /* number of events before timeout */ 41 | 42 | /* 43 | * the following are general purpose fields that are ignored 44 | * by state_xxx() and statelist_xxx() routines. Other 45 | * subsystems (seqptr, filt, ...) use them privately for 46 | * various purposes. See specific modules to get their various 47 | * significances. 48 | */ 49 | unsigned tag; /* user-defined tag */ 50 | unsigned tic; /* absolute tic of the FIRST event */ 51 | struct seqev *pos; /* pointer to the FIRST event */ 52 | }; 53 | 54 | struct statelist { 55 | /* 56 | * instead of a simple list, we should use a hash table here, 57 | * but statistics on real-life cases seem to show that lookups 58 | * are very fast thanks to the state ordering (average lookup 59 | * time is around 1-2 iterations for a common MIDI file), so 60 | * we keep using a simple list 61 | */ 62 | struct state *first; /* head of the state list */ 63 | unsigned changed; /* if changed within this tick */ 64 | unsigned serial; /* unique ID */ 65 | #ifdef STATE_PROF 66 | struct prof prof; 67 | #endif 68 | }; 69 | 70 | void state_pool_init(unsigned); 71 | void state_pool_done(void); 72 | struct state *state_new(void); 73 | void state_del(struct state *); 74 | void state_log(struct state *); 75 | void state_copyev(struct state *, struct ev *, unsigned); 76 | unsigned state_match(struct state *, struct ev *); 77 | unsigned state_inspec(struct state *, struct evspec *); 78 | unsigned state_eq(struct state *, struct ev *); 79 | unsigned state_cancel(struct state *, struct ev *); 80 | unsigned state_restore(struct state *, struct ev *); 81 | 82 | void statelist_init(struct statelist *); 83 | void statelist_done(struct statelist *); 84 | void statelist_dump(struct statelist *); 85 | void statelist_dup(struct statelist *, struct statelist *); 86 | void statelist_empty(struct statelist *); 87 | void statelist_add(struct statelist *, struct state *); 88 | void statelist_rm(struct statelist *, struct state *); 89 | struct state *statelist_lookup(struct statelist *, struct ev *); 90 | struct state *statelist_update(struct statelist *, struct ev *); 91 | void statelist_outdate(struct statelist *); 92 | 93 | #endif /* MIDISH_STATE_H */ 94 | -------------------------------------------------------------------------------- /str.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /* 18 | * simple string manupulation functions. A NULL pointer is considered 19 | * as a "non-sense" string, and cannot be used with str_new() and 20 | * str_delete(). Non-sense strings cannot be compared and have no 21 | * length 22 | */ 23 | 24 | #include 25 | #include "utils.h" 26 | #include "str.h" 27 | 28 | /* 29 | * allocate a new string and copy the string from the given argument 30 | * into the allocated buffer the argument cannot be NULL. 31 | */ 32 | char * 33 | str_new(char *val) 34 | { 35 | unsigned cnt; 36 | char *s, *buf; 37 | 38 | if (val == NULL) { 39 | log_puts("str_new: NULL pointer argument\n"); 40 | panic(); 41 | } 42 | cnt = str_len(val) + 1; 43 | buf = xmalloc(cnt, "str"); 44 | for (s = buf; cnt > 0; cnt--) { 45 | *s++ = *val++; 46 | } 47 | return buf; 48 | } 49 | 50 | /* 51 | * free a string allocated with str_new() can't be used on NULL 52 | * pointer 53 | */ 54 | void 55 | str_delete(char *s) 56 | { 57 | if (s == NULL) { 58 | log_puts("str_delete: NULL pointer argument\n"); 59 | panic(); 60 | } 61 | xfree(s); 62 | } 63 | 64 | /* 65 | * print the string to stderr; can be safely used even if the string 66 | * is NULL 67 | */ 68 | void 69 | str_log(char *s) 70 | { 71 | if (s == NULL) { 72 | log_puts(""); 73 | } else { 74 | log_puts(s); 75 | } 76 | } 77 | 78 | /* 79 | * return 1 if the two strings are identical and 0 otherwise. Two 80 | * zero-length strings are considered identical. 81 | */ 82 | unsigned 83 | str_eq(char *s1, char *s2) 84 | { 85 | 86 | if (s1 == NULL || s2 == NULL) { 87 | log_puts("std_id: NULL pointer argument\n"); 88 | panic(); 89 | } 90 | for (;;) { 91 | if (*s1 == '\0' && *s2 == '\0') { 92 | return 1; 93 | } else if (*s1 == '\0' || *s2 == '\0' || *s1 != *s2) { 94 | return 0; 95 | } 96 | s1++; 97 | s2++; 98 | } 99 | } 100 | 101 | /* 102 | * return the length of the given string 103 | */ 104 | unsigned 105 | str_len(char *s) 106 | { 107 | unsigned n; 108 | for (n = 0; *s; s++) { 109 | n++; 110 | } 111 | return n; 112 | } 113 | 114 | /* 115 | * concatenate two strings. 116 | */ 117 | char * 118 | str_cat(char *s1, char *s2) 119 | { 120 | size_t n1, n2; 121 | char *buf; 122 | 123 | n1 = str_len(s1); 124 | n2 = str_len(s2); 125 | 126 | buf = xmalloc(n1 + n2 + 1, "str"); 127 | 128 | memcpy(buf, s1, n1); 129 | memcpy(buf + n1, s2, n2); 130 | 131 | buf[n1 + n2] = 0; 132 | return buf; 133 | } 134 | -------------------------------------------------------------------------------- /str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_STR_H 18 | #define MIDISH_STR_H 19 | 20 | char *str_new(char *); 21 | void str_delete(char *); 22 | void str_log(char *); 23 | unsigned str_eq(char *, char *); 24 | unsigned str_len(char *); 25 | char *str_cat(char *, char *); 26 | 27 | #endif /* MIDISH_STR_H */ 28 | -------------------------------------------------------------------------------- /sysex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_SYSEX_H 18 | #define MIDISH_SYSEX_H 19 | 20 | struct chunk { 21 | struct chunk *next; 22 | unsigned used; /* bytes used in 'data' */ 23 | #define CHUNK_SIZE 0x100 24 | unsigned char data[CHUNK_SIZE]; 25 | }; 26 | 27 | struct sysex { 28 | struct sysex *next; 29 | unsigned unit; /* device number */ 30 | struct chunk *first, *last; 31 | }; 32 | 33 | struct sysexlist { 34 | struct sysex *first, **lastptr; 35 | }; 36 | 37 | struct sysex_data { 38 | unsigned char *data; 39 | unsigned int unit; 40 | unsigned int size; 41 | unsigned int pos; 42 | }; 43 | 44 | void chunk_pool_init(unsigned); 45 | void chunk_pool_done(void); 46 | struct chunk *chunk_new(void); 47 | void chunk_del(struct chunk *); 48 | 49 | void sysex_pool_init(unsigned); 50 | void sysex_pool_done(void); 51 | struct sysex *sysex_new(unsigned); 52 | void sysex_del(struct sysex *); 53 | void sysex_add(struct sysex *, unsigned); 54 | void sysex_log(struct sysex *); 55 | unsigned sysex_check(struct sysex *); 56 | 57 | void sysexlist_init(struct sysexlist *); 58 | void sysexlist_done(struct sysexlist *); 59 | void sysexlist_clear(struct sysexlist *); 60 | void sysexlist_put(struct sysexlist *, struct sysex *); 61 | struct sysex *sysexlist_get(struct sysexlist *); 62 | void sysexlist_log(struct sysexlist *); 63 | 64 | void sysexlist_add(struct sysexlist *, unsigned int, struct sysex *); 65 | struct sysex *sysexlist_rm(struct sysexlist *, unsigned int); 66 | 67 | struct sysex *sysex_undorestore(struct sysex_data *); 68 | unsigned int sysex_undosave(struct sysex *, struct sysex_data *); 69 | 70 | #endif /* MIDISH_SYSEX_H */ 71 | -------------------------------------------------------------------------------- /textio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_TEXTIO_H 18 | #define MIDISH_TEXTIO_H 19 | 20 | #define CHAR_EOF (-1) 21 | 22 | struct textin; 23 | struct textout; 24 | 25 | struct textin *textin_new(char *); 26 | void textin_delete(struct textin *); 27 | unsigned textin_getchar(struct textin *, int *); 28 | void textin_getpos(struct textin *, unsigned *, unsigned *); 29 | 30 | struct textout *textout_new(char *); 31 | void textout_delete(struct textout *); 32 | void textout_shiftleft(struct textout *); 33 | void textout_shiftright(struct textout *); 34 | void textout_putstr(struct textout *, char *); 35 | void textout_putlong(struct textout *, long); 36 | void textout_putbyte(struct textout *, unsigned); 37 | 38 | /* ------------------------------------------------- stdin/stdout --- */ 39 | 40 | extern struct textout *tout; 41 | extern struct textin *tin; 42 | 43 | void textio_init(void); 44 | void textio_done(void); 45 | 46 | #endif /* MIDISH_TEXTIO_H */ 47 | -------------------------------------------------------------------------------- /timo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | /* 18 | * trivial timeouts implementation. 19 | * 20 | * A timeout is used to schedule the call of a routine (the callback) 21 | * there is a global list of timeouts that is processed inside the 22 | * event loop ie mux_run(). Timeouts work as follows: 23 | * 24 | * first the timo structure must be initialized with timo_set() 25 | * 26 | * then the timeout is scheduled (only once) with timo_add() 27 | * 28 | * if the timeout expires, the call-back is called; then it can 29 | * be scheduled again if needed. It's OK to reschedule it again 30 | * from the callback 31 | * 32 | * the timeout can be aborted with timo_del(), it is OK to try to 33 | * abort a timout that has expired 34 | * 35 | */ 36 | 37 | #include "utils.h" 38 | #include "timo.h" 39 | 40 | unsigned timo_debug = 0; 41 | struct timo *timo_queue; 42 | unsigned timo_abstime; 43 | 44 | /* 45 | * initialise a timeout structure, arguments are callback and argument 46 | * that will be passed to the callback 47 | */ 48 | void 49 | timo_set(struct timo *o, void (*cb)(void *), void *arg) 50 | { 51 | o->cb = cb; 52 | o->arg = arg; 53 | o->set = 0; 54 | } 55 | 56 | /* 57 | * schedule the callback in 'delta' 24-th of microseconds. The timeout 58 | * must not be already scheduled 59 | */ 60 | void 61 | timo_add(struct timo *o, unsigned delta) 62 | { 63 | struct timo **i; 64 | unsigned val; 65 | int diff; 66 | 67 | #ifdef TIMO_DEBUG 68 | if (o->set) { 69 | log_puts("timo_add: already set\n"); 70 | panic(); 71 | } 72 | if (delta == 0) { 73 | log_puts("timo_add: zero timeout is evil\n"); 74 | panic(); 75 | } 76 | #endif 77 | val = timo_abstime + delta; 78 | for (i = &timo_queue; *i != NULL; i = &(*i)->next) { 79 | diff = (*i)->val - val; 80 | if (diff > 0) { 81 | break; 82 | } 83 | } 84 | o->set = 1; 85 | o->val = val; 86 | o->next = *i; 87 | *i = o; 88 | } 89 | 90 | /* 91 | * abort a scheduled timeout 92 | */ 93 | void 94 | timo_del(struct timo *o) 95 | { 96 | struct timo **i; 97 | 98 | for (i = &timo_queue; *i != NULL; i = &(*i)->next) { 99 | if (*i == o) { 100 | *i = o->next; 101 | o->set = 0; 102 | return; 103 | } 104 | } 105 | if (timo_debug) 106 | log_puts("timo_del: not found\n"); 107 | } 108 | 109 | /* 110 | * routine to be called by the timer when 'delta' 24-th of microsecond 111 | * elapsed. This routine updates time referece used by timeouts and 112 | * calls expired timeouts 113 | */ 114 | void 115 | timo_update(unsigned delta) 116 | { 117 | struct timo *to; 118 | int diff; 119 | 120 | /* 121 | * update time reference 122 | */ 123 | timo_abstime += delta; 124 | 125 | /* 126 | * remove from the queue and run expired timeouts 127 | */ 128 | while (timo_queue != NULL) { 129 | /* 130 | * there is no overflow here because + and - are 131 | * modulo 2^32, they are the same for both signed and 132 | * unsigned integers 133 | */ 134 | diff = timo_queue->val - timo_abstime; 135 | if (diff > 0) 136 | break; 137 | to = timo_queue; 138 | timo_queue = to->next; 139 | to->set = 0; 140 | to->cb(to->arg); 141 | } 142 | } 143 | 144 | /* 145 | * initialize timeout queue 146 | */ 147 | void 148 | timo_init(void) 149 | { 150 | timo_queue = NULL; 151 | timo_abstime = 0; 152 | } 153 | 154 | /* 155 | * destroy timeout queue 156 | */ 157 | void 158 | timo_done(void) 159 | { 160 | if (timo_queue != NULL) { 161 | log_puts("timo_done: timo_queue not empty!\n"); 162 | panic(); 163 | } 164 | timo_queue = (struct timo *)0xdeadbeef; 165 | } 166 | -------------------------------------------------------------------------------- /timo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_TIMO_H 18 | #define MIDISH_TIMO_H 19 | 20 | struct timo { 21 | struct timo *next; 22 | unsigned val; /* time to wait before the callback */ 23 | unsigned set; /* true if the timeout is set */ 24 | void (*cb)(void *arg); /* routine to call on expiration */ 25 | void *arg; /* argument to give to 'cb' */ 26 | }; 27 | 28 | void timo_set(struct timo *, void (*)(void *), void *); 29 | void timo_add(struct timo *, unsigned); 30 | void timo_del(struct timo *); 31 | void timo_update(unsigned); 32 | void timo_init(void); 33 | void timo_done(void); 34 | 35 | extern unsigned timo_abstime; 36 | 37 | #endif /* MIDISH_TIMO_H */ 38 | -------------------------------------------------------------------------------- /track.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_TRACK_H 18 | #define MIDISH_TRACK_H 19 | 20 | #include "ev.h" 21 | 22 | struct seqev { 23 | unsigned delta; 24 | struct ev ev; 25 | struct seqev *next, **prev; 26 | }; 27 | 28 | struct track { 29 | struct seqev eot; /* end-of-track event */ 30 | struct seqev *first; /* head of the event list */ 31 | }; 32 | 33 | struct track_data { 34 | struct seqev_data { 35 | unsigned delta; 36 | struct ev ev; 37 | } *evs; 38 | unsigned int pos, nrm, nins; 39 | }; 40 | 41 | void seqev_pool_init(unsigned); 42 | void seqev_pool_done(void); 43 | struct seqev *seqev_new(void); 44 | void seqev_del(struct seqev *); 45 | void seqev_dump(struct seqev *); 46 | 47 | void track_init(struct track *); 48 | void track_done(struct track *); 49 | void track_dump(struct track *); 50 | unsigned track_numev(struct track *); 51 | unsigned track_numtic(struct track *); 52 | void track_clear(struct track *); 53 | unsigned track_isempty(struct track *); 54 | void track_chomp(struct track *); 55 | void track_shift(struct track *, unsigned); 56 | void track_swap(struct track *, struct track *); 57 | 58 | unsigned seqev_avail(struct seqev *); 59 | void seqev_ins(struct seqev *, struct seqev *); 60 | void seqev_rm(struct seqev *); 61 | 62 | void track_setchan(struct track *, unsigned, unsigned); 63 | void track_chanmap(struct track *, char *); 64 | unsigned track_evcnt(struct track *, unsigned); 65 | 66 | unsigned track_undosave(struct track *, struct track_data *); 67 | unsigned track_undodiff(struct track *, struct track_data *); 68 | void track_undorestore(struct track *, struct track_data *); 69 | 70 | #endif /* MIDISH_TRACK_H */ 71 | -------------------------------------------------------------------------------- /tty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifndef TTY_H 17 | #define TTY_H 18 | 19 | #include 20 | 21 | #define TTY_KEY_SHIFT (1 << 31) 22 | #define TTY_KEY_CTRL (1 << 30) 23 | #define TTY_KEY_ALT (1 << 29) 24 | 25 | enum TTY_KEY { 26 | /* 27 | * we put special "control" keys in the "private" unicode plane, 28 | * allowing to encode any key as a simple int 29 | * 30 | * certain function keys (tab, enter, delete... ) have unicode 31 | * character, but since we don't use them as "characters" we 32 | * put them in the private plane as well, shifted by 0x100000 33 | */ 34 | TTY_KEY_BS = 0x100008, 35 | TTY_KEY_TAB = 0x100009, 36 | TTY_KEY_ENTER = 0x10000d, 37 | TTY_KEY_ESC = 0x10001b, 38 | TTY_KEY_DEL = 0x10007f, 39 | TTY_KEY_UP = 0x100100, TTY_KEY_DOWN, TTY_KEY_LEFT, TTY_KEY_RIGHT, 40 | TTY_KEY_HOME, TTY_KEY_END, TTY_KEY_PGUP, TTY_KEY_PGDOWN, 41 | TTY_KEY_INSERT 42 | }; 43 | 44 | #define TTY_TSTATE_ANY 0 /* expect any char */ 45 | #define TTY_TSTATE_ESC 1 /* got ESC */ 46 | #define TTY_TSTATE_CSI 2 /* got CSI, parsing it */ 47 | #define TTY_TSTATE_CSI_PAR 3 /* parsing CSI param (number) */ 48 | #define TTY_TSTATE_ERROR 4 /* found error, skipping */ 49 | #define TTY_TSTATE_INT 5 /* got ESC */ 50 | #define TTY_ESC_NPAR 8 /* max params in CSI */ 51 | 52 | struct pollfd; 53 | 54 | struct tty_ops { 55 | void (*draw)(void *); 56 | void (*resize)(void *, int); 57 | void (*onkey)(void *, int); 58 | }; 59 | 60 | int tty_init(void); 61 | void tty_done(void); 62 | int tty_pollfd(struct pollfd *); 63 | int tty_revents(struct pollfd *); 64 | void tty_winch(void); 65 | void tty_int(void); 66 | void tty_reset(void); 67 | void tty_write(void *, size_t); 68 | 69 | void tty_tflush(void); 70 | void tty_toutput(char *, int); 71 | void tty_tsetcurs(int); 72 | void tty_tputs(int, int, char *, int); 73 | void tty_tclear(void); 74 | void tty_tclrscr(void); 75 | void tty_tendl(void); 76 | 77 | extern struct tty_ops *tty_ops; 78 | extern void *tty_arg; 79 | 80 | struct el_ops { 81 | /* 82 | * Called for every character when a new line is entered, 83 | * including for \n and EOF. 84 | */ 85 | void (*onchar)(void *, int); 86 | 87 | /* 88 | * Called when a completion list must be built (when the TAB 89 | * key is hit the first time). The function gets a pointer to 90 | * the text, its size and the current cursor position. It 91 | * must parse the text, build the appropriate completion list 92 | * (by calling el_compladd() for each item) and return in the 93 | * extents of the sub-string being completed (for instance the 94 | * last component of the path). 95 | */ 96 | void (*oncompl)(void *, char *, int, int, int *, int *); 97 | }; 98 | 99 | void el_init(struct el_ops *, void *); 100 | void el_done(void); 101 | void el_setprompt(char *); 102 | void el_compladd(char *); 103 | 104 | extern struct tty_ops el_tty_ops; 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /undo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef MIDISH_UNDO_H 18 | #define MIDISH_UNDO_H 19 | 20 | #include "track.h" 21 | #include "sysex.h" 22 | 23 | struct songtrk; 24 | struct songchan; 25 | struct songfilt; 26 | struct songsx; 27 | 28 | enum { 29 | UNDO_EMPTY, 30 | UNDO_STR, 31 | UNDO_UINT, 32 | UNDO_TRACK, 33 | UNDO_TDEL, 34 | UNDO_TNEW, 35 | UNDO_FILT, 36 | UNDO_FDEL, 37 | UNDO_FNEW, 38 | UNDO_CDEL, 39 | UNDO_CNEW, 40 | UNDO_XADD, 41 | UNDO_XRM, 42 | UNDO_XDEL, 43 | UNDO_XNEW, 44 | UNDO_SCALE 45 | }; 46 | 47 | struct undo { 48 | struct undo *next; 49 | int type; 50 | char *func; 51 | char *name; 52 | unsigned size; 53 | union { 54 | struct undo_setstr { 55 | char **ptr, *val; 56 | } ren; 57 | struct undo_setuint { 58 | unsigned int *ptr, val; 59 | } uint; 60 | struct undo_track { 61 | struct track *track; 62 | struct track_data data; 63 | } track; 64 | struct undo_tdel { 65 | struct songtrk *trk; 66 | struct track_data data; 67 | } tdel; 68 | struct undo_filt { 69 | struct filt *filt; 70 | struct filt data; 71 | } filt; 72 | struct undo_fdel { 73 | struct songfilt *filt; 74 | struct undo_fdel_trk { 75 | struct undo_fdel_trk *next; 76 | struct songtrk *trk; 77 | } *trks; 78 | } fdel; 79 | struct undo_cdel { 80 | struct songchan *chan; 81 | struct track_data data; 82 | } cdel; 83 | struct undo_sysex { 84 | struct sysexlist *list; 85 | struct sysex_data data; 86 | } sysex; 87 | struct undo_xdel { 88 | struct songsx *sx; 89 | } xdel; 90 | struct undo_scale { 91 | unsigned int oldunit, newunit; 92 | } scale; 93 | } u; 94 | }; 95 | 96 | void undo_pop(struct song *); 97 | void undo_push(struct song *, struct undo *); 98 | void undo_clear(struct song *, struct undo **); 99 | void undo_start(struct song *, char *, char *); 100 | void undo_setstr(struct song *, char *, char **, char *); 101 | void undo_setuint(struct song *, char *, char *, unsigned int *, unsigned int); 102 | void undo_scale(struct song *, char *, char *, unsigned int, unsigned int); 103 | 104 | void undo_track_save(struct song *, struct track *, char *, char *); 105 | void undo_track_diff(struct song *); 106 | void undo_tdel_do(struct song *, struct songtrk *, char *); 107 | struct songtrk *undo_tnew_do(struct song *, char *, char *); 108 | void undo_filt_save(struct song *, struct filt *, char *, char *); 109 | 110 | void undo_fdel_do(struct song *, struct songfilt *, char *); 111 | struct songfilt *undo_fnew_do(struct song *, char *, char *); 112 | 113 | struct songchan *undo_cnew_do(struct song *, unsigned int, unsigned int, int, 114 | char *, char *); 115 | void undo_cdel_do(struct song *, struct songchan *, char *); 116 | 117 | void undo_xadd_do(struct song *, char *, struct songsx *, struct sysex *); 118 | void undo_xrm_do(struct song *, char *, struct songsx *, unsigned int); 119 | void undo_xdel_do(struct song *, char *, struct songsx *); 120 | struct songsx *undo_xnew_do(struct song *, char *, char *); 121 | 122 | #endif /* MIDISH_UNDO_H */ 123 | -------------------------------------------------------------------------------- /utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2012 Alexandre Ratchov 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef UTILS_H 18 | #define UTILS_H 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | void log_putc(char *, size_t); 27 | void log_puts(char *); 28 | void log_putx(unsigned long); 29 | void log_putu(unsigned long); 30 | void log_puti(long); 31 | void log_perror(char *); 32 | void log_putp(void *); 33 | void panic(void); 34 | void log_flush(void); 35 | 36 | void *xmalloc(size_t, char *); 37 | char *xstrdup(char *, char *); 38 | void xfree(void *); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | extern unsigned log_sync; 45 | 46 | #endif /* UTILS_H */ 47 | --------------------------------------------------------------------------------