MCPcopy Create free account
hub / github.com/audeering/opensmile / setupNamesForElement

Method setupNamesForElement

src/functionals/functionals.cpp:229–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227// We need setupNamesForField if in wholeMatrixMode with ProcessFieldsInMatrixMode
228
229int cFunctionals::setupNamesForElement(int idxi, const char*name, long nEl)
230{
231 // in a winToVecProcessor , nEl should always be 1!
232 int i, j;
233 for (i=0; i<nFunctionalsEnabled; i++) {
234 if ( (functN[i] > 0) && (functObj[i] != NULL) ) {
235 for (j=0; j<functN[i]; j++) {
236 char * newname;
237 if (functNameAppend != NULL) {
238 newname = myvprint("%s__%s_%s",name,functNameAppend,functObj[i]->getValueName(j));
239 } else {
240 newname = myvprint("%s_%s",name,functObj[i]->getValueName(j));
241 }
242
243 const FrameMetaInfo * fmeta = reader_->getFrameMetaInfo();
244 int ao = 0;
245 if (fmeta != NULL && idxi < fmeta->N) {
246 ao = fmeta->field[idxi].arrNameOffset;
247 }
248 long nElementsOut = functObj[i]->getNumberOfElements(j);
249 if (nElementsOut > 0) {
250 writer_->addField(newname, nEl * nElementsOut, ao);
251 if (fmeta != NULL && idxi < fmeta->N) {
252 // copy metadata (e.g. frequency axis labels...)
253 functObj[i]->setFieldMetaData(writer_, fmeta, idxi, nEl * nElementsOut);
254/* double * buf = (double *)malloc(fmeta->field[idxi].infoSize);
255 memcpy(buf, fmeta->field[idxi].info, fmeta->field[idxi].infoSize);
256 writer_->setFieldInfo(-1, // last field added
257 fmeta->field[idxi].dataType, buf,
258 fmeta->field[idxi].infoSize);*/
259 }
260 // TODO: we need to pass arrNameOffset through setupNamesForElement
261 // however, this will require modification of the call in winToVecProcessor
262 // and thus will require several descendant classes to be updated!
263 }
264 free(newname);
265 j += nElementsOut - 1;
266 }
267 }
268 }
269 /*
270 if (globalDuration) {
271 writer->addField("inputDuration");
272 }
273 // ^ we cannot do this in this type of component..!
274 */
275 return nFunctValues * nEl;
276}
277
278// this must return the multiplier, i.e. the vector size returned for each input element (e.g. number of functionals, etc.)
279int cFunctionals::getMultiplier()

Callers

nothing calls this directly

Calls 6

myvprintFunction · 0.50
getValueNameMethod · 0.45
getFrameMetaInfoMethod · 0.45
getNumberOfElementsMethod · 0.45
addFieldMethod · 0.45
setFieldMetaDataMethod · 0.45

Tested by

no test coverage detected