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 |
|
|
297 |
|
LinuxSampler::ArrayList<CC> amplitude_oncc; |
298 |
|
LinuxSampler::ArrayList<CC> volume_oncc; |
299 |
|
LinuxSampler::ArrayList<CC> cutoff_oncc; // -9600 to 9600 cents |
300 |
|
LinuxSampler::ArrayList<CC> pitch_oncc; |
301 |
|
LinuxSampler::ArrayList<CC> resonance_oncc; // 0 to 40 dB |
302 |
|
|
303 |
EG(); |
EG(); |
304 |
EG(const EG& eg) { Copy(eg); } |
EG(const EG& eg) { Copy(eg); } |
305 |
void operator=(const EG& eg) { Copy(eg); } |
void operator=(const EG& eg) { Copy(eg); } |
320 |
float resonance; // 0 to 40 dB |
float resonance; // 0 to 40 dB |
321 |
float pan; // -100 to 100 % |
float pan; // -100 to 100 % |
322 |
|
|
323 |
|
LinuxSampler::ArrayList<CC> delay_oncc; // 0 to 100 seconds |
324 |
LinuxSampler::ArrayList<CC> freq_oncc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> freq_oncc; // 0 to 20 Hz |
325 |
|
LinuxSampler::ArrayList<CC> freq_smoothcc; // 0 to ? milliseconds |
326 |
LinuxSampler::ArrayList<CC> fade_oncc; // 0 to 100 seconds |
LinuxSampler::ArrayList<CC> fade_oncc; // 0 to 100 seconds |
327 |
LinuxSampler::ArrayList<CC> phase_oncc; // 0 to 360 degrees |
LinuxSampler::ArrayList<CC> phase_oncc; // 0 to 360 degrees |
328 |
|
LinuxSampler::ArrayList<CC> volume_oncc; // -144 to 6 dB |
329 |
|
LinuxSampler::ArrayList<CC> volume_smoothcc; // 0 to ? milliseconds |
330 |
LinuxSampler::ArrayList<CC> pitch_oncc; |
LinuxSampler::ArrayList<CC> pitch_oncc; |
331 |
|
LinuxSampler::ArrayList<CC> pitch_smoothcc; // 0 to ? milliseconds |
332 |
|
LinuxSampler::ArrayList<CC> pan_oncc; // -100 to 100 % |
333 |
|
LinuxSampler::ArrayList<CC> pan_smoothcc; // 0 to ? milliseconds |
334 |
|
LinuxSampler::ArrayList<CC> cutoff_oncc; // -9600 to 9600 cents |
335 |
|
LinuxSampler::ArrayList<CC> cutoff_smoothcc; // 0 to ? milliseconds |
336 |
|
LinuxSampler::ArrayList<CC> resonance_oncc; // 0 to 40 dB |
337 |
|
LinuxSampler::ArrayList<CC> resonance_smoothcc; // 0 to ? milliseconds |
338 |
|
|
339 |
LFO(); |
LFO(); |
340 |
LFO(const LFO& lfo) { Copy(lfo); } |
LFO(const LFO& lfo) { Copy(lfo); } |
437 |
optional<int> delay_samples; Array<optional<int> > delay_samples_oncc; |
optional<int> delay_samples; Array<optional<int> > delay_samples_oncc; |
438 |
optional<int> end; |
optional<int> end; |
439 |
optional<float> loop_crossfade; |
optional<float> loop_crossfade; |
440 |
optional<int> offset; optional<int> offset_random; Array<optional<int> > offset_oncc; |
optional<uint> offset; optional<int> offset_random; Array<optional<int> > offset_oncc; |
441 |
loop_mode_t loop_mode; |
loop_mode_t loop_mode; |
442 |
optional<int> loop_start; optional<int> loop_end; |
optional<int> loop_start; optional<int> loop_end; |
443 |
optional<int> sync_beats; |
optional<int> sync_beats; |
515 |
Array<int> pitchlfo_depthcc; |
Array<int> pitchlfo_depthcc; |
516 |
|
|
517 |
LinuxSampler::ArrayList<CC> pitchlfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> pitchlfo_freqcc; // 0 to 20 Hz |
518 |
LinuxSampler::ArrayList<CC> fillfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> fillfo_depthcc; // -1200 to 1200 cents |
519 |
LinuxSampler::ArrayList<CC> amplfo_freqcc; // 0 to 20 Hz |
LinuxSampler::ArrayList<CC> fillfo_freqcc; // 0 to 20 Hz |
520 |
|
LinuxSampler::ArrayList<CC> amplfo_depthcc; // -10 to 10 dB |
521 |
|
LinuxSampler::ArrayList<CC> amplfo_freqcc; // 0 to 20 Hz |
522 |
|
|
523 |
// envelope generators |
// envelope generators |
524 |
LinuxSampler::ArrayList<EG> eg; |
LinuxSampler::ArrayList<EG> eg; |
608 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
609 |
// class Instrument |
// class Instrument |
610 |
|
|
611 |
/// Provides all neccessary information for the synthesis of an Instrument |
/// Provides all necessary information for the synthesis of an Instrument |
612 |
class Instrument : public SampleManager |
class Instrument : public SampleManager |
613 |
{ |
{ |
614 |
public: |
public: |