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 |
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 |
|
void search(const Instrument* pInstrument, int triggercc); |
428 |
|
Region* next(); |
429 |
|
private: |
430 |
|
LinuxSampler::ArrayList<Region*>* pRegionList; |
431 |
|
int regionIndex; |
432 |
|
}; |
433 |
|
|
434 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
435 |
// class Region |
// class Region |
436 |
|
|
455 |
uint GetLoopEnd(); |
uint GetLoopEnd(); |
456 |
uint GetLoopCount(); |
uint GetLoopCount(); |
457 |
|
|
458 |
/// Return true if region is triggered by key |
/// Return true if region is triggered by key. Region is |
459 |
bool OnKey(uint8_t chan, uint8_t key, uint8_t vel, |
/// assumed to come from a search in the lookup table. |
460 |
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); |
|
|
|
|
|
/// Return true if region is triggered by control change |
|
|
bool OnControl(uint8_t chan, uint8_t cont, uint8_t val, |
|
|
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); |
|
461 |
|
|
462 |
/// Return an articulation for the current state |
/// Return an articulation for the current state |
463 |
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); |
464 |
|
|
465 |
// unique region id |
// unique region id |
466 |
int id; |
int id; |
483 |
std::string GetName() { return name; } |
std::string GetName() { return name; } |
484 |
SampleManager* GetSampleManager() { return pSampleManager; } |
SampleManager* GetSampleManager() { return pSampleManager; } |
485 |
|
|
|
/** |
|
|
* @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 |
|
|
); |
|
|
|
|
486 |
bool DestroyRegion(Region* pRegion); |
bool DestroyRegion(Region* pRegion); |
487 |
bool HasKeyBinding(uint8_t key); |
bool HasKeyBinding(uint8_t key); |
488 |
bool HasKeySwitchBinding(uint8_t key); |
bool HasKeySwitchBinding(uint8_t key); |
490 |
/// List of Regions belonging to this Instrument |
/// List of Regions belonging to this Instrument |
491 |
std::vector<Region*> regions; |
std::vector<Region*> regions; |
492 |
|
|
493 |
friend class sfz::File; |
friend class File; |
494 |
|
friend class Query; |
495 |
|
|
496 |
private: |
private: |
497 |
std::string name; |
std::string name; |
498 |
std::vector<bool> KeyBindings; |
std::vector<bool> KeyBindings; |
499 |
std::vector<bool> KeySwitchBindings; |
std::vector<bool> KeySwitchBindings; |
500 |
SampleManager* pSampleManager; |
SampleManager* pSampleManager; |
501 |
|
LookupTable* pLookupTable; |
502 |
|
LookupTable* pLookupTableCC[128]; |
503 |
}; |
}; |
504 |
|
|
505 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |