/usr/include/CLAM/LoopingSDIFFileReader.hxx is in libclam-dev 1.4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #ifndef _LoopingSDIFFileReader_
#define _LoopingSDIFFileReader_
#include "BufferedSDIFFileReader.hxx"
#include "SDIFInConfig.hxx"
#include "Frame.hxx"
#include "SpectralPeakArray.hxx"
#include "Spectrum.hxx"
#include "SimpleLoopMetadata.hxx"
#define DEFAULT_NUMBER_OF_CROSSFADE_FRAMES 100
namespace CLAM
{
/**
* This class extends the length of an SDIFFile indefinitely by looping between
* its frames. It supports looping between multiple loop points with crossfading.
*
* \author greg kellum [gkellum@iua.upf.edu] 7/30/07
* \since CLAM v1.1
*/
class LoopingSDIFFileReader : public BufferedSDIFFileReader
{
public:
/**
* You MUST give the instance the filename of the SDIF file to read.
* in the SDIFInConfig object.
*/
LoopingSDIFFileReader(const SDIFInConfig& argSDIFInConfig);
~LoopingSDIFFileReader();
/**
* You MUST to give the instance the filename of the SDIF file to read.
* in the SDIFInConfig object. You can further specify which kinds of
* objects to read from the SDIFFile. See the doc for SDIFInConfig.
*/
bool Configure(const SDIFInConfig& c);
/**
* This method returns the next frame from the internal buffer.
*/
virtual Frame* ReadFrame();
/**
* This returns true if and only if this class has been given some loop points
*/
bool isLooping();
/**
* Adds a single loop point for a sample.
*/
void AddLoop(SimpleLoopMetadata& aSimpleLoop);
/**
* Adds a list of loop points for a sample. (Note the data structure is actually
* a vector rather than a list.
*/
void SetListOfLoops(std::vector<SimpleLoopMetadata>& theLoopList);
/**
* Clears all of the loop points previously set
*/
void ClearLoops();
/**
* Returns all of the loop points previously set
*/
std::vector<SimpleLoopMetadata>& GetListOfLoops();
/**
* Resets the SDIFFileReader to read the very first frame from the file again
* thereby restarting the attack stage of the sample.
*/
void Reset();
private:
/**
* This crossfades between two given spectral peak arrays.
*/
void CrossfadeSpectralPeakArrays(SpectralPeakArray& sourceSpectralPeaks1,
SpectralPeakArray& sourceSpectralPeaks2,
SpectralPeakArray& targetSpectralPeaks,
float crossfadeFactor);
/**
* This crossfades between two given residual spectrums.
*/
void CrossfadeResidualSpectrum(Spectrum& sourceSpectrum1,
Spectrum& sourceSpectrum2,
Spectrum& targetSpectrum,
float crossfadeFactor);
/**
* This returns the index number of one loop selected at random from the
* list of loops. But only those loops will be considered for which we have
* already preloaded the buffers.
*/
int ChooseLoopRandomly(int frameBufferPosition, int indexOfCurrentLoop);
// every time ReadFrame() is called, the frame is copied to this singleton
// object which is returned rather than the frame from the BufferedSDIFReader
Frame* outgoingFrame;
// number of frames that should be crossfaded before looping
int numberOfCrossfadeFrames;
// a list of loop points for this sample
std::vector<SimpleLoopMetadata> listOfLoops;
// the index of the loop that we are currently using
int indexOfCurrentLoop;
};
} // end namespace CLAM
#endif
|