📄 featurefile.h
字号:
boolean isOpen() const; // methods that get features from buffers or files // long getBufferedData(Vector<AlgorithmData>& data, long start_pos = DEF_START_POS, long num_elem = DEF_NUM_ELEM); long getBufferedData(Vector<VectorFloat>& data, long start_pos = DEF_START_POS); long getBufferedData(VectorFloat& data, long channel_tag, long start_pos = DEF_START_POS, long num_elem = DEF_NUM_ELEM); long readFeatureData(Vector<AlgorithmData>& data, long start_pos = DEF_START_POS, long num_elem = DEF_NUM_ELEM); long readFeatureData(Vector<VectorFloat>& data, long channel_tag = DEF_CHANNEL_TAG, long start_pos = DEF_START_POS, long num_elem = DEF_NUM_ELEM); // methods that write features to a file // long writeFeatureData(Vector<AlgorithmData>& data, long channel_tag = DEF_CHANNEL_TAG); long writeFeatureData(Vector<VectorFloat>& data, long channel_tag = DEF_CHANNEL_TAG); //--------------------------------------------------------------------------- // // class-specific public methods: // indexing methods // //--------------------------------------------------------------------------- // method: operator() // AlgorithmData& operator()(long index) { return v_d(index); } // method: operator() // const AlgorithmData& operator()(long index) const { return v_d(index); } // method: operator() // AlgorithmData& operator()(long ctag, long frame) { return v_d(frame * num_channels_d + ctag); } // method: operator() // const AlgorithmData& operator()(long ctag, long frame) const { return v_d(frame * num_channels_d + ctag); } //--------------------------------------------------------------------------- // // class-specific public methods: // set methods // //--------------------------------------------------------------------------- // method: setName // boolean setName(const String& arg) { return name_d.assign(arg); } // method: setFileType // boolean setFileType(FILE_TYPE file_type) { file_type_d = file_type; return true; } // method: setFileFormat // boolean setFileFormat(FILE_FORMAT file_format) { file_format_d = file_format; return true; } // method: setCompType // boolean setCompType(COMP_TYPE comp_type) { if (comp_type != LINEAR) { return Error::handle(name(), L"setCompType", Error::NOT_IMPLEM, __FILE__, __LINE__); } compression_type_d = comp_type; return true; } // method: setAmplitudeRange // boolean setAmplitudeRange(double amplitude_range) { amplitude_range_d = amplitude_range; return true; } // method: setNumChannels // boolean setNumChannels(long arg) { return num_channels_d.assign(arg); } // method: setID // boolean setID(const String& arg) { return id_d.assign(arg); } // method: setNumFeatures // boolean setNumFeatures(long arg) { num_features_d = arg; return true; } // method: setDataType // boolean setDataType(DATA_TYPE arg) { data_type_d = arg; return true; } // method: setCoefType // boolean setCoefType(AlgorithmData::COEF_TYPE arg) { coef_type_d = arg; return true; } // method: setFrameDuration // boolean setFrameDuration(float arg) { frame_duration_d = arg; return true; } // method: setSampleFrequency // boolean setSampleFrequency(float arg) { sample_frequency_d = arg; return true; } // method: setLength // boolean setLength(long arg) { v_d.setLength(arg); return true; } // other set methods // boolean setBufferSize(long nblocks); //--------------------------------------------------------------------------- // // class-specific public methods: // get methods // //--------------------------------------------------------------------------- // method: getName // const String& getName() const { return name_d; } // method: getFileType // FILE_TYPE getFileType() const { return file_type_d; } // method: getFileFormat // FILE_FORMAT getFileFormat() const { return file_format_d; } // method: getCompType // COMP_TYPE getCompType() const { return compression_type_d; } // method: getAmplitudeRange // double getAmplitudeRange() const { return amplitude_range_d; } // method: getNumChannels // long getNumChannels() const { return num_channels_d; } // method: getID // const String& getID() const { return id_d; } // method: getNumFeatures // long getNumFeatures() const { return num_features_d; } // method: getDataType // DATA_TYPE getDataType() const { return data_type_d; } // method: getCoefType // AlgorithmData::COEF_TYPE getCoefType() const { return coef_type_d; } // method: getFrameDuration // float getFrameDuration() const { return frame_duration_d; } // method: getSampleFrequency // float getSampleFrequency() const { return sample_frequency_d; } // method: getNumFrames // long getNumFrames(const Sof& sof) const { return (sof.getVecSize() / num_channels_d); } // other get methods // long getNumFrames(); //--------------------------------------------------------------------------- // // class-specific public methods: // partial i/o methods // //--------------------------------------------------------------------------- // method: readStart // boolean readStart(const String& pname = String::EMPTY, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = true) { in_sof_d.find(name(), (long) tag_d); return readStart(in_sof_d, pname, size, param, nested); } // method: readTerminate // boolean readTerminate() { return in_sof_d.stopPartialRead(); } // other partial read methods // boolean readPartialData(long start_pos, long num_elem); // method: writeStart // boolean writeStart(const String& pname = String::EMPTY); // method: writeTerminate // boolean writeTerminate(const String& pname = String::EMPTY) { writeTerminate(in_sof_d, pname); return true; } // other partial write methods // boolean writePartialData(long start_pos, long num_elem); // almostEqual function // boolean almostEqual(const FeatureFile& arg, double percent = Integral::DEF_PERCENTAGE, double bound = Integral::DEF_BOUND) const; //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // method: getStartFeature // long getStartFeature(long ctag = DEF_CHANNEL_TAG) const { long buf_duration = buffers_d(ctag).getNumElements(); long buf_end = buf_end_ftr_d(ctag); // calculate and return the start time // return (buf_end - buf_duration); } // method: getEndFeature // long getEndFeature(long ctag = DEF_CHANNEL_TAG) const { return buf_end_ftr_d(ctag); } // append methods // boolean appendData(); // configuration i/o methods: // this method reads and writes only the configuration parameters. it is // called by both readData and readStart // boolean readConfig(Sof& sof, SofParser& parser); boolean writeConfig(Sof& sof) const; // feature file format i/o methods: // read data of a certain number from the feature file, in the // default case, read the whole file // long readRawData(Vector<AlgorithmData>& data, long start_pos = DEF_START_POS, long num_samp = DEF_NUM_ELEM); long readRawData(Vector<VectorFloat>& data_a, long ctag_a, long start_samp_a, long num_samp_a); long writeRawData(Vector<AlgorithmData>& data_a, long ctag_a); long writeRawData(Vector<VectorFloat>& data_a, long ctag_a); long readSofData(Vector<AlgorithmData>& data, long start_pos = DEF_START_POS, long num_elem = DEF_NUM_ELEM); long readSofData(Vector<VectorFloat>& data_a, long ctag_a, long start_samp_a, long num_samp_a); long writeSofData(Vector<AlgorithmData>& data, long channel_tag = DEF_CHANNEL_TAG); long writeSofData(Vector<VectorFloat>& data, long channel_tag = DEF_CHANNEL_TAG); boolean readSofStart(); boolean writeSofStart(); // partial i/o methods: // boolean readStart(Sof& sof, const String& pname = String::EMPTY, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = true); boolean writeStart(Sof& sof, const String& pname = String::EMPTY) const; boolean writeTerminate(Sof& sof, const String& pname = String::EMPTY) const; // reset methods: clear out buffer and pointers // boolean resetBuffer(long channel_tag = CHANNEL_TAG_ALL);};// end of include file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -