/usr/include/sbsms.h is in libsbsms-dev 2.0.0-3.
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | // -*- mode: c++ -*-
#ifndef SBSMS_INCLUDE
#define SBSMS_INCLUDE
#include <stdio.h>
namespace _sbsms_ {
typedef float t_fft[2];
typedef t_fft audio;
typedef long long int SampleCountType;
typedef long long int TimeType;
typedef unsigned char TrackIndexType;
enum {
maxBands = 10,
numQualityParams = 52
};
struct SBSMSQualityParams {
int bands;
int H;
int N[maxBands];
int N0[maxBands];
int N1[maxBands];
int N2[maxBands];
int res[maxBands];
};
class SBSMSQuality {
public:
SBSMSQuality(const SBSMSQualityParams *params);
SBSMSQualityParams params;
long getFrameSize();
long getMaxPresamples();
};
extern const SBSMSQualityParams SBSMSQualityStandard;
struct SBSMSFrame {
float ratio0;
float ratio1;
audio *buf;
long size;
};
typedef long (*SBSMSResampleCB)(void *cbData, SBSMSFrame *frame);
class SBSMSInterface {
public:
virtual ~SBSMSInterface() {}
virtual long samples(audio *buf, long n) { return 0; }
virtual float getStretch(float t)=0;
virtual float getPitch(float t)=0;
virtual long getPresamples()=0;
virtual SampleCountType getSamplesToInput()=0;
virtual SampleCountType getSamplesToOutput()=0;
};
class SBSMSTrackPoint {
public:
virtual ~SBSMSTrackPoint() {}
virtual float getF()=0;
virtual float getM()=0;
virtual float getPhase()=0;
};
class SBSMSTrack {
public:
virtual ~SBSMSTrack() {}
virtual SBSMSTrackPoint *getSBSMSTrackPoint(const TimeType &time)=0;
virtual TrackIndexType getIndex()=0;
virtual bool isFirst(const TimeType &synthtime)=0;
virtual bool isLast(const TimeType &synthtime)=0;
};
class SBSMSRenderer {
public:
virtual ~SBSMSRenderer() {}
virtual void startFrame() {}
virtual void startTime(int c, const TimeType &time, int n) {}
virtual void render(int c, SBSMSTrack *t) {}
virtual void endTime(int c) {}
virtual void endFrame() {}
virtual void end(const SampleCountType &samples) {}
};
enum SBSMSError {
SBSMSErrorNone = 0,
SBSMSErrorInvalidRate
};
class SBSMSImp;
class SBSMS {
public:
SBSMS(int channels, SBSMSQuality *quality, bool bSynthesize);
~SBSMS();
long read(SBSMSInterface *iface, audio *buf, long n);
void addRenderer(SBSMSRenderer *renderer);
void removeRenderer(SBSMSRenderer *renderer);
long renderFrame(SBSMSInterface *iface);
long getInputFrameSize();
SBSMSError getError();
friend class SBSMSImp;
protected:
SBSMSImp *imp;
};
enum SlideType {
SlideIdentity = 0,
SlideConstant,
SlideLinearInputRate,
SlideLinearOutputRate,
SlideLinearInputStretch,
SlideLinearOutputStretch,
SlideGeometricInput,
SlideGeometricOutput
};
class SlideImp;
class Slide {
public:
Slide(SlideType slideType, float rate0 = 1.0f, float rate1 = 1.0f, const SampleCountType &n = 0);
~Slide();
float getTotalStretch();
float getStretchedTime(float t);
float getRate(float t);
float getStretch(float t);
float getRate();
float getStretch();
void step();
protected:
SlideImp *imp;
};
class SBSMSInterfaceSlidingImp;
class SBSMSInterfaceSliding : public SBSMSInterface {
public:
SBSMSInterfaceSliding(Slide *rateSlide,
Slide *pitchSlide,
bool bPitchReferenceInput,
const SampleCountType &samplesToInput,
long preSamples,
SBSMSQuality *quality);
virtual ~SBSMSInterfaceSliding();
virtual float getStretch(float t);
virtual float getPitch(float t);
virtual long getPresamples();
virtual SampleCountType getSamplesToInput();
virtual SampleCountType getSamplesToOutput();
friend class SBSMSInterfaceSlidingImp;
protected:
SBSMSInterfaceSlidingImp *imp;
};
class ResamplerImp;
class Resampler {
public:
Resampler(SBSMSResampleCB func, void *data, SlideType slideType = SlideConstant);
~Resampler();
long read(audio *audioOut, long frames);
void reset();
long samplesInOutput();
protected:
ResamplerImp *imp;
};
}
#endif
|