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_db() 00021 { 00022 init_db[0] = db_1->value(); 00023 init_db[1] = db_2->value(); 00024 init_db[2] = db_3->value(); 00025 init_db[3] = db_4->value(); 00026 init_db[4] = db_5->value(); 00027 init_db[5] = db_6->value(); 00028 init_db[6] = db_7->value(); 00029 init_db[7] = db_8->value(); 00030 init_db[8] = db_9->value(); 00031 init_db[9] = db_10->value(); 00032 init_db[10] = db_11->value(); 00033 init_db[11] = db_12->value(); 00034 } 00035 00036 void contrappunto::db_lim_input() 00037 { 00038 db_min_ = (int)min_db->value(); 00039 db_max_ = (int)max_db->value(); 00040 } 00041 00042 void contrappunto::subset_db() 00043 { 00044 formula formula; 00045 db_lim_input(); 00046 //////////INITIALIZE DB SUBSET///// 00047 int sub_tdb_size = (int)db_max_ - (int)db_min_; 00048 float *sub_tdb = new float[sub_tdb_size]; 00049 00050 init_params(); 00051 int indice = (int)db_min_; 00052 int i; 00053 for (i = 0; i < sub_tdb_size; i++) 00054 { 00055 sub_tdb[i] = tdb[indice]; 00056 indice++; 00057 } 00058 /////////////////////////////////////////////////////////// 00059 if (logic_a->value() == 1) 00060 { 00061 formula.trp_seq_tdb(); 00062 init_params(); 00063 db_1->value(sub_tdb[formula.j_db1]); 00064 } 00065 00066 else if (logic_a->value() == 2) 00067 { 00068 formula.trp_seq_tdb(); 00069 init_params(); 00070 00071 db_1->value(sub_tdb[formula.j_db1]); 00072 db_2->value(sub_tdb[formula.j_db2]); 00073 } 00074 00075 else if (logic_a->value() == 3) 00076 { 00077 formula.trp_seq_tdb(); 00078 init_params(); 00079 00080 db_1->value(sub_tdb[formula.j_db1]); 00081 db_2->value(sub_tdb[formula.j_db2]); 00082 db_3->value(sub_tdb[formula.j_db3]); 00083 } 00084 00085 else if (logic_a->value() == 4) 00086 { 00087 formula.trp_seq_tdb(); 00088 init_params(); 00089 00090 db_1->value(sub_tdb[formula.j_db1]); 00091 db_2->value(sub_tdb[formula.j_db2]); 00092 db_3->value(sub_tdb[formula.j_db3]); 00093 db_4->value(sub_tdb[formula.j_db4]); 00094 } 00095 00096 else if (logic_a->value() == 5) 00097 { 00098 formula.trp_seq_tdb(); 00099 init_params(); 00100 00101 db_1->value(sub_tdb[formula.j_db1]); 00102 db_2->value(sub_tdb[formula.j_db2]); 00103 db_3->value(sub_tdb[formula.j_db3]); 00104 db_4->value(sub_tdb[formula.j_db4]); 00105 db_5->value(sub_tdb[formula.j_db5]); 00106 } 00107 00108 else if (logic_a->value() == 6) 00109 { 00110 formula.trp_seq_tdb(); 00111 init_params(); 00112 00113 db_1->value(sub_tdb[formula.j_db1]); 00114 db_2->value(sub_tdb[formula.j_db2]); 00115 db_3->value(sub_tdb[formula.j_db3]); 00116 db_4->value(sub_tdb[formula.j_db4]); 00117 db_5->value(sub_tdb[formula.j_db5]); 00118 db_6->value(sub_tdb[formula.j_db6]); 00119 } 00120 00121 else if (logic_a->value() == 7) 00122 { 00123 formula.trp_seq_tdb(); 00124 init_params(); 00125 00126 db_1->value(sub_tdb[formula.j_db1]); 00127 db_2->value(sub_tdb[formula.j_db2]); 00128 db_3->value(sub_tdb[formula.j_db3]); 00129 db_4->value(sub_tdb[formula.j_db4]); 00130 db_5->value(sub_tdb[formula.j_db5]); 00131 db_6->value(sub_tdb[formula.j_db6]); 00132 db_7->value(sub_tdb[formula.j_db7]); 00133 } 00134 00135 else if (logic_a->value() == 8) 00136 { 00137 formula.trp_seq_tdb(); 00138 init_params(); 00139 00140 db_1->value(sub_tdb[formula.j_db1]); 00141 db_2->value(sub_tdb[formula.j_db2]); 00142 db_3->value(sub_tdb[formula.j_db3]); 00143 db_4->value(sub_tdb[formula.j_db4]); 00144 db_5->value(sub_tdb[formula.j_db5]); 00145 db_6->value(sub_tdb[formula.j_db6]); 00146 db_7->value(sub_tdb[formula.j_db7]); 00147 db_8->value(sub_tdb[formula.j_db8]); 00148 } 00149 00150 else if (logic_a->value() == 9) 00151 { 00152 formula.trp_seq_tdb(); 00153 init_params(); 00154 00155 db_1->value(sub_tdb[formula.j_db1]); 00156 db_2->value(sub_tdb[formula.j_db2]); 00157 db_3->value(sub_tdb[formula.j_db3]); 00158 db_4->value(sub_tdb[formula.j_db4]); 00159 db_5->value(sub_tdb[formula.j_db5]); 00160 db_6->value(sub_tdb[formula.j_db6]); 00161 db_7->value(sub_tdb[formula.j_db7]); 00162 db_8->value(sub_tdb[formula.j_db8]); 00163 db_9->value(sub_tdb[formula.j_db9]); 00164 } 00165 00166 else if (logic_a->value() == 10) 00167 { 00168 formula.trp_seq_tdb(); 00169 init_params(); 00170 00171 db_1->value(sub_tdb[formula.j_db1]); 00172 db_2->value(sub_tdb[formula.j_db2]); 00173 db_3->value(sub_tdb[formula.j_db3]); 00174 db_4->value(sub_tdb[formula.j_db4]); 00175 db_5->value(sub_tdb[formula.j_db5]); 00176 db_6->value(sub_tdb[formula.j_db6]); 00177 db_7->value(sub_tdb[formula.j_db7]); 00178 db_8->value(sub_tdb[formula.j_db8]); 00179 db_9->value(sub_tdb[formula.j_db9]); 00180 db_10->value(sub_tdb[formula.j_db10]); 00181 } 00182 00183 else if (logic_a->value() == 11) 00184 { 00185 formula.trp_seq_tdb(); 00186 init_params(); 00187 00188 db_1->value(sub_tdb[formula.j_db1]); 00189 db_2->value(sub_tdb[formula.j_db2]); 00190 db_3->value(sub_tdb[formula.j_db3]); 00191 db_4->value(sub_tdb[formula.j_db4]); 00192 db_5->value(sub_tdb[formula.j_db5]); 00193 db_6->value(sub_tdb[formula.j_db6]); 00194 db_7->value(sub_tdb[formula.j_db7]); 00195 db_8->value(sub_tdb[formula.j_db8]); 00196 db_9->value(sub_tdb[formula.j_db9]); 00197 db_10->value(sub_tdb[formula.j_db10]); 00198 db_11->value(sub_tdb[formula.j_db11]); 00199 } 00200 00201 else if (logic_a->value() == 12) 00202 { 00203 formula.trp_seq_tdb(); 00204 init_params(); 00205 00206 db_1->value(sub_tdb[formula.j_db1]); 00207 db_2->value(sub_tdb[formula.j_db2]); 00208 db_3->value(sub_tdb[formula.j_db3]); 00209 db_4->value(sub_tdb[formula.j_db4]); 00210 db_5->value(sub_tdb[formula.j_db5]); 00211 db_6->value(sub_tdb[formula.j_db6]); 00212 db_7->value(sub_tdb[formula.j_db7]); 00213 db_8->value(sub_tdb[formula.j_db8]); 00214 db_9->value(sub_tdb[formula.j_db9]); 00215 db_10->value(sub_tdb[formula.j_db10]); 00216 db_11->value(sub_tdb[formula.j_db11]); 00217 db_12->value(sub_tdb[formula.j_db12]); 00218 } 00219 delete [] sub_tdb; 00220 } 00221 00222 void contrappunto::init_db_serie() 00223 { 00224 int i; 00225 if (bt_enable_db->value() == 1) 00226 { 00227 subset_db(); 00228 } 00229 00230 ini_db(); 00231 for (i = 0; i < 12; i++) 00232 { 00233 serie_db[i] = init_db[i]; 00234 } 00235 } 00236 00237 /*INITIALIZE PITCH SERIES<<<<<<<<<*/ 00238 00239 /*RETROGRADO>>>>>>>>*/ 00240 00241 void contrappunto::retroDb() 00242 { 00243 if (bt_enable_db->value() == 1) 00244 { 00245 subset_db(); 00246 } 00247 init_db_serie(); 00248 00249 int i; 00250 int s = 11; 00251 00252 for (i=0;i<12;i++) 00253 { 00254 serie_manip[i] = serie_db[s]; 00255 s--; 00256 } 00257 } 00258 00259 00260 void retro_db() 00261 { 00262 contrappunto ob; 00263 ob.retroDb(); 00264 db_1->value(ob.serie_manip[0]); 00265 db_2->value(ob.serie_manip[1]); 00266 db_3->value(ob.serie_manip[2]); 00267 db_4->value(ob.serie_manip[3]); 00268 db_5->value(ob.serie_manip[4]); 00269 db_6->value(ob.serie_manip[5]); 00270 db_7->value(ob.serie_manip[6]); 00271 db_8->value(ob.serie_manip[7]); 00272 db_9->value(ob.serie_manip[8]); 00273 db_10->value(ob.serie_manip[9]); 00274 db_11->value(ob.serie_manip[10]); 00275 db_12->value(ob.serie_manip[11]); 00276 } 00277 00278 void retroDb_cb(Fl_Widget*,void*) 00279 { 00280 retro_db(); 00281 counterpointPitch->value(0); 00282 } 00283 00284 /*RETROGRADO<<<<<*/ 00285 00286 /*CROCE<<<<<<<<<<<*/ 00287 00288 00289 void contrappunto::croceDb() 00290 { 00291 init_db_serie(); 00292 serie_manip[0] = serie_db[11]; 00293 serie_manip[1] = serie_db[0]; 00294 serie_manip[2] = serie_db[10]; 00295 serie_manip[3] = serie_db[1]; 00296 serie_manip[4] = serie_db[9]; 00297 serie_manip[5] = serie_db[2]; 00298 serie_manip[6] = serie_db[8]; 00299 serie_manip[7] = serie_db[3]; 00300 serie_manip[8] = serie_db[7]; 00301 serie_manip[9] = serie_db[4]; 00302 serie_manip[10] = serie_db[6]; 00303 serie_manip[11] = serie_db[5]; 00304 } 00305 00306 00307 void croce_db() 00308 { 00309 contrappunto ob; 00310 ob.croceDb(); 00311 db_1->value(ob.serie_manip[0]); 00312 db_2->value(ob.serie_manip[1]); 00313 db_3->value(ob.serie_manip[2]); 00314 db_4->value(ob.serie_manip[3]); 00315 db_5->value(ob.serie_manip[4]); 00316 db_6->value(ob.serie_manip[5]); 00317 db_7->value(ob.serie_manip[6]); 00318 db_8->value(ob.serie_manip[7]); 00319 db_9->value(ob.serie_manip[8]); 00320 db_10->value(ob.serie_manip[9]); 00321 db_11->value(ob.serie_manip[10]); 00322 db_12->value(ob.serie_manip[11]); 00323 } 00324 00325 void croceDb_cb(Fl_Widget*,void*) 00326 { 00327 croce_db(); 00328 } 00329 00330 /*CROCE<<<<<<<<<<<<<<*/ 00331 00332 /*SLIDE>>>>>>>>>>>>>>*/ 00333 00334 void contrappunto::slideDb() 00335 { 00336 init_db_serie(); 00337 int i, s; 00338 i = 0; 00339 s = 1; 00340 for (i=0;i<11;i++) 00341 { 00342 serie_manip[i] = serie_db[s]; 00343 s++; 00344 } 00345 serie_manip[11] = serie_db[0]; 00346 } 00347 00348 void slide_db() 00349 { 00350 contrappunto ob; 00351 ob.slideDb(); 00352 db_1->value(ob.serie_manip[0]); 00353 db_2->value(ob.serie_manip[1]); 00354 db_3->value(ob.serie_manip[2]); 00355 db_4->value(ob.serie_manip[3]); 00356 db_5->value(ob.serie_manip[4]); 00357 db_6->value(ob.serie_manip[5]); 00358 db_7->value(ob.serie_manip[6]); 00359 db_8->value(ob.serie_manip[7]); 00360 db_9->value(ob.serie_manip[8]); 00361 db_10->value(ob.serie_manip[9]); 00362 db_11->value(ob.serie_manip[10]); 00363 db_12->value(ob.serie_manip[11]); 00364 } 00365 00366 void slideDb_cb(Fl_Widget*,void*) 00367 { 00368 slide_db(); 00369 } 00370 00371 /*******JUMP1*****/ 00372 00373 void contrappunto::jump_oneDb() 00374 { 00375 init_db_serie(); 00376 serie_manip[0] = serie_db[1]; 00377 serie_manip[1] = serie_db[3]; 00378 serie_manip[2] = serie_db[5]; 00379 serie_manip[3] = serie_db[7]; 00380 serie_manip[4] = serie_db[9]; 00381 serie_manip[5] = serie_db[11]; 00382 serie_manip[6] = serie_db[0]; 00383 serie_manip[7] = serie_db[2]; 00384 serie_manip[8] = serie_db[4]; 00385 serie_manip[9] = serie_db[6]; 00386 serie_manip[10] = serie_db[8]; 00387 serie_manip[11] = serie_db[10]; 00388 } 00389 00390 00391 void jumpone_db() 00392 { 00393 contrappunto ob; 00394 ob.jump_oneDb(); 00395 db_1->value(ob.serie_manip[0]); 00396 db_2->value(ob.serie_manip[1]); 00397 db_3->value(ob.serie_manip[2]); 00398 db_4->value(ob.serie_manip[3]); 00399 db_5->value(ob.serie_manip[4]); 00400 db_6->value(ob.serie_manip[5]); 00401 db_7->value(ob.serie_manip[6]); 00402 db_8->value(ob.serie_manip[7]); 00403 db_9->value(ob.serie_manip[8]); 00404 db_10->value(ob.serie_manip[9]); 00405 db_11->value(ob.serie_manip[10]); 00406 db_12->value(ob.serie_manip[11]); 00407 00408 } 00409 00410 void jumpOneDb_cb(Fl_Widget*,void*) 00411 { 00412 jumpone_db(); 00413 } 00414 00415 /****JUMP1*****/ 00416