The add_to_library_path() function has now support for paths prefixed
[ahxm.git] / compiler.y
blobba52f2535fcc9d5b5acb1763df188edd9a4e447f
1 %{
2 /*
4 Ann Hell Ex Machina - Music Software
5 Copyright (C) 2003/2005 Angel Ortega <angel@triptico.com>
7 compiler.y - Scripting language YACC parser
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 http://www.triptico.com
27 #include "config.h"
29 #include <stdio.h>
30 #include <string.h>
31 #include <stdlib.h>
32 #include <math.h>
34 #include "annhell.h"
36 /*******************
37 Data
38 ********************/
40 int yylex(void);
41 void yyerror(char * s);
43 /* injecting code functions (defined in compiler.l) */
44 int push_code(char * code, int times, int dyn);
45 int push_code_from_file(char * file);
47 /* current track */
48 int track;
50 /* current time */
51 double cur_time;
53 /* note globals */
54 static double length;
55 static int octave;
56 static int transpose;
57 static double staccato;
58 static float volume;
59 static double gliss;
61 /* parser debugging */
63 #define DEBUGF if(ss_debug)printf
65 /* named blocks */
67 struct named_block
69 char name[64];
70 char * block;
73 static struct named_block * named_blocks=NULL;
74 static int n_named_blocks=0;
75 static int named_blocks_size=0;
77 /* group info */
78 struct group
80 double start;
81 double gliss;
82 double max;
85 static struct group * groups=NULL;
86 static int n_groups=0;
87 static int groups_size=0;
89 /* mark info */
90 struct mark
92 char name[64];
93 double time;
96 static struct mark * marks=NULL;
97 static int n_marks=0;
98 static int marks_size=0;
100 /* arpeggiator */
101 struct arp
103 double delay;
104 int transpose;
105 float volume;
106 int track;
109 static struct arp * arps=NULL;
110 static int n_arps=0;
111 static int arps_size=0;
113 static double arp_delay;
114 static int arp_transpose;
115 static float arp_volume;
116 static int arp_track;
118 int compiler_error=0;
120 extern int yyline;
122 /*******************
123 Code
124 ********************/
126 void c_err(char * e1, char * e2, char * e3)
127 /* reports an error from the compiler */
129 printf("ahxm:");
130 if(e1 != NULL) printf(" %s", e1);
131 if(e2 != NULL) printf(" %s", e2);
132 if(e3 != NULL) printf(" %s", e3);
133 printf(" in line %d\n", yyline);
135 compiler_error++;
139 static void forward(double step)
140 /* moves forward current time */
142 /* add step */
143 cur_time += step;
145 /* quantizations could be done here */
149 /* named blocks */
151 static int set_named_block(char * name, char * block)
152 /* sets a named block */
154 int n;
156 /* find first if block is previously defined */
157 for(n=0;n < n_named_blocks;n++)
159 if(strcmp(name, named_blocks[n].name) == 0)
161 free(named_blocks[n].block);
162 break;
166 if(n == n_named_blocks)
168 /* need to expand? */
169 if(n_named_blocks == named_blocks_size)
171 named_blocks_size += 4;
173 named_blocks=(struct named_block *)
174 realloc(named_blocks,
175 named_blocks_size *
176 sizeof(struct named_block));
179 n_named_blocks++;
182 strncpy(named_blocks[n].name, name, sizeof(named_blocks[n].name));
183 named_blocks[n].block=block;
185 return(1);
189 static void insert_named_block(char * name)
190 /* inserts a named block */
192 int n;
194 for(n=0;n < n_named_blocks;n++)
196 if(strcmp(name, named_blocks[n].name) == 0)
198 push_code(named_blocks[n].block, 1, 0);
199 return;
203 c_err("block-not-found", name, NULL);
207 static int insert_file(char * filename)
209 if(!push_code_from_file(filename))
211 c_err("script-not-found", filename, NULL);
212 return(1);
215 return(0);
219 /* groups */
221 static int push_group(void)
222 /* starts a new group of notes */
224 if(n_groups == groups_size)
226 groups_size += 4;
228 groups=(struct group *) realloc(groups,
229 groups_size * sizeof(struct group));
232 groups[n_groups].start=cur_time;
233 groups[n_groups].gliss=0.0;
234 groups[n_groups].max=0.0;
236 n_groups++;
238 return(1);
242 static int next_group_part(void)
243 /* part delimiter */
245 if(n_groups == 0)
247 c_err("missing-start-of-group", NULL, NULL);
248 return(0);
251 /* store maximum frame */
252 if(groups[n_groups - 1].max < cur_time)
253 groups[n_groups - 1].max=cur_time;
255 /* add glissando delay */
256 groups[n_groups - 1].gliss += gliss;
258 /* rewind */
259 cur_time=groups[n_groups - 1].start + groups[n_groups - 1].gliss;
261 return(1);
265 static int pop_group(void)
266 /* finishes a group, moving the frame to the end of the longer part */
268 if(n_groups == 0)
270 c_err("missing-start-of-group", NULL, NULL);
271 return(0);
274 n_groups--;
276 cur_time=groups[n_groups].max;
278 return(1);
282 /* marks */
284 static void add_mark(char * name)
285 /* creates a new mark */
287 if(n_marks == marks_size)
289 marks_size += 4;
291 marks=(struct mark *) realloc(marks,
292 marks_size * sizeof(struct mark));
295 strncpy(marks[n_marks].name, name, sizeof(marks[n_marks].name));
296 marks[n_marks].time=cur_time;
298 n_marks++;
302 static void find_mark(char * name, int set)
303 /* finds a mark by name, optionally moving time cursor there */
305 int n;
307 for(n=0;n < n_marks;n++)
309 if(strcmp(marks[n].name, name) == 0)
311 if(set)
313 if(cur_time > marks[n].time)
314 c_err("mark-overpassed", name, NULL);
315 else
316 cur_time=marks[n].time;
318 else
319 if(cur_time != marks[n].time)
320 c_err("mark-mismatch", name, NULL);
322 return;
326 c_err("mark-not-found", name, NULL);
330 /* arpeggiator */
332 static void arp_default(void)
333 /* resets arpeggiator values to the default ones */
335 arp_delay=0.0;
336 arp_transpose=0;
337 arp_volume=1.0;
338 arp_track=track;
342 static void add_arp(void)
343 /* adds an arpeggiator note */
345 /* if the note is exactly the same, do nothing */
346 if(arp_delay == 0.0 && arp_transpose == 0 &&
347 arp_volume == 1.0 && arp_track == track)
348 return;
350 if(n_arps == arps_size)
352 arps_size += 4;
354 arps=(struct arp *) realloc(arps,
355 arps_size * sizeof(struct arp));
358 arps[n_arps].delay=arp_delay;
359 arps[n_arps].transpose=arp_transpose;
360 arps[n_arps].volume=arp_volume;
361 arps[n_arps].track=arp_track;
363 n_arps++;
364 arp_default();
368 /* song events */
370 static void add_note_event(int note)
371 /* adds a note event */
373 int n;
374 int np;
375 union song_ev e;
377 /* calculate the note */
378 np=note + transpose + (octave * 12);
380 /* is note out of range? */
381 if(np < 0 || np > 127)
383 c_err("note-out-of-range", NULL, NULL);
384 return;
387 e.note.type=SONG_EV_NOTE;
388 e.note.time=cur_time;
389 e.note.trk_id=track;
390 e.note.note=np;
391 e.note.len=length * staccato;
392 e.note.vol=volume;
394 add_song_ev(&e);
396 /* add arpeggiator repetitions */
397 for(n=0;n < n_arps;n++)
399 e.note.time=cur_time + arps[n].delay;
400 e.note.trk_id=arps[n].track;
401 e.note.note=np + arps[n].transpose;
402 e.note.vol=volume * arps[n].volume;
404 add_song_ev(&e);
409 static void add_tempo_event(int trk_id, double tempo)
411 union song_ev e;
413 e.tempo.type=SONG_EV_TEMPO;
414 e.tempo.time=cur_time;
415 e.tempo.trk_id=trk_id;
416 e.tempo.tempo=tempo;
417 add_song_ev(&e);
421 static void add_meter_event(int trk_id, int num, int den)
423 union song_ev e;
425 e.meter.type=SONG_EV_METER;
426 e.meter.time=cur_time;
427 e.meter.trk_id=trk_id;
428 e.meter.num=num;
429 e.meter.den=den;
430 add_song_ev(&e);
433 static void add_measure_event(void)
435 union song_ev e;
437 e.measure.type=SONG_EV_MEASURE;
438 e.measure.time=cur_time;
439 e.measure.trk_id=-1;
440 e.measure.line=yyline;
442 add_song_ev(&e);
446 static void add_ss_sustain_event(double sustain)
448 union song_ev e;
450 e.ss_sustain.type=SONG_EV_SS_SUSTAIN;
451 e.ss_sustain.time=cur_time;
452 e.ss_sustain.trk_id=track;
453 e.ss_sustain.sustain=sustain;
455 add_song_ev(&e);
459 static void add_ss_vibrato_event(double depth, double freq)
461 union song_ev e;
463 e.ss_vibrato.type=SONG_EV_SS_VIBRATO;
464 e.ss_vibrato.time=cur_time;
465 e.ss_vibrato.trk_id=track;
466 e.ss_vibrato.vib_depth=depth;
467 e.ss_vibrato.vib_freq=freq;
469 add_song_ev(&e);
473 static void add_ss_channel_event(int channel, float vol)
475 union song_ev e;
477 e.ss_channel.type=SONG_EV_SS_CHANNEL;
478 e.ss_channel.time=cur_time;
479 e.ss_channel.trk_id=track;
480 e.ss_channel.channel=channel;
481 e.ss_channel.vol=vol;
483 add_song_ev(&e);
487 static void add_ss_wav_event(char * wav_file, int base, int min, int max,
488 double loop_start, double loop_end)
490 union song_ev e;
492 e.ss_wav.type=SONG_EV_SS_WAV;
493 e.ss_wav.time=cur_time;
494 e.ss_wav.trk_id=track;
495 e.ss_wav.file=wav_file;
496 e.ss_wav.base=base;
497 e.ss_wav.min=min;
498 e.ss_wav.max=max;
499 e.ss_wav.loop_start=loop_start;
500 e.ss_wav.loop_end=loop_end;
501 add_song_ev(&e);
505 static void add_ss_pat_event(char * pat_file)
507 union song_ev e;
509 e.ss_pat.type=SONG_EV_SS_PAT;
510 e.ss_pat.time=cur_time;
511 e.ss_pat.trk_id=track;
512 e.ss_pat.file=pat_file;
514 add_song_ev(&e);
518 static void add_ss_eff_event(int type, int channel, double size, float gain,
519 double depth, double freq, double phase, float initial, float final)
521 union song_ev e;
523 e.ss_eff.type=type;
524 e.ss_eff.time=cur_time;
525 e.ss_eff.trk_id=track;
526 e.ss_eff.channel=channel;
527 e.ss_eff.size=size;
528 e.ss_eff.gain=gain;
529 e.ss_eff.depth=depth;
530 e.ss_eff.freq=freq;
531 e.ss_eff.phase=phase;
532 e.ss_eff.initial=initial;
533 e.ss_eff.final=final;
535 add_song_ev(&e);
539 static void add_ss_pitch_stretch(int note, double len, float vol)
541 union song_ev e;
543 e.ss_pitch_stretch.type=SONG_EV_SS_PITCH_STRETCH;
544 e.ss_pitch_stretch.time=cur_time;
545 e.ss_pitch_stretch.trk_id=track;
546 e.ss_pitch_stretch.note=note;
547 e.ss_pitch_stretch.len=len;
548 e.ss_pitch_stretch.vol=vol;
550 add_song_ev(&e);
554 static void add_midi_channel_event(int channel)
556 union song_ev e;
558 e.midi_channel.type=SONG_EV_MIDI_CHANNEL;
559 e.midi_channel.time=cur_time;
560 e.midi_channel.trk_id=track;
561 e.midi_channel.channel=channel;
563 add_song_ev(&e);
567 static void add_midi_program_event(int program)
569 union song_ev e;
571 e.midi_program.type=SONG_EV_MIDI_PROGRAM;
572 e.midi_program.time=cur_time;
573 e.midi_program.trk_id=track;
574 e.midi_program.program=program;
576 add_song_ev(&e);
580 static void init_track(void)
581 /* sets the default values for a new track */
583 cur_time=0.0;
584 length=0.0;
585 transpose=0;
586 staccato=0.8;
587 volume=0.75;
588 octave=5;
589 gliss=0;
591 /* groups should not cross track boundaries */
592 n_groups=0;
594 /* reset arpeggiator */
595 n_arps=0;
596 arp_default();
602 %union {
603 int i;
604 double d;
605 char * p;
608 %token <i> P_INTEGER S_INTEGER
609 %token <d> P_REAL S_REAL
610 %token <i> NOTE_P NOTE_T3 NOTE_T5
611 %token <p> NEW_MARK GOTO_MARK ASSERT_MARK
613 %token <p> BLOCK BLK_ASSIGN BLK_INSERT FILE_INSERT
615 %token <p> XC_STR
616 %token <i> XC_ABSNOTE
617 %token <d> XC_MSECS
619 %token SS_SEP SS_WAV SS_LOOP_WAV SS_PAT SS_SUSTAIN SS_VIBRATO SS_CHANNEL SS_VOL
621 %token SS_EFF_DELAY SS_EFF_ECHO SS_EFF_COMB SS_EFF_ALLPASS SS_EFF_FLANGER
622 %token SS_EFF_WOBBLE SS_EFF_SQWOBBLE SS_EFF_FADER SS_EFF_REVERB SS_EFF_OFF
624 %token SS_PITCH_STRETCH SS_TIME_STRETCH
626 %token MIDI_CHANNEL MIDI_PROGRAM MIDI_GENERIC
628 %type <i> integer note note_pitch rest
629 %type <d> real p_number number note_length
631 %type <d> arp_list arp_note
632 %type <i> xc_absnote
636 script:
637 script stmt { ; }
638 | /* NULL */
641 stmt:
642 note {
643 /* note event */
644 add_note_event($1);
645 forward(length);
647 | rest {
648 /* rest */
649 forward(length);
651 | 'z' note_length {
652 /* zero note */
653 length=$2;
655 | 'o' P_INTEGER {
656 /* absolute octave */
657 octave=$2;
659 | 'o' S_INTEGER {
660 /* relative octave */
661 octave += $2;
663 | 'v' P_INTEGER {
664 /* absolute volume */
665 volume=(float)$2;
667 | 'v' P_REAL {
668 /* absolute volume */
669 volume=(float)$2;
671 | 'v' S_REAL {
672 /* relative volume */
673 volume += (float)$2;
675 | 't' integer {
676 /* transpose */
677 transpose=$2;
679 | 's' p_number {
680 /* staccato */
681 staccato=$2;
684 | '<' {
685 /* start of group */
686 push_group();
688 | ';' {
689 /* group delimiter */
690 next_group_part();
692 | '>' {
693 /* end of group */
694 pop_group();
696 | 'l' note_length {
697 /* glissando */
698 gliss=$2;
701 | '|' {
702 /* measure mark event */
703 add_measure_event();
706 | NEW_MARK {
707 /* add new mark */
708 add_mark($1);
710 | GOTO_MARK {
711 /* go to mark */
712 find_mark($1, 1);
714 | ASSERT_MARK {
715 /* assert mark */
716 find_mark($1, 0);
719 | '\\' {
720 /* new track */
722 track++;
723 init_track();
725 | 'T' p_number {
726 /* tempo setting */
727 add_tempo_event(-1, $2);
729 | 'M' P_INTEGER '/' P_INTEGER {
730 /* meter (time signature) setting */
731 add_meter_event(-1, $2, $4);
734 | BLOCK '*' P_INTEGER {
735 /* repeat block */
736 push_code($1, $3, 1);
738 | BLOCK BLK_ASSIGN {
739 /* assign block */
740 set_named_block($2, $1);
742 | BLK_INSERT {
743 /* insert named block */
744 insert_named_block($1);
746 | FILE_INSERT {
747 /* insert file */
748 insert_file($1);
751 | arp { ; }
753 | xc_cmd { ; }
757 integer:
758 P_INTEGER { $$ = $1; }
759 | S_INTEGER { $$ = $1; }
762 real:
763 P_REAL { $$ = $1; }
764 | S_REAL { $$ = $1; }
767 p_number:
768 P_INTEGER { $$ = (double) $1; }
769 | P_REAL { $$ = $1; }
772 number:
773 integer { $$ = (double) $1; }
774 | real { $$ = $1; }
777 note:
778 note_pitch { $$ = $1; }
779 | note note_length { $$ = $1; length=$2; }
780 | note '~' number { $$ = $1; DEBUGF("imm volume: %lf\n", $3); }
783 note_pitch:
784 NOTE_P { $$ = $1; }
785 | note_pitch '&' { $$ = $1 - 1; }
786 | note_pitch '#' { $$ = $1 + 1; }
787 | note_pitch '\'' { $$ = $1 + 12; }
788 | note_pitch ',' { $$ = $1 - 12; }
791 note_length:
792 P_INTEGER { $$ = 1 / (double) $1; }
793 | note_length NOTE_T3 { $$ = $1 * 2.0 / 3.0; }
794 | note_length NOTE_T5 { $$ = $1 * 4.0 / 5.0; }
795 | note_length '*' p_number { $$ = $1 * $3; }
796 | note_length '.' { $$ = $1 * 1.5; }
799 rest:
800 'r' { ; }
801 | rest note_length {
802 /* rest with length */
803 length=$2;
807 arp:
808 'x' {
809 /* empty arpeggiator */
810 n_arps=0;
811 arp_default();
813 | 'x' arp_list { ; }
816 arp_list:
817 arp_note {
818 /* first arpeggiator note */
819 n_arps=0;
820 add_arp();
822 | arp_list ',' arp_note {
823 /* rest of arpeggiator notes */
824 add_arp();
828 arp_note:
829 note_length {
830 /* arpeggiator delay */
831 arp_delay=$1;
833 | arp_note '~' number {
834 /* arpeggiator volume */
835 arp_volume=(float)$3;
837 | arp_note S_INTEGER {
838 /* arpeggiator transpose */
839 arp_transpose=$2;
841 | arp_note '@' P_INTEGER {
842 /* arpeggiator track */
843 arp_track=$3;
847 xc_absnote:
848 P_INTEGER { $$ = $1; }
849 | XC_ABSNOTE { $$ = $1; }
852 xc_cmd:
853 SS_WAV XC_STR xc_absnote {
854 /* load .wav file with just one note */
855 add_ss_wav_event($2, $3, $3, $3, -1.0, -1.0);
857 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote {
858 /* load .wav file */
859 add_ss_wav_event($2, $3, $4, $5, -1.0, -1.0);
861 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote number number {
862 /* load .wav file, with loop boundaries */
863 add_ss_wav_event($2, $3, $4, $5, $6, $7);
865 | SS_PAT XC_STR {
866 /* load .pat file */
867 add_ss_pat_event($2);
869 | SS_SUSTAIN XC_MSECS {
870 /* sets sustain */
871 add_ss_sustain_event($2);
873 | SS_VIBRATO XC_MSECS number {
874 /* sets vibrato */
875 add_ss_vibrato_event($2, $3);
877 | SS_CHANNEL integer number {
878 /* sets volume for a channel */
879 add_ss_channel_event($2, $3);
881 | SS_VOL number number {
882 /* set vol for 2 channels */
883 add_ss_channel_event(0, $2);
884 add_ss_channel_event(1, $3);
886 | SS_VOL number number number {
887 /* set vol for 3 channels */
888 add_ss_channel_event(0, $2);
889 add_ss_channel_event(1, $3);
890 add_ss_channel_event(2, $4);
892 | SS_VOL number number number number {
893 /* set vol for 4 channels */
894 add_ss_channel_event(0, $2);
895 add_ss_channel_event(1, $3);
896 add_ss_channel_event(2, $4);
897 add_ss_channel_event(3, $5);
899 | SS_VOL number number number number number number {
900 /* set vol for 6 channels */
901 add_ss_channel_event(0, $2);
902 add_ss_channel_event(1, $3);
903 add_ss_channel_event(2, $4);
904 add_ss_channel_event(3, $5);
905 add_ss_channel_event(4, $6);
906 add_ss_channel_event(5, $7);
908 | SS_EFF_DELAY integer XC_MSECS {
909 /* delay effect */
910 add_ss_eff_event(SONG_EV_SS_EFF_DELAY,
911 $2, $3, 0, 0, 0, 0, 0, 0);
914 | SS_EFF_ECHO integer XC_MSECS number {
915 /* echo effect */
916 add_ss_eff_event(SONG_EV_SS_EFF_ECHO,
917 $2, $3, $4, 0, 0, 0, 0, 0);
920 | SS_EFF_COMB integer XC_MSECS number {
921 /* comb effect */
922 add_ss_eff_event(SONG_EV_SS_EFF_COMB,
923 $2, $3, $4, 0, 0, 0, 0, 0);
926 | SS_EFF_ALLPASS integer XC_MSECS number {
927 /* allpass effect */
928 add_ss_eff_event(SONG_EV_SS_EFF_ALLPASS,
929 $2, $3, $4, 0, 0, 0, 0, 0);
932 | SS_EFF_FLANGER integer XC_MSECS number XC_MSECS number number {
933 /* flanger effect */
934 add_ss_eff_event(SONG_EV_SS_EFF_FLANGER,
935 $2, $3, $4, $5, $6, $7, 0, 0);
938 | SS_EFF_WOBBLE integer number number {
939 /* wobble effect */
940 add_ss_eff_event(SONG_EV_SS_EFF_WOBBLE,
941 $2, 0, 0, 0, $3, $4, 0, 0);
944 | SS_EFF_SQWOBBLE integer number number {
945 /* square wobble effect */
946 add_ss_eff_event(SONG_EV_SS_EFF_SQWOBBLE,
947 $2, 0, 0, 0, $3, $4, 0, 0);
950 | SS_EFF_FADER integer XC_MSECS number number {
951 /* fader effect */
952 add_ss_eff_event(SONG_EV_SS_EFF_FADER,
953 $2, $3, 0, 0, 0, 0, $4, $5);
956 | SS_EFF_REVERB integer {
957 /* reverb effect */
958 add_ss_eff_event(SONG_EV_SS_EFF_REVERB,
959 $2, 0, 0, 0, 0, 0, 0, 0);
962 | SS_EFF_OFF integer {
963 /* off effect */
964 add_ss_eff_event(SONG_EV_SS_EFF_OFF,
965 $2, 0, 0, 0, 0, 0, 0, 0);
968 | SS_PITCH_STRETCH xc_absnote number number {
969 /* pitch stretch note */
970 add_ss_pitch_stretch($2, $3, $4);
972 forward($3);
975 | MIDI_CHANNEL integer {
976 /* midi channel */
977 add_midi_channel_event($2);
980 | MIDI_PROGRAM integer {
981 /* midi program */
982 add_midi_program_event($2);
988 void yyerror(char * s)
990 c_err(s, NULL, NULL);
993 #ifdef QQ
994 int main(void)
996 init_track();
998 push_code("!this-is-a-mark", 1, 0);
999 push_code("< c1 ; e& ; g>", 1, 0);
1000 push_code("^this-is-a-mark", 1, 0);
1001 push_code("x4,2-1,2.+4", 1, 0);
1002 push_code("a b'' c,, ", 1, 0);
1003 push_code("v0.1 (d8 v+0.1)*10", 1, 0);
1004 push_code("t1 t-2 t+3", 1, 0);
1005 push_code("{ fader -1 100ms 0 1 } r r4. z2 `room_kit.ahs` o4 o+1 o-2 ", 1, 0);
1006 push_code("{ sustain 100ms }", 1, 0);
1007 push_code("T120.0 M4/4 z8 abcde T80 (edcba)=drum1 $drum1 $drum1 ((a&b)*3 (cd)*2)*10", 2, 0);
1009 yyparse();
1011 printf("Exiting main...\n");
1012 exit(0);
1014 #endif
1016 static void compile_startup(void)
1018 track=0;
1019 yyline=1;
1020 compiler_error=0;
1022 /* default settings */
1023 add_tempo_event(-2, 120.0);
1024 add_meter_event(-2, 4, 4);
1025 init_track();
1029 int compile(char * code)
1031 compile_startup();
1033 push_code(code, 1, 0);
1035 return(yyparse() + compiler_error);
1039 int compile_file(char * file)
1041 compile_startup();
1043 if(insert_file(file))
1044 return(1);
1046 return(yyparse() + compiler_error);