5 Copyright (C) 2003 Angel Ortega <angel@triptico.com>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 http://www.triptico.com
35 #include "generator.h"
37 #include "instrument.h"
51 #define NUM_GENERATORS 64
52 struct generator _generators
[NUM_GENERATORS
];
59 extern double _note_frequency
[128];
68 struct effect_delay e
;
71 _linear_interpolation
=1;
74 memset(_generators
, '\0', sizeof(_generators
));
75 build_note_frequencies();
77 load_pat_file("samples/acpiano.pat");
78 /* load_pat_file("/cdrom/orchhit.pat"); */
81 load_wav_file("samples/amen1.wav", &size
, &ls
, &rs
);
84 add_instrument_layer(&i
, 36, 0, 128, ls
, rs
,
85 size
, 0, size
, 44100 / 3);
87 instrument_play_note(&i
, 36-12, 1, 1);
89 /* generator_portamento(&i.generators[0], 44100 * 2,
90 _note_frequency[36-10] / _note_frequency[36]); */
92 /* instrument_play_note(&i, 39, 1, 1); */
95 load_wav_file("samples/amen1.wav", &size, &ls, &rs);
97 generator_play(&_generators[0], ls, rs, size, 1, 0, size, 0.2, 1, 4410);
99 load_wav_file("samples/01c1.wav", &size, &ls, &rs);
100 generator_play(&_generators[1], ls, rs, size,
101 _note_freq[24] / _note_freq[36], 0, size, 1, 1, 44100 / 3);
103 load_wav_file("samples/05c3.wav", &size, &ls, &rs);
105 generator_play(&_generators[2], ls, rs, size,
106 _note_freq[36] / _note_freq[36], 0, size, 0.5, 0.5, 0);
108 generator_play(&_generators[3], ls, rs, size,
109 _note_freq[39] / _note_freq[36], 0, size, 0.5, 0.5, 0);
111 generator_play(&_generators[4], ls, rs, size,
112 _note_freq[43] / _note_freq[36], 0, size, 0.5, 0.5, 0);
114 load_wav_file("samples/as-al017.wav", &size, &ls, &rs);
115 generator_play(&_generators[5], ls, rs, size, 1, 0, size, 2, 2, 0);
118 f=popen("sox -V -t raw -s -r 44100 -c 2 -w - qq.wav","w");
121 if(output_open("oss", "/dev/dsp") < 0)
123 printf("Error: can't init driver\n");
127 /* init_delay(&e, (int)TIME2SAMPLES(20.0 / 1000.0), 0.1); */
128 init_delay(&e
, 44100, 0.1);
130 for(n
=TIME2SAMPLES(15);n
> 0;n
--)
136 for(m=0;m < NUM_GENERATORS;m++)
137 generator(&_generators[m], &l, &r);
139 generate_instrument(&i
, &l
, &r
);
141 if(n
< TIME2SAMPLES(13))
142 process_flanger(&e
, &l
, &r
);
146 /* if(n < TIME2SAMPLES(14))
147 generator_release(&_generators[1]); */