diff options
author | Matthew Hoops | 2012-03-20 14:18:57 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-03-20 14:49:16 -0400 |
commit | 71756bdf4eae5ba9cc3f329b85e894f04640aaef (patch) | |
tree | 40d464262da107ab5eed82f198685209161ebac1 /audio/softsynth/mt32/Poly.h | |
parent | 03eba05b09e5c9e5a351f8111185934b92a3fed3 (diff) | |
parent | 3c3576a224b92c703b4e8ea20008ac8a069980dd (diff) | |
download | scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.gz scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.bz2 scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'audio/softsynth/mt32/Poly.h')
-rw-r--r-- | audio/softsynth/mt32/Poly.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/audio/softsynth/mt32/Poly.h b/audio/softsynth/mt32/Poly.h new file mode 100644 index 0000000000..cd15a776f5 --- /dev/null +++ b/audio/softsynth/mt32/Poly.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher + * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MT32EMU_POLY_H +#define MT32EMU_POLY_H + +namespace MT32Emu { + +class Part; + +enum PolyState { + POLY_Playing, + POLY_Held, // This marks keys that have been released on the keyboard, but are being held by the pedal + POLY_Releasing, + POLY_Inactive +}; + +class Poly { +private: + Part *part; + unsigned int key; + unsigned int velocity; + unsigned int activePartialCount; + bool sustain; + + PolyState state; + + Partial *partials[4]; + +public: + Poly(Part *part); + void reset(unsigned int key, unsigned int velocity, bool sustain, Partial **partials); + bool noteOff(bool pedalHeld); + bool stopPedalHold(); + bool startDecay(); + bool startAbort(); + void terminate(); + + void backupCacheToPartials(PatchCache cache[4]); + + unsigned int getKey() const; + unsigned int getVelocity() const; + bool canSustain() const; + PolyState getState() const; + unsigned int getActivePartialCount() const; + bool isActive() const; + + void partialDeactivated(Partial *partial); +}; + +} + +#endif /* POLY_H_ */ |