48 |
class Instrument; |
class Instrument; |
49 |
class File; |
class File; |
50 |
class LookupTable; |
class LookupTable; |
51 |
|
class SampleManager; |
52 |
|
|
53 |
class Sample : public LinuxSampler::SampleFileBase<Region> { |
class Sample : public LinuxSampler::SampleFileBase<Region> { |
54 |
|
private: |
55 |
|
int End; |
56 |
|
long TotalFrames; |
57 |
|
|
58 |
public: |
public: |
59 |
Sample(String File, bool DontClose = false, uint offset = 0): LinuxSampler::SampleFileBase<Region>(File, DontClose) { |
Sample(String File, bool DontClose = false, uint offset = 0, int end = -2 /* -2 means unspecified */) |
60 |
|
: LinuxSampler::SampleFileBase<Region>(File, DontClose) |
61 |
|
{ |
62 |
Offset = offset; |
Offset = offset; |
63 |
|
End = end; |
64 |
|
|
65 |
|
long tfc = LinuxSampler::SampleFileBase<Region>::GetTotalFrameCount(); |
66 |
|
if (Offset >= tfc) { |
67 |
|
std::cerr << "Offset for file '" << this->GetFile() << "' too long (" << Offset << ")" << std::endl; |
68 |
|
Offset = 0; |
69 |
|
} |
70 |
|
|
71 |
|
if (End == -2 || End > tfc) TotalFrames = tfc; |
72 |
|
else if (End == -1 || End < Offset) TotalFrames = 0; |
73 |
|
else TotalFrames = End; |
74 |
} |
} |
75 |
virtual ~Sample() { } |
virtual ~Sample() { } |
76 |
|
|
77 |
|
virtual long GetTotalFrameCount() { return TotalFrames; } |
78 |
|
|
79 |
|
friend class SampleManager; |
80 |
}; |
}; |
81 |
|
|
82 |
// Enumerations |
// Enumerations |
94 |
|
|
95 |
class SampleManager : public LinuxSampler::SampleManager<Sample, Region> { |
class SampleManager : public LinuxSampler::SampleManager<Sample, Region> { |
96 |
public: |
public: |
97 |
Sample* FindSample(std::string samplePath, int offset); |
Sample* FindSample(std::string samplePath, uint offset, int end); |
98 |
|
|
99 |
protected: |
protected: |
100 |
virtual void OnSampleInUse(Sample* pSample) { |
virtual void OnSampleInUse(Sample* pSample) { |
289 |
int loop; |
int loop; |
290 |
int loop_count; |
int loop_count; |
291 |
float amplitude; |
float amplitude; |
292 |
|
float volume; |
293 |
float cutoff; |
float cutoff; |
294 |
|
int pitch; // -9600 to 9600 cents |
295 |
|
float resonance; // 0 to 40 dB |
296 |
|
float pan; // -100 to 100 % |
297 |
|
int pan_curve; |
298 |
|
|
299 |
|
LinuxSampler::ArrayList<CC> amplitude_oncc; |
300 |
|
LinuxSampler::ArrayList<CC> volume_oncc; |
301 |
|
LinuxSampler::ArrayList<CC> cutoff_oncc; // -9600 to 9600 cents |
302 |
|
LinuxSampler::ArrayList<CC> pitch_oncc; |
303 |
|
LinuxSampler::ArrayList<CC> resonance_oncc; // 0 to 40 dB |
304 |
|
LinuxSampler::ArrayList<CC> pan_oncc; // -100 to 100 % |
305 |
|
LinuxSampler::ArrayList<CC> pan_curvecc; // used only as temporary buffer during the parsing - values are then moved to pan_oncc |
306 |
|
|
307 |
EG(); |
EG(); |
308 |
EG(const EG& eg) { Copy(eg); } |
EG(const EG& eg) { Copy(eg); } |
309 |
void operator=(const EG& eg) { Copy(eg); } |
void operator=(const EG& eg) { Copy(eg); } |
324 |
float resonance; // 0 to 40 dB |
float resonance; // 0 to 40 dB |
325 |
float pan; // -100 to 100 % |
float pan; // -100 to 100 % |
326 |
|
|
327 |
|
LinuxSampler::ArrayList<CC> delay_oncc; // 0 to 100 seconds |
328 |
LinuxSampler::ArrayList<CC> freq_oncc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> freq_oncc; // 0 to 20 Hz |
329 |
|
LinuxSampler::ArrayList<CC> freq_smoothcc; // 0 to ? milliseconds |
330 |
LinuxSampler::ArrayList<CC> fade_oncc; // 0 to 100 seconds |
LinuxSampler::ArrayList<CC> fade_oncc; // 0 to 100 seconds |
331 |
LinuxSampler::ArrayList<CC> phase_oncc; // 0 to 360 degrees |
LinuxSampler::ArrayList<CC> phase_oncc; // 0 to 360 degrees |
332 |
|
LinuxSampler::ArrayList<CC> volume_oncc; // -144 to 6 dB |
333 |
|
LinuxSampler::ArrayList<CC> volume_smoothcc; // 0 to ? milliseconds |
334 |
LinuxSampler::ArrayList<CC> pitch_oncc; |
LinuxSampler::ArrayList<CC> pitch_oncc; |
335 |
|
LinuxSampler::ArrayList<CC> pitch_smoothcc; // 0 to ? milliseconds |
336 |
|
LinuxSampler::ArrayList<CC> pan_oncc; // -100 to 100 % |
337 |
|
LinuxSampler::ArrayList<CC> pan_smoothcc; // 0 to ? milliseconds |
338 |
|
LinuxSampler::ArrayList<CC> cutoff_oncc; // -9600 to 9600 cents |
339 |
|
LinuxSampler::ArrayList<CC> cutoff_smoothcc; // 0 to ? milliseconds |
340 |
|
LinuxSampler::ArrayList<CC> resonance_oncc; // 0 to 40 dB |
341 |
|
LinuxSampler::ArrayList<CC> resonance_smoothcc; // 0 to ? milliseconds |
342 |
|
|
343 |
LFO(); |
LFO(); |
344 |
LFO(const LFO& lfo) { Copy(lfo); } |
LFO(const LFO& lfo) { Copy(lfo); } |
441 |
optional<int> delay_samples; Array<optional<int> > delay_samples_oncc; |
optional<int> delay_samples; Array<optional<int> > delay_samples_oncc; |
442 |
optional<int> end; |
optional<int> end; |
443 |
optional<float> loop_crossfade; |
optional<float> loop_crossfade; |
444 |
optional<int> offset; optional<int> offset_random; Array<optional<int> > offset_oncc; |
optional<uint> offset; optional<int> offset_random; Array<optional<int> > offset_oncc; |
445 |
loop_mode_t loop_mode; |
loop_mode_t loop_mode; |
446 |
optional<int> loop_start; optional<int> loop_end; |
optional<int> loop_start; optional<int> loop_end; |
447 |
optional<int> sync_beats; |
optional<int> sync_beats; |
519 |
Array<int> pitchlfo_depthcc; |
Array<int> pitchlfo_depthcc; |
520 |
|
|
521 |
LinuxSampler::ArrayList<CC> pitchlfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> pitchlfo_freqcc; // 0 to 20 Hz |
522 |
LinuxSampler::ArrayList<CC> fillfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> fillfo_depthcc; // -1200 to 1200 cents |
523 |
LinuxSampler::ArrayList<CC> amplfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> fillfo_freqcc; // 0 to 20 Hz |
524 |
|
LinuxSampler::ArrayList<CC> amplfo_depthcc; // -10 to 10 dB |
525 |
|
LinuxSampler::ArrayList<CC> amplfo_freqcc; // 0 to 20 Hz |
526 |
|
|
527 |
// envelope generators |
// envelope generators |
528 |
LinuxSampler::ArrayList<EG> eg; |
LinuxSampler::ArrayList<EG> eg; |
533 |
LinuxSampler::ArrayList<CC> volume_oncc; |
LinuxSampler::ArrayList<CC> volume_oncc; |
534 |
LinuxSampler::ArrayList<CC> volume_curvecc; // used only as temporary buffer during the parsing - values are then moved to volume_oncc |
LinuxSampler::ArrayList<CC> volume_curvecc; // used only as temporary buffer during the parsing - values are then moved to volume_oncc |
535 |
LinuxSampler::ArrayList<CC> volume_smoothcc; // used only as temporary buffer during the parsing - values are then moved to volume_oncc |
LinuxSampler::ArrayList<CC> volume_smoothcc; // used only as temporary buffer during the parsing - values are then moved to volume_oncc |
536 |
|
|
537 |
|
LinuxSampler::ArrayList<CC> pan_oncc; // -100 to 100 % |
538 |
|
LinuxSampler::ArrayList<CC> pan_curvecc; // used only as temporary buffer during the parsing - values are then moved to pan_oncc |
539 |
|
LinuxSampler::ArrayList<CC> pan_smoothcc; // used only as temporary buffer during the parsing - values are then moved to pan_oncc |
540 |
}; |
}; |
541 |
|
|
542 |
class Query { |
class Query { |
616 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
617 |
// class Instrument |
// class Instrument |
618 |
|
|
619 |
/// Provides all neccessary information for the synthesis of an Instrument |
/// Provides all necessary information for the synthesis of an Instrument |
620 |
class Instrument : public SampleManager |
class Instrument : public SampleManager |
621 |
{ |
{ |
622 |
public: |
public: |
691 |
LFO& lfo(int x); |
LFO& lfo(int x); |
692 |
void copyCurves(LinuxSampler::ArrayList<CC>& curves, LinuxSampler::ArrayList<CC>& dest); |
void copyCurves(LinuxSampler::ArrayList<CC>& curves, LinuxSampler::ArrayList<CC>& dest); |
693 |
void copySmoothValues(LinuxSampler::ArrayList<CC>& smooths, LinuxSampler::ArrayList<CC>& dest); |
void copySmoothValues(LinuxSampler::ArrayList<CC>& smooths, LinuxSampler::ArrayList<CC>& dest); |
694 |
|
|
695 |
|
int ToInt(const std::string& s) throw(LinuxSampler::Exception); |
696 |
|
float ToFloat(const std::string& s) throw(LinuxSampler::Exception); |
697 |
|
|
698 |
|
int currentLine; |
699 |
std::string currentDir; |
std::string currentDir; |
700 |
/// Pointer to the Instrument belonging to this file |
/// Pointer to the Instrument belonging to this file |
701 |
Instrument* _instrument; |
Instrument* _instrument; |