00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Luigi Negretti Lanner * 00003 * luigi.negrettilanner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 void ini_pitch() 00021 { 00022 init_pitch[0] = pch_1->value(); 00023 init_pitch[1] = pch_2->value(); 00024 init_pitch[2] = pch_3->value(); 00025 init_pitch[3] = pch_4->value(); 00026 init_pitch[4] = pch_5->value(); 00027 init_pitch[5] = pch_6->value(); 00028 init_pitch[6] = pch_7->value(); 00029 init_pitch[7] = pch_8->value(); 00030 init_pitch[8] = pch_9->value(); 00031 init_pitch[9] = pch_10->value(); 00032 init_pitch[10] = pch_11->value(); 00033 init_pitch[11] = pch_12->value(); 00034 } 00035 00036 void contrappunto::pitch_lim_input() 00037 { 00038 pitch_min_ = (int)min_pch->value(); 00039 pitch_max_ = (int)max_pch->value(); 00040 } 00041 00042 void contrappunto::subset_pitch() 00043 { 00044 formula formula; 00045 pitch_lim_input(); 00046 00047 //////////INITIALIZE PITCH SUBSET///// 00048 int sub_tcrm_size = (int)pitch_max_ - (int)pitch_min_; 00049 float *sub_tcrm = new float[sub_tcrm_size]; 00050 00051 init_params(); 00052 int indice = (int)pitch_min_; 00053 int i; 00054 for (i = 0; i < sub_tcrm_size; i++) 00055 { 00056 sub_tcrm[i] = tcrom[indice]; 00057 indice++; 00058 } 00059 /////////////////////////////////////////////////////////// 00060 00061 if (logic_a->value() == 1) 00062 { 00063 formula.trp_seq_tcrom(); 00064 pch_1->value(sub_tcrm[formula.j_p1]); 00065 } 00066 00067 else if (logic_a->value() == 2) 00068 { 00069 formula.trp_seq_tcrom(); 00070 pch_1->value(sub_tcrm[formula.j_p1]); 00071 pch_2->value(sub_tcrm[formula.j_p2]); 00072 } 00073 00074 else if (logic_a->value() == 3) 00075 { 00076 formula.trp_seq_tcrom(); 00077 pch_1->value(sub_tcrm[formula.j_p1]); 00078 pch_2->value(sub_tcrm[formula.j_p2]); 00079 pch_3->value(sub_tcrm[formula.j_p3]); 00080 } 00081 00082 else if (logic_a->value() == 4) 00083 { 00084 formula.trp_seq_tcrom(); 00085 pch_1->value(sub_tcrm[formula.j_p1]); 00086 pch_2->value(sub_tcrm[formula.j_p2]); 00087 pch_3->value(sub_tcrm[formula.j_p3]); 00088 pch_4->value(sub_tcrm[formula.j_p4]); 00089 } 00090 00091 else if (logic_a->value() == 5) 00092 { 00093 formula.trp_seq_tcrom(); 00094 pch_1->value(sub_tcrm[formula.j_p1]); 00095 pch_2->value(sub_tcrm[formula.j_p2]); 00096 pch_3->value(sub_tcrm[formula.j_p3]); 00097 pch_4->value(sub_tcrm[formula.j_p4]); 00098 pch_5->value(sub_tcrm[formula.j_p5]); 00099 } 00100 00101 else if (logic_a->value() == 6) 00102 { 00103 formula.trp_seq_tcrom(); 00104 pch_1->value(sub_tcrm[formula.j_p1]); 00105 pch_2->value(sub_tcrm[formula.j_p2]); 00106 pch_3->value(sub_tcrm[formula.j_p3]); 00107 pch_4->value(sub_tcrm[formula.j_p4]); 00108 pch_5->value(sub_tcrm[formula.j_p5]); 00109 pch_6->value(sub_tcrm[formula.j_p6]); 00110 } 00111 00112 else if (logic_a->value() == 7) 00113 { 00114 formula.trp_seq_tcrom(); 00115 pch_1->value(sub_tcrm[formula.j_p1]); 00116 pch_2->value(sub_tcrm[formula.j_p2]); 00117 pch_3->value(sub_tcrm[formula.j_p3]); 00118 pch_4->value(sub_tcrm[formula.j_p4]); 00119 pch_5->value(sub_tcrm[formula.j_p5]); 00120 pch_6->value(sub_tcrm[formula.j_p6]); 00121 pch_7->value(sub_tcrm[formula.j_p7]); 00122 } 00123 00124 else if (logic_a->value() == 8) 00125 { 00126 formula.trp_seq_tcrom(); 00127 pch_1->value(sub_tcrm[formula.j_p1]); 00128 pch_2->value(sub_tcrm[formula.j_p2]); 00129 pch_3->value(sub_tcrm[formula.j_p3]); 00130 pch_4->value(sub_tcrm[formula.j_p4]); 00131 pch_5->value(sub_tcrm[formula.j_p5]); 00132 pch_6->value(sub_tcrm[formula.j_p6]); 00133 pch_7->value(sub_tcrm[formula.j_p7]); 00134 pch_8->value(sub_tcrm[formula.j_p8]); 00135 } 00136 00137 else if (logic_a->value() == 9) 00138 { 00139 formula.trp_seq_tcrom(); 00140 pch_1->value(sub_tcrm[formula.j_p1]); 00141 pch_2->value(sub_tcrm[formula.j_p2]); 00142 pch_3->value(sub_tcrm[formula.j_p3]); 00143 pch_4->value(sub_tcrm[formula.j_p4]); 00144 pch_5->value(sub_tcrm[formula.j_p5]); 00145 pch_6->value(sub_tcrm[formula.j_p6]); 00146 pch_7->value(sub_tcrm[formula.j_p7]); 00147 pch_8->value(sub_tcrm[formula.j_p8]); 00148 pch_9->value(sub_tcrm[formula.j_p9]); 00149 } 00150 00151 else if (logic_a->value() == 10) 00152 { 00153 formula.trp_seq_tcrom(); 00154 pch_1->value(sub_tcrm[formula.j_p1]); 00155 pch_2->value(sub_tcrm[formula.j_p2]); 00156 pch_3->value(sub_tcrm[formula.j_p3]); 00157 pch_4->value(sub_tcrm[formula.j_p4]); 00158 pch_5->value(sub_tcrm[formula.j_p5]); 00159 pch_6->value(sub_tcrm[formula.j_p6]); 00160 pch_7->value(sub_tcrm[formula.j_p7]); 00161 pch_8->value(sub_tcrm[formula.j_p8]); 00162 pch_9->value(sub_tcrm[formula.j_p9]); 00163 pch_10->value(sub_tcrm[formula.j_p10]); 00164 } 00165 00166 else if (logic_a->value() == 11) 00167 { 00168 formula.trp_seq_tcrom(); 00169 pch_1->value(sub_tcrm[formula.j_p1]); 00170 pch_2->value(sub_tcrm[formula.j_p2]); 00171 pch_3->value(sub_tcrm[formula.j_p3]); 00172 pch_4->value(sub_tcrm[formula.j_p4]); 00173 pch_5->value(sub_tcrm[formula.j_p5]); 00174 pch_6->value(sub_tcrm[formula.j_p6]); 00175 pch_7->value(sub_tcrm[formula.j_p7]); 00176 pch_8->value(sub_tcrm[formula.j_p8]); 00177 pch_9->value(sub_tcrm[formula.j_p9]); 00178 pch_10->value(sub_tcrm[formula.j_p10]); 00179 pch_11->value(sub_tcrm[formula.j_p11]); 00180 } 00181 00182 else if (logic_a->value() == 12) 00183 { 00184 formula.trp_seq_tcrom(); 00185 pch_1->value(sub_tcrm[formula.j_p1]); 00186 pch_2->value(sub_tcrm[formula.j_p2]); 00187 pch_3->value(sub_tcrm[formula.j_p3]); 00188 pch_4->value(sub_tcrm[formula.j_p4]); 00189 pch_5->value(sub_tcrm[formula.j_p5]); 00190 pch_6->value(sub_tcrm[formula.j_p6]); 00191 pch_7->value(sub_tcrm[formula.j_p7]); 00192 pch_8->value(sub_tcrm[formula.j_p8]); 00193 pch_9->value(sub_tcrm[formula.j_p9]); 00194 pch_10->value(sub_tcrm[formula.j_p10]); 00195 pch_11->value(sub_tcrm[formula.j_p11]); 00196 pch_12->value(sub_tcrm[formula.j_p12]); 00197 } 00198 delete [] sub_tcrm; 00199 } 00200 00201 void contrappunto::init_pitch_serie() 00202 { 00203 ini_pitch(); 00204 00205 if (bt_enable_pch->value() == 1) 00206 { 00207 subset_pitch(); 00208 } 00209 int i; 00210 for (i = 0; i < 12; i++) 00211 { 00212 serie_pitch[i] = init_pitch[i]; 00213 } 00214 } 00215 00216 void contrappunto::retroPitch() 00217 { 00218 init_pitch_serie(); 00219 00220 int i; 00221 int s = 11; 00222 00223 for (i=0;i<12;i++) 00224 { 00225 serie_manip[i] = serie_pitch[s]; 00226 s--; 00227 } 00228 } 00229 00230 void retro_pitch() 00231 { 00232 contrappunto ob; 00233 ob.retroPitch(); 00234 pch_1->value(ob.serie_manip[0]); 00235 pch_2->value(ob.serie_manip[1]); 00236 pch_3->value(ob.serie_manip[2]); 00237 pch_4->value(ob.serie_manip[3]); 00238 pch_5->value(ob.serie_manip[4]); 00239 pch_6->value(ob.serie_manip[5]); 00240 pch_7->value(ob.serie_manip[6]); 00241 pch_8->value(ob.serie_manip[7]); 00242 pch_9->value(ob.serie_manip[8]); 00243 pch_10->value(ob.serie_manip[9]); 00244 pch_11->value(ob.serie_manip[10]); 00245 pch_12->value(ob.serie_manip[11]); 00246 } 00247 00248 void retroPitch_cb(Fl_Widget*,void*) 00249 { 00250 retro_pitch(); 00251 } 00252 00253 void contrappunto::crocePitch() 00254 { 00255 init_pitch_serie(); 00256 serie_manip[0] = serie_pitch[11]; 00257 serie_manip[1] = serie_pitch[0]; 00258 serie_manip[2] = serie_pitch[10]; 00259 serie_manip[3] = serie_pitch[1]; 00260 serie_manip[4] = serie_pitch[9]; 00261 serie_manip[5] = serie_pitch[2]; 00262 serie_manip[6] = serie_pitch[8]; 00263 serie_manip[7] = serie_pitch[3]; 00264 serie_manip[8] = serie_pitch[7]; 00265 serie_manip[9] = serie_pitch[4]; 00266 serie_manip[10] = serie_pitch[6]; 00267 serie_manip[11] = serie_pitch[5]; 00268 } 00269 00270 void croce_pitch() 00271 { 00272 contrappunto ob; 00273 ob.crocePitch(); 00274 pch_1->value(ob.serie_manip[0]); 00275 pch_2->value(ob.serie_manip[1]); 00276 pch_3->value(ob.serie_manip[2]); 00277 pch_4->value(ob.serie_manip[3]); 00278 pch_5->value(ob.serie_manip[4]); 00279 pch_6->value(ob.serie_manip[5]); 00280 pch_7->value(ob.serie_manip[6]); 00281 pch_8->value(ob.serie_manip[7]); 00282 pch_9->value(ob.serie_manip[8]); 00283 pch_10->value(ob.serie_manip[9]); 00284 pch_11->value(ob.serie_manip[10]); 00285 pch_12->value(ob.serie_manip[11]); 00286 } 00287 00288 void crocePitch_cb(Fl_Widget*,void*) 00289 { 00290 croce_pitch(); 00291 } 00292 00293 void contrappunto::slidePitch() 00294 { 00295 init_pitch_serie(); 00296 int i, s; 00297 i = 0; 00298 s = 1; 00299 for (i=0;i<11;i++) 00300 { 00301 serie_manip[i] = serie_pitch[s]; 00302 s++; 00303 } 00304 serie_manip[11] = serie_pitch[0]; 00305 } 00306 00307 void slide_pitch() 00308 { 00309 contrappunto ob; 00310 ob.slidePitch(); 00311 pch_1->value(ob.serie_manip[0]); 00312 pch_2->value(ob.serie_manip[1]); 00313 pch_3->value(ob.serie_manip[2]); 00314 pch_4->value(ob.serie_manip[3]); 00315 pch_5->value(ob.serie_manip[4]); 00316 pch_6->value(ob.serie_manip[5]); 00317 pch_7->value(ob.serie_manip[6]); 00318 pch_8->value(ob.serie_manip[7]); 00319 pch_9->value(ob.serie_manip[8]); 00320 pch_10->value(ob.serie_manip[9]); 00321 pch_11->value(ob.serie_manip[10]); 00322 pch_12->value(ob.serie_manip[11]); 00323 } 00324 00325 void slidePitch_cb(Fl_Widget*,void*) 00326 { 00327 slide_pitch(); 00328 } 00329 00330 void contrappunto::jump_onePitch() 00331 { 00332 init_pitch_serie(); 00333 serie_manip[0] = serie_pitch[1]; 00334 serie_manip[1] = serie_pitch[3]; 00335 serie_manip[2] = serie_pitch[5]; 00336 serie_manip[3] = serie_pitch[7]; 00337 serie_manip[4] = serie_pitch[9]; 00338 serie_manip[5] = serie_pitch[11]; 00339 serie_manip[6] = serie_pitch[0]; 00340 serie_manip[7] = serie_pitch[2]; 00341 serie_manip[8] = serie_pitch[4]; 00342 serie_manip[9] = serie_pitch[6]; 00343 serie_manip[10] = serie_pitch[8]; 00344 serie_manip[11] = serie_pitch[10]; 00345 } 00346 00347 void jumpone_pitch() 00348 { 00349 contrappunto ob; 00350 ob.jump_onePitch(); 00351 pch_1->value(ob.serie_manip[0]); 00352 pch_2->value(ob.serie_manip[1]); 00353 pch_3->value(ob.serie_manip[2]); 00354 pch_4->value(ob.serie_manip[3]); 00355 pch_5->value(ob.serie_manip[4]); 00356 pch_6->value(ob.serie_manip[5]); 00357 pch_7->value(ob.serie_manip[6]); 00358 pch_8->value(ob.serie_manip[7]); 00359 pch_9->value(ob.serie_manip[8]); 00360 pch_10->value(ob.serie_manip[9]); 00361 pch_11->value(ob.serie_manip[10]); 00362 pch_12->value(ob.serie_manip[11]); 00363 } 00364 00365 void jumpOnePitch_cb(Fl_Widget*,void*) 00366 { 00367 jumpone_pitch(); 00368 } 00369