/* ZynAddSubFX - a software synthesizer Part.h - Part implementation Copyright (C) 2002-2005 Nasca Octavian Paul Author: Nasca Octavian Paul This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #ifndef PART_H #define PART_H #define MAX_INFO_TEXT_SIZE 1000 #include "../globals.h" #include "../Params/Controller.h" #include "../Containers/NotePool.h" #include namespace zyncarla { /** Part implementation*/ class Part { public: /**Constructor * @param microtonal_ Pointer to the microtonal object * @param fft_ Pointer to the FFTwrapper*/ Part(Allocator &alloc, const SYNTH_T &synth, const AbsTime &time, const int& gzip_compression, const int& interpolation, Microtonal *microtonal_, FFTwrapper *fft_, WatchManager *wm=0, const char *prefix=0); /**Destructor*/ ~Part(); // Copy misc parameters not stored in .xiz format void cloneTraits(Part &part) const REALTIME; // Midi commands implemented //returns true when note is successfully applied bool NoteOn(unsigned char note, unsigned char velocity, int masterkeyshift) REALTIME; void NoteOff(unsigned char note) REALTIME; void PolyphonicAftertouch(unsigned char note, unsigned char velocity, int masterkeyshift) REALTIME; void AllNotesOff() REALTIME; //panic void SetController(unsigned int type, int par) REALTIME; void ReleaseSustainedKeys() REALTIME; //this is called when the sustain pedal is released void ReleaseAllKeys() REALTIME; //this is called on AllNotesOff controller /* The synthesizer part output */ void ComputePartSmps() REALTIME; //Part output //saves the instrument settings to a XML file //returns 0 for ok or <0 if there is an error int saveXML(const char *filename); int loadXMLinstrument(const char *filename); void add2XML(XMLwrapper& xml); void add2XMLinstrument(XMLwrapper& xml); void defaults(); void defaultsinstrument(); void applyparameters(void) NONREALTIME; void applyparameters(std::function do_abort) NONREALTIME; void initialize_rt(void) REALTIME; void kill_rt(void) REALTIME; void getfromXML(XMLwrapper& xml); void getfromXMLinstrument(XMLwrapper& xml); void cleanup(bool final = false); //the part's kit struct Kit { Kit(void); Part *parent; bool firstkit; bool Penabled, Pmuted; unsigned char Pminkey, Pmaxkey; char *Pname; bool Padenabled, Psubenabled, Ppadenabled; unsigned char Psendtoparteffect; ADnoteParameters *adpars; SUBnoteParameters *subpars; PADnoteParameters *padpars; bool active(void) const; uint8_t sendto(void) const; bool validNote(char note) const; const static rtosc::Ports &ports; } kit[NUM_KIT_ITEMS]; //Part parameters void setkeylimit(unsigned char Pkeylimit); void setkititemstatus(unsigned kititem, bool Penabled_); unsigned char partno; /**