47 |
class Group; |
class Group; |
48 |
class Instrument; |
class Instrument; |
49 |
class File; |
class File; |
50 |
|
class LookupTable; |
51 |
|
|
52 |
class Sample : public LinuxSampler::SampleFileBase<Region> { |
class Sample : public LinuxSampler::SampleFileBase<Region> { |
53 |
public: |
public: |
298 |
int lovel; int hivel; |
int lovel; int hivel; |
299 |
Array<int> locc; Array<int> hicc; |
Array<int> locc; Array<int> hicc; |
300 |
int lobend; int hibend; |
int lobend; int hibend; |
301 |
int lobpm; int hibpm; |
float lobpm; float hibpm; |
302 |
int lochanaft; int hichanaft; |
int lochanaft; int hichanaft; |
303 |
int lopolyaft; int hipolyaft; |
int lopolyaft; int hipolyaft; |
304 |
int loprog; int hiprog; |
int loprog; int hiprog; |
321 |
trigger_t trigger; |
trigger_t trigger; |
322 |
|
|
323 |
uint group; |
uint group; |
324 |
optional<int> off_by; |
uint off_by; |
325 |
off_mode_t off_mode; |
off_mode_t off_mode; |
326 |
|
|
327 |
Array<int> on_locc; Array<int> on_hicc; |
Array<int> on_locc; Array<int> on_hicc; |
405 |
LinuxSampler::ArrayList<EG> eg; |
LinuxSampler::ArrayList<EG> eg; |
406 |
}; |
}; |
407 |
|
|
408 |
|
class Query { |
409 |
|
public: |
410 |
|
uint8_t chan; // MIDI channel |
411 |
|
uint8_t key; // MIDI note TODO: or controller |
412 |
|
uint8_t vel; // MIDI velocity |
413 |
|
int bend; // MIDI pitch bend |
414 |
|
uint8_t bpm; // host BPM |
415 |
|
uint8_t chanaft; // MIDI channel pressure |
416 |
|
uint8_t polyaft; // MIDI polyphonic aftertouch |
417 |
|
uint8_t prog; // MIDI program change |
418 |
|
float rand; // generated random number |
419 |
|
trigger_t trig; // how it was triggered |
420 |
|
uint8_t* cc; // all 128 CC values |
421 |
|
float timer; // time since previous region in the group was triggered |
422 |
|
bool* sw; // state of region key switches, 128 possible values |
423 |
|
uint8_t last_sw_key; // last key pressed in the key switch range |
424 |
|
uint8_t prev_sw_key; // previous note value |
425 |
|
|
426 |
|
void search(const Instrument* pInstrument); |
427 |
|
Region* next(); |
428 |
|
private: |
429 |
|
LinuxSampler::ArrayList<Region*>* pRegionList; |
430 |
|
int regionIndex; |
431 |
|
}; |
432 |
|
|
433 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
434 |
// class Region |
// class Region |
435 |
|
|
454 |
uint GetLoopEnd(); |
uint GetLoopEnd(); |
455 |
uint GetLoopCount(); |
uint GetLoopCount(); |
456 |
|
|
457 |
/// Return true if region is triggered by key |
/// Return true if region is triggered by key. Region is |
458 |
bool OnKey(uint8_t chan, uint8_t key, uint8_t vel, |
/// assumed to come from a search in the lookup table. |
459 |
int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, |
bool OnKey(const Query& q); |
|
uint8_t prog, float rand, trigger_t trig, uint8_t* cc, |
|
|
float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key); |
|
460 |
|
|
461 |
/// Return true if region is triggered by control change |
/// Return true if region is triggered by control change |
462 |
bool OnControl(uint8_t chan, uint8_t cont, uint8_t val, |
bool OnControl(uint8_t chan, uint8_t cont, uint8_t val, |
465 |
float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key); |
float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key); |
466 |
|
|
467 |
/// Return an articulation for the current state |
/// Return an articulation for the current state |
468 |
Articulation* GetArticulation(int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, uint8_t* cc); |
Articulation* GetArticulation(int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, uint8_t* cc); |
469 |
|
|
470 |
// unique region id |
// unique region id |
471 |
int id; |
int id; |
488 |
std::string GetName() { return name; } |
std::string GetName() { return name; } |
489 |
SampleManager* GetSampleManager() { return pSampleManager; } |
SampleManager* GetSampleManager() { return pSampleManager; } |
490 |
|
|
|
/** |
|
|
* @returns All regions that are triggered by key |
|
|
*/ |
|
|
std::vector<Region*> GetRegionsOnKey ( |
|
|
uint8_t chan, uint8_t key, uint8_t vel, |
|
|
int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, |
|
|
uint8_t prog, float rand, trigger_t trig, uint8_t* cc, |
|
|
float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key |
|
|
); |
|
|
|
|
491 |
bool DestroyRegion(Region* pRegion); |
bool DestroyRegion(Region* pRegion); |
492 |
bool HasKeyBinding(uint8_t key); |
bool HasKeyBinding(uint8_t key); |
493 |
bool HasKeySwitchBinding(uint8_t key); |
bool HasKeySwitchBinding(uint8_t key); |
495 |
/// List of Regions belonging to this Instrument |
/// List of Regions belonging to this Instrument |
496 |
std::vector<Region*> regions; |
std::vector<Region*> regions; |
497 |
|
|
498 |
friend class sfz::File; |
friend class File; |
499 |
|
friend class Query; |
500 |
|
|
501 |
private: |
private: |
502 |
std::string name; |
std::string name; |
503 |
std::vector<bool> KeyBindings; |
std::vector<bool> KeyBindings; |
504 |
std::vector<bool> KeySwitchBindings; |
std::vector<bool> KeySwitchBindings; |
505 |
SampleManager* pSampleManager; |
SampleManager* pSampleManager; |
506 |
|
LookupTable* pLookupTable; |
507 |
}; |
}; |
508 |
|
|
509 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |