Revision 6:55d7698f79f8 mat_oct/onsetsds.c
| mat_oct/onsetsds.c | ||
|---|---|---|
| 79 | 79 |
packeddata[j+j+1] = (float) imag[frameoffset + j]; |
| 80 | 80 |
} |
| 81 | 81 |
bool onset = onsetsds_process(&ods, packeddata); |
| 82 |
// printf("%i ", onset);
|
|
| 83 |
// printf("[%i] %i", i, onset);
|
|
| 84 | 82 |
results[i] = (onset ? 1.0 : 0.0); |
| 85 |
// printf("[%i] %g", i, results[i]);
|
|
| 86 | 83 |
} |
| 87 | 84 |
|
| 88 | 85 |
// Copy the results from double-array into matlab format |
| 89 |
// mwSize *dims = (mwSize*) mxCalloc(2, sizeof(mwSize)); |
|
| 90 |
// dims[0] = 1; |
|
| 91 |
// dims[1] = numframes; |
|
| 92 |
// mxArray *resultsM = mxCreateNumericArray(2, dims, mxINT8_CLASS, mxREAL); |
|
| 93 | 86 |
mxArray *resultsM = mxCreateDoubleMatrix(1,numframes,mxREAL); |
| 94 |
// mxSetPr(resultsM, results); |
|
| 95 | 87 |
memcpy(mxGetPr(resultsM), results, numframes * sizeof(double)); |
| 96 | 88 |
plhs[0] = resultsM; |
| 97 | 89 |
|
| 98 | 90 |
// destroy the ods correctly, and any matlabby things that need to go too. |
| 99 | 91 |
free(ods.data); |
| 100 | 92 |
free(packeddata); |
| 101 |
// mxFree(dims); |
|
| 102 | 93 |
mxFree(results); |
| 103 |
// *resultsM ? no I think that lives on in matlabworld |
|
| 104 | 94 |
} |
Also available in: Unified diff