comparison plugins/Transcription.cpp @ 178:f96ea0e4b475

Fix compiler warnings with -Wall -Wextra
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 28 Sep 2015 12:33:17 +0100
parents dcf5800f0f00
children 258939b7c810
comparison
equal deleted inserted replaced
177:a83a81ed1303 178:f96ea0e4b475
349 m_Base = timestamp; 349 m_Base = timestamp;
350 } 350 }
351 351
352 if (m_Excess) return FeatureSet(); 352 if (m_Excess) return FeatureSet();
353 353
354 for (size_t i = 0; i < m_blockSize;i++) { 354 for (int i = 0; i < m_blockSize;i++) {
355 355
356 if (m_SampleN >= m_AllocN) { 356 if (m_SampleN >= m_AllocN) {
357 size_t newsize = m_AllocN * 2; 357 int newsize = m_AllocN * 2;
358 if (newsize < 10000) newsize = 10000; 358 if (newsize < 10000) newsize = 10000;
359 double *newbuf = (double *)realloc(m_SoundIn, newsize * sizeof(double)); 359 double *newbuf = (double *)realloc(m_SoundIn, newsize * sizeof(double));
360 if (!newbuf) { 360 if (!newbuf) {
361 m_Excess = true; 361 m_Excess = true;
362 break; 362 break;
380 double * OutArray; 380 double * OutArray;
381 double *OutArray2; 381 double *OutArray2;
382 double *hello1; 382 double *hello1;
383 double *hello2; 383 double *hello2;
384 int Msec; 384 int Msec;
385 size_t i; 385 int i;
386 size_t j; 386 int j;
387 size_t n; 387 int n;
388 size_t count;
389 388
390 Msec=(int)(100*m_SampleN/m_inputSampleRate); 389 Msec=(int)(100*m_SampleN/m_inputSampleRate);
391 390
392 if (Msec < 100) return returnFeatures; 391 if (Msec < 100) return returnFeatures;
393 392
469 } 468 }
470 469
471 double starts[88]; 470 double starts[88];
472 for (n = 0; n < 88; ++n) starts[n] = -1.0; 471 for (n = 0; n < 88; ++n) starts[n] = -1.0;
473 472
474 int nn;
475 for (j = 0; j <Msec; j++) { 473 for (j = 0; j <Msec; j++) {
476
477 474
478 for(n=0;n<88;n++) 475 for(n=0;n<88;n++)
479 { 476 {
480 if(OutArray2[j*88+n]>0) 477 if(OutArray2[j*88+n]>0)
481 { 478 {
534 531
535 532
536 533
537 void sofacomplexMex(double *y, double *z, int ncols,double StartNote,double NoteInterval1,double NoteNum,double C,double D,double SR) 534 void sofacomplexMex(double *y, double *z, int ncols,double StartNote,double NoteInterval1,double NoteNum,double C,double D,double SR)
538 { 535 {
539 int mseconds,i,j,el,count,count2; 536 int mseconds,i,el,count,count2;
540 double Snote,NoteInterval,NoteN, BasicR; 537 double Snote,NoteInterval,NoteN;
541 double *signs; 538 double *signs;
542 double *rwork,*buffer; 539 double *rwork;
543 double freq,R,gain,gainI,gainII,coefI,coefM; 540 double freq,R,gain,gainI,gainII,coefI,coefM;
544 double output,input,outputI,outputM; 541 double output,input,outputI,outputM;
545 double *x; 542 double *x;
546 double *sum,*sum2; 543 double *sum,*sum2;
547 double power; 544 double power;
548 double temp;
549
550 545
551 //SR=44100; 546 //SR=44100;
552 Snote=StartNote; 547 Snote=StartNote;
553 NoteInterval=NoteInterval1; 548 NoteInterval=NoteInterval1;
554 NoteN=NoteNum; 549 NoteN=NoteNum;
811 806
812 free(Out); 807 free(Out);
813 } 808 }
814 809
815 810
816 void FindPeaks(double *In, int InLen,double *Out1,double *Out2, int db, int db2, int db3) 811 void FindPeaks(double *In, int InLen,double *Out1,double *Out2, int /* db */, int db2, int db3)
817 { 812 {
818 int i,lastout; 813 int i,lastout;
819 for (i=0;i<InLen;i++) 814 for (i=0;i<InLen;i++)
820 { 815 {
821 Out1[i]=0; 816 Out1[i]=0;
1180 free(OutArray); 1175 free(OutArray);
1181 } 1176 }
1182 1177
1183 void PeakDetect(double *In, int InLen) 1178 void PeakDetect(double *In, int InLen)
1184 { 1179 {
1185 int i,j; 1180 int i;
1186 double *Out1; 1181 double *Out1;
1187 1182
1188 Out1=(double*)malloc(InLen*sizeof(double)); 1183 Out1=(double*)malloc(InLen*sizeof(double));
1189 for (i=0;i<InLen;i++) 1184 for (i=0;i<InLen;i++)
1190 { 1185 {
1305 1300
1306 free(Input); 1301 free(Input);
1307 1302
1308 } 1303 }
1309 1304
1310 void PitchEstimation(double *In, int InLen, double *OutArray,double *OutArray2) 1305 void PitchEstimation(double *In, int /* InLen */, double *OutArray,double *OutArray2)
1311 { 1306 {
1312 double *xx,*x,*y,*y1,*PeakPitch1, *PeakPitch2,*PeakInput1, *PeakInput2; 1307 double *xx,*x,*y,*y1,*PeakPitch1, *PeakPitch2,*PeakInput1, *PeakInput2;
1313 double *out,*outValue; 1308 double *out,*outValue;
1314 double *output,*output1; 1309 double *output,*output1;
1315 double notefloat,hh0,hh1,hh28;
1316 double outM12[12];
1317 int *outc; 1310 int *outc;
1318 int *yI;
1319 double temp; 1311 double temp;
1320 int i,j,sumI; 1312 int i,sumI;
1321 int Len; 1313 int Len;
1322 int NN,NN2;
1323 int count;
1324 double Th;
1325 1314
1326 Len=1050; 1315 Len=1050;
1327 xx=(double*)malloc(Len*sizeof(double)); 1316 xx=(double*)malloc(Len*sizeof(double));
1328 x=(double*)malloc(Len*sizeof(double)); 1317 x=(double*)malloc(Len*sizeof(double));
1329 y=(double*)malloc(Len*sizeof(double)); 1318 y=(double*)malloc(Len*sizeof(double));
1477 OutArray[i]=0; 1466 OutArray[i]=0;
1478 OutArray2[i]=0; 1467 OutArray2[i]=0;
1479 1468
1480 } 1469 }
1481 1470
1482 Th=30;
1483 for(i=20;i<105;i++) 1471 for(i=20;i<105;i++)
1484 { 1472 {
1485 if(output1[i]==1) 1473 if(output1[i]==1)
1486 { 1474 {
1487 OutArray[i]=outc[i]+200+2; 1475 OutArray[i]=outc[i]+200+2;
1488 OutArray2[i]=y[outc[i]]; 1476 OutArray2[i]=y[outc[i]];
1489
1490 } 1477 }
1491
1492 } 1478 }
1493 1479
1494 free(xx); // xx=(double*)malloc(Len*sizeof(double)); 1480 free(xx); // xx=(double*)malloc(Len*sizeof(double));
1495 free(x); // x=(double*)malloc(Len*sizeof(double)); 1481 free(x); // x=(double*)malloc(Len*sizeof(double));
1496 free(y); // y=(double*)malloc(Len*sizeof(double)); 1482 free(y); // y=(double*)malloc(Len*sizeof(double));
1631 } 1617 }
1632 void dbfunction( double *InputArray, int InputHLen, int InputVLen,double *OutArray) 1618 void dbfunction( double *InputArray, int InputHLen, int InputVLen,double *OutArray)
1633 { 1619 {
1634 int i; 1620 int i;
1635 int j; 1621 int j;
1636 double temp;
1637 1622
1638 for (i=0;i<InputVLen;i++) 1623 for (i=0;i<InputVLen;i++)
1639 { 1624 {
1640 for (j=0;j<InputHLen;j++) 1625 for (j=0;j<InputHLen;j++)
1641 { 1626 {