diff --git a/.gitmodules b/.gitmodules index 10785ef9a9d..2863bf4825c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "src/3rdparty/rpmalloc/rpmalloc"] path = src/3rdparty/rpmalloc/rpmalloc url = https://github.com/rampantpixels/rpmalloc.git +[submodule "plugins/zynaddsubfx/zynaddsubfx"] + path = plugins/zynaddsubfx/zynaddsubfx + url = https://github.com/lmms/zynaddsubfx.git diff --git a/plugins/zynaddsubfx/AUTHORS.txt b/plugins/zynaddsubfx/AUTHORS.txt deleted file mode 100644 index e2441c036b1..00000000000 --- a/plugins/zynaddsubfx/AUTHORS.txt +++ /dev/null @@ -1,18 +0,0 @@ -Main author: - Nasca Octavian Paul - -Developers: - Mark McCurry - Harald Hvaal - -Contributors: - Gerald Folcher (legato, mono notes memory) - Lars Luthman (zombie fix,jack midi, LASH support) - Daniel Clemente (with a workaround of X11 repeated key bug) - Emmanuel Saracco (fix for JACK output) - Achim Settelmeier (QUERTZ keyboard layout for virtual keyboard) - Jérémie Andréi (AZERTY keyboard layout, Array index fix, OSS failsafe) - Alexis Ballier (const char* <-> string mismatch, NULLMidi prototype fix) - Tobias Doerffel (static-instance variables fix, missing include fix) - James Morris (Memory leaks in FLTK GUI) - diff --git a/plugins/zynaddsubfx/COPYING b/plugins/zynaddsubfx/COPYING deleted file mode 100644 index e47a022c6cb..00000000000 --- a/plugins/zynaddsubfx/COPYING +++ /dev/null @@ -1,347 +0,0 @@ - -NOTE! The GPL below is copyrighted by the Free Software Foundation, but -the instance of code that it refers to (the ZynAddSubFX application) -is copyrighted by the authors (Nasca Octavian Paul and others) who actually wrote it. ---------------------------------------------------------------------------- - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/zynaddsubfx/ChangeLog b/plugins/zynaddsubfx/ChangeLog deleted file mode 100644 index fb680430adc..00000000000 --- a/plugins/zynaddsubfx/ChangeLog +++ /dev/null @@ -1,976 +0,0 @@ -6 Mar 2002 -(dupamasa - in jur de ora 4) Mi-a venit ideea exact cum sa fac cand ma plimbam pe strada Pandurilor -7/8 Mar 2002 - Started to do diagrams -10 Mar 2002 - Started to write "voice" -11 Mar 2002 - Heard first sound -12 Mar 2002 - tested with 200 voices -16 Mar 2002 - made "Note" the main class - - added vibratto - - added glissando -20 Mar 2002 - started to write the Envelope class -21 Mar 2002 - Envelope written (almost) - Volume envelope almost written -23 Mar 2002 - Scris relasenote(putin) - Envelope-ul este si in dB - "glissando" este inlocuit cu "Envelope" de frecventa - started to write the LFO class -24 Mar 2002 - Corrected a bug that could crashed the synth (forgotten to disable the amp/freq envelopeenabled when killed it) -25 Mar 2002 - Started to write the Filter class (wrote only few lines) -27 Mar 2002 - Scris filtrul(putin), si FilterEnvelope -28 Mar 2002 - Adaugat la LFO si tipul "rampup" si "rampdown" - Scris filterLFO si amplitudeLFO(termollo) - redenumiti si aranjati parametrii - Adaugat LFO delay - Scris FilterEnvelope(corect) si FilterLFO(corect) -29 Mar 2002 - Adaugat RingModulation - Adaugat FM/RM Amplitude si Frequency Envelope - Corectat un bug minor la Envelope-ASRinit(); - Adaugat FM -01 Apr 2002 - Corectat un bug care facea sa se auda paraituri la sunetele care incepeau co o faza!=0 - Scris cativa dintre parametrii globali Envelop-ulire,LFO,Filter,.. -02 Apr 2002 - Curatat putin ADnote - Adaugat VelocityScale la amplitudine, la FM si la Filtru Global -03 Apr 2002 - Aranjati toti parametrii ADnote in structuri -04 Apr 2002 - Mutati multi parametrii in ADnoteParameters - Inceput sa scriu ADnoteParameters -05 Apr 2002 - Inceput sa scriu clase speciale pentru parametrii(midi) (LFO..) -06 Apr 2002 - Continuat sa scriu clasele speciale pentru parametrii - Teoretic merge sinteza multitimbrala(Adica se poate aplea ADnote(canal,note,vel)) -07 Apr 2002 - Completat(aproape) transferul de parametri midi la cei reali -08 Apr 2002 - Added FM oscil at parameters and corrected a small FM bug -09 Apr 2002 - Inceput sa-l fac real-time -10 Apr 2002 - Merge la keyboard-ul MIDI, polifonic -27 Apr 2002 - Scris interfata la OSS, la latenta scazuta - Corectat un bug care facea ca sa se execute calcule inutile, ceea ce facea ca polifonia maxima sa scada de 10 ori -29 Apr 2002 - Inceput sa scriu interfata midi(obiect) -30 Apr 2002 - Continuat putin interfata midi (dar nu am terminat) -02 Mai 2002 - Merge in timp real cu latenta scazuta, dar se mai auda niste "pacanaituri" -03 Mai 2002 - Inceput sa scriu Reverb (acum este doar ecou) - "Pacanaiturile" au fost eliminate. -09 Mai 2002 - Reverb-ul suna a reverberatie -11 Mai 2002 - Adaugat cativa parametrii midi la Reverb -18 Mai 2002 - Adaugat filtrul AllPass la Reverb si adaugat parametrul Plohidamp -19 Mai 2002 - Adaugat InitialDelay (idelay) la Reverb -24 Iun 2002 - Clasa Filtru nu mai este dependenta de FilterParams(pot sa-l folosesc in alte scopuri) - Corectat un bug la filtru care facea ca la rezomante scazute sa amplifice f. mult basii - Adaugat High Pass Filter - Rezonanta filtrului este exponentiala - Adauga LPF+HPF la Reverb - Inceput sa scriu Generatorul de Functii (OscilGen) -25 Iun 2002 - Scris cateva forme de unda (functii) - Reverb-ul are volumul in dB si daca este zero(ca parametru) atunci se dezactiveaza -02 Iul 2002 - Adaugat inca o functie la generatorul de functii -03 Iul 2002 - Inceput sa scriu generarea de functii la OscilGen pe baza de FFT - Inlaturat DC-ul de la OscilGen -04 Iul 2002 - Adaugat ANTI-ALIASING la ADnote si insumarea armonicelor se face in domeniul frecventa - Corectat un bug care facea sa sune rau dac OSCIL_SIZE!=512 (era declarat de 2 ori) -12 Iul 2002 - Adaugat posibilitatea de a folosi ca modulator alta voce - Adaugat parametrii MIDI la OscilGen -13 Iul 2002 - Adaugat Randomness la clasa OscilGen -15 Iul 2002 - Adaugat si Panning(incl. Randomness) => instrumentul este acum stereo -16 Iul 2002 - Adaugat Randomness la LFO (faza 0 => random) - Inlaturat o eroare care facea ca amplitudinea sa nu fie interpolata -17 Iul 2002 - Volumul FM-ului este exponential - Adaugat atenuare la volumul FM-ului la note inalte -23 Iul 2002 - Adaugat EnvelopeStretch - Corectata o eroare care facea ca uneori sunetul sa se auda foarte tare la inceput - Adaugat fade-in (f. scurt) si fade out in caz ca envelop-ul are A=0 sau R=0, a.i. sa nu se auda pacanaituri -24 Iul 2002 - Corectat Relase-ul la Envelope si adaugat ForcedRelase -25 Iul 2002 - Adaugat posibilitatea de a nu folosi AntiAliasing-ul - Adaugat Frequency Modulation (nu phase modulation) - Adaugat Delay la fiecare voce - Adaugat Morphing la modulatie -26 Iul 2002 - Inceput sa scriu clasa Part -27 Iul 2002 - Se face controlul Midi folosind clasa Part si nu ADnote -28 Iul 2002 - Corectata o eroare care facea sa se instantieze clasa ADnoteParameters pt. fiecare nota => memoria era ocupata excesiv si "manca" din procesor. Cauza erorii este ca trimiteam obiectul ADnoteParameters ca parametru si nu referinta lui. Asta era cauza pacanaiturilor ce se auzeau daca apasam multe clape simultan. -29 Iul 2002 - Adaugat clasa Master (Permite acum mai multe instr. simultan => multitimbral) - Observat o eroare la Envelope -30 Iul 2002 - Adaugat EnvelopeStretch si Forcedrelase la instantierea unui obiect EnvelopeParams - Durata Sustainul-ui fortat este acceeasi indiferent de paramentrul EnvelopeStretch - Adaugat Ecou -31 Iul 2002 - Daca VelocityScaleFunction=127 atunci orice vel. va face amplitudinea maxima (ca si cand vel.=127) - Inceput sa scriu Interfata Utilizator -01 Aug 2002 - Toti parametrii sunt convertiti in REALTYPE direct de ADnote,de LFO - Inlataurate mici probleme de AntiAliasing daca detune-ul era prea sus si la unele moduri FM - Programul incepe sa fie controlabil de Interfata -02 Aug 2002 - Inlaturat o eroare stupida care facea ca sa se seteze valorile EnvelopeParams la -1 (scria din Master:: prea mult) -03 Aug 2002 - Terminata interfata pentru ADnoteParameters.GlobalPars - Adaugat inca un parametru la lfo (continuous LFO) care faca ca LFO-ul sa nu inceapa la fiecare NoteOn - Corectat doua erori la ...[nvoice].AmpEnvelope si ...[nvoice].FreqEnvelope - Scrisa interfata pentru ADnoteParameters.VoicePars (fara FM+OSCIL...) -04 Aug 2002 - Scrisa interfata cu FM (fara Oscil) - Corectate doua erori cu provire la FMampenv si FMfreqenv - Inlaturat aliasing-ul la vocea FM - Modificata interfata (Voice si FM-ul sunt intr-o singura fereastra) - Inceput sa scriu schimbare voce curenta. -05 Aug 2002 - Adaugat interfata pentru cei mai importanti parametrii ai ADnote_VoicePar[nvoice] - Inceput sa scriu interfata pentru OscilGen -06 Aug 2002 - Este mult mai usoara schimbarea vocii curente. - Inceput sa scriu OscilEditor - Nu mai este necesara changebasefunc() la oscil pentru a schimba basefunction, se apeleaza automat. - OscilEditor este (aproape) complet - Toti parametrii ADnoteParameters au UI - Corectate cateva erori (cauzate de faptul ca nu am verificat daca ADnote::...Enabled!=0) -07 Aug 2002 - Corectata o eroare la envelope - Adaugat afisaj spectrum la OscilEdit - Adaugat parametrii noi: extenal oscillator (voice si FM) si oscilphase(si FM) si interfata pentru ei - Gasite mai multe erori care apar daca misc widget-urile in timp ce cant la clape (probabil este vorba de thread-uri care trebuie sa fie sincronizate sau ceva cam asa sau memory leaks) - Inceput sa scriu interfata pentru Part - Adaugat bypass la filtrul global - Adaugat conversia oscil-ului in basefunction - Corectata o mica eroare la calcularea oscil-ului referitor la faze -08 Aug 2002 - In VoiceList valorile sunt actualizate la fiecare apasare a butonului "ShowVoiceList" si formele de unda sunt afisate corect. - Corectate niste mici erori la FM - Daca se foloseste ca modulator o alta voce, interfata dezativeaza unii parametrii FM daca sunt inutili - Inceput sa scriu interfata si parametrii Master/Part - Schimbat putin Master si Part (atentie sa nu se instantieza ADnoteParameters la fiecare apasare de tasta) - Inceput sa scriu control-ul pentru Master/Parts -09 Aug 2002 - Scris parametrii Part si Master - Inceput sa scriu sincronizarea intre thread-uri -10 Aug 2002 - Adaugat o noua forma de unda la OscilGen - Adaugat sincronizarea intre thread-uri=>programul nu mai crapa daca in timp ce apas clapele, modific forma de unda - Adaugat enable/disable ADnote - Inceput sa scriu SUBnote/SUBnoteParameters - Se poate canta si la SUBnote(inceput sa scriu UI pt. el) -11 Aug 2002 - Scris controlul armonicelor - Adugati cativa parametrii la SUBnote - Adaugat AmpEnvelope la SUBnote(si UI) -12 Aug 2002 - Adaugat Detune la SUBnote si schimbat Detune-ul la ADnote - Adaugat FreqEnvelope la SUBnote -16 Aug 2002 - Corectata o eroare care facea ca VoiceOut sa fie inlaturat chiar daca era inca folosit(de alte voci) - Daca "Forced Relase" este off atunci se face relase-ul liniar - Adaugat BandWidth Envelope -17 Aug 2002 - Inceput sa pregatesc pentru EffectManager -18 Aug 2002 - Adaugat inca un parametru la Reverb: initial delay fb - Scris efectele de insertie - Inceput sa scriu efectele de sistem -19 Aug 2002 - Continuat sa scriu efectele de sistem - Inceput sa scriu interfata la Efecte (Reverb - terminat, aproape) -22 Aug 2002 - Corectata o eroare la Echo - Se poate schimba efectul de insertie - Gasita o eroare care "crapa" programul daca schimb efectul de le Reverb (rezolvata temporar, dar cu "memory leak") -23 Aug 2002 - Corectata eroarea la Reverb (a fost din cauza ca am pus ">" in loc de ">=" :-p ) - Terminat efectele de insertie(si interfata) - Adaugat Effect cleanup - Scrisa interfata pentru efectele sistem (cu exceptia sendto another sys eff) -24 Aug 2002 - Adaugate doua noi efecte: Chorus si Phaser -25 Aug 2002 - Nu se mai aude tacanit la Chorus daca schimb Delay/Depth - Corectat o mica eroare care facea ca sa nu se afiseze Pinsparts corect - Adaugat un nou efect: AlienWah - Nu se mai aude tacanit la Phaser si la AlienWah la frecvente LFO f. mari -27 Aug 2002 - Adaugata o noua forma de unda: Chirp - Adaugat Waveshaping la OscilGen - Se poate compila si fara UI - Inceput sa scriu Salvarea/Incarcarea Parametrilor -28 Aug 2002 - In ADnoteVoiceListUI se afisaza corect daca vocea este activata/dezactivata - Scrisa Salvarea/Incarcarea parametrilor (cu exceptia la OSCIL::UseAsBaseFunction) - Adaugat File Save/Open -29 Aug 2002 - Se poate salva si oscil::useasbase - Se afiseaza corect valorile dupa incarcare -01 Sep 2002 - Adaugat "codul de intrare" sa saveload 0xfe pt. a sti de unde incepe o noua "ramura" - "Codul de intrare" este folosit pentru a nu incarca "ramurile" care nu se potrivesc cu specificatiile (ex. nr. de voce sau nr. part prea mare) - Adaugat header la fisier - Imbunatatit OscilUI::useasbase -03 Sep 2002 - Modificat codurile de parmetrii: indicele par. sunt >= 0x80, parametrii <0x80 , controlerii speciali(urcare/coborare creanga) >=0xf0; Este util la versiunile viitoare, la forward/reverse compatibility. - Inceput sa scriu clasa Microtonal si interfata pt. Microtonal -04 Sep 2002 - Adaugat Pfilterbypass la salvare (am uitat sa o pun pana acum) - Aproape terminat Microtonal-ul (cu exceptia importului din fisiere .scl) -05 Sep 2002 - Facut cateva mici modificari la Microtonal si Echo - Adaugat un nou parametru la ADnote: PVolumeminus - Adaudat parametrii noi de Detune: Pcoarsedetune(coarse+octave) si Pdetunetype - Adaugat cateva tipuri de detune -06 Sep 2002 - Adaugat posibilitatea de a folosi ADnotepars:Globalpars.Pdetudetype in loc de Pdetunetype (0 = default detunetype), asa ca nu mai trebuie sa mai modific la fiecare voce detunetype: setez la 0 si modific global-ul - Facut mici modificari la MidiInput(OSS) -07 Sep 2002 - Corectata o eroare cu privire la detune si daca freq. > Nyquist - Modificat driver-ul OSSmidiin - Adaugat driver Alsa cu port virtual - Se poate salva doar instrumentele/microtonal. - Adaugata un nou fel de waveshaping(Zigzag) -08 Sep 2002 - Psysefxvol[][] sunt scalate in dB - Nu mai este periculos sa inchid fereastra principala -09 Sep 2002 - Se actualizeaza corect la incarcare la Master:Psysefxvol[][],Pvolume,Pkeyshift; si alti parametrii la Part - Adaugat nume la Part - Panic-ul (Shut-up-ul) se aplica si la efecte - Part->Penable controleaza de fapt daca Part-ul este activat/complet dezactivat. Daca se dezactiveaza un part toate notele+ efectele insertion sunt oprite. Nu mai consuma CPU daca folosesc multe part-uri. - Adaugat un nou parametru la part: Pnoteon care controleaza daca part-ul primeste mesaje NoteOn - Adaugarea extensiei se face automat. - Adaugat LFO exp_up 1 si 2 - Curatat putin de memory leaks (mai am de curatat si interfata) -10 Sep 2002 - Adaugat filtrul HPF cu un pol - Interfata se inchide corect. - Adaugat textul cu Copyright in interfata - Traduse toate comentariile in limba engleza - Adaugat licenta in fiecare fisier -11 Sep 2002 - Adaugat descriere la fiecare fisier - Corectata o eroare care facea ca SUBnote sa aiba amplitudini f. mari la freq. f. inalte - Adaugat cateva macro-uri la interpolarea amplitudinii -12 Sep 2002 - Modificat extensiile (*.mas.zyn ---> *.mas_zyn, la fel si celelalte) pentru a nu aparea fisiere *.mas.mas.zyn -13 Sep 2002 - Am decis numele programului: "ZynAddSubFX" (Zyn de la synthetizer (inlocuit S cu Z), Add de la additive, Sub de la substractive, FX de la effects) -14 Sep 2002 - Volumul din ADvoicelist se afiseaza corect -15 Sep 2002 - Adaugat inca 3 moduri de waveshaping Limiter, UpperLimiter, LowerLimiter -16 Sep 2002 - Adaugat Makefile -17 Sep 2002 - Corectata o mica eroare care facea ca sa nu se incarce fisierele cu data intotdeauna - Nu se amplifica freq. f. inalte daca freq. filtrului este mare. - Inceput sa scriu documentatia. -18 Sep 2002 - Adaugat functia de resetare a tuturor parametrilor(master si instrument) -23 Sep 2002 - Adaugat posibilitatea de a conecta efectele de insertie la iesire Master - Lfo-ul la frecventa incepe de la 0 pt. startphase=0 -24 Sep 2002 - Corectate niste mici erori la Chorus/Phaser - Adaugat si "substract" la Chorus si Phaser - Limitat tipul detune-ului la valoarea maxima -25 Sep 2002 - LANSAT PE INTERNET - PRIMA VERSIUNE (1.0.0) --------------------------------------------------------------------------------------------------- -01 Dec 2002 - Corectat niste comentarii - - Inlaturat o eroare care facea ca ZynAddSubFX sa crape daca dezactivez un part utilizat - - Inceput sa scriu Rezonanta -02 Dec 2002 - Terminat de scris Rezonante - - Adaugat filtru trecer-banda (BPF) - - Scris Recording -03 Dec 2002 - Adaugat Gain la Resonance - - Adaugat "New Instrument" la meniu -06 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.1) --------------------------------------------------------------------------------------------------- -08 Dec 2002 - Inceput sa scriu Bank si interfata pentru Bank -09 Dec 2002 - adaugat si "make debug" - - Continuat sa scriu Bank/UI; acum se poate folosi (dar nu salva pe HDD) -10 Dec 2002 - Terminat Bank (mai trebuie scris un "config" file pentru a alege automat ultima banka folosita) -11 Dec 2002 - Am mai lucrat ceva la Bank si am adaugat "config file" -12 Dec 2002 - Filtrul BPF suna mai tare - - Nu mai ar trebui sa fie probleme la compilarea FFTwrapper.h (fftw.h) -13 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.2) --------------------------------------------------------------------------------------------------- - - Corectat o eroare care facea ca programul sa crape daca salvam parametrii in timp ce cantam - - LANSAT PE INTERNET - VERSIUNEA (1.0.2-1) - de acasa --------------------------------------------------------------------------------------------------- -21 Dec 2002 - Corectate mici erori (nu mai dispare "Bypass Global Filter", inlaturat zgomotul de mica amplitudine - cauzat de reverb,nu mai apare intarzierea foarte lunga de la inceput a notelor muzicale daca conectam la aseqview) - - Adaugat filtru de rejectie banda (Notch) - - adugat randomize la Resonance - - Inceput sa scriu VU-meter-ul -22 Dec 2002 - Terminat VU-meter-ul - - Schimbat modul in care efectele de insertie se calculeaza (suna mai tare un pic) - - Adaugata o noua functie la OscilGen -23 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.3) --------------------------------------------------------------------------------------------------- -24 Dec 2002 - Adaugata posibilitatea de a incarca fisiere ".scl" (la Microtonal) -26 Dec 2002 - Adaugata optiunea de a folosi numai OSS-ul (fara ALSA) -27 Dec 2002 - Corectate cateva erori si modificate cateva lucruri marunte la Microtonal -28 Dec 2002 - Mici modificari la Microtonal - - Panic-ul la Reverb functioneaza OK - - Inceput sa scriu Scale Degree Mapping la Microtonal -29 Dec 2002 - Continuat Scale Degree Mapping la Microtonal (dar nu am terminat) -30 Dec 2002 - Corectat lucrul cu ScaleShift-ul - - schimbat modul in care se face keyshift-ul (nu se mai schimba armonia, indiferent de sistem) -31 Dec 2002 - Terminat Mapping-ul la Microtonal(incl. incarcarea/salvarea) - Corectat eroarea care facea ca la Microtonal sa nu se incarce de fiecare data din scl_zyn unele date - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -01 Ian 2003 - Corectata o eroare la Microtonal (erau probleme la InvertKeys daca era folosit key mapping) - - Adaugata un nou tip de waveshaping (Inverse Limiter) -02 Ian 2003 - Adaugat afisaj al acordului fin (cents) - - Butoanele arata f. frumos (am adaugat un nou widget in loc de Fl_Dial) -03 Ian 2003 - Schimbate butoanele (putin) - - Nu se mai aude un tacanit la ShutUp sau AllNotesOff - - Corectat putin waveshaper-quantisize si butoanele - - Inlaturata o eroare care facea ca programul sa crape daca schimbam unii parametri ale efectelor -07 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.4) --------------------------------------------------------------------------------------------------- -08 Ian 2003 - Am inlaturat de-a binelea eroarea (cu efectele - 3 Ian) -11 Ian 2003 - Corectate o mica eroare care facea ca volumul sa fie negativ la ADnote::voice[].PVolume <64 -13 Ian 2003 - Corectata o mica eroare la VU-Meter - - Corectata o mica eroare cu privire la panning la Reverb -15 Ian 2003 - Adaugat min/max keyresponse limits la Part - - Adaugat Filtru si FiltreEnvelope la SubNote -16 Ian 2003 - Curatat codul sursa (ADnote) prin inlaturarea unor variabile - - Durata fadein-ul este aleasa automat (a.i. sa nu rezulte click-uri la notele joase si nici fadein-ul audibil la notele inalte sau cu freqcvente inalte) - - Corectata o mica eroare care faca ca uneori instrumentul sa nu fie salvat/sters la Bank slot-ul cerut - - Imbunatatita putin interfata: La ADnote si SUBnote, butoanele care controleaza amplitudinea armonicelor sunt colorate diferit daca au amplitudinea 0 -17 Ian 2003 - Corectate erori la Chorus si la Phaser care faceau ca sa sune prea 'sec' (din cauza ca wet-ul era la 50% din volum) -18 Ian 2003 - Inceput sa scriu Preset-uri la efecte -19 Ian 2003 - Adaugat Preset-urile la efecte -20 Ian 2003 - Schimbat putin HPF-ul la Reverb -21 Ian 2003 - Adaugat tuning-ul la Reverb (si Freeverb) si Roomsize - - Schimata putin interfata si modificat putin widgetul Pdial -22 Ian 2003 - Amplificat volumul Reverb-ului cu 6 dB - - Buffer-ul foloseste liste simplu-inlantuite, asa ca nu-i mai problema la "configuratii mari" (multe part-uri) -24 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.5) --------------------------------------------------------------------------------------------------- -26 Ian 2003 - Inceput sa scriu GetAudioOutSamples, care ar putea fi apelat in modul callback -27 Ian 2003 - Adaugat o noua fuctie la waveshaping (clip) - - Adaugat suportul pentru Jack (adica programul poate rula in modul call-back ;-) ) - - Inlaturata o eroare care facea ca npart sa fie foarte mare si ca programul sa crape -29 Ian 2003 - Schimbari foarte minore la OscilGen::waveshape (la clip) - - Daca dau "clear" la OscilEdit, butoanele care au amplitudinea zero, sunt colorate corect -30 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.6) --------------------------------------------------------------------------------------------------- -31 Ian 2003 - Inceput sa adaug optiuni la linia de comanda - - Rata de esantionare (SAMPLE_RATE) este setata la rulare si nu la compilare -01 Feb 2003 - Inca 2 variabile sunt setate la rulare (SOUND_BUFFER_SIZE si OSCIL_SIZE) - - Volumul la Part se aplica doar dupa efecte de insertie - - Inceput sa scriu Distorsionarea (fara filtre) -02 Feb 2003 - Schimbate modurile de distorsionare (exp -> asym1 si pow -> pow ( altul ) ) - - Terminat Distorsionarea -03 Feb 2003 - Adaugata inca o functie la waveshape (asym2) - - Inceput sa scriu Controller-ii - - Adaugat controller-i PitchWheel,Expression,Panning,Filter Cutoff, Filter Q, BandWidth, Modulation Wheel - - Panning-ul si volumul sunt interpolate - - Inceput sa scriu un nou program (Controller) care timite mesaje midi (controller) catre un port ALSA - - Panning-ul la Part se aplica doar dupa efecte de insertie - - Panning-ul la efecte se aplica inainte de procesare -04 Feb 2003 - Adaugat posibilitatea de a seta intensitatea/dezactiva la controlleri(incl. UI) - - Adaugat controler-ul FMmodulationAmplitude - - Corectat o eroare la Buffer (care facea ca Buffer-ul sa nu se reseteze :-P ) -05 Feb 2003 - Corectata o eroare care facea ca programul sa consume mult din procesor (denormalisation) - - Nu mai este permisa o valoare a lui OSCIL_SIZE care sa nu fie putere a lui 2 (este ajustata automat) - - Adaugat controller-i Volume si Sustain Pedal, AllNotesOff, AllSoundOff, ResetAllControllers - - Adaugat NRPN, adica toti parametrii efectelor pot fi controlati prin controlleri -06 Feb 2003 - Pus limite la parametrii efectelor a.i. sa nu se seteze (datorita controllerilor) la valori nevalide - - Inlaturata o mica eroare la controller-ul BandWidth - - Schimbat putin EffectLFO::updateparams - - Controler-ul BandWidth afecteaza doar FineDetune-ul - - Schimbat putin identificare controlerilor si adaugat controlleri la OSS - - Schimbat putin interfata utilizator la controlleri -07 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.7) --------------------------------------------------------------------------------------------------- -08 Feb 2003 - Adaugat modul "mono"(monofonic) la part - - Inceput sa scriu portamento-ul -09 Feb 2003 - Terminat portamento-ul -10 Feb 2003 - Inceput sa scriu Equaliser-ul - - Inlaturata o eroare care facea ca la parametrii efectelor care sunt 0 sa nu fie incarcati -11 Feb 2003 - Terminat Equaliser-ul (adica adaugat vizualizator freq response) - - Corectata o mica eroare care facea ca part-ul 0 sa fie activ chiar daca cel salvat era inactiv -12 Feb 2003 - Mici modificari la EQ (UI) - - Adaugata posibilitatea de swap (stanga <--> dreapta) - - Adaugat Q la filtrele shelf -13 Feb 2003 - Adaugat inca un parametru la Phaser (phase) - - Curatit putin codul sursa la efecte - - Adaugat system effect send to next systems effects -14 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.8) --------------------------------------------------------------------------------------------------- - - cateva mici modificari (de la un patch primit de pe Internet) - - adaugat keylimit la Part (si first note priority) -15 Feb 2003 - Corectata o foarte mica eroare la Part -16 Feb 2003 - Se poate aplica filtrul inainte de distorsion - - Adaugat filter stages (adica filtrul se poate aplica de mai multe ori) -17 Feb 2003 - Corectata o mica eroare la Reverb si modificat putin filter-ul si UI -18 Feb 2003 - Corectata o eroare care facea ca semnalul la voice sa fie intre [-4.0..4.0] si sa faca probleme la RingModulation - - Adaugat modul Noise la ADsynth(voice) pentru a putea produce si tobe - - Adaugat parametrul fixed frequency la 440Hz -19 Feb 2003 - Corectata o mica eroare la ADnote (aparea un fadein nedorit) - - Facute inca cateva mici modificari la ADnoteUI -20 Feb 2003 - Imbunatatit foarte mult Controller-ul si adaugat la ZynAddSubFX ca program extern - - Modificat putin Waveshaper-ul (fct. L/U limit) - - Corectata o eroare la SUBnote (care facea probleme la glissando) - - Adaugat un nou parametru Punch la ADnote care face ca sa sune ca si cum ar fi o lovitura (f. util la Rhodes) -21 Feb 2003 - Adaugata inca o functie de distorsionare x(1-x) -23 Feb 2003 - Corectata o eroare (cu mutex) care facea ca sunetul sa fie extrem de tare, daca in timp ce cantam, modificam unii parametrii de sunet la ADnote -24 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.9) --------------------------------------------------------------------------------------------------- - - Adaugata posibilitatea de a tipari notele si timpul in care au fost produse (optiunea -D) -26 Feb 2003 - Adaugat inca 2 controlleri (Resonance Center Freq. (relative) si Resonace Bandwidth(relative)) -27 Feb 2003 - Adaugata posibilitatea de a modifica parametrii (in mod direct) al oscilatorului extern -07 Mar 2003 - Portat partial(doar interfata) programul sub Windows -08 Mar 2003 - Adaugat Virtual Keyboard - - Cateva mici modificari in vederea portarii pt. windows - - Adaugat si controller la Virtual Keyboard -09 Mar 2003 - Adaugat pitch wheel la Virtual Keyboard si modificat putin controller-ul la VK -10 Mar 2003 - Adaugat Filter Frequency Tracking (adica modificarea frecventei filtrului in functie de frecventa notei) - - Marite eficienta la LFOparams - update lfotime - - Adaugat mod de normalize prin RMS - - Corectate doua erori la Distorsion (negate si mono+prefiltering) -11 Mar 2003 - In Windows, nu mai este necesar functiile getopt (scrisa o functie proprie) -12 Mar 2003 - Adaugat filtru la OscilGen -13 Mar 2003 - Adaugat mai multe filtre la OscilGen - - Facute optimzari la ADnote (adaugarea unui element la oscilsmp si fmsmp,etc.) si curatat putin codul sursa - - Corectata o eroare care amplifica fm-ul la rate de esantionare inalte - - Optimizat si curatat reverb-ul -16 Mar 2003 - Modificate optiunile de compilare in Makefile.inc si coduri sursa a.i. sa se realizeze portarea pe windows mai usor -17 Mar 2003 - Inregistrarea se face in formatul WAV si nu RAW - - Adaugat trigger la recorder (se incepe inregistrarea doar cand este apasata o nota) - - Adaugat interfata PortAudio - - Corectata eroarea care facea ca UI sa nu ruleze pt. Windows (trebuia dat show() la UI in thread-ul 3) si corectate alte erori din windows - - Si audio-ul functioneaza sub Windows - - Corectata o eroare care se manifesta foarte rar(Resonance, i era de la 0 si nu de la 1) -18 Mar 2003 - Adaugat interpolare la filtru (nu se mai aud tacanaituri, daca frecventa filtrului se schimba foarte rapid si semnalul contine putine armonice) - - Adaugat interfata Midi in Windows => consider ca programul este portat in Windows -19 Mar 2003 - Adaugat interfata de configurare - - Corectata o eroare la OscilGen care facea ca in loc ca amplitudinile sa fie reduse la -40,..,-100dB, sa fie setate la 1 si unde era intensitate mare sa file amplificate -20 Mar 2003 - Corectata o mica eroare la interfata (uneori disparea butonul ON de la ADvoice) -21 Mar 2003 - LANSAT PE INTERNET - VERSIUNEA (1.2.0) --------------------------------------------------------------------------------------------------- - - Se interpoleaza filtrul si cand se trece peste pragul Nyquist (in sus sau in jos) -22 Mar 2003 - Corectata o eroare care facea ca nr. de esantioane scrise in headerul fisierului WAV sa nu fie initializat -26 Mar 2003 - Nu mai este permisa alegerea unui fisier wav in timpul pauzei de la record - - Gasita si corectata o eroare stupida (am pus la NRPN 0x98 in loc de 98 zecimal) -28 Mar 2003 - Inceput sa portez programul sub VST -29 Mar 2003 - Adaugat Master fine detune (-64.0 .. 63.0 cents) -01 Apr 2003 - Functioneaza portarea sub VST, dar mai este de lucru... -02 Apr 2003 - Modificat synth-ul a.i. sa se poate apela in mai multe instante in VST - - Continuata portarea in VST -03 Apr 2003 - Continuata portarea in VST (este limitat la o singura instanta) -05 Apr 2003 - Adaugata posibilitatea de a interschimba/copia parametrii efectelor - - Mici modificari la Makefile (ignora headerele inexistente la deps) -06 Apr 2003 - Adaugat posibilitatea de protectie impotriva atenuarii a notei fundamentale la rezonanta - - Pitch bend-ul merge bine in Windows -07 Apr 2003 - LANSAT PE INTERNET - VERSIUNEA (1.2.1) --------------------------------------------------------------------------------------------------- - - Adaugat efect la part (adica efect care face parte din instrument ;-) ) -08 Apr 2003 - Adaugata interpolare la Resonance (peak-urile le interpoleaza) -09 Apr 2003 - Interfata la Envelope este o singura clasa - - Adaugat Envelope free mode (adica de orice forma) - - Adaugata posibilitatea de a copia de la o voce la alta la ADnote - - Release-ul este liniar (in loc de dB) -10 Apr 2003 - Adaugata afisarea ultimului fisier master salvat/incarcat - - Adaugata setarea notei minime/maxime la ultima nota - - Pot alege daca release-ul sa fie liniar - - Facute cateva corecturi la envelope -11 Apr 2003 - Curatat codul sursa la UI si impartit in mai multe fisiere .fl - - Corectate niste erori la Envelope si adaugat modul liniar/logaritmic la amplitudine -12 Apr 2003 - Inceput sa scriu kit-ul la part -13 Apr 2003 - Terminat de scris kit-ul la part+UI -14 Apr 2003 - Copierea vocilor este sub forma de clipboard - - ADsyn su SUBsyn check-urile de la PartUI sunt actualizate -15 Apr 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.0) --------------------------------------------------------------------------------------------------- -16 Apr 2003 - Adaugat modul "Single" la instrument kit, care face ca sa sune doar primul instrument din kit disponibil -21 Apr 2003 - Adaugat realtime priority, care seteaza prioritatea mare la sintetizator, daca are posibilitate; merge numai pe Linux - - Gasite multe erori mici(dar potential periculoase) cu ajutorul programului Valgrind -30 Apr 2003 - Adaugat "Spectrum adjust" la OscilGen, care ajusteaza intensitatile armonicelor -03 Mai 2003 - Normalizat spectrul inaintea adjust-ului la OscilGen -04 Mai 2003 - Adaugat mod "egal temperat" la fixed frequency (440Hz), util la tobe -05 Mai 2003 - Adaugat modul "Drum mode", unde sistemul este intotdeauna temperat (12tET), toate notele sunt mapate si transpose-ul este ignorat -08 Mai 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.1) --------------------------------------------------------------------------------------------------- -09 Iun 2003 - Am schimbat in .H in fisierele .fl (ca sa se poate compila si pe Debian) -10 Iun 2003 - Inceput sa modific interfata la filtru a.i. sa pot adauga filtrul formantic usor - - Interfata pentru filtru este o singura clasa -12 Iun 2003 - Inceput sa scriu panoul de part-uri (care afiseaza parametrii importanti ale part-urilor) - - VU-meter-ul poate afisa si intensitatea part-ului dorit (folosit la panou de part-uri) -13 Iun 2003 - Terminat panoul de part-uri - - Adaugat posibilitatea de a inchide automat fereastra bancii de instrumente, cand se incarca un instrument -19 Iun 2003 - Modificat modul cum se calculeaza frecventa filtrului (se fac doar adunari si doar la urma se ridica la putere) -22 Iun 2003 - Aproape terminat filtrul formantic (fara UI) -24 Iun 2003 - Merge mai multe instante in jack (alege porturi diferite) -26 Iun 2003 - Continuat de scris filtrul formantic -29 Iun 2003 - Adaugat vu-meter fals la Panel (in caz ca partul este dezactivat si primeste note on). De asemenea se arata daca in partul dezactivat s-a cantat ceva (apare o liniuta). -09 Iul 2003 - Inceput sa scriu interfata pentru filtrul formantic -10 Iul 2003 - Continuat filtrul formantic (interfata) -11 Iul 2003 - Eroarea vine de la Makefile pt. ca nu recompileaza si clasele care folosesc o anumita clasa, daca aceasta din urma se schimba - - Continuat filtrul formantic (interfata+adaugarea interpolarii la Q) -12 Iul 2003 - Adaugat la filtrul formantic setarile de amplitudine formanti si interpolarea acestora - - Adaugat grafic la UI-ul filtrului formantic si alti paramatrii la filtrul formantic -13 Iul 2003 - Corectata eroarea la FormantFilter care facea ca sa nu se interpoleze intre vocale - - Adaugat parametrul VowelClearness la FormantFilter care face ca sa se evite vocalele mixte -14 Iul 2003 - Inlaturat parametrul Psequence[].pos, pt. ca era confuz => fiecare vocala are zona egala - - Adaugat parametrii Psequencestretch si Psequencereversed la FormantFilter - - Adaugat parametrul Pgain la filtru (-30...30 dB) - - Terminat de scris Filtrul Formantic - - Corectata o eroare care facea ca sa nu se salveze oscilatorul la o ADnote_voce, daca vocea este dezactivata, chiar daca era folosita de o alta voce - - Prima data se cauta fisierul "default.bnk_zyn" si in dir "/usr/share/zynaddsubfx" sau "/usr/local/share/zynaddsubfx" -15 Iul 2003 - Setat Pkeylimit prestabilit la 15 la Part - - Activarea unui Part din interfata Panel schimba automat part-ul curent la acela - - Se poate alege ca un instrument din Kit sa fie procesat incepand cu un anumit efect; si se mai poate alege ca un efect din Part sa fie trimis in afara -17 Iul 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.2) --------------------------------------------------------------------------------------------------- -21 Iul 2003 - Corectata o eroare la FilterUI care facea ca la fiecare afisare sa se initializeze FilterParames::Pgain la 64 -25 Iul 2003 - Corectata o eroare care facea ca modulatia in faza/frecventa sa sune diferit la diferite rate de esantionare/oscilsize -26 Iul 2003 - Afisat corect - valoarea OSCIL_SIZE ajustata (in caz ca a fost data optiunea "-o" incorect) - - In windows arata si numele la midi_in_device -04 Aug 2003 - Adaugat filtrele Peak,LowShelf,HighSelf la filtru si foloseste parametrul Gain de la interfata filtrelor -30 Aug 2003 - Adaugat un nou tip de filtru: State Variable Filter -31 Aug 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.3) --------------------------------------------------------------------------------------------------- -02 Sep 2003 - Adaugata posibilitatea de a incarca de la inceput un fisier .mas_zyn "-l" - - Se poate lansa programul fara interfata utilizator ("-U") -17 Sep 2003 - Adaugat niste simple patch-uri de Frank Neumann -02 Oct 2003 - Corectata o eroare la SUBsynth care facea ca la freq inalte si Q foarte mici sa se produca filtre instabile -30 Oct 2003 - Adaugate posibilitatea (+interfata in config) de Dump (avansat) - - Adaugat ModWheel liniar si facut prestabilit (si posibilitatea de a alege in interfata modul de modwheel) -04 Nov 2003 - Modificat putin interfata la ResonanceUI -05 Nov 2003 - Marita viteza prin inlocuirea de (int) cu cod de asamblare (cu.10-50% la FM,chorus,etc.) -10 Nov 2003 - Inceput sa adaug posibilitatea de a adauga comentarii la instrumente -11 Nov 2003 - Terminat de adaugat comentariile/autor/tipuri la instrumente -12 Nov 2003 - Adaugat intefata pentru FFTW3 la fftwrapper -18 Nov 2003 - Inceput sa scriu Sequencer-ul -19 Nov 2003 - Adaugat un buton "i" pt. instrument info si facut ca instrument info sa se afiseze automat daca se schimba partul (sau se incarca instrumente,etc) -20 Nov 2003 - Continuat de scris Sequencer-ul si inceput sa ii scriu interfata - - Mici modificari la preset-urile de la Echo -26 Nov 2003 - Continuat de scris sequencerul - inceput sa scriu inregistrarea (fara timer) -27 Nov 2003 - Se poate inregistra (dar nu rula) - adaugat timerul de inregistrat - - Frecventa maxima al filtrelor este de Nyquist-500.0 pentru a evita instabilitatea filtrelor -28 Nov 2003 - Adaugata favorizarea portamento-ului in sus sau un jos; ex. se poate face ca portamento-ul sa fie doar in sus, sau portamento-ul in jos sa fie mai scurt decat cel in jos - - Inceput sa pun pe cvs la cvs.sourceforge.net -01 Dec 2003 - Am facut niste mici modificari ca urmare a unui bug-report -05 Dec 2003 - Facute cateva modificari la jack -08 Dec 2003 - Inceput sa incerc sa fac rt-safe sub jack, dar in stadiul actual suportul jack este nefunctional -11 Dec 2003 - Adaugat aleatorism la amplitudinile armonicelor -13 Dec 2003 - Adaugat LFO frequency randomness -14 Dec 2003 - Imbunatatit LFO frequency randomness -15 Dec 2003 - Corectata o mica eroare la ADnoteParameters (lipseau niste break-uri la salvarea/incarcarea parametrilor) -16 Dec 2003 - Eroarea cu break-urile se dovedeste a fi o eroare majora :( ; adica corectarea ei, necesita resalvarea tuturor instrumentelor - - Am revenit la suportul vechi de JACK, dar cel nou este disponiblil ca JACK_RT (nefunctional inca) -17 Dec 2003 - Inceput sa restucturez Part-ul (am adaugat clasele Instrument,InstrumentParams) - programul nu mai este compatibil cu versiunile anterioare - - RMS normalize este prestabilit la OscilGen -18 Dec 2003 - Continuat de restructurat Part-ul - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -01 Feb 2004 - Revenit la versiunea din 16 Dec. 2003 - - Pus iarasi RMS normalize prestabilit la OscilGen - - M-am razgandit ;) nu mai restructurez part-ul; mai bine pun acolo o functie separata pentru salvari/incarcari par instrumente - - Inceput sa adaug suportul XML -02 Feb 2004 - Corectata o eroare care facea ca numele la instrumentele din bank sa fie aratate gresit (nu era pus un \0 ) - - Continuat suportul de XML -03 Feb 2004 - Continuat de scris suportul XML - inceput sa salvezi cativa parametrii -04 Feb 2004 - Se salveaza parametrii XML la master, part, filter, lfo, envelope, resonance si adnote (partial) -05 Feb 2004 - Se salveaza toti parametrii in XML -06 Feb 2004 - Adaugat salvarea de instrument in XML - - Adaugat export la bank intr-un director XML si decis ca bank-ul sa fie un director cu mai multe fisiere xml de forma XXXX-nume.xml sau XXXX-nume.xml.gz -07 Feb 2004 - Adaugat functii de initializare si renuntat la masterdefaultbuf si instrumentdefaultbuf (adica salvarea la inceput si incarcarea bufferelor cu instrumentele prestabilite) - - Corectata o mica eroare care facea ca sa se incarce subnotepars la adnotepars (eroarea a aparut azi) -08 Feb 2004 - Modificat putin formatul XML -10 Feb 2004 - Adaugata salvarea parametrilor pt. basefunction la OscilGen - - Inceput sa scriu incarcarea parametrilor -11 Feb 2004 - Se pot incarca cativa parametrii de la master -12 Feb 2004 - Continuat incarcarea parametrilor XML si la part (neterminat) -13 Feb 2004 - Terminat de adaugat parametrii la incarcarea XML -14 Feb 2004 - Se poate incarca si instrumente - - Rezolvata o problema la coarse detune - - Corectate cateva erori la incarcarea XML-ului - - Frecventa LFO-ul de la instrumente are valoare reala intre 0..1 - - Corectata eroarea care facea ca functia de rezonanta sa fie trasata incorect - - Adaugata compresie gzip la fisiere si decompresie automata la incarcare (folosesc biblioteca zlib) -15 Feb 2004 - O mica modificare la envelope parameters in sensul ca envelope-ul prestabilit la FM nu mai este liniar -22 Feb 2004 - Adaugat normalize Full RMS la Oscil -23 Feb 2004 - Inceput sa fac ca sa pot adauga Bank bazat pe XML (adaugat temporar clasa OldBank) -24 Feb 2004 - Continuat la Bank -25 Feb 2004 - La Bank - inceput sa scriu partea ca sa arate instrumentele din banca -26 Feb 2004 - Continuat la Bank -27 Feb 2004 - Corectate erori la snprintf (nu dadeam parametru "%s" inainte de string si daca acel string continea ceva %, era periculos) si alte erori - - Micsorat timpul de marire amplitudine la ADnote (doar in cazul cand amplitudinea creste brusc ca la un LFO expdown) - - Corectata o eroare foarte veche la LFO amplitudine (amplitudinea nu scadea corespunzator) -28 Feb 2004 - Se poate incarca si salva instrumente in Bank -01 Mar 2004 - Se pot schimba bancile de instrumente - - Introduse si celelalte functii la Bank (cu exceptia salvarii/incarcarii locului bancii folosite) - - Se poate importa banci din bnk_zyn -03 Mar 2004 - Terminat (teoretic) partea de XML -05 Mar 2004 - Actualizat Copyright-ul la 2004 in fisiere -08 Mar 2004 - Corectat o mica eroare la OscilGen (se aplica gain-ul rezonantei incorect) -09 Mar 2004 - Adaugata posibilitatea de stretch la LFO in functie de frecventa notei -12 Mar 2004 - Adaugata modulatie la OscilGen (functia de baza) -13 Mar 2004 - Adaugat HarmonicShift la oscilgen -15 Mar 2004 - Inceput sa scriu partea de incarcare MIDI - - Inlaturata partea de recording din Sequencer -16 Mar 2004 - Inceput sa scriu partea de analiza midi -25 Mar 2004 - Continuat partea de analiza midi -28 Mar 2004 - Scris partea de incarcat fisier midi - - Merge partial playerul -26 Mai 2004 - Playerul merge bine cu un canal midi (rezolvata problema cu timing-ul) -03 Iun 2004 - Adaugata partea de play speed la interfata -06 Iun 2004 - Adaugata functia sigmoid la distorsionare -12 Iun 2004 - Modificat modul cum este realizat bank-urile, adica directoarele de bank-uri exista in anumite directoare si aceste directoare sunt cautate automat de bankuri; adaugat optiunea de a se folosi mai multe bank-uri -13 Iun 2004 - Adaugat filtrul "sinus" la OscilGen - - Managementul bancilor de instrumente este complet - - Se cauta bancile si in '/usr/share/zynaddsubfx/banks' si '/usr/local/share/zynaddsubfx/banks' - - Corectata o eroare la filter la OscilGen care filtra diferit componentele sin si cos - - Adaugat posibilitatea de swap la instrumentele din bank -14 Iun 2004 - Adaugat __DATE__ si __TIME__ sa stiu cand s-a compilat - - Modificat interfata la PartUI - - Imbunatatit modulatia basefunc la OscilGen (adaugat inca un parametru si inca un tip de modulatie ("power")) - - Adaugat inca o noua functie basefunc la OscilGen (sqr=atan(sin(x)*a)) -15 Iun 2004 - Adaugat posibilitatea de a face armonicele ca sa depinda de frecventa ("adaptive") si rezultatul suna foarte frumos pentru ca tendinta este de pastrare a frecventelor armonicelor si nu a numarului de ordine al lor -16 Iun 2004 - Inceput sa trec configul pe XML -17 Iun 2004 - Adaugat tipul threshUp la spectrum adjust - - Terminat de trecut config-ul pe XML (inclusiv setarile bancilor de instrumente) -18 Iun 2004 - Incercata interpolarea cubica dar am vazut ca nu merita pentru ca OSCIL_SIZE e suficient de mare si pentru o interpolare liniara - - Separat OscilGenUI din ADnoteUI - - Inceput sa scriu modulul de sinteza PADnote -19 Iun 2004 - Adaugat modul liniar de controller bandwidth si modificat modul liniar la controllerul modulation wheel - - Adaugata modulatia in frecventa la OsciGen -20 Iun 2004 - Nu se mai deschide automat fereastra de instrumente daca a fost deschisa si s-a descarcat un instrument - - Facute mici modificari la FM-ul de la Oscil -21 Iun 2004 - Inceput sa scriu conversia in sinus -22 Iun 2004 - Continuat conversia in sinus si facut teste pentru posibilitatea de "draw" cu sliderele -23 Iun 2004 - Modificat modul in care parametrii se afiseaza la OscilGen (este o functie "refresh" care face asta) - - Adaugata posibilitatea de draw la armonicele OscilGen daca se apasa tasta Shift - - Corectata o mica eroare care facea imposibila modificarea amplitudinii armonicelor cu tastatura - - Adaugat randomness de grup (adica se aplica acelasi randomness la toate vocile care folosesc acelasi oscilator) -24 Iun 2004 - Inlaturata setara de normalize la OscilGen. Intotdeauna normalize este Full RMS - - Facute cateva imbunatatiri la interfata unde sunt inlocuite comuter-urile cu setari mai usor de inteles de catre utilizator (ex. la efectele de insertie se arata "insert to Master Out" in loc de "-2") -29 Iun 2004 - Inlaturata setarea cu gain la Resonance pentru ca este inutil (datorita faptului ca normalize este Full RMS intotdeauna) -30 Iun 2004 - Inlaturata o eroare recenta la EffectUI si modificat EffectUI in sensul ca nu trebuie sters si reinstantiat pentru a se reincarca valorile curente de efecte - - Inceput sa scriu un nou efect (DynamicFilter) -01 Iul 2004 - Corectata o mica eroare la EffectUI care facea ca efectele sa nu apara activate - - Continuat de scris la DynamicFiter (mai este doar de salvat parametrii si de auto-update la filtru) -02 Iul 2004 - Continuat la DynamicFilter (adaugata auto-update, adaugat preset-uri) - - Terminat DynamicFilter - - Corectata o eroare la EQui care facea ca sa nu se actualizeze efectul curent si sa nu se obtina graficul egalizatorului -03 Iul 2004 - Corectata o mica eroare care nu activa la EffectUI daca efectul anterior era dezactivat - - Actualizat Swap/Copy la efecte ca sa proceseze si parametrii la filtre - - Adaugat Bypass la efectele de instrument - - Imbunatatit interfata utilizator (eliminate setarile "-1",etc.) - - Scris calcularea profilului la PADsynth - - Adaugat OscilGen si Resonance la PADsynth si inceput sa scriu interfata utilizator la PADsynth -04 Iul 2004 - Adaugata calcularea automata a largimii de banda echivalente si afisarea ei - - Inceput sa scriu partea de sinteza la PADsynth - - Auzit primul sunet la PADsynth -05 Iul 2004 - Nu mai face urat daca schimb parametrii in timp ce cant si apas apply - - Adaugat harmonic scale si position la PADsynth - - Se calculeaza corect si armonicele cu largime de banda mare -06 Iul 2004 - Inceput sa adaug filtre,lfo,envelopes,etc. la PADsynth -07 Iul 2004 - Corectate cateva mici erori si adaugat autoscale - - Modificata putin interfata de la filtru - - Adaugata interfata si parametrii la LFOs,Envelopes,Filter la PADsynth - - Adaugata fereastra care arata pozitiile armonicelor si continuat de lucru la acestea -08 Iul 2004 - La pozitiile armonicelor sunt aratate si valorile lor reale in dB - - Alte adaugiri minore la PADsynth - - Adaugat interpolare cubica la PADsynth -09 Iul 2004 - Modificat modul cum se calculeaza profilul armonicelor la PADsynth (nu se mai ridica la patrat) - - Corectate cateva erori la PADsynth - - Modific amplitudinea in functie de sqrt(largime de banda) => amplitudinile armonicelor sunt echivalente cu oscil -11 Iul 2004 - Acum nu se mai intrerupe sunetul la notele care canta in timp ce sunt aplicate modificarile la parametrii - - Se poate alege marimea sample-lui - - Adaugat multisampling la PADsynth - - Cand se incarca parametrii ADsynth se da volumul ceva mai incet ca sa corecteze faptul ca normalize-ul este doar RMS -12 Iul 2004 - Inlocuit codul de D/W sau Volume de la efecte cu un cod unic in EffectMgr - - Se poate face efecte la instrumente la care doar semnalul Wet e procesat de efectele urmatoare - - Modificat modul cum se calculeaza intensitatea Wet la Reverb si Echo - - Corectata eroarea la FM care facea ca daca Adaptive Harmonics!=0 sa se calculeze FM-ul gresit -13 Iul 2004 - Rezonanta la PADsynth se face in functie de armonica reala si nu de numarul de ordine al armonicei - - LFO,Envelope, Filters, etc. merg la PADnote - - Inceput sa fac partea de aratare ca parametrii au fost schimbati (butonul "Apply" se coloreaza in rosu) -14 Iul 2004 - Butonul Apply la PADsynth se coloreaza in rosu cand se modifica ceva - - Adaugat fixed freq. la PADsynth - - Sunt salvati si parametrii PADsynth => consider in mod oficial ca PADsynth este complet -15 Iul 2004 - Facuta o modificare la PADnoteUI care arata foarte frumos - - Completata partea de save/load si stabilite noile extensii ale fisierelor: master - .XMZ, instrument - .XIZ, microtonal - .XSZ - - Inlocuit memset cu un macro (ZERO) pentru ca memset nu seteaza toate valorile ci uneori doar prima valoare cu 0 (e o optimizare la gcc care face asta) - - Corectate niste erori la makefile care aveau legatura cu compilarea in windows - - Corectate 2 erori referitor la Banci de instrumente -16 Iul 2004 - Adaugat inca noi tipuri de harmonic bandwidth scale - - Adaugat inca un parametru la filter la OscilGen si inca un nou tip de filtru -17 Iul 2004 - Corectata o eroare care facea sa crape programul uneori dupa ce scria instrumentul in banca - - Modificata optiunea -l ca sa incarce un .xmz - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre1) --------------------------------------------------------------------------------------------------- -18 Iul 2004 - Corectata o mica eroare la afisare care facea ca la PADnoteUI sa fie trasate liniile in mod gresit -19 Iul 2004 - Corectata doua mici erori (se incarca gresit parametrii filtrului de la OscilGen) - - Corectata inca o mica eroare care facea ca sa nu se coloreze butonul PAD_Synth Apply in rosu la anumiti parametrii de la oscilgen - - Se dezactiveaza butoanele Edit de la PartUI ca sa nu se poata edita module de sinteza inactive -20 Iul 2004 - Corectate cateva erori cu compilare pe windows -21 Iul 2004 - Corectata o mica eroare la Bank si alte erori -26 Iul 2004 - Acum este folosita biblioteca mxml-2 - - Corectata o eroare care facea ca sample-ul la PADnote sa nu fie ales in functie de frecventa reala de baza (cu detune) - - Mutat functiile de waveshaping in Distorsion.C/.h -27 Iul 2004 - Corectata o eroare foarte suparatoare care bloca uneori calculatorul - - Adaugat inca un nou parametru la PADsynth la base function - - Nu se mai arata butonul de apply parameters la PADsynth cand nu este necesar - - Eliminate blocarile de cateva secunde din threadul de sunet in momentul cand se incarca un nou instrument care contine parametrii PADsynth - - Adaugata schimbarea titlului ferestrei principale la load XML -29 Iul 2004 - Modificat modul cum este stocat lista de banci root dir - - Gasita o eroare care facea ca sa se stearga denormalkillbuffer inaintea lui master -30 Iul 2004 - Gasite si corectate o gramada de erori (eu stergeam elemente din ferestre si fltk le stergea din nou) - - Eliminate warning-urile pentru -Wall -31 Iul 2004 - Eliminate complet stergerile in plus de la UI din destructorele obiecte - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre2) --------------------------------------------------------------------------------------------------- -01 Aug 2004 - Adaugat un nou tip de OvertonesPosition la PADsynth -02 Aug 2004 - Am pus din nou schimbarea schedule-ului la valoare corecta (l-am scos dintr-o greseala) -04 Aug 2004 - Am corectat niste erori la VST - - Merge VST, dar nu intotdeauna stabil (merge stabil pe vsthost.exe) - - Corectata eroare care facea ca sa nu mearga MIDI - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre2 VST) --------------------------------------------------------------------------------------------------- -13 Aug 2004 - Inceput sa scriu modurile continuous si discrete la PADnote -14 Aug 2004 - Terminat modul continuous la PADnote - - Corectata o mica eroare la OscilGen care facea daca adaptive harmonics e activ si phase randomness>0 sa rezulte si aleatorism in amplitudinile armonicelor - - Inceput sa scriu Presets/Clipboard (Clipboardul, in stadiu actual va putea copia doar parametrii folositi si nu cei dezactivati) - - Merge partial partea de Copy in clipboard -15 Aug 2004 - Corectata o eroare in main.c la pitch bend - - Scos Swap/Copy la efecte si la PartUI si vechiul Copy/Paste de la ADnote voice - - Merge clipboardul la Oscil, Resonance, Filter si partial la ADsynth,SUBSynth si PADsynth -16 Aug 2004 - Corectata inca o eroare la pitch bend (aratata de Krzysztof Korpiela) - - Adaugat refresh si la Filtru si paste la ADnote, SUBnote si PADsynth sunt complete -17 Aug 2004 - Adaugat clipboard la LFO, Envelope, ADnoteVoice si Filter Vowel -18 Aug 2004 - In clipboard se salveaza toti parametrii (chiar si cei dezactivati) - - Corectata o eroare care facea ca instrumentul sa fie incarcat la fiecare salvare in banca - - Tipurile de lfo sunt compatibile intre ele la clipboard -19 Aug 2004 - Corectata o mica eroare la XMLwrapper care facea ca sa se salveze fortat toti parametrii (chiar si cei nefolositi) - - Adaugata partea de salvare/incarcare a listei directoarelor unde se afla presetarile -21 Aug 2004 - Am lucrat putin la salvare/incarcare a listei dir. cu presetari -22 Aug 2004 - Corectata o eroare de compilare - - Makefile-ul modificat, a.i. make-ul sa se opreasca in caz de eroare - - Terminat managerul de preset-uri -23 Aug 2004 - Adaugata posibilitatea de a se vedea direct din lista cu bancile de instrumente -24 Aug 2004 - Inlaturat complet suportul pentru formatele *.mas_zyn, *.ins_zyn, *.bnk_zyn si *.scl_zyn - - Ascuns Sequencer-ul de utilizator (o sa il continui mai incolo) -25 Aug 2004 - Listele de banci si de preset-uri sunt sortate - - Corectate niste erori la Oscilgen care faceau ca sa se calculeze randomness chiar daca este folosit de PADsynth si pus automat parametrul randomness daca PADsynth este folosit (in caz ca se va importa la un ADsynth) - - Gasita o eroare care face sa crape daca lucrez mult cu bancile de instrumente -27 Aug 2004 - Adaugata posibilitatea de a dezactiva aratarea starii PADsynth din instrumente - - LANSAT PE INTERNET - VERSIUNEA (2.0.0) --------------------------------------------------------------------------------------------------- -05 Sep 2004 - Corectata o mica eroare de la SUBnote (legat de pitch wheel) -06 Sep 2004 - Eliminata variabila "disablekitloading" din Part si din UI -07 Sep 2004 - Modificat id-ul vst in 'zasf' (inainte era de 5 litere si poate cauza un crash la host) -27 Sep 2004 - Corectat un mic bug la salvare in xml la parametrul FMcoarseDetune din adnote - - La VST, daca incerc sa inchid fereastra principala, se minimizeaza - - Eliminate setarile cu indice '0' (zero) -28 Sep 2004 - Adaugata salvarea tuturor parametrilor in hostul VST (trebuie testat) - - Adaugat installer pt. windows (cu NSIS) -29 Sep 2004 - Inceput sa scriu interfata utilizator pt. incepatori -30 Sep 2004 - Terminat de scris interfata utilizator pt. incepatori si se selecteaza la pornire modul dorit - - Adaugata posibilitatea de a compila cu suport jack si oss simultan si sa se aleaga runtime ce doresc (jack/oss) -01 Oct 2004 - Corectata o mica eroare care facea ca sa nu se inchida ferestrele cu instrumente cand incarc din banca - - LANSAT PE INTERNET - VERSIUNEA (2.1.0) --------------------------------------------------------------------------------------------------- -02 Oct 2004 - Corectata o eroare grava care facea ca sa nu pot schimba partul curent in interfata utilizator obisnuita -03 Oct 2004 - LANSAT PE INTERNET - VERSIUNEA (2.1.1) --------------------------------------------------------------------------------------------------- -04 Oct 2004 - Corectata o eroare care face ca in modul simple UI, sa se inverseze panning-ul - - Adaugat un icon la ZynAddSubFX -10 Oct 2004 - Si controllerul de Resonance se aplica la toate item-urile din kit -12 Oct 2004 - Corectata o eroare care facea ca butoanele Addpoint si Delpoint de la Envelope sa nu fie afisate -16 Oct 2004 - Corectata o eroare care facea ca partUI-ul sa nu se actualizeze intotdeauna cand incarcam un instrument -20 Oct 2004 - Corectata o mica eroare asemanetoare cu cea din 16 Oct, dar care afecta meniul new -07 Nov 2004 - Corectata o mica eroare care facea ca sa nu se incarce corect instrumentele in linia de comanda (-l) -14 Nov 2004 - Nu mai verific in bank daca este un director sau fisier simplu, pt. ca poate sa aiba probleme -28 Nov 2004 - Curatat codul la OscilGen (acum datele sunt stocate mai bine si nu in functie de biblioteca FFTW) - - Corectata o mica eroare la OscilGen cu adaptive harmonics care facea ca energia vechilor armonice sa nu se adauge in mod corect la noile armonice (la note inalte) - - Sortarea nu mai este quicksort la bank si la presets pt. ca am vazut ca nu merge in windows intotdeauna - - Corectata o eroare la egalizator care facea ca sa se aplice si la el par. D/W -29 Nov 2004 - Marita zona de valori la adaptive harmonics power din OscilGen - - Adaugata posibilitate de a post-procesa la adaptive harmonics(adica a adauga sau a amplifica anumite armonice) -05 Dec 2004 - Corectata o eroare care facea ca functiile getChunk si setChunk sa fie supraincarcate in loc de suprascrise (dar nu am testat) - - Corectata o eroare care returna gresit la canDo in vst (netestat) -17 Dec 2004 - Inceput sa folosesc Dvorak pt. VK -18 Dec 2004 - Continuat putin la VK -20 Dec 2004 - Se poate selecta la VK dintre "qwerty" si "Dvorak" - - Corectata o mica erare care facea sa nu arate BWprofile dezactivat la PADnote - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - -04 Ian 2005 - Corectata o mica eroare care facea ca sa nu arate Force Release la Freemode Envelope -15 Ian 2005 - Corectata o eroare la controllerul bandwidth care facea ca sa ajunga la valoarea 0 si sa dea peste cap SUBsynth -22 Ian 2005 - Inceput sa scriu suportul pt. DSSI -27 Ian 2005 - Corectata eroare care facea ca in cazul in care sunt 2 banci cu acelasi nume (sau aceeasi bank root dir sa fie selectat de 2 ori) sa produca confuzie -03 Feb 2005 - Inceput sa scriu la Microtonal ca sa se faca butonul apply de culoare rosie cand se schimba ceva -06 Feb 2005 - Facuta o mica modificare care interzice punera notelor "0" in dump si alta modificare care mareste nr. de octave calculate la PADsynth - - Renuntat sa fac modificarea la Microtonal inceputa din 03 Feb, pentru ca nu am gasit cum pot schimba culoarea butonului automat cand modific un text -07 Feb 2005 - Corectata o eroare care facea ca la microtonal mapping sa nu se calculeze corect (adica sa se stocheze valoarea corecta) -12 Feb 2005 - Controllerul prestabilit la Virtual Keyboard este Filter Cutoff in loc de BandWidth - - Modificate cateva preseturi la DynamicFilter - - Adaugata posibilitatea de a mari sau micsora cu un parametru detune-ul vocilor de la ADnote -17 Feb 2005 - Corectate cateva erori la PADsynth care faceau ca sa se citeasca date din zone de memorie nealocata - - Corectata o eroare la Bank care facea ca uneori sa crape programul cand umblam mult cu bankuri -19 Feb 2005 - Corectata o eroare care facea ca uneori sa fie calculata frecventa la ADnote=nan si programul sa crape pentru ca era folosit parametrul bandwidthDetuneMultiplier inainte de a fi calculat -21 Feb 2005 - Se afiseaza corect numele fisierului proaspat salvat in fereastra principala -26 Feb 2005 - Corectata eroarea la windows si la OSS care facea ca pitch bend sa nu fie mapat corect (trebuie verificat) -27 Feb 2005 - Se afiseaza corect valoarea lui detune in centi -28 Feb 2005 - Corectata o mica eroare care facea ca sa nu se afiseze intotdeauna corect detune-ul la ADvoice - - Afisajul VU-meter la Master nu mai prezinta variatii mari in timp scurt - - Adaugata afisajul RMS la VU-meter -06 Mar 2005 - Facute cateva mici modificari referitoare in special la warning-uri - - Corectata o mica eroare care facea ca la un Paste sa nu se actulizeze unii parametrii ai filtrului in interfata -12 Mar 2005 - Imbunatatiri la interfata PADsynth, adica se poate da "apply" direct din OscilGenUI sau ResonanceUI -13 Mar 2005 - Facute cateva compilari in Makefile pt. compilare pt. Windows (standalone exe si vst) - - Se compileaza in mod cross-compile pt. windows din linux -14 Mar 2005 - Mici modificari la afisarea RMS-ului - - Actualizat textul copyright-ului la anul 2005 -22 Mar 2005 - Corectata o mica eroare care facea ca la schimbari foarte lente al parametrilor sa nu se actualizeze Format Filter -25 Mar 2005 - Corectata o eroare care facea ca uneori, la anumite setari ale lui SepctrumAdjust din OscilGen sa rezulte semnal zero - Corectata o mica eroare care facea ca daca se foloseste setarea 440Hz la Padsynth sa se aleaga sample-ul incorect -06 Apr 2005 - Modificat installerul pt. windows si pregatit pt. installer (folosit cross-compiling si nsis&wine) - - Adaugat icon in format windows (si la installer) - - Adaugat parametrul '-Y' la linia de comanda, care este folosit doar pentru installerul NSIS (parametrul este necesar pentru ca NSIS ma forteaza sa dau un parametru la program pentru ca sa adauge un icon la shortcut; zynaddsubfx ignora acest parametru) -07 Apr 2005 - Pregatit pentru release -08 Apr 2005 - Corectata o mica eroare care facea ca sa nu se incarce configul la inceput - - LANSAT PE INTERNET - VERSIUNEA (2.2.0) --------------------------------------------------------------------------------------------------- -12 Apr 2005 - Actualizat pentru MXML 2.2 (nu o sa mearga pe vers. mai vechi de mxml) -27 Apr 2005 - Adaugata posibilitatea de a inlatura complet interfata grafica in Makefile.inc (in acest caz nu mai sunt necesare bibliotecile grafice ca fltk) - - Adaugata posibilitatea de a incarca direct un instrument cu -L (deocamdata se poate incarca doar in part-ul 0) - - LANSAT PE INTERNET - VERSIUNEA (2.2.1) --------------------------------------------------------------------------------------------------- -28 Apr 2005 - Corectata o eroare care facea ca uneori sa fie frecventa prea mare la LFO daca era folosit random - - Nu mai afiseaza optionea -A in help daca nu este compilat si OSS si JACK -29 Mai 2005 - Corectata o eroare care facea ca sa nu se tina minte ultimul bank -27 Aug 2005 - Corectata o eroare care facea ca sa nu mearga functia Dump (se initializa inainte de citirea configurarilor) -21 Sep 2005 - Imbunatatit modul de scalare al profilei unei armonice la PADsynth -27 Sep 2005 - Gasita si rezolvata o posibila problema la PADsynth care facea ca sa nu se foloseasca mutex la stergerea de sample-uri (daca se aleg mai putine sample-uri decat initial) -09 Oct 2005 - Rezolvat un memory-leak la FFTwrapper - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -16 Apr 2006 - Corectata o eroare care facea ca sa nu se foloseasca insertion effect la master -20 Aug 2006 - Adaugat 88200 ca rata de esantionare -14 Sep 2006 - Se afiseaza spectrul la nota cu frecventa de 440 Hz la Oscil si pentru parametru Adaptive Harmonics -30 Oct 2006 - Adaugat un patch "standalone zombie fix stripped from Lars" - - Adaugat un patch "Extended mono" si "font resizing stuff" de Gerald Folcher -31 Oct 2006 - Adaugat un patch "Extended mono v.3" de Gerald Folcher - - Inlocuit fl_ask cu fl_choice in fisierele .fl - - In mod prestabilit nu se mai seteaza volumul la efectul 0 - - Efectele sunt numerotare de la 1 si in la "send to" din partui -01 Nov 2006 - Adaugat patch-urile de Jack Midi si LASH de Lars Luthman -06 Nov 2006 - Aplicat un patch "Fix for ALSA system lockup" de Lars Luthman -10 Nov 2006 - Aplicat un patch "zyn-extendedmono_v4_update-061110.diff.gz" de Gerald Folcher -14 Nov 2006 - Aplicat un patch "zyn-CVS-extendedmono_v5_update-061113.diff.gz" de Gerald Folcher - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -19 Mar 2007 - Aplicat un patch mic de la Daniel Clemente care este un workaround la bug-ul X11 cand tin tastele apasate mai mult timp -01 Apr 2007 - O mica modificare cu xclass zynaddsubfx in MasterUI.fl -09 Sep 2007 - Schimbata licenta la GPL 2 or other later - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -02 Ian 2008 - Corectate cateva mici erori la dezalocarea memoriei - - Codul de recorder wav a fost rescris - - Adaugata functia de export la sample-urile din PADsynth - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -20 Feb 2009 (Mark McCurry) - - Made several functions accept 'constant char' over 'char' to - prevent warnings - - Changed several 'delete' operations to 'delete []' based upon - the usage of 'new []' - - Gave external programs Makefiles - - Gave dials tooltips showing their value when they are being - moved - - Gave dials the ability to have normal tooltips when the mouse - hovers over them - - Created tooltips for the effects knobs - - Standardized the code, so it could compile with pedantic without - errors [it looks like some errors may have been missed] - -22 Feb 2009 (Mark McCurry) - - Fix improper deallocation in PresetsStore - - Fixed errors with drawing of the Oscillator as reported with - valgrind - -07 Mar 2009 (Mark McCurry) - - Added start of DocBook documentation - - Incorperated JACK output patch by Emmanuel Saracco - - Incorperated QUERTZ layout by Achim Settelmeier - -29 Mar 2009 (Mark McCurry) - - Started to use Doxygen within the Effects - - Started to use const within Effects - - Changing tabs->four spaces in hopes of generating a bit more - consitancy - - Began to use Initialization Lists - - Almost all changes contained in Effects until further - discussion on the style, so consistancy can be reached - -28 May 2009 (Mark McCurry) - - Added some more Doxygen comments - - Added Audio Samples classes - - Added Stereo template - - Added Control class - - Added DelayCtl class - -20 Iun 2009 (Paul Nasca) - - Bugfix: WAV export of PADsynth - -10 Iul 2009 (Paul Nasca) - - Update copyright info - -11 Jul 2009 (Mark McCurry) - - Added Proportinal Portamento - - Replaced Docbook with AsciiDoc - -18 Jul 2009 (Mark McCurry) - - Enabled volume controller by default - -20 Jul 2009 (Mark McCurry) - - Incorperated AZERTY layout by sourceforge user jimee - -02 Sep 2009 (Mark McCurry) - - Incorperated const char* <-> string mismatch by Alexis Ballier - -04 Sep 2009 (Mark McCurry) - - Incorperated NULLMidiIn function prototype fix by Alexis Ballier - -07 Sep 2009 (Mark McCurry) - - Fixed glitch in XMLwrapper, which would prevent file loading - -11 Sep 2009 (Mark McCurry) - - Moved PADsynth_used from public struct to has/set methods in - XMLwrapper - - Created wrapper functions, so that XMLwrapper can be somewhat - usable when const - - Removed multiple addparam methods and replaced it with one - variable argument function - - Replaced int2str, real2str, str2int, and str2real from XMLwrapper - with stringTo and stringFrom function templates in Util. - - Moved newFFTFREQS and deleteFFTFREQS from Util to FFTwrapper - - Removed unneeded stack from XMLwrapper - -18 Sep 2009 (Mark McCurry) - - Started to use versioning information in XMLwrapper - - Remove last of stack helper functions in XMLwrapper - - Added std::string retreval to XMLwrapper - -20 Sep 2009 (Paul Nasca) - - Started to implement the Unison effect for ADsynth - -22 Sep 2009 (Paul Nasca) - - Added vibratto and other features to Unison effect - -22 Sep 2009 (Mark McCurry) - - Changed temporary data for Oscilgen from static to instance - recommended by Tobias Doerffel - - Fixed Memory leaks in UI based upon James Morris' patch - -23 Sep 2009 (Paul Nasca) - - Added unison invert phase - - Made unison frequency spread to depend on Bandwidth controllers and parameters - - Added unison vibratto speed control and other improvements - - bugfixes: Voice Amplitude Envelope and FM - -24 Sep 2009 (Paul Nasca) - - Small enhancements and bugfixes to Unison - - Started to implement Bandwidth to the Reverb effect - -25 Sep 2009 (Mark McCurry) - - Allowed for XMLwrapper to retrieve strings stored in mxml TEXT - fields -29 Sep 2009 (Paul Nasca) - - Remove the old (FFT based) Bandwidth effect to Reverb and started rewrite it (based on multivoice chorus/unison effect) - -01 Oct 2009 (Paul Nasca) - - Corrected the ADsynth unison LFO rounding function - - Made Unison based on Bandwidth (in cents) parameter - -02 Oct 2009 (Mark McCurry) - - Added OSS failsafe by Jérémie Andréi - -04 Oct 2009 (Mark McCurry) - - fixed Ctest issues - -06 Oct 2009 (Mark McCurry) - - Added first simple profiling test - -08 Oct 2009 (Mark McCurry) - - Started to see if memset/memcpy offer performance benifits when - widely used - - Added basic SUBnote test - -09 Oct 2009 (Mark McCurry) - - Restylized codebase with uncrustify - -28 Oct 2009 (Paul Nasca) - - Disable "bw" control on Reverb when Bandwidth mode is not enabled - -18 Nov 2009 (Mark McCurry) - - Fixed segfault in VirKeyBoard - -02 Dec 2009 (Paul Nasca) - - Fixed a small typo on Virtual Keyboard - -10 Dec 2009 (Mark McCurry) - - Separated out Presets and arrayed Presets to reduce warnings from - the Wextra flag - - Minor change to Filter_ and FormantFilter to reduce unwanted warnings - diff --git a/plugins/zynaddsubfx/FAQ.txt b/plugins/zynaddsubfx/FAQ.txt deleted file mode 100644 index 37e558ba148..00000000000 --- a/plugins/zynaddsubfx/FAQ.txt +++ /dev/null @@ -1,27 +0,0 @@ - Frequently Asked Questions - -------------------------- - -Q1) What means "ZynAddSubFX" ? -A1) The name of the program comes from 4 words: - 1) Synthesizer ('S'->'Z') --> Zyn - ^^^ - 2) Additive Synthesis ------> Add - ^^^ - 3) Subtractive Synthesis ---> Sub - ^^^ - 4) Effects ----------------> FX - - So, ZynAddSubFX is a SYNthesizer with ADDitive, SUBtractive engines and effects. - - -Q2) How can I load files from older versions of ZynAddSubFX (like *.mas_zyn,etc) -A2) You need to convert them into new format. Please use 2.0.0pre1 or (recommended) 2.0.0pre2 versions of ZynAddSubFX to load old file formants and save them in the new formats - - -Q3) How can I change the number of parts, voices to ADSynth, effects, etc. ? -A3) Look in src/globals.h and change there these values. You don't have to change anything else, just recompile all. But most settings must be below 128. As the rule of the thumb if a setting is 128 or below 128, please don't make it bigger than 128. Anyway, I don't believe that you'll need more than 128 for these settings; for example you don't need 128(or more) effects same time? That's why I put the limit of 128 (using 7 bits of char). - - -Q4) How do I enable Jack support on ZynAddSubFX ? -A4) Look in "Makefile.inc" from "src/" directory for more information. It is highly recommended that the Jack samplerate to be equal to ZynAddSubFX samplerate (SAMPLE_RATE from globals.h), otherwise the resampling will be done and this will decrease the quality a bit. - diff --git a/plugins/zynaddsubfx/HISTORY.txt b/plugins/zynaddsubfx/HISTORY.txt deleted file mode 100644 index ccfba04a69e..00000000000 --- a/plugins/zynaddsubfx/HISTORY.txt +++ /dev/null @@ -1,196 +0,0 @@ -2.4.0 (21 Jun 2009) - - extended mono functionality - - legato mode - - export functionality on PADsynth - - inclusion of LASH client - - inclusion of DSSI audio output - - enabled tooltips for knobs (both description and value tooltips) - - added support for newer JACK api - - added quertz support for virtual keyboard - - started to encorperate cxxtest for unit testing - - many bugfixes - - code cleanup - -2.2.1 (28 Apr 2005) - - made to work with mxml-2.2 (will NOT work on older versions) - - it is possible to remove completely the graphical user interface (e.g. it can run without X). For this you need to modify the DISABLE_GUI option from the Makefile.inc - - added a commandline -L which load a instrument (.xiz) - now it only loads to part 0 (you can use this option with -l to load a master file and after this the option -L to replace the part) - -2.2.0 (8 Apr 2005) - - the VST version of ZynAddSubFX is removed from the instalation until it will be more stable (hope soon :) ) - - now, the instrument banks contains over 300 high quality instruments - - added "Apply" a button from OscilGen window for PADsynth - - added another parameter to ADsynth that controls the amount of all detunes of voices - - adaptive harmonics postprocess - - improved the VU-meter and added a RMS plot - - Dvorak support for Virtual Keyboard - - many bugs fixed and code cleanups - -2.1.1 (2 Oct 2004) - - Removed a big bug that prevented changing the part -2.1.0 (1 Oct 2004) - - Added a installer for windows (thanks to NSIS installer ( http://nsis.sourceforge.net/ ) ). Both VST and standalone vesions are contained in the same installer. - - Added a new user interface for beginners. You can switch the current user interface with that anytime do you want. - - All parts, effects, etc. are counted from '1' and not from '0' - - Added the posibility to compile the OSS and JACK support in the same binary (look in the Makefile.inc) - - VST host should be able to save all zynaddsubfx parameters into their setups (this is untested) - - Bugfixes and other - -2.0.0 (27 Aug 2004) - - VST version works (there are some issues/bugs but it works) - - Added a advanced Clipboard and Preset module - now is possible to add user preset LFOs,Envelopes, Effects, Oscillators, Resonances, Filters, etc. - - Completely removed the *.MAS_ZYN formats (masters, instruments,etc) support; use 2.0.0pre1 and 2.0.0pre2 to convert - - Corrected a error to pitch bend on VST plugin (thanks to Krzysztof Korpiela) - - Impoved the PADsynth module - - Because the PADsynth module takes a time to load, the instrument that contains such modules are shown in different colors - - Bugfixes - - Other - -2.0.0_pre2 (31 Iul 2004) - - Updated the XMLwrapper to mxml-2.0 - - Many bugfixes - - Other - -2.0.0_pre1 (17 Iul 2004) - - Added a new powerful synth engine which is called PADsynth, you can make very beautifull pads and even some strange sounds - - Now is used the XML format for all zynaddsubfx parameters(.XMZ for master parameters, .XIZ for instrument parameters and .XSZ for scale parameters).You can import older parameters. All parameters files are compressed with gzip algorithm. - - Some parameters has changed and you might ecounter different sounds that you saved in the older versions of zynaddsubfx - - The instrument banks are no longer single files, but directories that contains instrument .XIZ files (you can organize them even with a file manager). Also, you can use more than 1 banks easily. - - Added a new effect called DynamicFilter that allows you to do WahWah,AutoWah, VocalMorpher and other effects - - Speedups - - Started to write a small sequencer that allows to load and play a midi file from zynaddsubfx (unfinished) - - ZynAddSubFX is available from CVS, too. Please look at the sourceforge project page to get more information ( http://sourceforge.net/projects/zynaddsubfx ) - - The waveform generator (OscilGen) has many new parameters :) also if you press the "Shift" key, you can draw the hamonics amplitude/phases - - Many user interface improvements - - You can load a file at the start of the program with "-l" command-line parameter and you can run zynaddsubfx w/o user interface with "-U" - - It is possible to dump all MIDI notes into a text file - - The instruments can contain comments and copyright information in order to encourage sharing of them - - FFT3W library is supported - - More "randomness" options - - Other impovements - - Many, many bugfixes - - Added the full changelog (since I started to write zynaddsubfx), most is in Romanian - - Other things - -1.4.3 (31 Aug 2003) - - added state variable filters and other types to analog filters - - small user interface improvememnts - - small bugfixes - -1.4.2 (17 Iul 2003) - - added full-featured, advanced formantic filters - - added mixer panel which lets you to see/change most important part settings, and shows a vu-meters for each part - - you can choose to process the instrument's kit items only with one Part effect (eg. you can make a instrument kit that contains a reverberated piano and flanged strings) - - enabled to launch more instances in Jack - - when is launched first time, it searches for default.bnk_zyn file into /usr/share/zynaddsubfx and /usr/local/share/zynaddsubfx directories (useful for binary packages for Linux distributions) - - bugfixes - -1.4.1 (8 May 2003) - - added single mode to the instrument kit who alows only one item to be played same time - - added "Spectrum Adjust" to the ADsynth oscillator - - added "drum mode" to the instrument, where all midi keys are mapped to 12tET - - added a parameter to the "440Hz" which make the freq to varies a bit according to the key pressed (very usefull to toms and other drums) - - (for OSS audio out) if it is launched with root privileges, the synth will gain realtime scheduling priority - - bugfixes - -1.4.0 (15 Apr 2003) - - added instrument's own effect (effects that are loaded/saved with the instrument) - - FreeMode Envelopes: all Envelopes can have any shape (not only ADSR) - - Added instrument kits: It is possible to use more than one instruments into one part (used for layered synths or drum kits) - - Amplitude envelopes can be linear or logarithmic - - added interpolation on the Resonance user interface - - user interface improvements and cleanups of it's code - - initiated a mailing list to allow users to share patches for ZynAddSubFX. Please share your ZynAddSubFX patches; look at http://lists.sourceforge.net/mailman/listinfo/zynaddsubfx-user for more information about the mailing list. - -1.2.1 (6 Apr 2003) - - improved filter interpolation - - bugfix: wav header is written correctly - - bugfix: NRPN works correctly (eg:the controller was 0x98 instead of 98), now you can controll all effects parametrer realtime via MIDI - - bugfix: pitch bend works OK in windows - - added master fine detune (-64..63 cents) - - it is possible to swap effects or copy them - - started to port ZynAddSubFX to VST (not functional, yet) - - the resonace can protect the fundamental freq. against damping - -1.2.0 (21 Mar 2003) - - ZynAddSubFX is ported to Windows ;-) - - added internal Virtual Keyboard - - added Configuration window - - added frequency tracking to filter - - improved the OscilGen (harmonic filter, RMS normalisation, etc..) - - improved the recorder (uses the WAV file format and it starts only when a key is pressed) - - added filter interpolation if the frequency is changed very fast (it removes some annoying clicks) - - other improovements, bugfixes, speedups and cleanups of the code - -1.0.9 (24 Feb 2003) - - added keylimit to Part - - you can use multiple filter stages in order to make very steep filter rolloffs (eg. 48 dB/octave) - - ADsynth - added noise mode and you can make fixed frequencies; added the "Punch" parameter - - added an external program "Controller" which enables you to use the mouse for MIDI controllers - - other improvements and bugfixes - -1.0.8 (14 Feb 2003) - - added mono mode and portamento - - added the EQ effect - - the output of a system effect can be sent to others system effects - - minor bugfixes and improvements - -1.0.7 (7 Feb 2003) - - some settings (like samplerate) are set at runtime (by comand line) - - added Distorsion effect - - added controllers, and NRPNs for changing all effects parameters by midi - - bugs removed and other improvements - -1.0.6 (30 Jan 2003) - - Added JACK output ;-) - - Minor improvements and bugfixes - -1.0.5 (24 Jan 2003) - - The bug that crashed ZynAddSubFX if you change some effect parameters, it is realy removed (I forgot to update the file before upload) - - Other bugfixes and code cleanups - - Added a Global Filter to SubSynth - - Added keyresponse limits to Part - - Added presets to Effects - - The fade is smaller on high frequecy content and larger on low frequecies; so you'll don't hear starting clicks on basses and audible fadeins on higher pitched sounds - - Added tunnings to Reverb: you can choose Random of Freeverb - -1.0.4 (7 Jan 2003) - - It is possible to load Scala (.scl and .kbm) files - - Added mapping from note number to scale degree is possible to load Scala kbm files - - Corrected small bugs related to Microtonal - - If you want to use ZynAddSubFX with OSS (or you don't have ALSA) you can modify the Makefile.inc file to compile with OSS only. - - It is shown the real detune (in cents) - - Made a new widget that replaces the Dial widget - - Removed a bug that crashed ZynAddSubFX if you change some effect parameters - -1.0.3 (23 Dec 2002) - - small bugfixes: "Bypass Global Filter" from ADnoteUI dissapears sometimes ; - removed the low amplitude noise produced by the reverb; - if you "acconect" zynaddsubfx with aseqview no note was processed a long time. - - added Notch Filter - - added the option to randomize the ressonance function - - added VU-Meter - - Change the Insertion effect modes behaves (it sounds a bit louder) - - Added to the project an external program called Spliter that splits the - keyboard and alows you to play two instruments same time. You can use this - program with ZynAddSubFX or any other synthesizer. - - Added a new function to OscilGen - -1.0.2-1 (13 Dec 2002) - - bug found and removed: sometimes when Master/Instrument is saved, the synth crashed - -1.0.2 (13 Dec 2002) - - Added instrument banks - - the BandPass Filter's output amplitude was increased - - few fixes of FFTwrapper. See the documentation from "FFTwrapper.h" if you got error messages. - -1.0.1 (6 Dec 2002) - - corrected a bug that made ZynAddSubFX to crash(sometimes) if you disable a part - - wrote Resonance - - added the BandPass filter - - added the recording feature - - added "New instrument" menuitem - -1.0.0 (25 Sep 2002) - - first release, done a lot before it :-) - diff --git a/plugins/zynaddsubfx/README.txt b/plugins/zynaddsubfx/README.txt deleted file mode 100644 index c7ae09ea8f1..00000000000 --- a/plugins/zynaddsubfx/README.txt +++ /dev/null @@ -1,95 +0,0 @@ -ZynAddSubFX ------------ -It is a realtime software synthesizer for Linux and Windows with many features. Please see the docs for details. -Copyright (c) 2002-2009 Nasca Octavian Paul and others contributors -e-mail: zynaddsubfx AT yahoo D0T com -ZynAddSubFX is free program and is distributed WITH NO WARRANTY. It is licensed under GNU General Public License version 2 (or later) - see the file COPYING. - - --==## PLEASE SHARE YOUR INSTRUMENTS/MASTER SETTINGS ##==-- - --==## MADE WITH ZynAddSubFX ##==-- - Here is the mailing list where you can share your patches with others: - http://lists.sourceforge.net/mailman/listinfo/zynaddsubfx-user - - -The project page is - http://sourceforge.net/projects/zynaddsubfx - or - http://zynaddsubfx.sourceforge.net - -ZynAddSubFX is also available on many Internet sites like: - http://www-ccrma.stanford.edu/planetccrma/software/soundapps.html (Planet CCRMA) - http://www.hitsquad.com/smm/programs/ZynAddSubFX/ - http://freshmeat.net/projects/zynaddsubfx/ - http://ibiblio.org/pub/Linux/apps/sound/midi/ - or search "ZynAddSubFX" on a search engine (like www.google.com). - - -Requirements: -------------- - - a fast computer - - Linux (tested with RedHat 7.2,7.3,etc.) or Windows - - FFTW 2.x.x or 3.x.x (tested with fftw 2.0.5, 2.1.3, and 3.1.3) - necessary for - Fast Fourier computations - - MXML-2.5 library from www.minixml.org - - zlib library from http://www.zlib.org - this exists in most Linux distributions - - (for Linux) OpenSoundSystem (OSS) (if you don't have ALSA, only) - - (for Windows) pthreads, portaudio - -Not required, but recommended: ---------------------------- - - - FLTK 1.x.x (tested with fltk 1.1.0, 1.1.1, 1.1.2,etc.) - - ALSA 0.9.x or later (with OSS emulation, if you don't use JACK) - - JACKit - if you want to use it you must enable compilation for JACK in Makefile.inc - - a VST host for the VST version - -Compilation: ------------- - If you want to compile on Windows, please read compile.win32 file. - If you don't know how to compile, you may download binaries from Planet CCRMA (see above, on sites). - First set what should sound input/ouput should use in Makefile.inc in src/ directory. - Then "make" from the "src/" directory. Hope all goes right. If the compiler complains something about FFTwrapper.h and FFTW library headers(rfftw.h or fftw.h) please read the docs from DSP/FFTwrapper.h . - To compile the Spliter, run "make" from the "Spliter" directory. - To compile the Controller, run "make" from the "Controller" directory. - -Running on LINUX ----------------- - *AUDIO OUTPUT - A) OSS (Open Sound System) - B) JACK (JACK Audio Connection Kit) - - *MIDI INPUT* - There are 2 possibilities of midi inputs (depends on what you have chosen in Makefile.inc to use - OSS or ALSA). - A) ALSA (Advanced Linux Sound Architecture) - 1) Launch ZynAddSubFX - 2) ZynAddSubFX will make a virtual MIDI port. - You can connect other midi devices (like a real MIDI keyboard, midi sequencers which supports ALSA or virtual keyboard - like vkeybd). - To connect, use "aconnect" or "alsa-patch-bay"; usualy the port of ZynAddSubFX is 128:0 or 129:0. - 3) You are ready to play - - It is possible to use midi sequencer/other software that doesn't supports ALSA with ZynAddSubFX, but this is a bit more complicated. - Search on Internet for "HOWTO Use MIDI Sequencers With Softsynths" by Frank Barknecht, if you want to do this. - - - B) OSS (Open Sound System) - 1) Launch ZynAddSubFX - 2) Connect the MIDI keyboard - - As you have seen the OSS option needs a real midi keyboard. If you don't have it, you can download/install ALSA from www.alsa-project.org - -Running on WINDOWS ------------------- - If you launch zynaddsubfx.exe and nothing happens, you need pthreadGC.dll in the same directory (or windows directory). The dll files are distribuited with ZynAddSubFX windows binaries. - It might be possible that the latency will be very high. If this happens, you have to set the environment variable PA_MIN_LATENCY_MSEC to a value that represents the latency in miliseconds. - Eg: (in autoexec.bat or launched before running ZynAddSubFX) "set PA_MIN_LATENCY_MSEC=50" - Warning: if the value is too low, you might encounter severe dropouts on ZynAddSubFX. You'll have to set to a higher value and turn off automated background tasks (like virus scanners, email clients, etc.). - If you have more cards, you can select the desired card where you can play audio with the environment variable "PA_RECOMMENDED_OUTPUT_DEVICE" - Eg: "set PA_RECOMMENDED_OUTPUT_DEVICE=1" - A better way to set all of this, I will put on next versions. - -Please send me instruments,banks,master settings,songs(midi+...xmz files) done with ZynAddSubFX. I'll appreciate this. - - -Have fun! :-) - ---The ZynAddSubFX team diff --git a/plugins/zynaddsubfx/bugs.txt b/plugins/zynaddsubfx/bugs.txt deleted file mode 100644 index 8b137891791..00000000000 --- a/plugins/zynaddsubfx/bugs.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/plugins/zynaddsubfx/update-zynaddsubfx.sh b/plugins/zynaddsubfx/update-zynaddsubfx.sh deleted file mode 100755 index ca87290ee13..00000000000 --- a/plugins/zynaddsubfx/update-zynaddsubfx.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -rm -rf zynaddsubfx -git clone git://github.com/LMMS/zynaddsubfx.git -rm -rf zynaddsubfx/.git - -git status zynaddsubfx/ - - diff --git a/plugins/zynaddsubfx/zynaddsubfx b/plugins/zynaddsubfx/zynaddsubfx new file mode 160000 index 00000000000..1a39a451b0f --- /dev/null +++ b/plugins/zynaddsubfx/zynaddsubfx @@ -0,0 +1 @@ +Subproject commit 1a39a451b0f3f7b502184e32e1257b443d7964d4 diff --git a/plugins/zynaddsubfx/zynaddsubfx/.gitignore b/plugins/zynaddsubfx/zynaddsubfx/.gitignore deleted file mode 100644 index 77d28419fba..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.o -*~ -src/zynaddsubfx -src/Tests/runner -src/Tests/runner.cpp -CMakeCache.txt -CMakeFiles -build diff --git a/plugins/zynaddsubfx/zynaddsubfx/.gitmodules b/plugins/zynaddsubfx/zynaddsubfx/.gitmodules deleted file mode 100644 index 183f3f373fe..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "instruments"] - path = instruments - url = git://git.code.sf.net/p/zynaddsubfx/instruments diff --git a/plugins/zynaddsubfx/zynaddsubfx/AUTHORS.txt b/plugins/zynaddsubfx/zynaddsubfx/AUTHORS.txt deleted file mode 100644 index 4c196ae5fa7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/AUTHORS.txt +++ /dev/null @@ -1,32 +0,0 @@ -Main author: - Nasca Octavian Paul - -Developers: - Mark McCurry - Harald Hvaal - -Contributors: - Gerald Folcher (legato, mono notes memory) - Lars Luthman (zombie fix,jack midi, LASH support) - Daniel Clemente (with a workaround of X11 repeated key bug) - Emmanuel Saracco (fix for JACK output) - Achim Settelmeier (QUERTZ keyboard layout for virtual keyboard) - Jérémie Andréi (AZERTY keyboard layout, Array index fix, OSS failsafe) - Alexis Ballier (const char* <-> string mismatch, NULLMidi prototype fix) - Tobias Doerffel (static-instance variables fix, missing include fix) - James Morris (Memory leaks in FLTK GUI) - Alan Calvert (Portions of New IO) - Stephen Parry (DSSI rebuild) - Ryan Billing (APhaser) - Hans Petter Selasky (OSS Midi, FreeBSD support, Bank UI bug fix) - Damien Goutte-Gattat (Bank select midi support) - Lieven Moors (Spike/Circle waveform) - Olaf Schulz (MIDI Aftertouch support) - Jonathan Liles (NSM & NTK support) - Johannes Lorenz (Effect Documentation) - Ilario Glasgo (Italian Doc Translation) - Christopher Oliver (Unison + presets fix, mousewheel support, - SUBnote overtones, unison enhancements, ...) - Filipe Coelho (Globals Cleanup) - Andre Sklenar (UI Pixmaps) - diff --git a/plugins/zynaddsubfx/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/CMakeLists.txt deleted file mode 100644 index d36aa807816..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") -project(zynaddsubfx) -set(VERSION "2.4.4") - -enable_testing() -include(CTestConfig.cmake) -#Currently the only directory that uses cmake -add_subdirectory(src) - -install(FILES AUTHORS.txt COPYING FAQ.txt HISTORY.txt README.txt - DESTINATION share/doc/zynaddsubfx - ) -install(FILES zynaddsubfx-jack.desktop zynaddsubfx-alsa.desktop - DESTINATION share/applications) -install(FILES zynaddsubfx.svg - DESTINATION share/pixmaps) -install(DIRECTORY instruments/banks - DESTINATION share/zynaddsubfx) -install(DIRECTORY instruments/examples - DESTINATION share/zynaddsubfx) diff --git a/plugins/zynaddsubfx/zynaddsubfx/COPYING b/plugins/zynaddsubfx/zynaddsubfx/COPYING deleted file mode 100644 index e47a022c6cb..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/COPYING +++ /dev/null @@ -1,347 +0,0 @@ - -NOTE! The GPL below is copyrighted by the Free Software Foundation, but -the instance of code that it refers to (the ZynAddSubFX application) -is copyrighted by the authors (Nasca Octavian Paul and others) who actually wrote it. ---------------------------------------------------------------------------- - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/plugins/zynaddsubfx/zynaddsubfx/CTestConfig.cmake b/plugins/zynaddsubfx/zynaddsubfx/CTestConfig.cmake deleted file mode 100644 index bf4f379ae2e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/CTestConfig.cmake +++ /dev/null @@ -1,13 +0,0 @@ -## This file should be placed in the root directory of your project. -## Then modify the CMakeLists.txt file in the root directory of your -## project to incorporate the testing dashboard. -## # The following are required to uses Dart and the Cdash dashboard -## ENABLE_TESTING() -## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "ZynAddSubFX") -set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "fundamental-code.com") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ZynAddSubFX") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/plugins/zynaddsubfx/zynaddsubfx/ChangeLog b/plugins/zynaddsubfx/zynaddsubfx/ChangeLog deleted file mode 100644 index 8030d671c13..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ChangeLog +++ /dev/null @@ -1,1038 +0,0 @@ -6 Mar 2002 -(dupamasa - in jur de ora 4) Mi-a venit ideea exact cum sa fac cand ma plimbam pe strada Pandurilor -7/8 Mar 2002 - Started to do diagrams -10 Mar 2002 - Started to write "voice" -11 Mar 2002 - Heard first sound -12 Mar 2002 - tested with 200 voices -16 Mar 2002 - made "Note" the main class - - added vibratto - - added glissando -20 Mar 2002 - started to write the Envelope class -21 Mar 2002 - Envelope written (almost) - Volume envelope almost written -23 Mar 2002 - Scris relasenote(putin) - Envelope-ul este si in dB - "glissando" este inlocuit cu "Envelope" de frecventa - started to write the LFO class -24 Mar 2002 - Corrected a bug that could crashed the synth (forgotten to disable the amp/freq envelopeenabled when killed it) -25 Mar 2002 - Started to write the Filter class (wrote only few lines) -27 Mar 2002 - Scris filtrul(putin), si FilterEnvelope -28 Mar 2002 - Adaugat la LFO si tipul "rampup" si "rampdown" - Scris filterLFO si amplitudeLFO(termollo) - redenumiti si aranjati parametrii - Adaugat LFO delay - Scris FilterEnvelope(corect) si FilterLFO(corect) -29 Mar 2002 - Adaugat RingModulation - Adaugat FM/RM Amplitude si Frequency Envelope - Corectat un bug minor la Envelope-ASRinit(); - Adaugat FM -01 Apr 2002 - Corectat un bug care facea sa se auda paraituri la sunetele care incepeau co o faza!=0 - Scris cativa dintre parametrii globali Envelop-ulire,LFO,Filter,.. -02 Apr 2002 - Curatat putin ADnote - Adaugat VelocityScale la amplitudine, la FM si la Filtru Global -03 Apr 2002 - Aranjati toti parametrii ADnote in structuri -04 Apr 2002 - Mutati multi parametrii in ADnoteParameters - Inceput sa scriu ADnoteParameters -05 Apr 2002 - Inceput sa scriu clase speciale pentru parametrii(midi) (LFO..) -06 Apr 2002 - Continuat sa scriu clasele speciale pentru parametrii - Teoretic merge sinteza multitimbrala(Adica se poate aplea ADnote(canal,note,vel)) -07 Apr 2002 - Completat(aproape) transferul de parametri midi la cei reali -08 Apr 2002 - Added FM oscil at parameters and corrected a small FM bug -09 Apr 2002 - Inceput sa-l fac real-time -10 Apr 2002 - Merge la keyboard-ul MIDI, polifonic -27 Apr 2002 - Scris interfata la OSS, la latenta scazuta - Corectat un bug care facea ca sa se execute calcule inutile, ceea ce facea ca polifonia maxima sa scada de 10 ori -29 Apr 2002 - Inceput sa scriu interfata midi(obiect) -30 Apr 2002 - Continuat putin interfata midi (dar nu am terminat) -02 Mai 2002 - Merge in timp real cu latenta scazuta, dar se mai auda niste "pacanaituri" -03 Mai 2002 - Inceput sa scriu Reverb (acum este doar ecou) - "Pacanaiturile" au fost eliminate. -09 Mai 2002 - Reverb-ul suna a reverberatie -11 Mai 2002 - Adaugat cativa parametrii midi la Reverb -18 Mai 2002 - Adaugat filtrul AllPass la Reverb si adaugat parametrul Plohidamp -19 Mai 2002 - Adaugat InitialDelay (idelay) la Reverb -24 Iun 2002 - Clasa Filtru nu mai este dependenta de FilterParams(pot sa-l folosesc in alte scopuri) - Corectat un bug la filtru care facea ca la rezomante scazute sa amplifice f. mult basii - Adaugat High Pass Filter - Rezonanta filtrului este exponentiala - Adauga LPF+HPF la Reverb - Inceput sa scriu Generatorul de Functii (OscilGen) -25 Iun 2002 - Scris cateva forme de unda (functii) - Reverb-ul are volumul in dB si daca este zero(ca parametru) atunci se dezactiveaza -02 Iul 2002 - Adaugat inca o functie la generatorul de functii -03 Iul 2002 - Inceput sa scriu generarea de functii la OscilGen pe baza de FFT - Inlaturat DC-ul de la OscilGen -04 Iul 2002 - Adaugat ANTI-ALIASING la ADnote si insumarea armonicelor se face in domeniul frecventa - Corectat un bug care facea sa sune rau dac OSCIL_SIZE!=512 (era declarat de 2 ori) -12 Iul 2002 - Adaugat posibilitatea de a folosi ca modulator alta voce - Adaugat parametrii MIDI la OscilGen -13 Iul 2002 - Adaugat Randomness la clasa OscilGen -15 Iul 2002 - Adaugat si Panning(incl. Randomness) => instrumentul este acum stereo -16 Iul 2002 - Adaugat Randomness la LFO (faza 0 => random) - Inlaturat o eroare care facea ca amplitudinea sa nu fie interpolata -17 Iul 2002 - Volumul FM-ului este exponential - Adaugat atenuare la volumul FM-ului la note inalte -23 Iul 2002 - Adaugat EnvelopeStretch - Corectata o eroare care facea ca uneori sunetul sa se auda foarte tare la inceput - Adaugat fade-in (f. scurt) si fade out in caz ca envelop-ul are A=0 sau R=0, a.i. sa nu se auda pacanaituri -24 Iul 2002 - Corectat Relase-ul la Envelope si adaugat ForcedRelase -25 Iul 2002 - Adaugat posibilitatea de a nu folosi AntiAliasing-ul - Adaugat Frequency Modulation (nu phase modulation) - Adaugat Delay la fiecare voce - Adaugat Morphing la modulatie -26 Iul 2002 - Inceput sa scriu clasa Part -27 Iul 2002 - Se face controlul Midi folosind clasa Part si nu ADnote -28 Iul 2002 - Corectata o eroare care facea sa se instantieze clasa ADnoteParameters pt. fiecare nota => memoria era ocupata excesiv si "manca" din procesor. Cauza erorii este ca trimiteam obiectul ADnoteParameters ca parametru si nu referinta lui. Asta era cauza pacanaiturilor ce se auzeau daca apasam multe clape simultan. -29 Iul 2002 - Adaugat clasa Master (Permite acum mai multe instr. simultan => multitimbral) - Observat o eroare la Envelope -30 Iul 2002 - Adaugat EnvelopeStretch si Forcedrelase la instantierea unui obiect EnvelopeParams - Durata Sustainul-ui fortat este acceeasi indiferent de paramentrul EnvelopeStretch - Adaugat Ecou -31 Iul 2002 - Daca VelocityScaleFunction=127 atunci orice vel. va face amplitudinea maxima (ca si cand vel.=127) - Inceput sa scriu Interfata Utilizator -01 Aug 2002 - Toti parametrii sunt convertiti in REALTYPE direct de ADnote,de LFO - Inlataurate mici probleme de AntiAliasing daca detune-ul era prea sus si la unele moduri FM - Programul incepe sa fie controlabil de Interfata -02 Aug 2002 - Inlaturat o eroare stupida care facea ca sa se seteze valorile EnvelopeParams la -1 (scria din Master:: prea mult) -03 Aug 2002 - Terminata interfata pentru ADnoteParameters.GlobalPars - Adaugat inca un parametru la lfo (continous LFO) care faca ca LFO-ul sa nu inceapa la fiecare NoteOn - Corectat doua erori la ...[nvoice].AmpEnvelope si ...[nvoice].FreqEnvelope - Scrisa interfata pentru ADnoteParameters.VoicePars (fara FM+OSCIL...) -04 Aug 2002 - Scrisa interfata cu FM (fara Oscil) - Corectate doua erori cu provire la FMampenv si FMfreqenv - Inlaturat aliasing-ul la vocea FM - Modificata interfata (Voice si FM-ul sunt intr-o singura fereastra) - Inceput sa scriu schimbare voce curenta. -05 Aug 2002 - Adaugat interfata pentru cei mai importanti parametrii ai ADnote_VoicePar[nvoice] - Inceput sa scriu interfata pentru OscilGen -06 Aug 2002 - Este mult mai usoara schimbarea vocii curente. - Inceput sa scriu OscilEditor - Nu mai este necesara changebasefunc() la oscil pentru a schimba basefunction, se apeleaza automat. - OscilEditor este (aproape) complet - Toti parametrii ADnoteParameters au UI - Corectate cateva erori (cauzate de faptul ca nu am verificat daca ADnote::...Enabled!=0) -07 Aug 2002 - Corectata o eroare la envelope - Adaugat afisaj spectrum la OscilEdit - Adaugat parametrii noi: extenal oscillator (voice si FM) si oscilphase(si FM) si interfata pentru ei - Gasite mai multe erori care apar daca misc widget-urile in timp ce cant la clape (probabil este vorba de thread-uri care trebuie sa fie sincronizate sau ceva cam asa sau memory leaks) - Inceput sa scriu interfata pentru Part - Adaugat bypass la filtrul global - Adaugat conversia oscil-ului in basefunction - Corectata o mica eroare la calcularea oscil-ului referitor la faze -08 Aug 2002 - In VoiceList valorile sunt actualizate la fiecare apasare a butonului "ShowVoiceList" si formele de unda sunt afisate corect. - Corectate niste mici erori la FM - Daca se foloseste ca modulator o alta voce, interfata dezativeaza unii parametrii FM daca sunt inutili - Inceput sa scriu interfata si parametrii Master/Part - Schimbat putin Master si Part (atentie sa nu se instantieza ADnoteParameters la fiecare apasare de tasta) - Inceput sa scriu control-ul pentru Master/Parts -09 Aug 2002 - Scris parametrii Part si Master - Inceput sa scriu sincronizarea intre thread-uri -10 Aug 2002 - Adaugat o noua forma de unda la OscilGen - Adaugat sincronizarea intre thread-uri=>programul nu mai crapa daca in timp ce apas clapele, modific forma de unda - Adaugat enable/disable ADnote - Inceput sa scriu SUBnote/SUBnoteParameters - Se poate canta si la SUBnote(inceput sa scriu UI pt. el) -11 Aug 2002 - Scris controlul armonicelor - Adugati cativa parametrii la SUBnote - Adaugat AmpEnvelope la SUBnote(si UI) -12 Aug 2002 - Adaugat Detune la SUBnote si schimbat Detune-ul la ADnote - Adaugat FreqEnvelope la SUBnote -16 Aug 2002 - Corectata o eroare care facea ca VoiceOut sa fie inlaturat chiar daca era inca folosit(de alte voci) - Daca "Forced Relase" este off atunci se face relase-ul liniar - Adaugat BandWidth Envelope -17 Aug 2002 - Inceput sa pregatesc pentru EffectManager -18 Aug 2002 - Adaugat inca un parametru la Reverb: initial delay fb - Scris efectele de insertie - Inceput sa scriu efectele de sistem -19 Aug 2002 - Continuat sa scriu efectele de sistem - Inceput sa scriu interfata la Efecte (Reverb - terminat, aproape) -22 Aug 2002 - Corectata o eroare la Echo - Se poate schimba efectul de insertie - Gasita o eroare care "crapa" programul daca schimb efectul de le Reverb (rezolvata temporar, dar cu "memory leak") -23 Aug 2002 - Corectata eroarea la Reverb (a fost din cauza ca am pus ">" in loc de ">=" :-p ) - Terminat efectele de insertie(si interfata) - Adaugat Effect cleanup - Scrisa interfata pentru efectele sistem (cu exceptia sendto another sys eff) -24 Aug 2002 - Adaugate doua noi efecte: Chorus si Phaser -25 Aug 2002 - Nu se mai aude tacanit la Chorus daca schimb Delay/Depth - Corectat o mica eroare care facea ca sa nu se afiseze Pinsparts corect - Adaugat un nou efect: AlienWah - Nu se mai aude tacanit la Phaser si la AlienWah la frecvente LFO f. mari -27 Aug 2002 - Adaugata o noua forma de unda: Chirp - Adaugat Waveshaping la OscilGen - Se poate compila si fara UI - Inceput sa scriu Salvarea/Incarcarea Parametrilor -28 Aug 2002 - In ADnoteVoiceListUI se afisaza corect daca vocea este activata/dezactivata - Scrisa Salvarea/Incarcarea parametrilor (cu exceptia la OSCIL::UseAsBaseFunction) - Adaugat File Save/Open -29 Aug 2002 - Se poate salva si oscil::useasbase - Se afiseaza corect valorile dupa incarcare -01 Sep 2002 - Adaugat "codul de intrare" sa saveload 0xfe pt. a sti de unde incepe o noua "ramura" - "Codul de intrare" este folosit pentru a nu incarca "ramurile" care nu se potrivesc cu specificatiile (ex. nr. de voce sau nr. part prea mare) - Adaugat header la fisier - Imbunatatit OscilUI::useasbase -03 Sep 2002 - Modificat codurile de parmetrii: indicele par. sunt >= 0x80, parametrii <0x80 , controlerii speciali(urcare/coborare creanga) >=0xf0; Este util la versiunile viitoare, la forward/reverse compatibility. - Inceput sa scriu clasa Microtonal si interfata pt. Microtonal -04 Sep 2002 - Adaugat Pfilterbypass la salvare (am uitat sa o pun pana acum) - Aproape terminat Microtonal-ul (cu exceptia importului din fisiere .scl) -05 Sep 2002 - Facut cateva mici modificari la Microtonal si Echo - Adaugat un nou parametru la ADnote: PVolumeminus - Adaudat parametrii noi de Detune: Pcoarsedetune(coarse+octave) si Pdetunetype - Adaugat cateva tipuri de detune -06 Sep 2002 - Adaugat posibilitatea de a folosi ADnotepars:Globalpars.Pdetudetype in loc de Pdetunetype (0 = default detunetype), asa ca nu mai trebuie sa mai modific la fiecare voce detunetype: setez la 0 si modific global-ul - Facut mici modificari la MidiInput(OSS) -07 Sep 2002 - Corectata o eroare cu privire la detune si daca freq. > Nyquist - Modificat driver-ul OSSmidiin - Adaugat driver Alsa cu port virtual - Se poate salva doar instrumentele/microtonal. - Adaugata un nou fel de waveshaping(Zigzag) -08 Sep 2002 - Psysefxvol[][] sunt scalate in dB - Nu mai este periculos sa inchid fereastra principala -09 Sep 2002 - Se actualizeaza corect la incarcare la Master:Psysefxvol[][],Pvolume,Pkeyshift; si alti parametrii la Part - Adaugat nume la Part - Panic-ul (Shut-up-ul) se aplica si la efecte - Part->Penable controleaza de fapt daca Part-ul este activat/complet dezactivat. Daca se dezactiveaza un part toate notele+ efectele insertion sunt oprite. Nu mai consuma CPU daca folosesc multe part-uri. - Adaugat un nou parametru la part: Pnoteon care controleaza daca part-ul primeste mesaje NoteOn - Adaugarea extensiei se face automat. - Adaugat LFO exp_up 1 si 2 - Curatat putin de memory leaks (mai am de curatat si interfata) -10 Sep 2002 - Adaugat filtrul HPF cu un pol - Interfata se inchide corect. - Adaugat textul cu Copyright in interfata - Traduse toate comentariile in limba engleza - Adaugat licenta in fiecare fisier -11 Sep 2002 - Adaugat descriere la fiecare fisier - Corectata o eroare care facea ca SUBnote sa aiba amplitudini f. mari la freq. f. inalte - Adaugat cateva macro-uri la interpolarea amplitudinii -12 Sep 2002 - Modificat extensiile (*.mas.zyn ---> *.mas_zyn, la fel si celelalte) pentru a nu aparea fisiere *.mas.mas.zyn -13 Sep 2002 - Am decis numele programului: "ZynAddSubFX" (Zyn de la synthetizer (inlocuit S cu Z), Add de la additive, Sub de la substractive, FX de la effects) -14 Sep 2002 - Volumul din ADvoicelist se afiseaza corect -15 Sep 2002 - Adaugat inca 3 moduri de waveshaping Limiter, UpperLimiter, LowerLimiter -16 Sep 2002 - Adaugat Makefile -17 Sep 2002 - Corectata o mica eroare care facea ca sa nu se incarce fisierele cu data intotdeauna - Nu se amplifica freq. f. inalte daca freq. filtrului este mare. - Inceput sa scriu documentatia. -18 Sep 2002 - Adaugat functia de resetare a tuturor parametrilor(master si instrument) -23 Sep 2002 - Adaugat posibilitatea de a conecta efectele de insertie la iesire Master - Lfo-ul la frecventa incepe de la 0 pt. startphase=0 -24 Sep 2002 - Corectate niste mici erori la Chorus/Phaser - Adaugat si "substract" la Chorus si Phaser - Limitat tipul detune-ului la valoarea maxima -25 Sep 2002 - LANSAT PE INTERNET - PRIMA VERSIUNE (1.0.0) --------------------------------------------------------------------------------------------------- -01 Dec 2002 - Corectat niste comentarii - - Inlaturat o eroare care facea ca ZynAddSubFX sa crape daca dezactivez un part utilizat - - Inceput sa scriu Rezonanta -02 Dec 2002 - Terminat de scris Rezonante - - Adaugat filtru trecer-banda (BPF) - - Scris Recording -03 Dec 2002 - Adaugat Gain la Resonance - - Adaugat "New Instrument" la meniu -06 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.1) --------------------------------------------------------------------------------------------------- -08 Dec 2002 - Inceput sa scriu Bank si interfata pentru Bank -09 Dec 2002 - adaugat si "make debug" - - Continuat sa scriu Bank/UI; acum se poate folosi (dar nu salva pe HDD) -10 Dec 2002 - Terminat Bank (mai trebuie scris un "config" file pentru a alege automat ultima banka folosita) -11 Dec 2002 - Am mai lucrat ceva la Bank si am adaugat "config file" -12 Dec 2002 - Filtrul BPF suna mai tare - - Nu mai ar trebui sa fie probleme la compilarea FFTwrapper.h (fftw.h) -13 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.2) --------------------------------------------------------------------------------------------------- - - Corectat o eroare care facea ca programul sa crape daca salvam parametrii in timp ce cantam - - LANSAT PE INTERNET - VERSIUNEA (1.0.2-1) - de acasa --------------------------------------------------------------------------------------------------- -21 Dec 2002 - Corectate mici erori (nu mai dispare "Bypass Global Filter", inlaturat zgomotul de mica amplitudine - cauzat de reverb,nu mai apare intarzierea foarte lunga de la inceput a notelor muzicale daca conectam la aseqview) - - Adaugat filtru de rejectie banda (Notch) - - adugat randomize la Resonance - - Inceput sa scriu VU-meter-ul -22 Dec 2002 - Terminat VU-meter-ul - - Schimbat modul in care efectele de insertie se calculeaza (suna mai tare un pic) - - Adaugata o noua functie la OscilGen -23 Dec 2002 - LANSAT PE INTERNET - VERSIUNEA (1.0.3) --------------------------------------------------------------------------------------------------- -24 Dec 2002 - Adaugata posibilitatea de a incarca fisiere ".scl" (la Microtonal) -26 Dec 2002 - Adaugata optiunea de a folosi numai OSS-ul (fara ALSA) -27 Dec 2002 - Corectate cateva erori si modificate cateva lucruri marunte la Microtonal -28 Dec 2002 - Mici modificari la Microtonal - - Panic-ul la Reverb functioneaza OK - - Inceput sa scriu Scale Degree Mapping la Microtonal -29 Dec 2002 - Continuat Scale Degree Mapping la Microtonal (dar nu am terminat) -30 Dec 2002 - Corectat lucrul cu ScaleShift-ul - - schimbat modul in care se face keyshift-ul (nu se mai schimba armonia, indiferent de sistem) -31 Dec 2002 - Terminat Mapping-ul la Microtonal(incl. incarcarea/salvarea) - Corectat eroarea care facea ca la Microtonal sa nu se incarce de fiecare data din scl_zyn unele date - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -01 Ian 2003 - Corectata o eroare la Microtonal (erau probleme la InvertKeys daca era folosit key mapping) - - Adaugata un nou tip de waveshaping (Inverse Limiter) -02 Ian 2003 - Adaugat afisaj al acordului fin (cents) - - Butoanele arata f. frumos (am adaugat un nou widget in loc de Fl_Dial) -03 Ian 2003 - Schimbate butoanele (putin) - - Nu se mai aude un tacanit la ShutUp sau AllNotesOff - - Corectat putin waveshaper-quantisize si butoanele - - Inlaturata o eroare care facea ca programul sa crape daca schimbam unii parametri ale efectelor -07 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.4) --------------------------------------------------------------------------------------------------- -08 Ian 2003 - Am inlaturat de-a binelea eroarea (cu efectele - 3 Ian) -11 Ian 2003 - Corectate o mica eroare care facea ca volumul sa fie negativ la ADnote::voice[].PVolume <64 -13 Ian 2003 - Corectata o mica eroare la VU-Meter - - Corectata o mica eroare cu privire la panning la Reverb -15 Ian 2003 - Adaugat min/max keyresponse limits la Part - - Adaugat Filtru si FiltreEnvelope la SubNote -16 Ian 2003 - Curatat codul sursa (ADnote) prin inlaturarea unor variabile - - Durata fadein-ul este aleasa automat (a.i. sa nu rezulte click-uri la notele joase si nici fadein-ul audibil la notele inalte sau cu freqcvente inalte) - - Corectata o mica eroare care faca ca uneori instrumentul sa nu fie salvat/sters la Bank slot-ul cerut - - Imbunatatita putin interfata: La ADnote si SUBnote, butoanele care controleaza amplitudinea armonicelor sunt colorate diferit daca au amplitudinea 0 -17 Ian 2003 - Corectate erori la Chorus si la Phaser care faceau ca sa sune prea 'sec' (din cauza ca wet-ul era la 50% din volum) -18 Ian 2003 - Inceput sa scriu Preset-uri la efecte -19 Ian 2003 - Adaugat Preset-urile la efecte -20 Ian 2003 - Schimbat putin HPF-ul la Reverb -21 Ian 2003 - Adaugat tuning-ul la Reverb (si Freeverb) si Roomsize - - Schimata putin interfata si modificat putin widgetul Pdial -22 Ian 2003 - Amplificat volumul Reverb-ului cu 6 dB - - Buffer-ul foloseste liste simplu-inlantuite, asa ca nu-i mai problema la "configuratii mari" (multe part-uri) -24 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.5) --------------------------------------------------------------------------------------------------- -26 Ian 2003 - Inceput sa scriu GetAudioOutSamples, care ar putea fi apelat in modul callback -27 Ian 2003 - Adaugat o noua fuctie la waveshaping (clip) - - Adaugat suportul pentru Jack (adica programul poate rula in modul call-back ;-) ) - - Inlaturata o eroare care facea ca npart sa fie foarte mare si ca programul sa crape -29 Ian 2003 - Schimbari foarte minore la OscilGen::waveshape (la clip) - - Daca dau "clear" la OscilEdit, butoanele care au amplitudinea zero, sunt colorate corect -30 Ian 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.6) --------------------------------------------------------------------------------------------------- -31 Ian 2003 - Inceput sa adaug optiuni la linia de comanda - - Rata de esantionare (SAMPLE_RATE) este setata la rulare si nu la compilare -01 Feb 2003 - Inca 2 variabile sunt setate la rulare (SOUND_BUFFER_SIZE si OSCIL_SIZE) - - Volumul la Part se aplica doar dupa efecte de insertie - - Inceput sa scriu Distorsionarea (fara filtre) -02 Feb 2003 - Schimbate modurile de distorsionare (exp -> asym1 si pow -> pow ( altul ) ) - - Terminat Distorsionarea -03 Feb 2003 - Adaugata inca o functie la waveshape (asym2) - - Inceput sa scriu Controller-ii - - Adaugat controller-i PitchWheel,Expression,Panning,Filter Cutoff, Filter Q, BandWidth, Modulation Wheel - - Panning-ul si volumul sunt interpolate - - Inceput sa scriu un nou program (Controller) care timite mesaje midi (controller) catre un port ALSA - - Panning-ul la Part se aplica doar dupa efecte de insertie - - Panning-ul la efecte se aplica inainte de procesare -04 Feb 2003 - Adaugat posibilitatea de a seta intensitatea/dezactiva la controlleri(incl. UI) - - Adaugat controler-ul FMmodulationAmplitude - - Corectat o eroare la Buffer (care facea ca Buffer-ul sa nu se reseteze :-P ) -05 Feb 2003 - Corectata o eroare care facea ca programul sa consume mult din procesor (denormalisation) - - Nu mai este permisa o valoare a lui OSCIL_SIZE care sa nu fie putere a lui 2 (este ajustata automat) - - Adaugat controller-i Volume si Sustain Pedal, AllNotesOff, AllSoundOff, ResetAllControllers - - Adaugat NRPN, adica toti parametrii efectelor pot fi controlati prin controlleri -06 Feb 2003 - Pus limite la parametrii efectelor a.i. sa nu se seteze (datorita controllerilor) la valori nevalide - - Inlaturata o mica eroare la controller-ul BandWidth - - Schimbat putin EffectLFO::updateparams - - Controler-ul BandWidth afecteaza doar FineDetune-ul - - Schimbat putin identificare controlerilor si adaugat controlleri la OSS - - Schimbat putin interfata utilizator la controlleri -07 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.7) --------------------------------------------------------------------------------------------------- -08 Feb 2003 - Adaugat modul "mono"(monofonic) la part - - Inceput sa scriu portamento-ul -09 Feb 2003 - Terminat portamento-ul -10 Feb 2003 - Inceput sa scriu Equaliser-ul - - Inlaturata o eroare care facea ca la parametrii efectelor care sunt 0 sa nu fie incarcati -11 Feb 2003 - Terminat Equaliser-ul (adica adaugat vizualizator freq response) - - Corectata o mica eroare care facea ca part-ul 0 sa fie activ chiar daca cel salvat era inactiv -12 Feb 2003 - Mici modificari la EQ (UI) - - Adaugata posibilitatea de swap (stanga <--> dreapta) - - Adaugat Q la filtrele shelf -13 Feb 2003 - Adaugat inca un parametru la Phaser (phase) - - Curatit putin codul sursa la efecte - - Adaugat system effect send to next systems effects -14 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.8) --------------------------------------------------------------------------------------------------- - - cateva mici modificari (de la un patch primit de pe Internet) - - adaugat keylimit la Part (si first note priority) -15 Feb 2003 - Corectata o foarte mica eroare la Part -16 Feb 2003 - Se poate aplica filtrul inainte de distorsion - - Adaugat filter stages (adica filtrul se poate aplica de mai multe ori) -17 Feb 2003 - Corectata o mica eroare la Reverb si modificat putin filter-ul si UI -18 Feb 2003 - Corectata o eroare care facea ca semnalul la voice sa fie intre [-4.0..4.0] si sa faca probleme la RingModulation - - Adaugat modul Noise la ADsynth(voice) pentru a putea produce si tobe - - Adaugat parametrul fixed frequency la 440Hz -19 Feb 2003 - Corectata o mica eroare la ADnote (aparea un fadein nedorit) - - Facute inca cateva mici modificari la ADnoteUI -20 Feb 2003 - Imbunatatit foarte mult Controller-ul si adaugat la ZynAddSubFX ca program extern - - Modificat putin Waveshaper-ul (fct. L/U limit) - - Corectata o eroare la SUBnote (care facea probleme la glissando) - - Adaugat un nou parametru Punch la ADnote care face ca sa sune ca si cum ar fi o lovitura (f. util la Rhodes) -21 Feb 2003 - Adaugata inca o functie de distorsionare x(1-x) -23 Feb 2003 - Corectata o eroare (cu mutex) care facea ca sunetul sa fie extrem de tare, daca in timp ce cantam, modificam unii parametrii de sunet la ADnote -24 Feb 2003 - LANSAT PE INTERNET - VERSIUNEA (1.0.9) --------------------------------------------------------------------------------------------------- - - Adaugata posibilitatea de a tipari notele si timpul in care au fost produse (optiunea -D) -26 Feb 2003 - Adaugat inca 2 controlleri (Resonance Center Freq. (relative) si Resonace Bandwidth(relative)) -27 Feb 2003 - Adaugata posibilitatea de a modifica parametrii (in mod direct) al oscilatorului extern -07 Mar 2003 - Portat partial(doar interfata) programul sub Windows -08 Mar 2003 - Adaugat Virtual Keyboard - - Cateva mici modificari in vederea portarii pt. windows - - Adaugat si controller la Virtual Keyboard -09 Mar 2003 - Adaugat pitch wheel la Virtual Keyboard si modificat putin controller-ul la VK -10 Mar 2003 - Adaugat Filter Frequency Tracking (adica modificarea frecventei filtrului in functie de frecventa notei) - - Marite eficienta la LFOparams - update lfotime - - Adaugat mod de normalize prin RMS - - Corectate doua erori la Distorsion (negate si mono+prefiltering) -11 Mar 2003 - In Windows, nu mai este necesar functiile getopt (scrisa o functie proprie) -12 Mar 2003 - Adaugat filtru la OscilGen -13 Mar 2003 - Adaugat mai multe filtre la OscilGen - - Facute optimzari la ADnote (adaugarea unui element la oscilsmp si fmsmp,etc.) si curatat putin codul sursa - - Corectata o eroare care amplifica fm-ul la rate de esantionare inalte - - Optimizat si curatat reverb-ul -16 Mar 2003 - Modificate optiunile de compilare in Makefile.inc si coduri sursa a.i. sa se realizeze portarea pe windows mai usor -17 Mar 2003 - Inregistrarea se face in formatul WAV si nu RAW - - Adaugat trigger la recorder (se incepe inregistrarea doar cand este apasata o nota) - - Adaugat interfata PortAudio - - Corectata eroarea care facea ca UI sa nu ruleze pt. Windows (trebuia dat show() la UI in thread-ul 3) si corectate alte erori din windows - - Si audio-ul functioneaza sub Windows - - Corectata o eroare care se manifesta foarte rar(Resonance, i era de la 0 si nu de la 1) -18 Mar 2003 - Adaugat interpolare la filtru (nu se mai aud tacanaituri, daca frecventa filtrului se schimba foarte rapid si semnalul contine putine armonice) - - Adaugat interfata Midi in Windows => consider ca programul este portat in Windows -19 Mar 2003 - Adaugat interfata de configurare - - Corectata o eroare la OscilGen care facea ca in loc ca amplitudinile sa fie reduse la -40,..,-100dB, sa fie setate la 1 si unde era intensitate mare sa file amplificate -20 Mar 2003 - Corectata o mica eroare la interfata (uneori disparea butonul ON de la ADvoice) -21 Mar 2003 - LANSAT PE INTERNET - VERSIUNEA (1.2.0) --------------------------------------------------------------------------------------------------- - - Se interpoleaza filtrul si cand se trece peste pragul Nyquist (in sus sau in jos) -22 Mar 2003 - Corectata o eroare care facea ca nr. de esantioane scrise in headerul fisierului WAV sa nu fie initializat -26 Mar 2003 - Nu mai este permisa alegerea unui fisier wav in timpul pauzei de la record - - Gasita si corectata o eroare stupida (am pus la NRPN 0x98 in loc de 98 zecimal) -28 Mar 2003 - Inceput sa portez programul sub VST -29 Mar 2003 - Adaugat Master fine detune (-64.0 .. 63.0 cents) -01 Apr 2003 - Functioneaza portarea sub VST, dar mai este de lucru... -02 Apr 2003 - Modificat synth-ul a.i. sa se poate apela in mai multe instante in VST - - Continuata portarea in VST -03 Apr 2003 - Continuata portarea in VST (este limitat la o singura instanta) -05 Apr 2003 - Adaugata posibilitatea de a interschimba/copia parametrii efectelor - - Mici modificari la Makefile (ignora headerele inexistente la deps) -06 Apr 2003 - Adaugat posibilitatea de protectie impotriva atenuarii a notei fundamentale la rezonanta - - Pitch bend-ul merge bine in Windows -07 Apr 2003 - LANSAT PE INTERNET - VERSIUNEA (1.2.1) --------------------------------------------------------------------------------------------------- - - Adaugat efect la part (adica efect care face parte din instrument ;-) ) -08 Apr 2003 - Adaugata interpolare la Resonance (peak-urile le interpoleaza) -09 Apr 2003 - Interfata la Envelope este o singura clasa - - Adaugat Envelope free mode (adica de orice forma) - - Adaugata posibilitatea de a copia de la o voce la alta la ADnote - - Release-ul este liniar (in loc de dB) -10 Apr 2003 - Adaugata afisarea ultimului fisier master salvat/incarcat - - Adaugata setarea notei minime/maxime la ultima nota - - Pot alege daca release-ul sa fie liniar - - Facute cateva corecturi la envelope -11 Apr 2003 - Curatat codul sursa la UI si impartit in mai multe fisiere .fl - - Corectate niste erori la Envelope si adaugat modul liniar/logaritmic la amplitudine -12 Apr 2003 - Inceput sa scriu kit-ul la part -13 Apr 2003 - Terminat de scris kit-ul la part+UI -14 Apr 2003 - Copierea vocilor este sub forma de clipboard - - ADsyn su SUBsyn check-urile de la PartUI sunt actualizate -15 Apr 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.0) --------------------------------------------------------------------------------------------------- -16 Apr 2003 - Adaugat modul "Single" la instrument kit, care face ca sa sune doar primul instrument din kit disponibil -21 Apr 2003 - Adaugat realtime priority, care seteaza prioritatea mare la sintetizator, daca are posibilitate; merge numai pe Linux - - Gasite multe erori mici(dar potential periculoase) cu ajutorul programului Valgrind -30 Apr 2003 - Adaugat "Spectrum adjust" la OscilGen, care ajusteaza intensitatile armonicelor -03 Mai 2003 - Normalizat spectrul inaintea adjust-ului la OscilGen -04 Mai 2003 - Adaugat mod "egal temperat" la fixed frequency (440Hz), util la tobe -05 Mai 2003 - Adaugat modul "Drum mode", unde sistemul este intotdeauna temperat (12tET), toate notele sunt mapate si transpose-ul este ignorat -08 Mai 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.1) --------------------------------------------------------------------------------------------------- -09 Iun 2003 - Am schimbat in .H in fisierele .fl (ca sa se poate compila si pe Debian) -10 Iun 2003 - Inceput sa modific interfata la filtru a.i. sa pot adauga filtrul formantic usor - - Interfata pentru filtru este o singura clasa -12 Iun 2003 - Inceput sa scriu panoul de part-uri (care afiseaza parametrii importanti ale part-urilor) - - VU-meter-ul poate afisa si intensitatea part-ului dorit (folosit la panou de part-uri) -13 Iun 2003 - Terminat panoul de part-uri - - Adaugat posibilitatea de a inchide automat fereastra bancii de instrumente, cand se incarca un instrument -19 Iun 2003 - Modificat modul cum se calculeaza frecventa filtrului (se fac doar adunari si doar la urma se ridica la putere) -22 Iun 2003 - Aproape terminat filtrul formantic (fara UI) -24 Iun 2003 - Merge mai multe instante in jack (alege porturi diferite) -26 Iun 2003 - Continuat de scris filtrul formantic -29 Iun 2003 - Adaugat vu-meter fals la Panel (in caz ca partul este dezactivat si primeste note on). De asemenea se arata daca in partul dezactivat s-a cantat ceva (apare o liniuta). -09 Iul 2003 - Inceput sa scriu interfata pentru filtrul formantic -10 Iul 2003 - Continuat filtrul formantic (interfata) -11 Iul 2003 - Eroarea vine de la Makefile pt. ca nu recompileaza si clasele care folosesc o anumita clasa, daca aceasta din urma se schimba - - Continuat filtrul formantic (interfata+adaugarea interpolarii la Q) -12 Iul 2003 - Adaugat la filtrul formantic setarile de amplitudine formanti si interpolarea acestora - - Adaugat grafic la UI-ul filtrului formantic si alti paramatrii la filtrul formantic -13 Iul 2003 - Corectata eroarea la FormantFilter care facea ca sa nu se interpoleze intre vocale - - Adaugat parametrul VowelClearness la FormantFilter care face ca sa se evite vocalele mixte -14 Iul 2003 - Inlaturat parametrul Psequence[].pos, pt. ca era confuz => fiecare vocala are zona egala - - Adaugat parametrii Psequencestretch si Psequencereversed la FormantFilter - - Adaugat parametrul Pgain la filtru (-30...30 dB) - - Terminat de scris Filtrul Formantic - - Corectata o eroare care facea ca sa nu se salveze oscilatorul la o ADnote_voce, daca vocea este dezactivata, chiar daca era folosita de o alta voce - - Prima data se cauta fisierul "default.bnk_zyn" si in dir "/usr/share/zynaddsubfx" sau "/usr/local/share/zynaddsubfx" -15 Iul 2003 - Setat Pkeylimit prestabilit la 15 la Part - - Activarea unui Part din interfata Panel schimba automat part-ul curent la acela - - Se poate alege ca un instrument din Kit sa fie procesat incepand cu un anumit efect; si se mai poate alege ca un efect din Part sa fie trimis in afara -17 Iul 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.2) --------------------------------------------------------------------------------------------------- -21 Iul 2003 - Corectata o eroare la FilterUI care facea ca la fiecare afisare sa se initializeze FilterParames::Pgain la 64 -25 Iul 2003 - Corectata o eroare care facea ca modulatia in faza/frecventa sa sune diferit la diferite rate de esantionare/oscilsize -26 Iul 2003 - Afisat corect - valoarea OSCIL_SIZE ajustata (in caz ca a fost data optiunea "-o" incorect) - - In windows arata si numele la midi_in_device -04 Aug 2003 - Adaugat filtrele Peak,LowShelf,HighSelf la filtru si foloseste parametrul Gain de la interfata filtrelor -30 Aug 2003 - Adaugat un nou tip de filtru: State Variable Filter -31 Aug 2003 - LANSAT PE INTERNET - VERSIUNEA (1.4.3) --------------------------------------------------------------------------------------------------- -02 Sep 2003 - Adaugata posibilitatea de a incarca de la inceput un fisier .mas_zyn "-l" - - Se poate lansa programul fara interfata utilizator ("-U") -17 Sep 2003 - Adaugat niste simple patch-uri de Frank Neumann -02 Oct 2003 - Corectata o eroare la SUBsynth care facea ca la freq inalte si Q foarte mici sa se produca filtre instabile -30 Oct 2003 - Adaugate posibilitatea (+interfata in config) de Dump (avansat) - - Adaugat ModWheel liniar si facut prestabilit (si posibilitatea de a alege in interfata modul de modwheel) -04 Nov 2003 - Modificat putin interfata la ResonanceUI -05 Nov 2003 - Marita viteza prin inlocuirea de (int) cu cod de asamblare (cu.10-50% la FM,chorus,etc.) -10 Nov 2003 - Inceput sa adaug posibilitatea de a adauga comentarii la instrumente -11 Nov 2003 - Terminat de adaugat comentariile/autor/tipuri la instrumente -12 Nov 2003 - Adaugat intefata pentru FFTW3 la fftwrapper -18 Nov 2003 - Inceput sa scriu Sequencer-ul -19 Nov 2003 - Adaugat un buton "i" pt. instrument info si facut ca instrument info sa se afiseze automat daca se schimba partul (sau se incarca instrumente,etc) -20 Nov 2003 - Continuat de scris Sequencer-ul si inceput sa ii scriu interfata - - Mici modificari la preset-urile de la Echo -26 Nov 2003 - Continuat de scris sequencerul - inceput sa scriu inregistrarea (fara timer) -27 Nov 2003 - Se poate inregistra (dar nu rula) - adaugat timerul de inregistrat - - Frecventa maxima al filtrelor este de Nyquist-500.0 pentru a evita instabilitatea filtrelor -28 Nov 2003 - Adaugata favorizarea portamento-ului in sus sau un jos; ex. se poate face ca portamento-ul sa fie doar in sus, sau portamento-ul in jos sa fie mai scurt decat cel in jos - - Inceput sa pun pe cvs la cvs.sourceforge.net -01 Dec 2003 - Am facut niste mici modificari ca urmare a unui bug-report -05 Dec 2003 - Facute cateva modificari la jack -08 Dec 2003 - Inceput sa incerc sa fac rt-safe sub jack, dar in stadiul actual suportul jack este nefunctional -11 Dec 2003 - Adaugat aleatorism la amplitudinile armonicelor -13 Dec 2003 - Adaugat LFO frequency randomness -14 Dec 2003 - Imbunatatit LFO frequency randomness -15 Dec 2003 - Corectata o mica eroare la ADnoteParameters (lipseau niste break-uri la salvarea/incarcarea parametrilor) -16 Dec 2003 - Eroarea cu break-urile se dovedeste a fi o eroare majora :( ; adica corectarea ei, necesita resalvarea tuturor instrumentelor - - Am revenit la suportul vechi de JACK, dar cel nou este disponiblil ca JACK_RT (nefunctional inca) -17 Dec 2003 - Inceput sa restucturez Part-ul (am adaugat clasele Instrument,InstrumentParams) - programul nu mai este compatibil cu versiunile anterioare - - RMS normalize este prestabilit la OscilGen -18 Dec 2003 - Continuat de restructurat Part-ul - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -01 Feb 2004 - Revenit la versiunea din 16 Dec. 2003 - - Pus iarasi RMS normalize prestabilit la OscilGen - - M-am razgandit ;) nu mai restructurez part-ul; mai bine pun acolo o functie separata pentru salvari/incarcari par instrumente - - Inceput sa adaug suportul XML -02 Feb 2004 - Corectata o eroare care facea ca numele la instrumentele din bank sa fie aratate gresit (nu era pus un \0 ) - - Continuat suportul de XML -03 Feb 2004 - Continuat de scris suportul XML - inceput sa salvezi cativa parametrii -04 Feb 2004 - Se salveaza parametrii XML la master, part, filter, lfo, envelope, resonance si adnote (partial) -05 Feb 2004 - Se salveaza toti parametrii in XML -06 Feb 2004 - Adaugat salvarea de instrument in XML - - Adaugat export la bank intr-un director XML si decis ca bank-ul sa fie un director cu mai multe fisiere xml de forma XXXX-nume.xml sau XXXX-nume.xml.gz -07 Feb 2004 - Adaugat functii de initializare si renuntat la masterdefaultbuf si instrumentdefaultbuf (adica salvarea la inceput si incarcarea bufferelor cu instrumentele prestabilite) - - Corectata o mica eroare care facea ca sa se incarce subnotepars la adnotepars (eroarea a aparut azi) -08 Feb 2004 - Modificat putin formatul XML -10 Feb 2004 - Adaugata salvarea parametrilor pt. basefunction la OscilGen - - Inceput sa scriu incarcarea parametrilor -11 Feb 2004 - Se pot incarca cativa parametrii de la master -12 Feb 2004 - Continuat incarcarea parametrilor XML si la part (neterminat) -13 Feb 2004 - Terminat de adaugat parametrii la incarcarea XML -14 Feb 2004 - Se poate incarca si instrumente - - Rezolvata o problema la coarse detune - - Corectate cateva erori la incarcarea XML-ului - - Frecventa LFO-ul de la instrumente are valoare reala intre 0..1 - - Corectata eroarea care facea ca functia de rezonanta sa fie trasata incorect - - Adaugata compresie gzip la fisiere si decompresie automata la incarcare (folosesc biblioteca zlib) -15 Feb 2004 - O mica modificare la envelope parameters in sensul ca envelope-ul prestabilit la FM nu mai este liniar -22 Feb 2004 - Adaugat normalize Full RMS la Oscil -23 Feb 2004 - Inceput sa fac ca sa pot adauga Bank bazat pe XML (adaugat temporar clasa OldBank) -24 Feb 2004 - Continuat la Bank -25 Feb 2004 - La Bank - inceput sa scriu partea ca sa arate instrumentele din banca -26 Feb 2004 - Continuat la Bank -27 Feb 2004 - Corectate erori la snprintf (nu dadeam parametru "%s" inainte de string si daca acel string continea ceva %, era periculos) si alte erori - - Micsorat timpul de marire amplitudine la ADnote (doar in cazul cand amplitudinea creste brusc ca la un LFO expdown) - - Corectata o eroare foarte veche la LFO amplitudine (amplitudinea nu scadea corespunzator) -28 Feb 2004 - Se poate incarca si salva instrumente in Bank -01 Mar 2004 - Se pot schimba bancile de instrumente - - Introduse si celelalte functii la Bank (cu exceptia salvarii/incarcarii locului bancii folosite) - - Se poate importa banci din bnk_zyn -03 Mar 2004 - Terminat (teoretic) partea de XML -05 Mar 2004 - Actualizat Copyright-ul la 2004 in fisiere -08 Mar 2004 - Corectat o mica eroare la OscilGen (se aplica gain-ul rezonantei incorect) -09 Mar 2004 - Adaugata posibilitatea de stretch la LFO in functie de frecventa notei -12 Mar 2004 - Adaugata modulatie la OscilGen (functia de baza) -13 Mar 2004 - Adaugat HarmonicShift la oscilgen -15 Mar 2004 - Inceput sa scriu partea de incarcare MIDI - - Inlaturata partea de recording din Sequencer -16 Mar 2004 - Inceput sa scriu partea de analiza midi -25 Mar 2004 - Continuat partea de analiza midi -28 Mar 2004 - Scris partea de incarcat fisier midi - - Merge partial playerul -26 Mai 2004 - Playerul merge bine cu un canal midi (rezolvata problema cu timing-ul) -03 Iun 2004 - Adaugata partea de play speed la interfata -06 Iun 2004 - Adaugata functia sigmoid la distorsionare -12 Iun 2004 - Modificat modul cum este realizat bank-urile, adica directoarele de bank-uri exista in anumite directoare si aceste directoare sunt cautate automat de bankuri; adaugat optiunea de a se folosi mai multe bank-uri -13 Iun 2004 - Adaugat filtrul "sinus" la OscilGen - - Managementul bancilor de instrumente este complet - - Se cauta bancile si in '/usr/share/zynaddsubfx/banks' si '/usr/local/share/zynaddsubfx/banks' - - Corectata o eroare la filter la OscilGen care filtra diferit componentele sin si cos - - Adaugat posibilitatea de swap la instrumentele din bank -14 Iun 2004 - Adaugat __DATE__ si __TIME__ sa stiu cand s-a compilat - - Modificat interfata la PartUI - - Imbunatatit modulatia basefunc la OscilGen (adaugat inca un parametru si inca un tip de modulatie ("power")) - - Adaugat inca o noua functie basefunc la OscilGen (sqr=atan(sin(x)*a)) -15 Iun 2004 - Adaugat posibilitatea de a face armonicele ca sa depinda de frecventa ("adaptive") si rezultatul suna foarte frumos pentru ca tendinta este de pastrare a frecventelor armonicelor si nu a numarului de ordine al lor -16 Iun 2004 - Inceput sa trec configul pe XML -17 Iun 2004 - Adaugat tipul threshUp la spectrum adjust - - Terminat de trecut config-ul pe XML (inclusiv setarile bancilor de instrumente) -18 Iun 2004 - Incercata interpolarea cubica dar am vazut ca nu merita pentru ca OSCIL_SIZE e suficient de mare si pentru o interpolare liniara - - Separat OscilGenUI din ADnoteUI - - Inceput sa scriu modulul de sinteza PADnote -19 Iun 2004 - Adaugat modul liniar de controller bandwidth si modificat modul liniar la controllerul modulation wheel - - Adaugata modulatia in frecventa la OsciGen -20 Iun 2004 - Nu se mai deschide automat fereastra de instrumente daca a fost deschisa si s-a descarcat un instrument - - Facute mici modificari la FM-ul de la Oscil -21 Iun 2004 - Inceput sa scriu conversia in sinus -22 Iun 2004 - Continuat conversia in sinus si facut teste pentru posibilitatea de "draw" cu sliderele -23 Iun 2004 - Modificat modul in care parametrii se afiseaza la OscilGen (este o functie "refresh" care face asta) - - Adaugata posibilitatea de draw la armonicele OscilGen daca se apasa tasta Shift - - Corectata o mica eroare care facea imposibila modificarea amplitudinii armonicelor cu tastatura - - Adaugat randomness de grup (adica se aplica acelasi randomness la toate vocile care folosesc acelasi oscilator) -24 Iun 2004 - Inlaturata setara de normalize la OscilGen. Intotdeauna normalize este Full RMS - - Facute cateva imbunatatiri la interfata unde sunt inlocuite comuter-urile cu setari mai usor de inteles de catre utilizator (ex. la efectele de insertie se arata "insert to Master Out" in loc de "-2") -29 Iun 2004 - Inlaturata setarea cu gain la Resonance pentru ca este inutil (datorita faptului ca normalize este Full RMS intotdeauna) -30 Iun 2004 - Inlaturata o eroare recenta la EffectUI si modificat EffectUI in sensul ca nu trebuie sters si reinstantiat pentru a se reincarca valorile curente de efecte - - Inceput sa scriu un nou efect (DynamicFilter) -01 Iul 2004 - Corectata o mica eroare la EffectUI care facea ca efectele sa nu apara activate - - Continuat de scris la DynamicFiter (mai este doar de salvat parametrii si de auto-update la filtru) -02 Iul 2004 - Continuat la DynamicFilter (adaugata auto-update, adaugat preset-uri) - - Terminat DynamicFilter - - Corectata o eroare la EQui care facea ca sa nu se actualizeze efectul curent si sa nu se obtina graficul egalizatorului -03 Iul 2004 - Corectata o mica eroare care nu activa la EffectUI daca efectul anterior era dezactivat - - Actualizat Swap/Copy la efecte ca sa proceseze si parametrii la filtre - - Adaugat Bypass la efectele de instrument - - Imbunatatit interfata utilizator (eliminate setarile "-1",etc.) - - Scris calcularea profilului la PADsynth - - Adaugat OscilGen si Resonance la PADsynth si inceput sa scriu interfata utilizator la PADsynth -04 Iul 2004 - Adaugata calcularea automata a largimii de banda echivalente si afisarea ei - - Inceput sa scriu partea de sinteza la PADsynth - - Auzit primul sunet la PADsynth -05 Iul 2004 - Nu mai face urat daca schimb parametrii in timp ce cant si apas apply - - Adaugat harmonic scale si position la PADsynth - - Se calculeaza corect si armonicele cu largime de banda mare -06 Iul 2004 - Inceput sa adaug filtre,lfo,envelopes,etc. la PADsynth -07 Iul 2004 - Corectate cateva mici erori si adaugat autoscale - - Modificata putin interfata de la filtru - - Adaugata interfata si parametrii la LFOs,Envelopes,Filter la PADsynth - - Adaugata fereastra care arata pozitiile armonicelor si continuat de lucru la acestea -08 Iul 2004 - La pozitiile armonicelor sunt aratate si valorile lor reale in dB - - Alte adaugiri minore la PADsynth - - Adaugat interpolare cubica la PADsynth -09 Iul 2004 - Modificat modul cum se calculeaza profilul armonicelor la PADsynth (nu se mai ridica la patrat) - - Corectate cateva erori la PADsynth - - Modific amplitudinea in functie de sqrt(largime de banda) => amplitudinile armonicelor sunt echivalente cu oscil -11 Iul 2004 - Acum nu se mai intrerupe sunetul la notele care canta in timp ce sunt aplicate modificarile la parametrii - - Se poate alege marimea sample-lui - - Adaugat multisampling la PADsynth - - Cand se incarca parametrii ADsynth se da volumul ceva mai incet ca sa corecteze faptul ca normalize-ul este doar RMS -12 Iul 2004 - Inlocuit codul de D/W sau Volume de la efecte cu un cod unic in EffectMgr - - Se poate face efecte la instrumente la care doar semnalul Wet e procesat de efectele urmatoare - - Modificat modul cum se calculeaza intensitatea Wet la Reverb si Echo - - Corectata eroarea la FM care facea ca daca Adaptive Harmonics!=0 sa se calculeze FM-ul gresit -13 Iul 2004 - Rezonanta la PADsynth se face in functie de armonica reala si nu de numarul de ordine al armonicei - - LFO,Envelope, Filters, etc. merg la PADnote - - Inceput sa fac partea de aratare ca parametrii au fost schimbati (butonul "Apply" se coloreaza in rosu) -14 Iul 2004 - Butonul Apply la PADsynth se coloreaza in rosu cand se modifica ceva - - Adaugat fixed freq. la PADsynth - - Sunt salvati si parametrii PADsynth => consider in mod oficial ca PADsynth este complet -15 Iul 2004 - Facuta o modificare la PADnoteUI care arata foarte frumos - - Completata partea de save/load si stabilite noile extensii ale fisierelor: master - .XMZ, instrument - .XIZ, microtonal - .XSZ - - Inlocuit memset cu un macro (ZERO) pentru ca memset nu seteaza toate valorile ci uneori doar prima valoare cu 0 (e o optimizare la gcc care face asta) - - Corectate niste erori la makefile care aveau legatura cu compilarea in windows - - Corectate 2 erori referitor la Banci de instrumente -16 Iul 2004 - Adaugat inca noi tipuri de harmonic bandwidth scale - - Adaugat inca un parametru la filter la OscilGen si inca un nou tip de filtru -17 Iul 2004 - Corectata o eroare care facea sa crape programul uneori dupa ce scria instrumentul in banca - - Modificata optiunea -l ca sa incarce un .xmz - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre1) --------------------------------------------------------------------------------------------------- -18 Iul 2004 - Corectata o mica eroare la afisare care facea ca la PADnoteUI sa fie trasate liniile in mod gresit -19 Iul 2004 - Corectata doua mici erori (se incarca gresit parametrii filtrului de la OscilGen) - - Corectata inca o mica eroare care facea ca sa nu se coloreze butonul PAD_Synth Apply in rosu la anumiti parametrii de la oscilgen - - Se dezactiveaza butoanele Edit de la PartUI ca sa nu se poata edita module de sinteza inactive -20 Iul 2004 - Corectate cateva erori cu compilare pe windows -21 Iul 2004 - Corectata o mica eroare la Bank si alte erori -26 Iul 2004 - Acum este folosita biblioteca mxml-2 - - Corectata o eroare care facea ca sample-ul la PADnote sa nu fie ales in functie de frecventa reala de baza (cu detune) - - Mutat functiile de waveshaping in Distorsion.C/.h -27 Iul 2004 - Corectata o eroare foarte suparatoare care bloca uneori calculatorul - - Adaugat inca un nou parametru la PADsynth la base function - - Nu se mai arata butonul de apply parameters la PADsynth cand nu este necesar - - Eliminate blocarile de cateva secunde din threadul de sunet in momentul cand se incarca un nou instrument care contine parametrii PADsynth - - Adaugata schimbarea titlului ferestrei principale la load XML -29 Iul 2004 - Modificat modul cum este stocat lista de banci root dir - - Gasita o eroare care facea ca sa se stearga denormalkillbuffer inaintea lui master -30 Iul 2004 - Gasite si corectate o gramada de erori (eu stergeam elemente din ferestre si fltk le stergea din nou) - - Eliminate warning-urile pentru -Wall -31 Iul 2004 - Eliminate complet stergerile in plus de la UI din destructorele obiecte - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre2) --------------------------------------------------------------------------------------------------- -01 Aug 2004 - Adaugat un nou tip de OvertonesPosition la PADsynth -02 Aug 2004 - Am pus din nou schimbarea schedule-ului la valoare corecta (l-am scos dintr-o greseala) -04 Aug 2004 - Am corectat niste erori la VST - - Merge VST, dar nu intotdeauna stabil (merge stabil pe vsthost.exe) - - Corectata eroare care facea ca sa nu mearga MIDI - - LANSAT PE INTERNET - VERSIUNEA (2.0.0pre2 VST) --------------------------------------------------------------------------------------------------- -13 Aug 2004 - Inceput sa scriu modurile continous si discrete la PADnote -14 Aug 2004 - Terminat modul continous la PADnote - - Corectata o mica eroare la OscilGen care facea daca adaptive harmonics e activ si phase randomness>0 sa rezulte si aleatorism in amplitudinile armonicelor - - Inceput sa scriu Presets/Clipboard (Clipboardul, in stadiu actual va putea copia doar parametrii folositi si nu cei dezactivati) - - Merge partial partea de Copy in clipboard -15 Aug 2004 - Corectata o eroare in main.c la pitch bend - - Scos Swap/Copy la efecte si la PartUI si vechiul Copy/Paste de la ADnote voice - - Merge clipboardul la Oscil, Resonance, Filter si partial la ADsynth,SUBSynth si PADsynth -16 Aug 2004 - Corectata inca o eroare la pitch bend (aratata de Krzysztof Korpiela) - - Adaugat refresh si la Filtru si paste la ADnote, SUBnote si PADsynth sunt complete -17 Aug 2004 - Adaugat clipboard la LFO, Envelope, ADnoteVoice si Filter Vowel -18 Aug 2004 - In clipboard se salveaza toti parametrii (chiar si cei dezactivati) - - Corectata o eroare care facea ca instrumentul sa fie incarcat la fiecare salvare in banca - - Tipurile de lfo sunt compatibile intre ele la clipboard -19 Aug 2004 - Corectata o mica eroare la XMLwrapper care facea ca sa se salveze fortat toti parametrii (chiar si cei nefolositi) - - Adaugata partea de salvare/incarcare a listei directoarelor unde se afla presetarile -21 Aug 2004 - Am lucrat putin la salvare/incarcare a listei dir. cu presetari -22 Aug 2004 - Corectata o eroare de compilare - - Makefile-ul modificat, a.i. make-ul sa se opreasca in caz de eroare - - Terminat managerul de preset-uri -23 Aug 2004 - Adaugata posibilitatea de a se vedea direct din lista cu bancile de instrumente -24 Aug 2004 - Inlaturat complet suportul pentru formatele *.mas_zyn, *.ins_zyn, *.bnk_zyn si *.scl_zyn - - Ascuns Sequencer-ul de utilizator (o sa il continui mai incolo) -25 Aug 2004 - Listele de banci si de preset-uri sunt sortate - - Corectate niste erori la Oscilgen care faceau ca sa se calculeze randomness chiar daca este folosit de PADsynth si pus automat parametrul randomness daca PADsynth este folosit (in caz ca se va importa la un ADsynth) - - Gasita o eroare care face sa crape daca lucrez mult cu bancile de instrumente -27 Aug 2004 - Adaugata posibilitatea de a dezactiva aratarea starii PADsynth din instrumente - - LANSAT PE INTERNET - VERSIUNEA (2.0.0) --------------------------------------------------------------------------------------------------- -05 Sep 2004 - Corectata o mica eroare de la SUBnote (legat de pitch wheel) -06 Sep 2004 - Eliminata variabila "disablekitloading" din Part si din UI -07 Sep 2004 - Modificat id-ul vst in 'zasf' (inainte era de 5 litere si poate cauza un crash la host) -27 Sep 2004 - Corectat un mic bug la salvare in xml la parametrul FMcoarseDetune din adnote - - La VST, daca incerc sa inchid fereastra principala, se minimizeaza - - Eliminate setarile cu indice '0' (zero) -28 Sep 2004 - Adaugata salvarea tuturor parametrilor in hostul VST (trebuie testat) - - Adaugat installer pt. windows (cu NSIS) -29 Sep 2004 - Inceput sa scriu interfata utilizator pt. incepatori -30 Sep 2004 - Terminat de scris interfata utilizator pt. incepatori si se selecteaza la pornire modul dorit - - Adaugata posibilitatea de a compila cu suport jack si oss simultan si sa se aleaga runtime ce doresc (jack/oss) -01 Oct 2004 - Corectata o mica eroare care facea ca sa nu se inchida ferestrele cu instrumente cand incarc din banca - - LANSAT PE INTERNET - VERSIUNEA (2.1.0) --------------------------------------------------------------------------------------------------- -02 Oct 2004 - Corectata o eroare grava care facea ca sa nu pot schimba partul curent in interfata utilizator obisnuita -03 Oct 2004 - LANSAT PE INTERNET - VERSIUNEA (2.1.1) --------------------------------------------------------------------------------------------------- -04 Oct 2004 - Corectata o eroare care face ca in modul simple UI, sa se inverseze panning-ul - - Adaugat un icon la ZynAddSubFX -10 Oct 2004 - Si controllerul de Resonance se aplica la toate item-urile din kit -12 Oct 2004 - Corectata o eroare care facea ca butoanele Addpoint si Delpoint de la Envelope sa nu fie afisate -16 Oct 2004 - Corectata o eroare care facea ca partUI-ul sa nu se actualizeze intotdeauna cand incarcam un instrument -20 Oct 2004 - Corectata o mica eroare asemanetoare cu cea din 16 Oct, dar care afecta meniul new -07 Nov 2004 - Corectata o mica eroare care facea ca sa nu se incarce corect instrumentele in linia de comanda (-l) -14 Nov 2004 - Nu mai verific in bank daca este un director sau fisier simplu, pt. ca poate sa aiba probleme -28 Nov 2004 - Curatat codul la OscilGen (acum datele sunt stocate mai bine si nu in functie de biblioteca FFTW) - - Corectata o mica eroare la OscilGen cu adaptive harmonics care facea ca energia vechilor armonice sa nu se adauge in mod corect la noile armonice (la note inalte) - - Sortarea nu mai este quicksort la bank si la presets pt. ca am vazut ca nu merge in windows intotdeauna - - Corectata o eroare la egalizator care facea ca sa se aplice si la el par. D/W -29 Nov 2004 - Marita zona de valori la adaptive harmonics power din OscilGen - - Adaugata posibilitate de a post-procesa la adaptive harmonics(adica a adauga sau a amplifica anumite armonice) -05 Dec 2004 - Corectata o eroare care facea ca functiile getChunk si setChunk sa fie supraincarcate in loc de suprascrise (dar nu am testat) - - Corectata o eroare care returna gresit la canDo in vst (netestat) -17 Dec 2004 - Inceput sa folosesc Dvorak pt. VK -18 Dec 2004 - Continuat putin la VK -20 Dec 2004 - Se poate selecta la VK dintre "qwerty" si "Dvorak" - - Corectata o mica erare care facea sa nu arate BWprofile dezactivat la PADnote - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - -04 Ian 2005 - Corectata o mica eroare care facea ca sa nu arate Force Release la Freemode Envelope -15 Ian 2005 - Corectata o eroare la controllerul bandwidth care facea ca sa ajunga la valoarea 0 si sa dea peste cap SUBsynth -22 Ian 2005 - Inceput sa scriu suportul pt. DSSI -27 Ian 2005 - Corectata eroare care facea ca in cazul in care sunt 2 banci cu acelasi nume (sau aceeasi bank root dir sa fie selectat de 2 ori) sa produca confuzie -03 Feb 2005 - Inceput sa scriu la Microtonal ca sa se faca butonul apply de culoare rosie cand se schimba ceva -06 Feb 2005 - Facuta o mica modificare care interzice punera notelor "0" in dump si alta modificare care mareste nr. de octave calculate la PADsynth - - Renuntat sa fac modificarea la Microtonal inceputa din 03 Feb, pentru ca nu am gasit cum pot schimba culoarea butonului automat cand modific un text -07 Feb 2005 - Corectata o eroare care facea ca la microtonal mapping sa nu se calculeze corect (adica sa se stocheze valoarea corecta) -12 Feb 2005 - Controllerul prestabilit la Virtual Keyboard este Filter Cutoff in loc de BandWidth - - Modificate cateva preseturi la DynamicFilter - - Adaugata posibilitatea de a mari sau micsora cu un parametru detune-ul vocilor de la ADnote -17 Feb 2005 - Corectate cateva erori la PADsynth care faceau ca sa se citeasca date din zone de memorie nealocata - - Corectata o eroare la Bank care facea ca uneori sa crape programul cand umblam mult cu bankuri -19 Feb 2005 - Corectata o eroare care facea ca uneori sa fie calculata frecventa la ADnote=nan si programul sa crape pentru ca era folosit parametrul bandwidthDetuneMultiplier inainte de a fi calculat -21 Feb 2005 - Se afiseaza corect numele fisierului proaspat salvat in fereastra principala -26 Feb 2005 - Corectata eroarea la windows si la OSS care facea ca pitch bend sa nu fie mapat corect (trebuie verificat) -27 Feb 2005 - Se afiseaza corect valoarea lui detune in centi -28 Feb 2005 - Corectata o mica eroare care facea ca sa nu se afiseze intotdeauna corect detune-ul la ADvoice - - Afisajul VU-meter la Master nu mai prezinta variatii mari in timp scurt - - Adaugata afisajul RMS la VU-meter -06 Mar 2005 - Facute cateva mici modificari referitoare in special la warning-uri - - Corectata o mica eroare care facea ca la un Paste sa nu se actulizeze unii parametrii ai filtrului in interfata -12 Mar 2005 - Imbunatatiri la interfata PADsynth, adica se poate da "apply" direct din OscilGenUI sau ResonanceUI -13 Mar 2005 - Facute cateva compilari in Makefile pt. compilare pt. Windows (standalone exe si vst) - - Se compileaza in mod cross-compile pt. windows din linux -14 Mar 2005 - Mici modificari la afisarea RMS-ului - - Actualizat textul copyright-ului la anul 2005 -22 Mar 2005 - Corectata o mica eroare care facea ca la schimbari foarte lente al parametrilor sa nu se actualizeze Format Filter -25 Mar 2005 - Corectata o eroare care facea ca uneori, la anumite setari ale lui SepctrumAdjust din OscilGen sa rezulte semnal zero - Corectata o mica eroare care facea ca daca se foloseste setarea 440Hz la Padsynth sa se aleaga sample-ul incorect -06 Apr 2005 - Modificat installerul pt. windows si pregatit pt. installer (folosit cross-compiling si nsis&wine) - - Adaugat icon in format windows (si la installer) - - Adaugat parametrul '-Y' la linia de comanda, care este folosit doar pentru installerul NSIS (parametrul este necesar pentru ca NSIS ma forteaza sa dau un parametru la program pentru ca sa adauge un icon la shortcut; zynaddsubfx ignora acest parametru) -07 Apr 2005 - Pregatit pentru release -08 Apr 2005 - Corectata o mica eroare care facea ca sa nu se incarce configul la inceput - - LANSAT PE INTERNET - VERSIUNEA (2.2.0) --------------------------------------------------------------------------------------------------- -12 Apr 2005 - Actualizat pentru MXML 2.2 (nu o sa mearga pe vers. mai vechi de mxml) -27 Apr 2005 - Adaugata posibilitatea de a inlatura complet interfata grafica in Makefile.inc (in acest caz nu mai sunt necesare bibliotecile grafice ca fltk) - - Adaugata posibilitatea de a incarca direct un instrument cu -L (deocamdata se poate incarca doar in part-ul 0) - - LANSAT PE INTERNET - VERSIUNEA (2.2.1) --------------------------------------------------------------------------------------------------- -28 Apr 2005 - Corectata o eroare care facea ca uneori sa fie frecventa prea mare la LFO daca era folosit random - - Nu mai afiseaza optionea -A in help daca nu este compilat si OSS si JACK -29 Mai 2005 - Corectata o eroare care facea ca sa nu se tina minte ultimul bank -27 Aug 2005 - Corectata o eroare care facea ca sa nu mearga functia Dump (se initializa inainte de citirea configurarilor) -21 Sep 2005 - Imbunatatit modul de scalare al profilei unei armonice la PADsynth -27 Sep 2005 - Gasita si rezolvata o posibila problema la PADsynth care facea ca sa nu se foloseasca mutex la stergerea de sample-uri (daca se aleg mai putine sample-uri decat initial) -09 Oct 2005 - Rezolvat un memory-leak la FFTwrapper - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -16 Apr 2006 - Corectata o eroare care facea ca sa nu se foloseasca insertion effect la master -20 Aug 2006 - Adaugat 88200 ca rata de esantionare -14 Sep 2006 - Se afiseaza spectrul la nota cu frecventa de 440 Hz la Oscil si pentru parametru Adaptive Harmonics -30 Oct 2006 - Adaugat un patch "standalone zombie fix stripped from Lars" - - Adaugat un patch "Extended mono" si "font resizing stuff" de Gerald Folcher -31 Oct 2006 - Adaugat un patch "Extended mono v.3" de Gerald Folcher - - Inlocuit fl_ask cu fl_choice in fisierele .fl - - In mod prestabilit nu se mai seteaza volumul la efectul 0 - - Efectele sunt numerotare de la 1 si in la "send to" din partui -01 Nov 2006 - Adaugat patch-urile de Jack Midi si LASH de Lars Luthman -06 Nov 2006 - Aplicat un patch "Fix for ALSA system lockup" de Lars Luthman -10 Nov 2006 - Aplicat un patch "zyn-extendedmono_v4_update-061110.diff.gz" de Gerald Folcher -14 Nov 2006 - Aplicat un patch "zyn-CVS-extendedmono_v5_update-061113.diff.gz" de Gerald Folcher - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -19 Mar 2007 - Aplicat un patch mic de la Daniel Clemente care este un workaround la bug-ul X11 cand tin tastele apasate mai mult timp -01 Apr 2007 - O mica modificare cu xclass zynaddsubfx in MasterUI.fl -09 Sep 2007 - Schimbata licenta la GPL 2 or other later - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -02 Ian 2008 - Corectate cateva mici erori la dezalocarea memoriei - - Codul de recorder wav a fost rescris - - Adaugata functia de export la sample-urile din PADsynth - -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -20 Feb 2009 (Mark McCurry) - - Made several functions accept 'constant char' over 'char' to - prevent warnings - - Changed several 'delete' operations to 'delete []' based upon - the usage of 'new []' - - Gave external programs Makefiles - - Gave dials tooltips showing their value when they are being - moved - - Gave dials the ability to have normal tooltips when the mouse - hovers over them - - Created tooltips for the effects knobs - - Standardized the code, so it could compile with pedantic without - errors [it looks like some errors may have been missed] - -22 Feb 2009 (Mark McCurry) - - Fix improper deallocation in PresetsStore - - Fixed errors with drawing of the Oscillator as reported with - valgrind - -07 Mar 2009 (Mark McCurry) - - Added start of DocBook documentation - - Incorperated JACK output patch by Emmanuel Saracco - - Incorperated QUERTZ layout by Achim Settelmeier - -29 Mar 2009 (Mark McCurry) - - Started to use Doxygen within the Effects - - Started to use const within Effects - - Changing tabs->four spaces in hopes of generating a bit more - consitancy - - Began to use Initialization Lists - - Almost all changes contained in Effects until further - discussion on the style, so consistancy can be reached - -28 May 2009 (Mark McCurry) - - Added some more Doxygen comments - - Added Audio Samples classes - - Added Stereo template - - Added Control class - - Added DelayCtl class - -20 Iun 2009 (Paul Nasca) - - Bugfix: WAV export of PADsynth - -10 Iul 2009 (Paul Nasca) - - Update copyright info - -11 Jul 2009 (Mark McCurry) - - Added Proportinal Portamento - - Replaced Docbook with AsciiDoc - -18 Jul 2009 (Mark McCurry) - - Enabled volume controller by default - -20 Jul 2009 (Mark McCurry) - - Incorperated AZERTY layout by sourceforge user jimee - -02 Sep 2009 (Mark McCurry) - - Incorperated const char* <-> string mismatch by Alexis Ballier - -04 Sep 2009 (Mark McCurry) - - Incorperated NULLMidiIn function prototype fix by Alexis Ballier - -07 Sep 2009 (Mark McCurry) - - Fixed glitch in XMLwrapper, which would prevent file loading - -11 Sep 2009 (Mark McCurry) - - Moved PADsynth_used from public struct to has/set methods in - XMLwrapper - - Created wrapper functions, so that XMLwrapper can be somewhat - usable when const - - Removed multiple addparam methods and replaced it with one - variable argument function - - Replaced int2str, real2str, str2int, and str2real from XMLwrapper - with stringTo and stringFrom function templates in Util. - - Moved newFFTFREQS and deleteFFTFREQS from Util to FFTwrapper - - Removed unneeded stack from XMLwrapper - -18 Sep 2009 (Mark McCurry) - - Started to use versioning information in XMLwrapper - - Remove last of stack helper functions in XMLwrapper - - Added std::string retreval to XMLwrapper - -20 Sep 2009 (Paul Nasca) - - Started to implement the Unison effect for ADsynth - -22 Sep 2009 (Paul Nasca) - - Added vibratto and other features to Unison effect - -22 Sep 2009 (Mark McCurry) - - Changed temporary data for Oscilgen from static to instance - recommended by Tobias Doerffel - - Fixed Memory leaks in UI based upon James Morris' patch - -23 Sep 2009 (Paul Nasca) - - Added unison invert phase - - Made unison frequency spread to depend on Bandwidth controllers and parameters - - Added unison vibratto speed control and other improvements - - bugfixes: Voice Amplitude Envelope and FM - -24 Sep 2009 (Paul Nasca) - - Small enhancements and bugfixes to Unison - - Started to implement Bandwidth to the Reverb effect - -25 Sep 2009 (Mark McCurry) - - Allowed for XMLwrapper to retrieve strings stored in mxml TEXT - fields -29 Sep 2009 (Paul Nasca) - - Remove the old (FFT based) Bandwidth effect to Reverb and started rewrite it (based on multivoice chorus/unison effect) - -01 Oct 2009 (Paul Nasca) - - Corrected the ADsynth unison LFO rounding function - - Made Unison based on Bandwidth (in cents) parameter - -02 Oct 2009 (Mark McCurry) - - Added OSS failsafe by Jérémie Andréi - -04 Oct 2009 (Mark McCurry) - - fixed Ctest issues - -06 Oct 2009 (Mark McCurry) - - Added first simple profiling test - -08 Oct 2009 (Mark McCurry) - - Started to see if memset/memcpy offer performance benifits when - widely used - - Added basic SUBnote test - -09 Oct 2009 (Mark McCurry) - - Restylized codebase with uncrustify - -28 Oct 2009 (Paul Nasca) - - Disable "bw" control on Reverb when Bandwidth mode is not enabled - -30 Oct 2009 (Mark McCurry) - - Commited first stage of Nio (New IO) WIP - -18 Nov 2009 (Mark McCurry) - - Fixed segfault in VirKeyBoard - -02 Dec 2009 (Paul Nasca) - - Fixed a small typo on Virtual Keyboard - -10 Dec 2009 (Mark McCurry) - - Separated out Presets and arrayed Presets to reduce warnings from - the Wextra flag - - Minor change to Filter_ and FormantFilter to reduce unwanted warnings - -13 Dec 2009 (Mark McCurry) - - Deprecating Output system for the Nio system - - General Code Cleanup - - Adding OpenGL linking for proper compiles - -14 Jan 2010 (Mark McCurry) - - Fixed No UI Flag "-U" as it was previously partially initializing - the gui - -14 Feb 2010 (Stephen Parry) - - DSSI Support Repaired - -14 Feb 2010 (Mark McCurry) - - Made the Echo attempt to adjust the delay instead of erasing it - when length is changed - -02 May 2010 (Mark McCurry) - - Merging in cleanup from effects and adding APhaser by Ryan Billing - -27 Jun 2010 (Mark McCurry) - - Aphaser and Phaser are within same effect now - -17 Aug 2010 (Paul Nasca) - - small bugix on adsynth.cpp - -22 May 2010 (Mark McCurry) - - Mergin Nio backend - -18 Aug 2011 (Mark McCurry) - - Fixing DSSI subsystem - -29 Oct 2011 (Damien Goutte-Gattat) - - Added Bank select midi support - -05 Feb 2012 (Liven Moors) - - Added spike waveform to oscilator options - -06 Feb 2012 (Mark McCurry) - - Adding --exec-after-init option - -22 Feb 2012 (Liven Moors) - - Added circle waveform to oscilator options - -26 Mar 2012 (Mark McCurry) - - Fixed Segfault in Oscillgen - -27 Mar 2012 (Mark McCurry) - - Fixed chorus noise bug - -14 Apr 2012 (Mark McCurry) - - Removed Nio debugging code - -18 Apr 2012 (Jonathan Liles) - - Added Non-session-manager support - -31 Mar 2012 (Olaf Schulz) - - Added Midi aftertouch support - -Please See git log For future information diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.C b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.C deleted file mode 100644 index 8f2e6d94457..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.C +++ /dev/null @@ -1,84 +0,0 @@ -#include "Controller.h" -#include -#include -#include - -pthread_mutex_t mutex; -int Pexitprogram; - -Controller::Controller() { - //init - for(int i = 0; i < 6; ++i) { - pars[i].mode = 1; - pars[i].val1 = 0; - pars[i].val2 = 127; - pars[i].nrpn.cpar = 8; - pars[i].nrpn.fpar = 0; - pars[i].nrpn.cval = 0; - } - pars[0].ctl.par = 71; - pars[1].ctl.par = 74; - pars[2].ctl.par = 10; - pars[3].ctl.par = 11; - pars[4].ctl.par = 1; - pars[5].ctl.par = 75; - - //ALSA init - snd_seq_open(&midi_out, "default", SND_SEQ_OPEN_OUTPUT, 0); - - char portname[50]; sprintf(portname, "Controller"); - int alsaport = snd_seq_create_simple_port( - midi_out, - portname, - SND_SEQ_PORT_CAP_READ - | SND_SEQ_PORT_CAP_SUBS_READ, - SND_SEQ_PORT_TYPE_SYNTH); -} - -Controller::~Controller() { - snd_seq_close(midi_out); -} - -void Controller::sendcontroller(int par, unsigned char val) { - snd_seq_event_t midievent; - snd_seq_ev_clear(&midievent); - - snd_seq_ev_set_controller(&midievent, Pchout, par, val); - - snd_seq_ev_set_subs(&midievent); - snd_seq_ev_set_direct(&midievent); - snd_seq_event_output_direct(midi_out, &midievent); - -// fprintf(stderr,"Controller: %d %d\n",par,val); -} - -void Controller::sendnrpn(int npar, unsigned char val) { -// fprintf(stderr,"NRPN: %d %d %d %d\n",pars[npar].nrpn.cpar,pars[npar].nrpn.fpar,pars[npar].nrpn.cval,val); - - sendcontroller(0x63, pars[npar].nrpn.cpar); - sendcontroller(0x62, pars[npar].nrpn.fpar); - sendcontroller(0x06, pars[npar].nrpn.cval); - sendcontroller(0x26, val); -// fprintf(stderr,"------------\n\n"); -} - -void Controller::send(int npar, float xval) { - if(pars[npar].mode == 0) - return; - int val; - if(pars[npar].val1 <= pars[npar].val2) - val = - (int) (xval - * (pars[npar].val2 - pars[npar].val1 - + 1.0) * 0.9999 + pars[npar].val1); - else - val = - (int) (xval - * (pars[npar].val2 - pars[npar].val1 - - 1.0) * 0.9999 + pars[npar].val1 + 1.0); - switch(pars[npar].mode) { - case 1: sendcontroller(pars[npar].ctl.par, val); break; - //case 2:break; - case 3: sendnrpn(npar, val); break; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.h b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.h deleted file mode 100644 index 5b83744fee5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/Controller.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CONTROLLER_H -#define CONTROLLER_H -#include - -extern pthread_mutex_t mutex; -extern int Pexitprogram; - -class Controller -{ - public: - Controller(); - ~Controller(); - void send(int npar, float xval); - //parameters - unsigned char Pchout; - struct { - unsigned char mode; //0=off,1=ctl,2=RPN,3=NRPN - unsigned char val1, val2; - struct { - unsigned char par; - } ctl; - struct { - unsigned char cpar, fpar, cval; - } nrpn; - } pars[6]; - private: - void sendcontroller(int par, unsigned char val); - void sendnrpn(int npar, unsigned char val); - - snd_seq_t *midi_out; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/ControllerUI.fl b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/ControllerUI.fl deleted file mode 100644 index b83c9c08edd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/ControllerUI.fl +++ /dev/null @@ -1,217 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cxx} -decl {\#include } {selected public -} - -decl {\#include } {public -} - -decl {\#include "Controller.h"} {public -} - -decl {Controller *controller;} {} - -class Pad {: {public Fl_Box} -} { - Function {Pad(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {} {} - } - Function {temp_draw()} {} { - code {/*int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; -float freqx; - -fl_color(FL_BLACK); -fl_rectf(ox,oy,lx,ly); - - - -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); -*/} {} - } - Function {sendmidi(int button,float datax,float datay)} {} { - code {controller->send(button,datax); -controller->send(button+1,datay);} {} - } - Function {handle(int event)} {return_type int - } { - code {int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); - -if ((event==FL_PUSH)||(event==FL_DRAG)){ - if (x_<0) x_=0;if (y_<0) y_=0; - if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; - - float tmpx=(float) x_/(w()); - float tmpy=1.0-(float) y_/h(); - - int b=Fl::event_buttons()>>24; - - if (b&1) sendmidi(0,tmpx,tmpy); - if (b&2) sendmidi(2,tmpx,tmpy); - if (b&4) sendmidi(4,tmpx,tmpy); - -}; - -return(1);} {} - } - decl {int oldx,oldy;} {} -} - -class ControllerUI {} { - Function {make_window()} {} { - Fl_Window controlleruiwindow { - label {Midi Controller} - callback {o->hide(); -exit(0);} - xywh {210 213 340 410} type Double hide - } { - Fl_Counter {} { - label {Output Channel} - callback {controller->Pchout=(int) o->value();} - xywh {10 13 75 22} type Simple labelsize 10 align 5 minimum 0 maximum 15 step 1 textfont 1 - code0 {o->value(controller->Pchout);} - } - Fl_Box {} { - xywh {10 80 320 320} box ENGRAVED_BOX color 176 - class Pad - } - Fl_Choice {} { - callback {nbut=(int) o->value(); -refreshvalues();} - xywh {10 50 75 20} down_box BORDER_BOX - } { - MenuItem {} { - label {But.1 X} - xywh {0 0 100 20} labelfont 1 labelsize 12 - } - MenuItem {} { - label {But.1 Y} - xywh {10 10 100 20} labelfont 1 labelsize 12 divider - } - MenuItem {} { - label {But.2 X} - xywh {10 10 100 20} labelfont 1 labelsize 12 - } - MenuItem {} { - label {But.2 Y} - xywh {20 20 100 20} labelfont 1 labelsize 12 divider - } - MenuItem {} { - label {But.3 X} - xywh {20 20 100 20} labelfont 1 labelsize 12 - } - MenuItem {} { - label {But.3 Y} - xywh {30 30 100 20} labelfont 1 labelsize 12 - } - } - Fl_Group ctlgroup { - xywh {95 35 60 40} box ENGRAVED_BOX - } { - Fl_Counter ctlcounter { - label Controller - callback {controller->pars[nbut].ctl.par=(int) o->value();} - xywh {100 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 - } - } - Fl_Choice modechoice { - label Mode - callback {controller->pars[nbut].mode=(int) o->value(); -refreshvalues();} - xywh {95 13 60 20} down_box BORDER_BOX labelsize 10 align 5 - } { - MenuItem {} { - label OFF - xywh {30 30 100 20} labelfont 1 labelsize 12 - } - MenuItem {} { - label {Ctl.} - xywh {20 20 100 20} labelfont 1 labelsize 12 - } - MenuItem {} { - label RPN - xywh {30 30 100 20} labelfont 1 labelsize 12 deactivate - } - MenuItem {} { - label NRPN - xywh {40 40 100 20} labelfont 1 labelsize 12 - } - } - Fl_Group nrpngroup { - xywh {160 35 170 40} box ENGRAVED_BOX - } { - Fl_Counter cparcounter { - label {CoarseP.} - callback {controller->pars[nbut].nrpn.cpar=(int) o->value();} - xywh {165 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 - } - Fl_Counter fparcounter { - label {FineP.} - callback {controller->pars[nbut].nrpn.fpar=(int) o->value();} - xywh {220 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 - } - Fl_Counter cvalcounter { - label {CoarseV.} - callback {controller->pars[nbut].nrpn.cval=(int) o->value();} - xywh {275 50 50 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textfont 1 textsize 12 - } - } - Fl_Counter val1counter { - label {Val.1} - callback {controller->pars[nbut].val1=(int) o->value();} - xywh {190 15 50 15} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 12 - } - Fl_Counter val2counter { - label {Val.2} - callback {controller->pars[nbut].val2=(int) o->value();} - xywh {275 15 50 15} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 12 - } - Fl_Button exchangebutton { - label {<->} - callback {unsigned char tmp=controller->pars[nbut].val2; -controller->pars[nbut].val2=controller->pars[nbut].val1; -controller->pars[nbut].val1=tmp; -refreshvalues();} - xywh {245 15 25 15} box THIN_UP_BOX - } - } - } - Function {refreshvalues()} {} { - code {modechoice->value(controller->pars[nbut].mode); -val1counter->value(controller->pars[nbut].val1); -val2counter->value(controller->pars[nbut].val2); -ctlcounter->value(controller->pars[nbut].ctl.par); -cparcounter->value(controller->pars[nbut].nrpn.cpar); -fparcounter->value(controller->pars[nbut].nrpn.fpar); -cvalcounter->value(controller->pars[nbut].nrpn.cval); - -if (controller->pars[nbut].mode!=0){ - val1counter->activate(); - val2counter->activate(); - exchangebutton->activate(); -}else{ - val1counter->deactivate(); - val2counter->deactivate(); - exchangebutton->deactivate(); -}; - -if (controller->pars[nbut].mode==1) ctlgroup->activate(); - else ctlgroup->deactivate(); - -if (controller->pars[nbut].mode==3) nrpngroup->activate(); - else nrpngroup->deactivate();} {} - } - Function {ControllerUI(Controller *controller_)} {} { - code {nbut=0; -controller=controller_; -make_window(); -refreshvalues(); -controlleruiwindow->show();} {} - } - decl {int nbut;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/main.C b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/main.C deleted file mode 100644 index 6018dc73d61..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Controller/main.C +++ /dev/null @@ -1,16 +0,0 @@ -#include "Controller.h" -#include "ControllerUI.h" - -pthread_t thr1, thr2; -Controller controller; - - - -main() -{ - ControllerUI *controllerUI = new ControllerUI(&controller); - - Fl::run(); - - delete controllerUI; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.C b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.C deleted file mode 100644 index bf567ffd4ad..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.C +++ /dev/null @@ -1,82 +0,0 @@ -//Copyright (c) 2002-2003 Nasca Octavian Paul -//License: GNU GPL 2 - -#include "Spliter.h" -#include - -pthread_mutex_t mutex; -int Pexitprogram; - -Spliter::Spliter() { - //init - Psplitpoint = 60; - Pchin = 0; - Pchout1 = 0; - Pchout2 = 1; - Poct1 = 0; - Poct2 = 0; - //ALSA init - snd_seq_open(&midi_in, "default", SND_SEQ_OPEN_INPUT, 0); - snd_seq_open(&midi_out, "default", SND_SEQ_OPEN_OUTPUT, 0); - - char portname[50]; sprintf(portname, "Spliter IN"); - int alsaport = snd_seq_create_simple_port( - midi_in, - portname, - SND_SEQ_PORT_CAP_WRITE - | SND_SEQ_PORT_CAP_SUBS_WRITE, - SND_SEQ_PORT_TYPE_SYNTH); - sprintf(portname, "Spliter OUT"); - alsaport = snd_seq_create_simple_port( - midi_out, - portname, - SND_SEQ_PORT_CAP_READ - | SND_SEQ_PORT_CAP_SUBS_READ, - SND_SEQ_PORT_TYPE_SYNTH); -} - -Spliter::~Spliter() { - snd_seq_close(midi_in); - snd_seq_close(midi_out); -} - -// This splits the Midi events from one channel to another two channels -void Spliter::midievents() { - snd_seq_event_t *midievent; - midievent = NULL; - snd_seq_event_input(midi_in, &midievent); - - if(midievent == NULL) - return; - if((midievent->type == SND_SEQ_EVENT_NOTEON) - || (midievent->type == SND_SEQ_EVENT_NOTEOFF)) { - int cmdchan = midievent->data.note.channel; - if(cmdchan == Pchin) { - snd_seq_ev_set_subs(midievent); - snd_seq_ev_set_direct(midievent); - if(midievent->data.note.note < Psplitpoint) { - midievent->data.note.channel = Pchout1; - int tmp = midievent->data.note.note; - tmp += Poct1 * 12; if(tmp > 127) - tmp = 127; if(tmp < 0) - tmp = 0; - midievent->data.note.note = tmp; - } - else { - midievent->data.note.channel = Pchout2; - int tmp = midievent->data.note.note; - tmp += Poct2 * 12; if(tmp > 127) - tmp = 127; if(tmp < 0) - tmp = 0; - midievent->data.note.note = tmp; - } - snd_seq_event_output_direct(midi_out, midievent); - } - else { - snd_seq_ev_set_subs(midievent); - snd_seq_ev_set_direct(midievent); - snd_seq_event_output_direct(midi_out, midievent); - } - } - snd_seq_free_event(midievent); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.h b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.h deleted file mode 100644 index 9b5b83b1b8f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/Spliter.h +++ /dev/null @@ -1,27 +0,0 @@ -//Copyright (c) 2002-2003 Nasca Octavian Paul -//License: GNU GPL 2 - -#ifndef SPLITER_H -#define SPLITER_H -#include -#include - -extern pthread_mutex_t mutex; -extern int Pexitprogram; - -class Spliter -{ - public: - Spliter(); - ~Spliter(); - void midievents(); - - //parameters - unsigned char Psplitpoint; - unsigned char Pchin, Pchout1, Pchout2; - signed char Poct1, Poct2; - private: - snd_seq_t *midi_in, *midi_out; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/SpliterUI.fl b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/SpliterUI.fl deleted file mode 100644 index 7a8b4483648..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/SpliterUI.fl +++ /dev/null @@ -1,70 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0102 -header_name {.h} -code_name {.cxx} -decl {//Copyright (c) 2002-2003 Nasca Octavian Paul} {selected -} - -decl {//License: GNU GPL 2} {} - -decl {\#include } {public -} - -decl {\#include "Spliter.h"} {public -} - -class SpliterUI {} { - Function {make_window()} {open - } { - Fl_Window spliteruiwindow { - label {Midi Spliter} - callback {o->hide(); -exit(0);} - xywh {225 187 375 72} hide - } { - Fl_Counter {} { - label {Split note} - callback {spliter->Psplitpoint=(int) o->value();} - xywh {93 27 114 24} labelsize 12 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 16 - code0 {o->value(spliter->Psplitpoint);} - code1 {o->lstep(12);} - } - Fl_Counter {} { - label {Input Channel} - callback {spliter->Pchin=(int) o->value();} - xywh {6 30 69 18} type Simple labelsize 10 align 5 minimum 0 maximum 15 step 1 textfont 1 - code0 {o->value(spliter->Pchin);} - } - Fl_Counter {} { - label {Output Channel 1} - callback {spliter->Pchout1=(int) o->value();} - xywh {285 18 69 18} type Simple labelsize 10 align 5 minimum 0 maximum 15 step 1 textfont 1 - code0 {o->value(spliter->Pchout1);} - } - Fl_Counter {} { - label {Output Channel 2} - callback {spliter->Pchout2=(int) o->value();} - xywh {285 36 69 18} type Simple labelsize 10 align 6 minimum 0 maximum 15 step 1 textfont 1 - code0 {o->value(spliter->Pchout2);} - } - Fl_Counter {} { - label {Tr.1(oct.)} - callback {spliter->Poct1=(int) o->value();} - tooltip {Transpose (octaves)} xywh {225 18 48 18} type Simple labelsize 10 align 5 minimum -8 maximum 8 step 1 textfont 1 - code0 {o->value(spliter->Poct1);} - } - Fl_Counter {} { - label {Tr.2(oct.)} - callback {spliter->Poct2=(int) o->value();} - tooltip {Transpose (octaves)} xywh {225 36 48 18} type Simple labelsize 10 align 6 minimum -8 maximum 8 step 1 textfont 1 - code0 {o->value(spliter->Poct2);} - } - } - } - Function {SpliterUI(Spliter *spliter_)} {} { - code {spliter=spliter_; -make_window(); -spliteruiwindow->show();} {} - } - decl {Spliter *spliter;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/main.C b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/main.C deleted file mode 100644 index 464f8bd9be0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/main.C +++ /dev/null @@ -1,37 +0,0 @@ -//Copyright (c) 2002-2003 Nasca Octavian Paul -//License: GNU GPL 2 - -#include -#include "Spliter.h" -#include "SpliterUI.h" - -pthread_t thr1, thr2; -Spliter spliter; - -void *thread1(void *arg) { - Fl::run(); - return 0; -} -void *thread2(void *arg) { - while(Pexitprogram == 0) - spliter.midievents(); - return 0; -} - - -main() -{ - Pexitprogram = 0; - SpliterUI *spliterUI = new SpliterUI(&spliter); - - pthread_mutex_init(&mutex, NULL); - pthread_create(&thr1, NULL, thread1, NULL); - pthread_create(&thr2, NULL, thread2, NULL); - - while(Pexitprogram == 0) { - usleep(100000); - } - - pthread_mutex_destroy(&mutex); - delete spliterUI; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/readme.txt b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/readme.txt deleted file mode 100644 index 10a78cc0903..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/Spliter/readme.txt +++ /dev/null @@ -1,15 +0,0 @@ -Spliter ------- - -This program splits the keyboard and alows you to play two instruments same time. You can use this program with ZynAddSubFX or any other synthesizer. -This requires ALSA 0.9.x. - -To compile it, run "make". -If you want to use with ZynAddSubFX send the midi events thru Spliter with aconnect like this: - - - connect the keyboard port to "Spliter IN" port - - connect the "Spliter OUT" to ZynAddSubFX - - change the midi channels that you want to play. Be sure that the both output channels are enabled and receive NoteOn in ZynAddSubFX. - -If you change some settings from Spliter while you are playing to keyboard you may ecounter "stucked keys". To clear all theese press to "Panic" button from ZynAddSubFX. - diff --git a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/readme.txt b/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/readme.txt deleted file mode 100644 index 965bad38075..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/ExternalPrograms/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -These are external programs, which can use with ZynAddSubFX or any other midi device. More information is in the documentation (html - webpages). - diff --git a/plugins/zynaddsubfx/zynaddsubfx/FAQ.txt b/plugins/zynaddsubfx/zynaddsubfx/FAQ.txt deleted file mode 100644 index c774ef3d175..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/FAQ.txt +++ /dev/null @@ -1,27 +0,0 @@ - Frequently Asked Questions - -------------------------- - -Q1) What means "ZynAddSubFX" ? -A1) The name of the program comes from 4 words: - 1) Synthesizer ('S'->'Z') --> Zyn - ^^^ - 2) Additive Synthesis ------> Add - ^^^ - 3) Subtractive Synthesis ---> Sub - ^^^ - 4) Effects ----------------> FX - - So, ZynAddSubFX is a SYNthesizer with ADDitive, SUBtractive engines and effects. - - -Q2) How can I load files from older versions of ZynAddSubFX (like *.mas_zyn,etc) -A2) You need to convert them into new format. Please use 2.0.0pre1 or (recommended) 2.0.0pre2 versions of ZynAddSubFX to load old file formants and save them in the new formats - - -Q3) How can I change the number of parts, voices to ADSynth, effects, etc. ? -A3) Look in src/globals.h and change there these values. You don't have to change anything else, just recompile all. But most settings must be below 128. As the rule of the thumb if a setting is 128 or below 128, please don't make it bigger than 128. Anyway, I don't believe that you'll need more than 128 for these settings; for example you don't need 128(or more) effects same time? That's why I put the limit of 128 (using 7 bits of char). - - -Q4) How do I enable Jack support on ZynAddSubFX ? -A4) If your system has the jack libraries installed, ZynAddSubFX should automatically build with jack support. It is highly recommended that the Jack samplerate to be equal to ZynAddSubFX samplerate (SAMPLE_RATE from globals.h), otherwise the resampling will be done and this will decrease the quality a bit. - diff --git a/plugins/zynaddsubfx/zynaddsubfx/HISTORY.txt b/plugins/zynaddsubfx/zynaddsubfx/HISTORY.txt deleted file mode 100644 index 2631914ef12..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/HISTORY.txt +++ /dev/null @@ -1,239 +0,0 @@ -2.4.4 (28 Jun 2014) - - Add UI Mousewheel Support - - Add Spectral Adjust Parameter Rescaling - - Add Subnote filter smoothing - - Add Unison derandomization options - - Add NSM import/export - - Add NTK UI compatiability - - (re)Add OSX Support - - Enhance performance of ADnote and SUBnote - - Enhance Installer - - Fix JACK2 specific segfault - - Fix possible DSSI specific segfaults - - Fix Unison Regressions - - Documentation additions - - Misc bug fixes - - -2.4.3 (15 Jun 2012) - - Non-session manager support - - Midi aftertouch support - - Documentation additions - - Somewhat more sane Nio defaults - - Misc bug fixes - -2.4.2 (26 Feb 2012) - - New IO backend support - - MIDI bank select - - Spike/Circle waveform - - Faster subsynth - - --exec-after-init flag - - Version information compiled in - - Misc Bug fixes - -2.4.1 (27 Jun 2010) - - Azerty layout - - XML bug fixes - - Vibrato/Unison additions - - Reverb rewrite - - DSSI support enabled - - Adding APhaser - - other bugfixes - - code cleanup - -2.4.0 (21 Jun 2009) - - extended mono functionality - - legato mode - - export functionality on PADsynth - - inclusion of LASH client - - inclusion of DSSI audio output - - enabled tooltips for knobs (both description and value tooltips) - - added support for newer JACK api - - added quertz support for virtual keyboard - - started to encorperate cxxtest for unit testing - - many bugfixes - - code cleanup - -2.2.1 (28 Apr 2005) - - made to work with mxml-2.2 (will NOT work on older versions) - - it is possible to remove completely the graphical user interface (e.g. it can run without X). For this you need to modify the DISABLE_GUI option from the Makefile.inc - - added a commandline -L which load a instrument (.xiz) - now it only loads to part 0 (you can use this option with -l to load a master file and after this the option -L to replace the part) - -2.2.0 (8 Apr 2005) - - the VST version of ZynAddSubFX is removed from the instalation until it will be more stable (hope soon :) ) - - now, the instrument banks contains over 300 high quality instruments - - added "Apply" a button from OscilGen window for PADsynth - - added another parameter to ADsynth that controls the amount of all detunes of voices - - adaptive harmonics postprocess - - improved the VU-meter and added a RMS plot - - Dvorak support for Virtual Keyboard - - many bugs fixed and code cleanups - -2.1.1 (2 Oct 2004) - - Removed a big bug that prevented changing the part -2.1.0 (1 Oct 2004) - - Added a installer for windows (thanks to NSIS installer ( http://nsis.sourceforge.net/ ) ). Both VST and standalone vesions are contained in the same installer. - - Added a new user interface for beginners. You can switch the current user interface with that anytime do you want. - - All parts, effects, etc. are counted from '1' and not from '0' - - Added the posibility to compile the OSS and JACK support in the same binary (look in the Makefile.inc) - - VST host should be able to save all zynaddsubfx parameters into their setups (this is untested) - - Bugfixes and other - -2.0.0 (27 Aug 2004) - - VST version works (there are some issues/bugs but it works) - - Added a advanced Clipboard and Preset module - now is possible to add user preset LFOs,Envelopes, Effects, Oscillators, Resonances, Filters, etc. - - Completely removed the *.MAS_ZYN formats (masters, instruments,etc) support; use 2.0.0pre1 and 2.0.0pre2 to convert - - Corrected a error to pitch bend on VST plugin (thanks to Krzysztof Korpiela) - - Impoved the PADsynth module - - Because the PADsynth module takes a time to load, the instrument that contains such modules are shown in different colors - - Bugfixes - - Other - -2.0.0_pre2 (31 Iul 2004) - - Updated the XMLwrapper to mxml-2.0 - - Many bugfixes - - Other - -2.0.0_pre1 (17 Iul 2004) - - Added a new powerful synth engine which is called PADsynth, you can make very beautifull pads and even some strange sounds - - Now is used the XML format for all zynaddsubfx parameters(.XMZ for master parameters, .XIZ for instrument parameters and .XSZ for scale parameters).You can import older parameters. All parameters files are compressed with gzip algorithm. - - Some parameters has changed and you might ecounter different sounds that you saved in the older versions of zynaddsubfx - - The instrument banks are no longer single files, but directories that contains instrument .XIZ files (you can organize them even with a file manager). Also, you can use more than 1 banks easily. - - Added a new effect called DynamicFilter that allows you to do WahWah,AutoWah, VocalMorpher and other effects - - Speedups - - Started to write a small sequencer that allows to load and play a midi file from zynaddsubfx (unfinished) - - ZynAddSubFX is available from CVS, too. Please look at the sourceforge project page to get more information ( http://sourceforge.net/projects/zynaddsubfx ) - - The waveform generator (OscilGen) has many new parameters :) also if you press the "Shift" key, you can draw the hamonics amplitude/phases - - Many user interface improvements - - You can load a file at the start of the program with "-l" command-line parameter and you can run zynaddsubfx w/o user interface with "-U" - - It is possible to dump all MIDI notes into a text file - - The instruments can contain comments and copyright information in order to encourage sharing of them - - FFT3W library is supported - - More "randomness" options - - Other impovements - - Many, many bugfixes - - Added the full changelog (since I started to write zynaddsubfx), most is in Romanian - - Other things - -1.4.3 (31 Aug 2003) - - added state variable filters and other types to analog filters - - small user interface improvememnts - - small bugfixes - -1.4.2 (17 Iul 2003) - - added full-featured, advanced formantic filters - - added mixer panel which lets you to see/change most important part settings, and shows a vu-meters for each part - - you can choose to process the instrument's kit items only with one Part effect (eg. you can make a instrument kit that contains a reverberated piano and flanged strings) - - enabled to launch more instances in Jack - - when is launched first time, it searches for default.bnk_zyn file into /usr/share/zynaddsubfx and /usr/local/share/zynaddsubfx directories (useful for binary packages for Linux distributions) - - bugfixes - -1.4.1 (8 May 2003) - - added single mode to the instrument kit who alows only one item to be played same time - - added "Spectrum Adjust" to the ADsynth oscillator - - added "drum mode" to the instrument, where all midi keys are mapped to 12tET - - added a parameter to the "440Hz" which make the freq to varies a bit according to the key pressed (very usefull to toms and other drums) - - (for OSS audio out) if it is launched with root privileges, the synth will gain realtime scheduling priority - - bugfixes - -1.4.0 (15 Apr 2003) - - added instrument's own effect (effects that are loaded/saved with the instrument) - - FreeMode Envelopes: all Envelopes can have any shape (not only ADSR) - - Added instrument kits: It is possible to use more than one instruments into one part (used for layered synths or drum kits) - - Amplitude envelopes can be linear or logarithmic - - added interpolation on the Resonance user interface - - user interface improvements and cleanups of it's code - - initiated a mailing list to allow users to share patches for ZynAddSubFX. Please share your ZynAddSubFX patches; look at http://lists.sourceforge.net/mailman/listinfo/zynaddsubfx-user for more information about the mailing list. - -1.2.1 (6 Apr 2003) - - improved filter interpolation - - bugfix: wav header is written correctly - - bugfix: NRPN works correctly (eg:the controller was 0x98 instead of 98), now you can controll all effects parametrer realtime via MIDI - - bugfix: pitch bend works OK in windows - - added master fine detune (-64..63 cents) - - it is possible to swap effects or copy them - - started to port ZynAddSubFX to VST (not functional, yet) - - the resonace can protect the fundamental freq. against damping - -1.2.0 (21 Mar 2003) - - ZynAddSubFX is ported to Windows ;-) - - added internal Virtual Keyboard - - added Configuration window - - added frequency tracking to filter - - improved the OscilGen (harmonic filter, RMS normalisation, etc..) - - improved the recorder (uses the WAV file format and it starts only when a key is pressed) - - added filter interpolation if the frequency is changed very fast (it removes some annoying clicks) - - other improovements, bugfixes, speedups and cleanups of the code - -1.0.9 (24 Feb 2003) - - added keylimit to Part - - you can use multiple filter stages in order to make very steep filter rolloffs (eg. 48 dB/octave) - - ADsynth - added noise mode and you can make fixed frequencies; added the "Punch" parameter - - added an external program "Controller" which enables you to use the mouse for MIDI controllers - - other improvements and bugfixes - -1.0.8 (14 Feb 2003) - - added mono mode and portamento - - added the EQ effect - - the output of a system effect can be sent to others system effects - - minor bugfixes and improvements - -1.0.7 (7 Feb 2003) - - some settings (like samplerate) are set at runtime (by comand line) - - added Distorsion effect - - added controllers, and NRPNs for changing all effects parameters by midi - - bugs removed and other improvements - -1.0.6 (30 Jan 2003) - - Added JACK output ;-) - - Minor improvements and bugfixes - -1.0.5 (24 Jan 2003) - - The bug that crashed ZynAddSubFX if you change some effect parameters, it is realy removed (I forgot to update the file before upload) - - Other bugfixes and code cleanups - - Added a Global Filter to SubSynth - - Added keyresponse limits to Part - - Added presets to Effects - - The fade is smaller on high frequecy content and larger on low frequecies; so you'll don't hear starting clicks on basses and audible fadeins on higher pitched sounds - - Added tunnings to Reverb: you can choose Random of Freeverb - -1.0.4 (7 Jan 2003) - - It is possible to load Scala (.scl and .kbm) files - - Added mapping from note number to scale degree is possible to load Scala kbm files - - Corrected small bugs related to Microtonal - - If you want to use ZynAddSubFX with OSS (or you don't have ALSA) you can modify the Makefile.inc file to compile with OSS only. - - It is shown the real detune (in cents) - - Made a new widget that replaces the Dial widget - - Removed a bug that crashed ZynAddSubFX if you change some effect parameters - -1.0.3 (23 Dec 2002) - - small bugfixes: "Bypass Global Filter" from ADnoteUI dissapears sometimes ; - removed the low amplitude noise produced by the reverb; - if you "acconect" zynaddsubfx with aseqview no note was processed a long time. - - added Notch Filter - - added the option to randomize the ressonance function - - added VU-Meter - - Change the Insertion effect modes behaves (it sounds a bit louder) - - Added to the project an external program called Spliter that splits the - keyboard and alows you to play two instruments same time. You can use this - program with ZynAddSubFX or any other synthesizer. - - Added a new function to OscilGen - -1.0.2-1 (13 Dec 2002) - - bug found and removed: sometimes when Master/Instrument is saved, the synth crashed - -1.0.2 (13 Dec 2002) - - Added instrument banks - - the BandPass Filter's output amplitude was increased - - few fixes of FFTwrapper. See the documentation from "FFTwrapper.h" if you got error messages. - -1.0.1 (6 Dec 2002) - - corrected a bug that made ZynAddSubFX to crash(sometimes) if you disable a part - - wrote Resonance - - added the BandPass filter - - added the recording feature - - added "New instrument" menuitem - -1.0.0 (25 Sep 2002) - - first release, done a lot before it :-) - diff --git a/plugins/zynaddsubfx/zynaddsubfx/README.txt b/plugins/zynaddsubfx/zynaddsubfx/README.txt deleted file mode 100644 index 76b56c6a4ab..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/README.txt +++ /dev/null @@ -1,86 +0,0 @@ -ZynAddSubFX ------------ -It is a realtime software synthesizer for Linux and Windows with many features. Please see the docs for details. -Copyright (c) 2002-2014 Nasca Octavian Paul and others contributors -e-mail: zynaddsubfx AT yahoo D0T com -ZynAddSubFX is free program and is distributed WITH NO WARRANTY. It is licensed under GNU General Public License version 2 (and only version 2) - see the file COPYING. - - --==## PLEASE SHARE YOUR INSTRUMENTS/MASTER SETTINGS ##==-- - --==## MADE WITH ZynAddSubFX ##==-- - Here is the mailing list where you can share your patches with others: - http://lists.sourceforge.net/mailman/listinfo/zynaddsubfx-user - - -The project page is - http://sourceforge.net/projects/zynaddsubfx - or - http://zynaddsubfx.sourceforge.net - -ZynAddSubFX is also available on many Internet sites like: - http://www-ccrma.stanford.edu/planetccrma/software/soundapps.html (Planet CCRMA) - http://www.hitsquad.com/smm/programs/ZynAddSubFX/ - http://freshmeat.net/projects/zynaddsubfx/ - http://ibiblio.org/pub/Linux/apps/sound/midi/ - or search "ZynAddSubFX" on a search engine (like www.google.com). - - -Requirements: -------------- -- a fast computer -- Linux or Windows -- FFTW 3.x.x - necessary for Fast Fourier computations -- MXML-2.5 or more recent library from www.minixml.org -- zlib library from http://www.zlib.org -- (for Linux) OpenSoundSystem (OSS) (if you don't have ALSA, only) -- (for Windows) pthreads, portaudio - -Not required, but recommended: ------------------------------- -- FLTK 1.x.x (tested with fltk 1.1.0, 1.1.1, 1.1.2,etc.) -- ALSA 0.9.x or later (with OSS emulation, if you don't use JACK) -- JACK -- a VST host for the VST version [For more information see: - http://www.kvraudio.com/forum/viewtopic.php?t=268277&sid=95be0b6c9909300d566006428bcbb97d] - -Compilation: ------------- - For the main program see doc/build.txt. - To compile the Spliter, run "make" from the "Spliter" directory. - To compile the Controller, run "make" from the "Controller" directory. - -Running on LINUX ----------------- -Under linux there are several options for both audio output and MIDI input. -Defaults are set at compile time and the desired backend can be set when starting ZynAddSubFX with the '-I' and '-O' options. -The currently supported backends are: - -- Audio Output - * ALSA (Advanced Linux Sound Architecture) - * OSS (Open Sound System) - * JACK (JACK Audio Connection Kit) - * Port Audio - -- MIDI Input - * ALSA - * OSS - * JACK - -Running on WINDOWS ------------------- -NOTE: At this time only older versions of ZynAddSubFX were compiled on windows - See older versions on sf.net (ie version 2.2.1) - If you launch zynaddsubfx.exe and nothing happens, you need pthreadGC.dll in the same directory (or windows directory). The dll files are distribuited with ZynAddSubFX windows binaries. - It might be possible that the latency will be very high. If this happens, you have to set the environment variable PA_MIN_LATENCY_MSEC to a value that represents the latency in miliseconds. - Eg: (in autoexec.bat or launched before running ZynAddSubFX) "set PA_MIN_LATENCY_MSEC=50" - Warning: if the value is too low, you might encounter severe dropouts on ZynAddSubFX. You'll have to set to a higher value and turn off automated background tasks (like virus scanners, email clients, etc.). - If you have more cards, you can select the desired card where you can play audio with the environment variable "PA_RECOMMENDED_OUTPUT_DEVICE" - Eg: "set PA_RECOMMENDED_OUTPUT_DEVICE=1" - A better way to set all of this, I will put on next versions. - - -Please send me instruments,banks,master settings,songs(midi+...xmz files) done with ZynAddSubFX. I'll appreciate this. - - -Have fun! :-) - ---The ZynAddSubFX team diff --git a/plugins/zynaddsubfx/zynaddsubfx/bugs.txt b/plugins/zynaddsubfx/zynaddsubfx/bugs.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindAlsa.cmake b/plugins/zynaddsubfx/zynaddsubfx/cmake/FindAlsa.cmake deleted file mode 100644 index 23003b39cd2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindAlsa.cmake +++ /dev/null @@ -1,69 +0,0 @@ -# Alsa check, based on libkmid/configure.in.in. -# Only the support for Alsa >= 0.9.x was included; 0.5.x was dropped (but feel free to re-add it if you need it) -# It defines ... -# It offers the following macros: -# ALSA_CONFIGURE_FILE(config_header) - generate a config.h, typical usage: -# ALSA_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-alsa.h) -# ALSA_VERSION_STRING(version_string) looks for alsa/version.h and reads the version string into -# the first argument passed to the macro - -# Copyright (c) 2006, David Faure, -# Copyright (c) 2007, Matthias Kretz -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -include(CheckIncludeFiles) -include(CheckIncludeFileCXX) -include(CheckLibraryExists) - -# Already done by toplevel -find_library(ASOUND_LIBRARY asound) -set(ASOUND_LIBRARY_DIR "") -if(ASOUND_LIBRARY) - get_filename_component(ASOUND_LIBRARY_DIR ${ASOUND_LIBRARY} PATH) -endif(ASOUND_LIBRARY) - -check_library_exists(asound snd_seq_create_simple_port "${ASOUND_LIBRARY_DIR}" HAVE_LIBASOUND2) -if(HAVE_LIBASOUND2) - message(STATUS "Found ALSA: ${ASOUND_LIBRARY}") -else(HAVE_LIBASOUND2) - message(STATUS "ALSA not found") -endif(HAVE_LIBASOUND2) -set(ALSA_FOUND ${HAVE_LIBASOUND2}) - -find_path(ALSA_INCLUDES alsa/version.h) - -macro(ALSA_VERSION_STRING _result) - # check for version in alsa/version.h - if(ALSA_INCLUDES) - file(READ "${ALSA_INCLUDES}/alsa/version.h" _ALSA_VERSION_CONTENT) - string(REGEX REPLACE ".*SND_LIB_VERSION_STR.*\"(.*)\".*" "\\1" ${_result} ${_ALSA_VERSION_CONTENT}) - else(ALSA_INCLUDES) - message(STATUS "ALSA version not known. ALSA output will probably not work correctly.") - endif(ALSA_INCLUDES) -endmacro(ALSA_VERSION_STRING _result) - - -get_filename_component(_FIND_ALSA_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -macro(ALSA_CONFIGURE_FILE _destFile) - check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) - check_include_files(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H) - - check_include_files(linux/awe_voice.h HAVE_LINUX_AWE_VOICE_H) - check_include_files(awe_voice.h HAVE_AWE_VOICE_H) - check_include_files(/usr/src/sys/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H) - check_include_files(/usr/src/sys/gnu/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H) - - check_include_file_cxx(sys/asoundlib.h HAVE_SYS_ASOUNDLIB_H) - check_include_file_cxx(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H) - - check_library_exists(asound snd_pcm_resume "${ASOUND_LIBRARY_DIR}" ASOUND_HAS_SND_PCM_RESUME) - if(ASOUND_HAS_SND_PCM_RESUME) - set(HAVE_SND_PCM_RESUME 1) - endif(ASOUND_HAS_SND_PCM_RESUME) - - configure_file(${_FIND_ALSA_MODULE_DIR}/config-alsa.h.cmake ${_destFile}) -endmacro(ALSA_CONFIGURE_FILE _destFile) - -mark_as_advanced(ALSA_INCLUDES ASOUND_LIBRARY) diff --git a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindCxxTest.cmake b/plugins/zynaddsubfx/zynaddsubfx/cmake/FindCxxTest.cmake deleted file mode 100644 index 937142b58a9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindCxxTest.cmake +++ /dev/null @@ -1,200 +0,0 @@ -# - Find CxxTest -# Find the CxxTest suite and declare a helper macro for creating unit tests -# and integrating them with CTest. -# For more details on CxxTest see http://cxxtest.tigris.org -# -# INPUT Variables -# -# CXXTEST_USE_PYTHON [deprecated since 1.3] -# Only used in the case both Python & Perl -# are detected on the system to control -# which CxxTest code generator is used. -# Valid only for CxxTest version 3. -# -# NOTE: In older versions of this Find Module, -# this variable controlled if the Python test -# generator was used instead of the Perl one, -# regardless of which scripting language the -# user had installed. -# -# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3) -# Specify a list of options to pass to the CxxTest code -# generator. If not defined, --error-printer is -# passed. -# -# OUTPUT Variables -# -# CXXTEST_FOUND -# True if the CxxTest framework was found -# CXXTEST_INCLUDE_DIRS -# Where to find the CxxTest include directory -# CXXTEST_PERL_TESTGEN_EXECUTABLE -# The perl-based test generator -# CXXTEST_PYTHON_TESTGEN_EXECUTABLE -# The python-based test generator -# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3) -# The test generator that is actually used (chosen using user preferences -# and interpreters found in the system) -# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3) -# The full path to the Perl or Python executable on the system -# -# MACROS for optional use by CMake users: -# -# CXXTEST_ADD_TEST( ) -# Creates a CxxTest runner and adds it to the CTest testing suite -# Parameters: -# test_name The name of the test -# gen_source_file The generated source filename to be -# generated by CxxTest -# input_files_to_testgen The list of header files containing the -# CxxTest::TestSuite's to be included in -# this runner -# -# #============== -# Example Usage: -# -# find_package(CxxTest) -# if(CXXTEST_FOUND) -# include_directories(${CXXTEST_INCLUDE_DIR}) -# enable_testing() -# -# CXXTEST_ADD_TEST(unittest_foo foo_test.cc -# ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h) -# target_link_libraries(unittest_foo foo) # as needed -# endif() -# -# This will (if CxxTest is found): -# 1. Invoke the testgen executable to autogenerate foo_test.cc in the -# binary tree from "foo_test.h" in the current source directory. -# 2. Create an executable and test called unittest_foo. -# -# #============= -# Example foo_test.h: -# -# #include -# -# class MyTestSuite : public CxxTest::TestSuite -# { -# public: -# void testAddition( void ) -# { -# TS_ASSERT( 1 + 1 > 1 ); -# TS_ASSERT_EQUALS( 1 + 1, 2 ); -# } -# }; -# - -#============================================================================= -# Copyright 2008-2010 Kitware, Inc. -# Copyright 2008-2010 Philip Lowman -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# Version 1.4 (11/18/10) (CMake 2.8.4) -# Issue 11384: Added support to the CXX_ADD_TEST macro so header -# files (containing the tests themselves) show up in -# Visual Studio and other IDEs. -# -# Version 1.3 (8/19/10) (CMake 2.8.3) -# Included patch by Simone Rossetto to check if either Python or Perl -# are present in the system. Whichever intepreter that is detected -# is now used to run the test generator program. If both interpreters -# are detected, the CXXTEST_USE_PYTHON variable is obeyed. -# -# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying -# options to the CxxTest code generator. -# Version 1.2 (3/2/08) -# Included patch from Tyler Roscoe to have the perl & python binaries -# detected based on CXXTEST_INCLUDE_DIR -# Version 1.1 (2/9/08) -# Clarified example to illustrate need to call target_link_libraries() -# Changed commands to lowercase -# Added licensing info -# Version 1.0 (1/8/08) -# Fixed CXXTEST_INCLUDE_DIRS so it will work properly -# Eliminated superfluous CXXTEST_FOUND assignment -# Cleaned up and added more documentation - -#============================================================= -# CXXTEST_ADD_TEST (public macro) -#============================================================= -macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname) - set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_outfname}) - - add_custom_command( - OUTPUT ${_cxxtest_real_outfname} - DEPENDS ${ARGN} - COMMAND ${CXXTEST_TESTGEN_INTERPRETER} - ${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN} - ) - - set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true) - add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname} ${ARGN}) - - if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) - add_test(${_cxxtest_testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_cxxtest_testname}) - elseif(EXECUTABLE_OUTPUT_PATH) - add_test(${_cxxtest_testname} ${EXECUTABLE_OUTPUT_PATH}/${_cxxtest_testname}) - else() - add_test(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname}) - endif() - -endmacro(CXXTEST_ADD_TEST) - -#============================================================= -# main() -#============================================================= -if(NOT DEFINED CXXTEST_TESTGEN_ARGS) - set(CXXTEST_TESTGEN_ARGS --error-printer) -endif() - -find_package(PythonInterp QUIET) -find_package(Perl QUIET) - -find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h) -find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE - NAMES cxxtestgen cxxtestgen.py - PATHS ${CXXTEST_INCLUDE_DIR}) -find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl - PATHS ${CXXTEST_INCLUDE_DIR}) - -if(PYTHONINTERP_FOUND OR PERL_FOUND) - include(FindPackageHandleStandardArgs) - - if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON)) - set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) - set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE}) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG - CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE) - - elseif(PERL_FOUND) - set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE}) - set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE}) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG - CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE) - endif() - - if(CXXTEST_FOUND) - set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR}) - endif() - -else() - - set(CXXTEST_FOUND false) - if(NOT CxxTest_FIND_QUIETLY) - if(CxxTest_FIND_REQUIRED) - message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!") - else() - message(STATUS "Neither Python nor Perl found, CxxTest will not be used.") - endif() - endif() - -endif() diff --git a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindJACK.cmake b/plugins/zynaddsubfx/zynaddsubfx/cmake/FindJACK.cmake deleted file mode 100644 index 20379db8e0b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindJACK.cmake +++ /dev/null @@ -1,17 +0,0 @@ -#Find JACK Audio Connection Kit - -include(LibFindMacros) -libfind_pkg_check_modules(JACK jack) -find_path(JACK_INCLUDE_DIR - NAMES jack/jack.h - PATHS ${JACK_INCLUDE_DIRS} - ) - -find_library(JACK_LIBRARY - NAMES jack - PATHS ${JACK_LIBRARY_DIRS} - ) - -set(JACK_PROCESS_INCLUDES JACK_INCLUDE_DIR) -set(JACK_PROCESS_LIBS JACK_LIBRARY) -libfind_process(JACK) diff --git a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindOSS.cmake b/plugins/zynaddsubfx/zynaddsubfx/cmake/FindOSS.cmake deleted file mode 100644 index 319c90ed6d5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/cmake/FindOSS.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# Find OSS (Open Sound System) -find_path(OSS_INCLUDE_DIR sys/soundcard.h) -set(OSS_LIBRARIES True) -mark_as_advanced(OSS_INCLUDE_DIR) - -# handle the QUIETLY and REQUIRED arguments and set OSS_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSS DEFAULT_MSG OSS_LIBRARIES OSS_INCLUDE_DIR) diff --git a/plugins/zynaddsubfx/zynaddsubfx/cmake/Findzlib.cmake b/plugins/zynaddsubfx/zynaddsubfx/cmake/Findzlib.cmake deleted file mode 100644 index 49edafd1289..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/cmake/Findzlib.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# - Find zlib -# Find the native ZLIB includes and library -# -# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -# ZLIB_LIBRARIES - List of libraries when using zlib. -# ZLIB_FOUND - True if zlib found. - -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) - -IF (ZLIB_INCLUDE_DIR) - # Already in cache, be silent - SET(ZLIB_FIND_QUIETLY TRUE) -ENDIF (ZLIB_INCLUDE_DIR) - -FIND_PATH(ZLIB_INCLUDE_DIR zlib.h) - -SET(ZLIB_NAMES z zlib zdll) -FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) -MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR ) - -# Per-recommendation -SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") -SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}") - -# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/Doxyfile b/plugins/zynaddsubfx/zynaddsubfx/doc/Doxyfile deleted file mode 100644 index f48cdff2f13..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/Doxyfile +++ /dev/null @@ -1,309 +0,0 @@ -# Doxyfile 1.5.7 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = ZynAddSubFX -PROJECT_NUMBER = 2.3.0 -OUTPUT_DIRECTORY = /home/mark/zynaddsubfx/doc/dox2/ -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = YES -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = /home/mark/zynaddsubfx/src/ -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 5 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -TYPEDEF_HIDES_STRUCT = NO -SYMBOL_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = /home/mark/zynaddsubfx/src/ -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl \ - *.C \ - *.CC \ - *.C++ \ - *.II \ - *.I++ \ - *.H \ - *.HH \ - *.H++ \ - *.CS \ - *.PHP \ - *.PHP3 \ - *.M \ - *.MM \ - *.PY \ - *.F90 \ - *.F \ - *.VHD \ - *.VHDL -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -HTML_DYNAMIC_SECTIONS = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHG_LOCATION = -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NONE -TREEVIEW_WIDTH = 250 -FORMULA_FONTSIZE = 10 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -DOT_FONTNAME = FreeSans -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/01-intro_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/01-intro_IT.txt deleted file mode 100644 index 7db8b957533..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/01-intro_IT.txt +++ /dev/null @@ -1,55 +0,0 @@ -Come iniziare ---------------- -ZynAddSubFX è un sintetizzatore software piuttosto complesso, con un gran numero -di controlli. Perciò l'uso di ZynAddSubFX non è sempre ovvio. - -Molte applicazioni sotto Linux trasportano il MIDI con AlSA e trasmettono l'audio -con JACK. ZynAddSubFX può essere lanciato con questa configurazione eseguendo: - ------------------------------- -zynaddsubfx -I alsa -O jack -a ------------------------------- - -Questo imposta ALSA come driver input e JACK come driver audio, che dovrebbe -tentare di connettersi automaticamente alla tua scheda audio, per via del flag -a. -Se questa è la prima volta che lanci ZynAddSubFX, vedrai una schermata che ti lascia -scegliere tra l'interfaccia per principianti e quella avanzata. Attualmente -l'interfaccia 'beginner' è deprecata, quindi è raccomandato usare l'interfaccia -'advanced'. - -Ora dovresti essere in grado di vedere la finestra principale di ZynAddSubFX, dalla -quale puoi impostare patch, effetti e altre configurazioni generali, ma la cosa più -importante è che fornisce i collegamenti tra le patch. ZynAddSubFX è uno strumento -potente con una serie di patch di base, ma la vera forza sta dietro all'abilità di -creare delle patch personali. - -.Main Window -image::./images/uimain.png[] - -Per un utilizzo base, potrai usare il pulsante alla destra dell'etichetta 'enabled'. -Questo pulsante consentirà di selezionare lo strumento desiderato dai banchi -disponibili in ZynAddSubFX. Per suonare note in ZynAddSubFX puoi usare la tastiera -virtuale integrata (accessibile dal pulsante 'vK') oppure puoi connettere la tua -tastiera al sistema e usare *aconnect* per connetterla in ZynAddSubFX (supponendo -che si stia usando ALSA). - -Questa finestra principale consente l'accesso a molte features più avanzate. -Di cui alcune sono: - -* System Effects -* Insertion Effects -* Recording -* Part Settings (strumento impostazioni del livello) -* Master Settings -* Microtonal Settings - -Ad esempio, per utilizzare la funzione di registrazione deve essere selezionato un -file wave dal menù di registrazione, poi può essere avviata con il pulsante 'record' -e stoppata con il pulsante 'stop'. Questo è un modo semplice e veloce di registrare -alcuni samples da ZynAddSubFX, anche se ci sono strumenti con caratteristiche più -complete disponibili tramite gli strumenti di registrazione di JACK. - -NOTE: Dopo aver premuto 'record', il file wave non partirà la registrazione fino a -quando un nuovo tasto non sarà premuto da una sorgente MIDI esterna o dalla virtual -keyboard. Le proprietà dei 'System Effects' e degli 'Insertion Effects' sono -accessibili e disponibili così come le proprietà di ogni strumento. diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/02-filter_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/02-filter_IT.txt deleted file mode 100644 index 31e11bedd6a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/02-filter_IT.txt +++ /dev/null @@ -1,61 +0,0 @@ -Filters -------- -:Author: Mark McCurry -:Date: June 24, 2012 - -ZynAddSubFX offre diversi tipi di filtri, che possono essere usati per modellare -lo spettro di un segnale. I parametri primari che influenzano le caratteristiche -del filtro sono 'cutoff', 'resonance', 'filter stages' e il tipo di filtro '(filter type)'. - -* *Cutoff (frequenza di taglio)*: Questo valore determina quale frequenza segna - il punto di cambiamento per il filtro. - In un filtro 'low-pass' (passa-bassi) questo - valore segna il punto da cui le frequenze alte - verranno attenuate. -* *Resonance*: La Resonance di un filtro determina l'enfatizzazione del filtro - sulla frequenza di taglio. In ZynAddSubFX è rappresentata dal - fattore 'Q', che è definito come la frequenza di taglio diviso - la larghezza di banda '(bandwidth)'. In altre parole un più alto - valore di Q causa un picco molto più stretto e risonante. -* *Stages*: Il numero di fasi di filtrazione in un dato filtro descrive quanto - bruscamente è in grado di applicare cambiamenti nella risposta in - frequenza. - -I filtri analogici di base '(analog)' che ZynAddSubFX offre sono mostrati di -seguito, con la frequenza centrale segnata con una linea rossa. I filtri a stato -variabile '(state variable)' dovrebbero essere molto simili. - -image:images/filter0.png[] - -Come detto in precedenza, il valore Q di un filtro influenza quanto concentrata è -l'energia del segnale nella frequenza di taglio; il risultato di differenti valori -di Q sono mostrati sotto. - -TIP: Per molti suoni analogici classici, alti valori di Q sono ussati sugli -'sweeping filters'. Un semplice low-pass filter con Q alto modulato da un forte -'envelope' solitamente è sufficiente per avere un buon suono. - -image:images/filter1.png[] - -Infine, l'effetto dell'ordine del filtro può essere visto sotto. Questo è -approssimativamente il numero di fasi del filtro '(filter stages)'. Per patches -più complesse è importante capire che la nitidezza in più nel filtro non è gratuita, -in quanto richiede molti più calcoli in corso di esecuzione; questo fenomeno -è più facilmente visibile nel 'subsynth', dove è facile avere bisogno di centinaia -di 'filter stages' per produrre una certa nota. - -image:images/filter2.png[] - -User Interface -~~~~~~~~~~~~~~ - -image:images/uifilter.png[] - -* *C.freq*: Cutoff frequency -* *Q*: Level of resonance for the filter -* *V.SnsA.*: Velocity sensing amount for filter cutoff -* *V.Sns.*: Velocity sensing function -* *freq.tr*: Frequency tracking amount. When this parameter is positive, higher - note frequencies shift the filter's cutoff frequency higher. -* *gain*: Additional gain/attenuation for filter -* *St*: Filter stages diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/03-lfo_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/03-lfo_IT.txt deleted file mode 100644 index 29a530c8d18..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/03-lfo_IT.txt +++ /dev/null @@ -1,64 +0,0 @@ -LFO ---- -:author: Paul Nasca - -Introduzione -~~~~~~~~~~~~ - -"LFO" significa Low Frequency Oscillator. Questi oscillatori non sono usati per -fare suoni da soli, ma per cambiare alcuni parametri (come le frequenze, le -ampiezze o i filtri). - -L'LFO ha alcuni parametri di base: - -* *Delay*: Questo parametro imposta il tempo tra l'inizio della nota e l'inizio - dell'LFO -* *Start Phase*: La posizione che avrà l'LFO alla partenza -* *Frequency*: La velocità dell'LFO (quanto velocemente il parametro è controllato - dai cambiamenti dell'LFO) -* *Depth*: L'ampiezza dell'LFO (quanto il parametro è controllato dai cambiamenti - dell'LFO) - -image:images/lfo0.png[] - -Un altro importante parametro dell'LFO è la forma '(shape)'. Ci sono molti -tipi di LFO in base alla forma. ZynAddSubFX supporta le seguenti forme: - -image:images/lfo1.png[] - -Un altro parametro è 'LFO Randomness' (casualità dell'LFO). -Esso modifica casualmente l'ampiezza o la frequenza dell'LFO ed in ZynAddSubFX puoi scegliere quanto, con questo parametro. -Nelle seguenti immagini sono mostrati alcuni esempi di casualità e come cambia la -forma d'onda triangolare dell'LFO. - -image:images/lfo2.png[] - -Altri parametri sono: - -* *Continous mode*: Se si utilizza questa modalità, l'LFO non partirà da "zero" -ad ogni nuova nota, ma sarà continuo. E' molto utile applicato sui filtri, per -fare interessanti 'sweeps'. -* *Stretch*: Controlla quanto la frequenza dell'LFO cambia in base alla frequenza -della nota. -Si può passare da 'stretch' negativo (la frequenza dell'LFO diminuisce sulle -note più alte) a zero (rimane la stessa in tutte le note) a 'stretch' positivo -(aumenta sulle note più alte). - -User Interface -~~~~~~~~~~~~~~ - -In ZynAddSubFX i parametri dell'LFO sono mostrati così: - -image:images/uilfo.jpg[] - -Questi parametri sono: - -* *Freq*: LFO Frequency -* *Depth*: LFO Depth -* *Start*: LFO Start Phase - -Se questo knob è al valore più basso, LFO Start Phase sarà random -* *Delay*: LFO Delay -* *A.R.*: LFO Amplitude Randomnes -* *F.R.*: LFO Frequency Randomness -* *C.*: LFO Continous Mode -* *Str.*: LFO Stretch - Nell'immagine sopra LFO Stretch è impostato a zero diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/04-envelope_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/04-envelope_IT.txt deleted file mode 100644 index 3586681f314..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/04-envelope_IT.txt +++ /dev/null @@ -1,134 +0,0 @@ -Envelopes ---------- - -Introduzione -~~~~~~~~~~~~ -Gli inviluppi controllano come cambiano nel tempo l'ampiezza, la frequenza o il -filtro. - -Amplitude Envelopes (inviluppi di ampiezza) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Questi inviluppi controllano l'ampiezza del suono. -In ZynAddSubFX, gli inviluppi di ampiezza possono essere lineari o logaritmici. -Nell'immagine seguente sono mostrate le differenze tra questi inviluppi. - -image:images/envelope1.png[Alt text] - -L'inviluppo di ampiezza è diviso in: -* *Attack*: Inizia all'attacco della nota (Note On). Il volume inizia da 0 al -massimo. In ZynAddSubFX l'attack è sempre lineare -* *Decay*: Il volume scende dal valore massimo ad un livello chiamato "Sustain level" -* *Sustain*: Il volume rimane costante fino a quando il tasto non viene -rilasciato (Note Off). Dopo questo, avviene l'ultima fase. -* *Release*: Il volume scende a zero. - -Frequency Envelopes -~~~~~~~~~~~~~~~~~~~ - -Questi inviluppi controllano la frequenza (o, più esattamente, il 'pitch') -degli oscillatori. -La seguente figura disegna le fasi di questi inviluppi. - -image::images/envelope2.png[Alt text] - -La linea puntinata rappresenta il pitch reale del suono senza inviluppo. - -Gli inviluppi di frequenza sono divisi in 3 fasi: - -* *Attack*: Inizia all'attacco della nota (Note On). La frequenza inizia da un -certo valore e "scivola" alla reale frequenza della nota. -* *Sustain*: La frequenza è la stessa per tutto il periodo di Sustain -* *Release*: Questa fase inizia con il Note Off e scala la frequenza della nota -ad un certo valore - -Filter Envelopes -~~~~~~~~~~~~~~~~ - -Questi inviluppi controllano la frequenza di cutoff dei filtri e sono divisi in: - -image:images/envelope3.png[Alt Text] - -* *Attack*: Inizia all'inizio della nota (Note On). La frequenza di cutoff inizia -ad un certo valore e scala ad un altro -* *Decay*: La frequenza di cutoff continua a scivolare verso il valore reale della -frequenza di cutoff del filtro (linea puntinata) -* *Sustain*: La frequenza di cutoff è la stessa per tutto il periodo di -Sustain (linea puntinata) -* *Release*: Questa fase inizia con il Note Off e scala la frequenza di cutoff della -nota ad un certo valore - -Freemode Envelopes -~~~~~~~~~~~~~~~~~~ - -Per tutti gli inviluppi c'è una modalità che consente all'utente di impostare un numero -arbitrario di fasi e punti di controllo. Questa modalità è chiamata 'Freemode'. - -image:images/envelope4.png[Alt Text] - -L'unica fase che rimane sempre definita è il Sustain, dove gli inviluppi si bloccano -fino ad un evento Note Off. - -User Interface -~~~~~~~~~~~~~~ -Tutti i tipi di inviluppi hanno alcuni controlli comuni: - -* *E*: Mostra una finestra che può far vedere la vera forma dell'inviluppo o convertirlo -in 'Freemode' per editarlo -* *Stretch*: Come l'inviluppo è allungato in base alla nota. -Sulle note più alte gli inviluppi sono più corti delle note più basse. -Nel valore più a sinistra lo 'stretch' è zero. -Il valore più a destra indica un allungamento del 200%; ciò significa che l'inviluppo -è allungato circa 4 volte/ottava. -* *frcR*: Release forzato. Se questa opzione è settata su On, il rilascio andrà al -valore finale anche se la fase di Sustain non è stata completata. -Di solito questo parametro è settato. - - -I parametri degli Amplitude Evelopes in ZynAddSubFX sono: - -image:images/uienvelope3.jpg[Alt Text] - -* *A.dt*: Durata Attack -* *D.dt*: Durata Decay -* *S.Val*: Valore di Sustain -* *R.dt*: Release time -* *L*: Se questa opzione è settata l'inviluppo è lineare, altrimenti sarà logaritmico. - - -Per i Frequency Envelopes l'interfaccia ha i seguenti parametri: - -image:images/uienvelope2.jpg[Alt Text] - -* *A.val*: Valore di Attack -* *A.dt*: Durata Attack -* *R.dt*: Release time -* *R.val*: Valore di Release - - -I Filter Evelopes hanno i parametri: - -image:images/uienvelope1.jpg[Alt Text] - -* *A.val*: Valore di Attack -* *A.dt*: Durata di Attack -* *D.val*: Valore di Decay -* *D.dt*: Decay time -* *R.dt*: Release time -* *R.val*: Valore di Release - -I Freemode Envelopes hanno una finestra separata per impostare parametri e controlli: - -image:images/uienvelope0.jpg[] - -* *Control points (punti di controllo)*: Puoi muovere i punti usando il mouse. -In basso a destra nella finestra viene mostrata la durata totale dell'inviluppo. -Se si clicka su un control point verrà visualizzata la durata della fase in cui -è quel punto. -* *Freemode*: Questo pulsante attiva o disattiva la modalità 'Freemode' -* *Add Point*: Aggiunge un punto dopo il punto correntemente selezionato. -Puoi selezionare un punto clickandoci su. -* *Delete point*: Rimuove il punto dall'inviluppo. -* *Sust.*: Imposta il punto di Sustain. E' mostrato usando la linea gialla. -* *Str.*: Envelope stretch - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/05-adsynth_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/05-adsynth_IT.txt deleted file mode 100644 index 4a00c2f1647..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/05-adsynth_IT.txt +++ /dev/null @@ -1,78 +0,0 @@ -AdSynth -------- - -AdSynth, principalmente un motore di sintesi additiva, è uno dei tre principali -motori di sintesi disponibili in ZynAddSubFX. -Il concetto base di questo motore è la somma di un insieme di voci, ciascuno dei -quali consiste in oscillatori. - -High Level (Global) -~~~~~~~~~~~~~~~~~~~ - -Il livello globale di AdSynth consiste negli elementi mostrati nella figura sotto: - -.AdSynth Global Elements -image::gen/ad-note.png[scalewidth="50%",width="700"] - -Il livello globale di AdSynth è quasi interamente composto dagli elementi -precedentemente discussi. -Comunque appaiono qui alcune nuove features, come: il rilevamento di velocità -'(velocity sensing)', 'punch', opzioni di detune e relativa bandwidth, resonance. - -.AdSynth Global Window -image::images/ad-global.png[] - -Il rilevamento di velocità è semplicemente una trasformazione esponenziale dalla -velocità della nota ad alcuni cambiamenti di parametro (!?). -Il diagramma sotto mostra come il 'velocity sensing' controlla questa traslazione -in tutto il range di velocity delle note possibili. - -.Velocity Sensing Chart -image::gen/velf.png[scalewidth="50%",width="600"] - -Il 'punch' di una nota in AdSynth è un'amplificazione costante dell'output -alla partenza della nota, con una lunghezza determinata dal 'punch time' e 'stretch' -e l'ampiezza determinata da 'punch strength' e 'velocity sensing'. -Il controllo relBw nel riquadro di frequenza è di fatto un moltiplicatore per -"scordare" '(detuning)' tutte le voci di una nota. - -NOTE: TODO Talk about resonance - - -La somma delle voci passa attraverso filtri e amplificazione per produrre il -suono finale. -Questro potrebbe far pensare che ad-note è solo un mucchio di post-elaborazione -minore e che a questo livello molto della generazione del suono è nascosta. - -Voices -~~~~~~ - -La voce da accesso ad un configurazione simile dei parametri globali più altre -cose come il modulatore, l'oscillatore e features di unison. - -.AdSynth Voice Window -image::images/ad-voice.png[] - -Modulation -^^^^^^^^^^ - -Tra le opzioni di modulazione si può selezionare: - -* Morph -* Ring Modulation -* Phase Modulation -* Frequency Modulation -* Disabled - -Unison -^^^^^^ - -Unison è utile nel creare il suono tipo chorus di più oscillatori simultanei. - -Oscillator -~~~~~~~~~~ - -NOTE: TODO show waveforms, talk about distortions somewhere, etc - -.Oscillator Window -image::images/uioscil.png[] diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/06-controller_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/06-controller_IT.txt deleted file mode 100644 index 9035666edac..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/06-controller_IT.txt +++ /dev/null @@ -1,56 +0,0 @@ -Controller ---------- - -image::./images/uicontroller.png[] - -General -~~~~~~~ - -* *ModWh*: Modulation Wheel depth (profondità della Modulation Wheel) -* *Exp MWh*: Exponential Modulation Wheel (cambia la scala di mudulazione in - esponenziale) -* *BwDpth*: Bandwidth Depth (profondità della Bandwidth) -* *Exp BW*: Exponential Bandwidth (cambia la scala di Bandwidth in esponenziale) -* *PanDpth*: Panning Depth (profondità del pan) -* *FltQ*: Filter Q (resonance) depth -* *FltCut* Filter Cutoff frequency depth (profondità della frequenza di taglio) -* *Expr*: Attiva/disattiva Expression -* *Vol*: Attiva/disattiva la ricezione di Volume controller -* *FMamp*: Attiva/disattiva la ricezione di Modulation Amplitude controller (76) -* *Sustain*: Attiva/disattiva sustain pedal -* *PWheelB.Rng (cents)*: Pitch Wheel Bend Range (cents; 100 cents = 1 semitono) - -Portamento -~~~~~~~~~~ - -* *Rcv.*: Controlla se la parte riceve il Portamento - On/Off (65) -* *time*: La durata del Portamento -* *thresh*: La soglia '(Threshold)' del Portamento. -Rappresenta il minimo o il massimo numero di semitoni (o centesimi di semitono) -richiesti per lo start del Portamento. -La differenza è calcolata tra l'ultima nota e la corrente. -* *th.type*: Il tipo di Threshold -Se selezionato significa che il Portamento si attiva quando la differenza -delle frequenze è al di sopra della soglia ("thresh"); non selezionato si attiva -quando è al di sotto della soglia. - -NOTE: La Threshold si riferisce alle frequenze e non alle note MIDI - (si potrebbe tenere in considerazione se si usano scale microtonali). - - -Proportional Portamento -^^^^^^^^^^^^^^^^^^^^^^ -//// -TODO: add graphs to explain prp.rate and prp. depth -//// - -* *Propt.*: Se il Portamento è proporzionale al rapporto '(Ratio)' delle frequenze -* *Prp. Rate*: Ratio necessaria per raddoppiare il tempo del Portamento -* *Prp. Dpth* - -Resonance -~~~~~~~~~ - -* *CFdpth*: Controlla la profondità del centro della Resonance -* *BWdpth*: Controlla la profondità della larghezza di banda (Bandwidth) della -Resonance diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/08-saving_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/08-saving_IT.txt deleted file mode 100644 index 211bf36533a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/08-saving_IT.txt +++ /dev/null @@ -1,54 +0,0 @@ -Persistence ------------ - -Come la gran parte delle applicazioni ZynAddSubFX consente di salvare il tuo -lavoro e ricaricarlo. - -Salvare tutto -~~~~~~~~~~~~~ - -Uno dei modi più semplici di salvare il tuo lavoro è quello di salvare l'intera -sessione. Questo può essere fatto dal menu File e il risultato sarà la creazione -di un .xmz file. -Una volta creato, questo file conterrà le tutte le impostazioni della sessione, -come le accordature microtonali, tutte le patch, tutti i tipi di effetti, ecc... - -Salvare delle parti -~~~~~~~~~~~~~~~~~~~ - -In alcuni casi salvare tutto non è quello che si desidera. -Di seguito c'è un esempio di salvataggio di una patch. - -Patches -^^^^^^^ -Per salvare una patch, si può salvare dal menu strumenti o dalla bank window. - -Con il menu strumenti si può solo salvare il file in una dato percorso con -l'estensione .xiz. - -Con il menu dei banchi si può assegnare una patch ad un certo slot con un banco. -Questo strumento rimarrà qui per un futuro uso fin quando non viene cancellato. -Per vedere la posizione fisica del file .xiz si può controllare la finestra in -File->Settings->Bank_Root_Dirs, per vedere i percorsi dei banchi. - -NOTE: Devi avere i permessi di scrittura per aggiungere uno strumento al banco. - -Presets -^^^^^^^ - -Avete un'impostazione favorita per un inviluppo o un oscillatore difficile da -rifare? Allora i preset fanno al caso vostro. -I preset consentono di salvare le impostazioni per ogni componente che supporta -operazioni di copia/incolla. -Questo viene fatto con i prest file (.xpz), che sono memorizzati nelle cartelle -indicate da File->Settings->Preset_Root_Dirs. - -Riepilogo -~~~~~~~ - -.Riepilogo delle estensioni -[literal] -xmz Everything -xiz Instrument -xsz Scale Settings -xpz Presets diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_A-mididefaults_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_A-mididefaults_IT.txt deleted file mode 100644 index 2c73fb4edc3..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_A-mididefaults_IT.txt +++ /dev/null @@ -1,22 +0,0 @@ -Appendice A: Default MIDI -------------------------- - -.Connessioni MIDI di Default -[literal] -001 - Modulation Wheel -007 - Volume -010 - Pan -011 - Expression -064 - Sustain -065 - Portamento Enable -071 - Filter Q -074 - Filter Cutoff -075 - Bandwidth(*) -076 - Modulation Amplitude(*) -077 - Resonance Center Frequency(*) -078 - Resonance Bandwidth(*) -120 - All Sounds Off -121 - Reset All Controllers -123 - All Notes Off - -Le voci con '(*)' non rientrano nelle specifiche General Midi. diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_B-build_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_B-build_IT.txt deleted file mode 100644 index 34127ef63b1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_B-build_IT.txt +++ /dev/null @@ -1,61 +0,0 @@ -Appendice B: Compilare ZynAddSubFX --------------------------------- - -Introduzione a CMake -~~~~~~~~~~~~~~~~~~~~~ - -************************************************************************ -Note: Questa sezione è in gran parte copiata dal wiki di OpenSceneGraph: -http://www.openscenegraph.org/projects/osg/wiki/Build/CMake -************************************************************************ - -ZynAddSubFX usa CMake come suo sistema di compilazione unificato. CMake -è capace di leggere semplici build script dall'albero dei sorgenti e -creare da questo un sistema di compilazione specifico per la piattaforma. -Questo sistema di compilazione può avere la forma di VisualStudio project -files, Unix Makefiles o XCode project files. CMake è capace di individuare -automaticamente le dipendeze esterne e consente di attivare/disattivare -la compilazione del modulo e di configurare varie opzioni di compilazione. - -L'uso di un sistema di compilazione unificato consente di evitare rotture -di compilazione che erano presenti nel precedente metodo di compilazione, -ovvero quello di mantenere tre obiettivi di compilazione separati per -VisualStudio, Unix "make" and XCode. Si riduce anche l'onere della -manutenzione per gli sviluppatori base e collaboratori. -Nell'insieme, l'uso di CMake dovrebbe portare come risultato una migliore -coerenza e build più stabili su ogni piattaforma per gli utenti finali e -una maggiore produttività nello sviluppo di nuove versioni. -Speriamo che con una maggior coerenza di builds tra piattaforme renderà -più facile per gli sviluppatori utilizzare la 'development version' di -ZynAddSubFX e aiutare a contribuire ai testing e alle migliorie, -portando ad un codice di più alta qualità. - -Quick start guide -~~~~~~~~~~~~~~~~~ - -Per i più impazienti, qui c'è una guida veloce su come compilare -immediatamente ZynAddSubFX da sorgenti. - -************************************************************************ -Note: Ciò presuppone che tu abbia già una copia dei sorgenti. -************************************************************************ - ---------------------------------- -#enter the source directory -cd zynaddsubfx - -#make a directory for an out-of-source build -mkdir build -cd build - -#generate a cmake build project here from the cmake root, which is -#found in the directory below the current one -cmake .. - -#OPTIONAL: Adjust compile variables in the Cache file: -ccmake . - -#And finally, build as usual using make -make ---------------------------------- - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_C-doc_getting_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_C-doc_getting_IT.txt deleted file mode 100644 index 3c1ba8ad068..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/APPENDIX_C-doc_getting_IT.txt +++ /dev/null @@ -1,63 +0,0 @@ -Appendix C: Ottenere ZynAddSubFX -------------------------------- - -Normalmente ci sono diversi modi per ottenere una copia di ZynAddSubFX. - -SourceForge:: - http://sourceforge.net/projects/zynaddsubfx/files/ -Distribuition:: - apt/yum/others -Git:: - git clone git://git.code.sf.net/p/zynaddsubfx/code zynaddsubfxg - -Introduzione a Git -~~~~~~~~~~~~~~~~~~~ - -Per coloro che vogliono vivere "on the bleeding edge" o chi vuole essere certo che -la prossima release abbia meno bug, si può avere il codice con git. -Git è usato per gestire il codice sorgente di questo progetto ed è utile per -ottenere velocemente e facilmente una copia "up-to-date" del codice sorgente. - -Ottenere il codice sorgente -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Per avere una copia dei sorgenti di ZynAddSubFX tutto il necessario da fare è: - ---------------------------------------------- -git clone git://git.code.sf.net/p/zynaddsubfx/code zynaddsubfx - -cd zynaddsubfx - -#Download additional resources -git submodule init -git submodule update ---------------------------------------------- - -Ora dovresti essere nella directory del codice sorgente. - -Per compilare facilmente si guardi l'Appendice B del manuale. - -Dare un'occhiata ai branch -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Diciamo che lo sviluppo si è esteso ad una creazione di una feature che si vuole -vedere in anteprima. -Per il bene di questa guida, supponiamo che il nome del branch della feature che -verrà è 'foo'. - ------------------------------------------ -#checkout the foo branch from sourceforge -git checkout --track -b foo origin/foo - -#lets checkout the primary branch again -git checkout master - -#hop back to the other branch -git checkout foo ----------------------------------------- - -Ora si dovrebbe essere in grado di cambiare branches e andare nella build-directory -(come descritto in Appendice B) e ricompilare ZynAddSubFX. - -NOTE: Quando si usano i branches può venir meno un po' di stabilità. - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/zynaddsubfx_IT.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/IT/zynaddsubfx_IT.txt deleted file mode 100644 index 1d9c3a0352e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/IT/zynaddsubfx_IT.txt +++ /dev/null @@ -1,28 +0,0 @@ -Zynaddsubfx -=========== -:Author: Paul Nasca and Mark McCurry, translated by Ilario Glasgo - -include::01-intro_IT.txt[] - -include::02-filter_IT.txt[] - -include::03-lfo_IT.txt[] - -include::04-envelope_IT.txt[] - -include::05-adsynth_IT.txt[] - -include::06-controller_IT.txt[] - -///////////////////////////// -include 07-effects_IT.txt -include nrpn.txt -///////////////////////////// - -include::08-saving_IT.txt[] - -include::APPENDIX_A-mididefaults_IT.txt[] - -include::APPENDIX_B-build_IT.txt[] - -include::APPENDIX_C-doc_getting_IT.txt[] diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/README.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/README.txt deleted file mode 100644 index 5f1dcaa0881..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -Requirements for this directory: - - * standalone (latex module) - * pgfplots (latex module) - * pst-sigsys (latex module) - * auto-pst-pdf (latex module) - * pst-tools (latex module) - * gnuplot - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/adsynth.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/adsynth.txt deleted file mode 100644 index 545745dafbd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/adsynth.txt +++ /dev/null @@ -1,148 +0,0 @@ -AdSynth -------- - -AdSynth, a primarily additive synthesis engine, is one of the three major -synthesis engines available in ZynAddSubFX. -The basic concept of this engine is the summation of a collection of voices, -each of which consist of oscillators. - -High Level (Global) -~~~~~~~~~~~~~~~~~~~ - -AdSynth's global level consists of the elements shown in the below figure: - -.AdSynth Global Elements -image::gen/ad-note.png[scalewidth="50%",width="700"] - -The global level of adsynth is almost entirely composed of previously discussed -elements. -However a few new features appear here, this includes velocity sensing, punch, -detune options and realative bandwidth , and resonance. - -.AdSynth Global Window -image::images/ad-global.png[] - - -Velocity sensing is simply an exponental transformation from the note's velocity -to some parameter change. -The below diagram shows how the velocity senseing controls affects this -translation over the whole range of possible note velocities. - -.Velocity Sensing Chart -image::gen/velf.png[scalewidth="50%",width="600"] - -The puch of a note in AdSynth is a constant amplification to the output at the -start of the note, with its length determined by the punch time and stretch and -the amplitude being determined by the punch strength and velocity sensing. -The relBW control in the frequency pane is effectively a multiplier for detuning -all voices within an adnote. - -NOTE: TODO Talk about resonance - - -The sum of the voices are passed through filters and amplification to produce -the final sound. -This could lead one to think that ad-note is just a bunch of minor -postprocessing and at this level much of the sound generation is hidden. - -Voices -~~~~~~ - -The voice gives access to a similar setup to the global parameters and then some -more, such as the modulator, oscillator, and unison features. - -.AdSynth Voice Window -image::images/ad-voice.png[] - -Modulation -^^^^^^^^^^ - -Within the options for modulation, one can select: - -* Morph -* Ring Modulation -* Phase Modulation -* Frequency Modulation -* Disabled - -Unison -^^^^^^ - -Unison is useful in creating the chorus like sound of many simultaneous -oscillators - -Oscillator -~~~~~~~~~~ - -The oscillator is lets you choose the basic waveform, which oscillates while -the sound is playing and is then further modified. - -.Oscillator Window -image::images/uioscil.png[] - -[[adsynth::oscilllator::types_of_waveshaping, Types of Waveshaping]] -Types of Waveshaping -^^^^^^^^^^^^^^^^^^^^ - -Waveshaping can be done using the *Wsh* area in the Oscillator editor. - -The type of distortion has much influence on how the overtones are being placed. -Sometimes, you get a "fat" bass, and sometimes, high frequencies are added, -makeing the sound "crystal clear". - -Atan & Sigmoid -++++++++++++++ - -This is the default setting. It is an easy way to apply loudness to a -wave without getting undesired high overtones. Thus, it can be used both for -making instruments that sound like "real" ones, but also for electronic music. -The transformation turns, roughly said, every amplitude into a square amplitude. -Thus, sine, power, pulse and triangle turn into a usual square wave, while a saw -turns into a phased square wave. A chirp wave turns into a kind of phase -modulated square wave. - -Quants -++++++ - -http://en.wikipedia.org/wiki/Quantization_%28sound_processing%29[Quantization] -adds high overtones early. It can be seen as an unnatural effect, which is often -used for electronic music. - -The transformation is a bit similar to building -the http://en.wikipedia.org/wiki/Riemann_sum[lower sum] of a wave, -mathematically said. This means that the transformation effect turns your -"endless high" sampled wave into only a few samples. The more distortion you -will apply, the less samples will be used. Indeed, this is equivalent to say -that more input amplification is used. To see this, here is a small sample of -code, where "ws" is the (correctly scaled amount of input amplification, and "n" -the number of original samples. - ---------------------------------- -for(i = 0; i < n; ++i) - smps[i] = floor(smps[i] / ws + 0.5f) * ws; ---------------------------------- - -NOTE: If you turn on quantisation very high, you might be confused -that, especially high notes, make no sound. The reason: High frequencies are -"forgotten" if you sample with only few samples. Also, the sign of an amplitude -can be forgotten. This behaviour might make some quantisations a bit unexpected. - -Limiting & Clipping -+++++++++++++++++++ - -http://en.wikipedia.org/wiki/Limiting[Limiting] usually means that for a signal, -the amplitude is modified because it exceeds its maximum value. Overdrive, as -often used for guitars, is often achieved by limiting: It happens because an -amplifier "overdrives" the maximum amplitude it can deliver. - -ZynAddSubFX has two types of limiting. Soft limiting, here as *Lmt*, means -that the sound may not exceed a certain value. If the amplitude does so, it will -simply be reduced to the limiting value. The overtones are generated in the -lower frequencies first. - -Hard limiting, is also called clipping and abbreviated *Clip*. This means that -if the maximum is exceeded, instead of being constant at the limiting value, the -original signal still has some influence on the output signal. Still, it does -not exceed the limiting value. For ZynAddSubFX, a signal exceeding the limiting -value will continue to grow "in the negative". This leads to overtones being -generated on the full frequency band. \ No newline at end of file diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/build.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/build.txt deleted file mode 100644 index 35de26af1a7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/build.txt +++ /dev/null @@ -1,59 +0,0 @@ -Appendix B: Building ZynAddSubFX --------------------------------- - -Introduction to CMake -~~~~~~~~~~~~~~~~~~~~~ - -******************************************************************** -Note: This section is mostly copied from the OpenSceneGraph wiki, at: -http://www.openscenegraph.org/projects/osg/wiki/Build/CMake -******************************************************************** - -ZynAddSubFX uses CMake as its unified build system. CMake -is able to read simple build scripts from the source tree and create -from this a platform-specific build system. This build system can be in -the form of VisualStudio project files, Unix Makefiles or XCode project -files. CMake is able to automatically locate external dependencies, and -allows you to toggle on/off module compilation and configure various -build options. - -The use of a unified build system has allowed to avoid build breakages -that were common in the previous build method of maintaining three -separate build targets for VisualStudio, Unix "make" and XCode. It also -reduces the maintenance burden for core developers and contributors. -Taken together usage of CMake should result in better consistency and -more stable builds across all platforms for end users and a greater -productivity in development of new versions. Hopefully with greater -consistency of builds across platforms it will be easier for developers -to use the development version of ZynAddSubFX and help contribute -to its testing and refinement, leading to a high-quality code base. - -Quick start guide -~~~~~~~~~~~~~~~~~ - -For the impatient ones, here is a quick guide on how to immediately -build ZynAddSubFX from source. - -************************************************************** -Note: This assumes that you already have a copy of the source. -************************************************************** - ---------------------------------- -#enter the source directory -cd zynaddsubfx - -#make a directory for an out-of-source build -mkdir build -cd build - -#generate a cmake build project here from the cmake root, which is -#found in the directory below the current one -cmake .. - -#OPTIONAL: Adjust compile variables in the Cache file: -ccmake . - -#And finally, build as usual using make -make ---------------------------------- - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/controller.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/controller.txt deleted file mode 100644 index 80355659599..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/controller.txt +++ /dev/null @@ -1,54 +0,0 @@ -Controller ---------- - -image::./images/uicontroller.png[] - -General -~~~~~~~ - -* *ModWh*: Modullation Wheel depth -* *Exp MWh*: Exponental Modulation Wheel (changes modulation scale to - exponental) -* *BwDpth*: Bandwidth Depth -* *Exp BW*: Exponental Bandwidth (changes badwidth scale to exponental) -* *PanDpth*: Panning Depth -* *FltQ*: Filter Q (ressonance) depth -* *FltCut* Filter Cutoff frequency depth -* *Expr*: enable/disable expression -* *Vol*: enable/disable receiving volume controller -* *FMamp*: enable/disable receiving Modulation Amplitude controller (76) -* *Sustain*: enable/disable sustain pedal -* *PWheelB.Rng (cents)*: Pitch Wheel Bend Range (cents; 100 cents = 1 halftone) - -Portamento -~~~~~~~~~~ - -* *Rcv.*: If the part receives portamento On/Off (65) controller -* *time*: The duration of the portamento -* *thresh*: The threshold of the portamento. -It represents the minimum or the maximum number of halftones -(or hundried cents) required to start the portamento. -The difference is computed between the last note and current note. -* *th.type*: The threshold type. -Checked means that the portamento activates when the difference of frequencies -is above the threshold ("thresh"); not checked is for below the threshold. - -NOTE: The threshold refers to the frequencies and not to MIDI notes - (you should consider this if you use microtonal scales). - - -Proportinal Portamento -^^^^^^^^^^^^^^^^^^^^^^ -//// -TODO: add graphs to explain prp.rate and prp. depth -//// - -* *Propt.*: If the portamento is proportinal to ratio of frequencies -* *Prp. Rate*: Ratio needed to double the time of portamento -* *Prp. Dpth*: The divergence from - -Resonance -~~~~~~~~~ - -* *CFdpth*: resonance center controller depth -* *BWdpth*: resonance bandwidth controller depth diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/effects.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/effects.txt deleted file mode 100644 index a0d93f2de9f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/effects.txt +++ /dev/null @@ -1,531 +0,0 @@ -Effects -------- - -Effects are, generally, blackboxes that transform audio signals in a -specified way. More exactly, the only input data for an effect in ZynAddSubFX -is: - -* an array of samples, which is read *on line* -* the current system time (used for LFOs) - -The output is the transformed array of samples. - -NOTE: As described, effects have no information about anything else. For -example, key presses are not recognized. Therefore, pressing a key does not -initiate the LFO. Phase knobs will always be relative to a *global* LFO, which is -only dependent on the system time. - -ZynAddSubFX has 3 types of effects: - -* System Effects -* Insertion Effects -* Instrument Effects - -TODO: Describe these 3 types (their differences). - -[[effects::general_topics, General Topics]] -General topics -~~~~~~~~~~~~~~ - -* *Wetness* determines the mix of the results of the effect and its input. This -mix is made the effects output. If an effect is wet, it means that nothing of -the input signal is bypassing the effect. If it is dry, then the effect has no -effect. TODO: Difference between Volume and D/W? -* *Pan* lets you apply panning, which means that the sound source can move to -the right or left. Set it to 0.0 to only hear output on the right side, or to -the maximum value to only hear output on the left side. -* *LRc.* or *L/R* let you apply crossover. -* *Filter stages* are the number of times that this filter is applied in series. -So, if this number is 1, you simply have this one filter. If it is two, the -sound first passes the filter, and the results then pass the same filter again. -In ZynAddSubFX, the wetness is applied after all stages were passed. -* *LFOs* are, as the name says, oscillators with, compared to the frequency of -the sound, low frequency. They often appear in order to control the effect. -They can have some of the following controls: -** *LFO Type* determines the shape of the LFO. If not present, the LFO is a -sine wave. -** *Freq* determines the LFO's frequency. -** *Dpth* is a multiplier to the LFO. Thus, it determines the LFOs amplitude -and its influence. -** *Rnd* is the LFO amplitude's randomness -** *St.df* lets you determine how much left and right LFO are phase shifted. -64.0 means stereo, higher values increase the right LFO relatively to the left -one. -******************************************************************** -Hint: Keep in mind that Effects that can be controlled by LFO can also be -controlled arbitrary: Set the LFO depth to zero and manipulate the phase knob -(e.g. with NRPNs or maybe via OSC in the future). -******************************************************************** - -Equalizer -~~~~~~~~~ - -Introduction -^^^^^^^^^^^^ - -An http://en.wikipedia.org/wiki/Filter_%28signal_processing%29[equalizer] is a -filter effect that applies different volume to different frequencies of the -input signal. This can, for example, be used to "filter out" unwanted -frequencies. -ZynAddSubFX's implementations follow the -http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt["Cookbook formulae for -audio EQ"] by Robert Bristow-Johnson. - -Filter Types -^^^^^^^^^^^^ - -This topic is completely discussed in <>. - -Usage -^^^^^ - -We describe all parts of the GUI here. The term passband (or often just "band") -refers to the amount of frequencies which are not significantly attenuated by -the filter. - -* *Gain* (on the left) defines an offset which is added to the complete filter. -* *B.* lets you choose the passband number. Multiple passbands define one -filter. This is important if you want multiple filters to be called after each -other. Note that filters are commutative. -* *T.* lets you choose the current filter's type, as described above. -* *Freq* describes the frequencies where the filter has its poles. For some -filters, this is called the "cutoff" frequency. Note, however, that a bandpass -filter has two cutoff frequencies. -* *Gain* is only active for some filters and sets the amount of a special peak -these filters have. Note that for those filters, using the predefined gain makes -them effectless. -* *Resonance* lets you describe a peak at the given frequency for filters with -2 poles. This can be compared to real physical objects that have more gain at -their resonance frequency. -* *St.* lets you define multiple filter stages. This is equivalent to having -multiple copies of the same filter in sequence. - -Chorus -~~~~~~ - -Introduction -^^^^^^^^^^^^ - -In a chorus, many people sing together. Even if each of them sings at exactly -the same frequency, all their voices usually sound different. We say they have a -different timbre. Timbre is the way we perceive sound and makes us differ -between different music instruments. This is, physically, achieved by varying -both the amplitude envelope and the frequency spectrum. Multiple sounds with -slightly different timbres make a sound more shimmering, or powerful. This is -called the chorus effect. - -Function -^^^^^^^^ - -The chorus effect can be achieved by multiple people singing together. In -a concert, there are many instruments, resulting in the same effect. When making -electronic music, we only have an input wave and need to generate these -different timbres by ourselves. ZynAddSubFX therefore simply plays the sound, -pitch modulated by an LFO, and adds this to the original sound. This explains -the diagram below: The multiple pitches are generated by a delayed version of -the input. This version is being pitched by an LFO. More detailled, this pitch -is generated by varying the reading speed of the delayed sound; the variation -amount is controlled by an LFO. - -image:./gen/chorus.png[width=700, - title="The chorus effect. z^(-n.m) describes the delay."] - -TODO: Add LFO pointing to delay? - -Related effects to Chorus are Flangers. Flangers can be described as Chorus -with very short LFO delay and little LFO depth. You can imagine a flanger as two -copies of a sound playing at almost the same time. This leeds to interference, -which can be clearly heared. It is popular to apply flangers to guitars, giving -them more "character". - -Usage -^^^^^ - -* First, crossover is applied. -* The following 5 knobs (*Freq*, *Rnd*, *LFO Type*, *St.df*, *Depth*) control -the LFO for the pitch. If the depth is set to zero, the pitch will not be -changed at all. -* *Delay* is the time that the delayed sound is delayed "on average". Note that -the delay also depends on the current pitch. -* After the correct element of the sound buffer is found using the LFO, the -*Fb* knob lets you set how loud it shall be played. This is mostly redundant to -the *D/W* knob, but we have not applied panning and substraction yet. -* Next, the singal can be negated. If the *Substract* Checkbox is activated, -the amplitude is multiplied by -1. -* Finally, *Pan* lets you apply panning. - -Distortion -~~~~~~~~~~ - -Introduction -^^^^^^^^^^^^ - -Distortion means, in general, altering a signal. Natural instruments -usually produce sine like waves. A wave is transformed in an unnatural way when -distortion is used. The most distorted waves are usually pulse waves. It is -typical for distortion to add overtones to a sound. Distortion often increases -the power and the http://en.wikipedia.org/wiki/Loudness[loudness] of a signal, -while the db level is not increased. This is an important topic in the -http://en.wikipedia.org/wiki/Loudness_war[Loudness War]. - -NOTE: As distortion increases loudness, distorted music can cause ear damage -at lower volume levels. Thus, you might want to use it a bit careful. - -Distortion can happen in many situations when working with audio. Often, this is -not wanted. In classical music, for example, distortion does not occur -naturally. However, distortion can also be a wanted effect. It is typical for -Rock guitars, but also present in electronic music, mostly in Dubstep and -DrumNBass. - -The basic components of distortion are mainly - -* a preamplifier -* the waveshaping function -* filters - -Preamplification changes the volume before the wave is shaped, and is indeed the -amount of distortion. For example, if you clip a signal, the louder the input -gets, the more distortion you will get. This can have different meanings for -different types of distortions, as described below. - -******************************************************************** -The filters are practical. A reason for using them afterwards is that distortion -can lead to waves with undesired high frequency parts. Those can be filtered out -using the LPF. A reason for using filters before applying is to achieve -multiband distortion. ZynAddSubFX has no "real" multiband distortion by now, -however. -******************************************************************** - -Types of Distortion -^^^^^^^^^^^^^^^^^^^ - -This topic is completely discussed in -<>. Note -that you can use the -Oscillator editor in order to find out what your distortion effect does. Also -note that while the Oscillator editor's distortion is limited to some -oscillators you can produce in the Oscillator editor, the distortion effect can -be used on every wave that you can generate with ZynAddSubFX. - -Function -^^^^^^^^ - -We explain the functionality in a diagram and list the components below. - -image:./gen/distort.png[width=700, - title="The components of a distortion function."] - -* Negation is the first thing to happen. If the *Neg* Checkbox is activated, the -amplitude is multiplied by -1. -* Panning is applied. Note, however, that you have to activate the -Stereo Checkbox, labeled *St*, before. -* Pre amplification is done next. The amount can be changed using the -*Drive* nob. Indeed, this is the amount of distortion. For example, if you clip -a signal, the louder the input gets, the more distortion you will get. This can -have different meanings for different types of distortion, as described above. -* *HPF* and *LPF* are filters with 2 poles. Whether they are used before or -after the waveshape, depends on the checkbox labeled *PF*. -* The next step is the wave shape. This defines how the wave is -actually modified. The *Type* ComboBox lets you define how. We will discuss some -types below. -* After the wave shape, we scale the level again. This is called -output amplification. You can change the value using the *Level* knob. -* Crossover is the last step. This is controlled by the knob *LR Mix* and -means that afterwards, a percentage of the left side is applied to the right -side, and, synchronously, the other way round. It is a kind of interpolation -between left and right. If you set the LR Mix to 0.0, you will always have a -stereo output. - -Dynamic Filter -~~~~~~~~~~~~~ - -Introduction -^^^^^^^^^^^^ - -A dynamic filter is, as the name says, a filter which changes its parameters -dynamically, dependent on the input and current time. In ZynAddSubFX, -frequency is the only variable parameter. It can be used as an "envelope -following filter" (sometimes referenced "Auto Wah" or simply "envelope filter"). - -Function -^^^^^^^^ - -Though this filter might look a bit complicated, it is actually easy. We divide -the parameters into two classes: - -* *Filter Parameters* are the ones you get when you click on *Filter*. They -give the filter its basic settings. -* *Effect Parameters* are the other ones that control how the filter changes. - -The filter basically works like this: The input signal is passed through a -filter which dynamically changes its frequency. The frequency is an additive of: - -* the filter's base frequency -* an LFO from the effect parameters -* the "amplitude" of the input wave - -image:./gen/dynamic.png[width=700, - title="The components of a dynamical filter"] - -The amplitude of the input wave is not the current amplitude, but the so called -https://en.wikipedia.org/wiki/Root_mean_square["Root Mean Square (RMS)"] value. -This means that we build a mean on the current amplitude and the past values. -How much the new amplitude takes influence is determined by the *Amplitude -Smoothness* (see below). - -******************************************************************** -RMS value plays an important role in the term loudness. A fully distorted -signal can sound 20 db louder due to its higher RMS value. This filter takes -this into account, depending on the smoothness. -******************************************************************** - -Usage -^^^^^ - -* The 4 knobs in the middle (*Freq*, *Rnd*, *LFO Type*, *St.df*) control the -LFO. -* Two knobs let you control the way how the RMS value of the amplitudes is -measured: -** *A.M* sets the Amplitude Smoothness (this is described above). The higher -you set this value, the more slow will the filter react. -** *A.Inv.*, if being set, negates the (absolute) RMS value. This will lower -the filter frequency instead of increasing it. Note that this will not have -much effect if the effects input is not very loud. -* The following controls define the mix of the LFO and the amplitude. -** *A.S* sets the Amplitude Sensing (i.e. how much influence the amplitude -shall have). -** *LfoD* sets the LFO depth. -* The filter button lets you choose the filter type. -* After the input signal has passed through the filter, *Pan* can apply -panning. - -Echo -~~~~ - -Introduction -^^^^^^^^^^^^ - -The echo effect, also known as -http://en.wikipedia.org/wiki/Delay_%28audio_effect%29[delay effect], simulates -the natural reflection of a sound. The listener can hear the sound multiple -times, usually decreasing in volume. Echos can be useful to fill empty parts of -your songs with. - -Function -^^^^^^^^ - -In ZynAddSubFX, the echo is basically implemented as the addition of the -current sound and a delayed version of it. The delay is implemented as in the -picture below. First, we add the delayed signal to the effect input. Then, -they pass an LP1. This shall simulate the effect of dampening, which means that -low and especially high frequencies get lost earlier over distance than middle -frequencies do. Next, the sound is delayed, and then it will be output and added -to the input. - -image:./gen/echo.png[width="700", - title="The echo includes a fb line, labeled as z^-n, and a delay."] - -******************************************************************** -The exact formula in the source code for the dampening effect is as follows: - -latexmath:[$Y(t) := (1-d) \cdot X(t) + d \cdot Y(t-1)$], - -where latexmath:[t] be the time index for the input -buffer, latexmath:[d] be the dampening amount and latexmath:[X,Y] be the input, -respective the output of the dampening. This solves to - -latexmath:[$Y(z) = Z(Y(t)) = (1-d) \cdot X(z) + d \cdot Y(z) \cdot z^{-1}$] - -latexmath:[$\Leftrightarrow H(z) := \frac{Y(z)}{X(z)} = \frac{1-d}{1 - -d \cdot z^{-1}}$] - -which is used in latexmath:[$Y(z) = H(z) \cdot X(z)$]. So latexmath:[$H(z)$] is -indeed a filter, and by looking at it, we see that it is an LP1. Note that -infinite looping for d=1 is impossible. -******************************************************************** - -Description -^^^^^^^^^^^ - -* *Pan* lets you apply panning of the input. -* *Delay* sets the time for one delay. -* *LRdl.* means Left-Right-Delay. If it is set to the middle, then both sides -are delayed equally. If not, then the left echo comes earlier and the right -echo comes (the same amount) later than the average echo; or the other way -round. Set the knob to 0 to hear on the right first. -* *LRc.* applies crossover. -* Feedback describes how much of the delay is added back to the input. Set -*Fb.* to the maximum to hear an infinite echo, or to the minimum to just -hear a single repeat. -* The *Damp* value lets the LP1 reject higher frequencies earlier if -increased. - -Reverb -~~~~~~ - -Introduction -^^^^^^^^^^^^ - -A http://en.wikipedia.org/wiki/Reverberation[Reverberation] actually expresses -the effect of many echoes being played at the same time. This can happen in an -enclosed room, where the sound can be reflected in different angles. Also, in -nature, thunders approximate reverbs, because the sound is reflected in many -different ways, arriving at the listener at different times. - -In music, reverbs are popular in many ways. Reverbs with large room size can be -used to emulate sounds like in live concerts. This is useful for voices, pads, -and hand claps. A small room size can simulate the sound board of string -instruments, like guitars or pianos. - -Function -^^^^^^^^ - -As mentioned, a reverb consists of permanent echo. The reverb in ZynAddSubFX is -more complex than the echo. After the delaying, comb filters and then allpass -filters are being applied. These make the resulting sound more realistic. The -parameters for these filters depend on the roomsize. For details, consider the -information about https://ccrma.stanford.edu/~jos/pasp/Freeverb.html[Freeverb]. - -image:./gen/reverb.png[width=700, - "The reverb, being similar to the echo."] - -Description -^^^^^^^^^^^ - -* The *Type* ComboBox lets you select a reverb type: -** *Freeverb* is a preset. It was proposed by Jezar at Dreampoint. -** *Bandwidth* has the same parameters for the comb and allpass filters, but it -applies a unison before the LP/HP. The unison's bandwidth can be set using *bw*. -** Random chooses a random layout for comb and allpass each time the type or -the roomsize is being changed. -* The roomsize (*R.S.*) defines parameters only for the comb and allpass -filters. -* *Time* controls how long the whole reverb shall take, including how slow the -volume is decreased. -* The initial delay (*I.del*) is the time which the sounds need at least to -return to the user. The initial delay feedback (*I.delfb*) says how much of the -delayed sound is added to the input. -* Low pass filter (*LPF*) and high pass filter (*HPF*) can be applied before -the comb filters. -* The dampening control (*Damp*) currently only allows to damp low frequencies. -Its parameters are being used by the comb and allpass filters. -* *Pan* lets you apply panning. This is the last thing to happen. - - -Phaser -~~~~~~ - -Introduction -^^^^^^^^^^^^ - -The http://en.wikipedia.org/wiki/Phaser_%28effect%29[Phaser] is a special -dynamic filter. The result is a sweeping -sound, which is -often used on instruments with a large frequency band, like guitars or strings. -This makes it typical for genres like rock or funk, where it is often modulated -with a pedal, but also for giving strings a warm, relaxing character. - -Function -^^^^^^^^ - -The audio signal is split into two paths. One path remains unchanged. The other -one is sent to a delay line. The delay time (the so called *phase*) is made -dependent on the frequency. Therefore, an all-pass filter is applied to the -signal, which *preserves* the amplitude, but determines the delay time. In the -end, both paths are added. - -The following picture describes how this works on white noise. Light blue -signalises that the frequency is not present at the current time, and dark blue -signalises the opposite. The dark blue peaks appear if the delay time is very -short, because then, the second path almost equals the first one, which results -in duplication of the signal. If the delay line is very long, then it is --- in -the case of white noise --- totally at random whether the delayed signal -currently duplicates the unchanged path, or whether it cancels it out to zero. -This random effect results in white noise between the clear blue structures. - -image:./images/phaser-spectrogram.jpg[width="700", - title="Spectrogram of an 8-stage phaser - modulated by a sine LFO applied to white noise."] - -Phaser Types -^^^^^^^^^^^^ - -ZynAddSubFX offers different types of phasers: - -* Analog and "normal" phasers. Analog phasers are more complicated. They sound -punchier, while normal phasers sound more fluently. However, analog filters -usually need more filter stages to reach a characteristic sound. -* Sine and triangle filters. Note that an analog triangle filter with many poles -is a barber pole filter and can be used to generate -http://en.wikipedia.org/wiki/Shepard_tone[Shepard Tones], -i.e. tones that seem to increase or decrease with time, but do not really. -* The LFO function can be squared. This converts the triangle wave into a hyper -sine wave. The sine squared is simply a faster sine wave. -* TODO: Barber is deactivated, since PLFOtype is only 0 or 1? - -Description -^^^^^^^^^^^ - -For the normal phaser, first, the LFO is generated: - -* There are 4 controls (*Freq*,*Rnd*,*LFO tpye*,*St.df*) that define the -LFO. -* *Phase* and *Depth* are applied afterwards in the usual way (TODO: I don't -understand the code here for the normal phase...). For the analog phaser, -*Phase* is not implemented, yet. -** If *hyp* is being set, then the LFO function is being squared. - -Next, the input is being used. - -* *Analog* decides whether the phaser is analog or "normal". -* First, *Pan* applies panning to the original input in every loop. -* Next, barber pole phasing is being applied (Analog only). -* *Fb* applies feedback. The last sound buffer element is (after -phasing) multiplied by this value and then added to the current one. For normal -filter, the value is added before, for analog after the first phasing stage. -* Now, *Stages* phasing stages are being applied. *dist* sets the distortion -for when applying the phasing stages. This has only effect for analog phasers. -* The feedback is taken now. -* In the end, *Substract* inverts the signal, multiplying it by -1. - -Alienwah -~~~~~~~~ - -Introduction -^^^^^^^^^^^^ - -The AlienWah effect is a special, dynamic -http://en.wikipedia.org/wiki/Formant[formant] filter (TODO: is this true?). -Paul Nasca named it AlienWah because it sounded "a bit like wahwah, but more -strange". The result of the filter is a sound varying between the -vocals "Ahhhhh" (or "Uhhhhh") and "Eeeeee". - -Function -^^^^^^^^ - -The way that the filter moves between the two vocals is mainly -described by an LFO. A bit easified, Paul Nasca has stated the formula (for -latexmath:[$i^2=-1; R<1$]) as - -latexmath:[$fb=R*(\cos(\alpha)+i*\sin(\alpha))$] - -latexmath:[$y_n=y_{n-delay}*R*(\cos(\alpha)+i*\sin(\alpha))+x_n*(1-R)$]. - -The input latexmath:[$x_n$] has the real part of the samples from the wavefile -and the imaginary part is zero. The output of this effect is the real part of -latexmath:[$y_n$]. latexmath:[$\alpha$] is the phase. - -Description -^^^^^^^^^^^ - -* *Pan* -* The following 5 controls (*Freq*,*Rnd*,*LFO tpye*,*St.df*, *Dpth*) define the -LFO. -** *Fb* - -** *Delay* If this value is low, the sound is turned more into a -"wah-wah"-effect. -** *Phase* See latexmath:[$\alpha$] in the above formula. This lets you set -where the vocal is between "Ahhhhh" and "Eeeeee". -** *L/R* applies crossover in the end of every stage. This is currently not -implemented for the Analog Phaser. diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/envelope.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/envelope.txt deleted file mode 100644 index 157843eb392..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/envelope.txt +++ /dev/null @@ -1,131 +0,0 @@ -Envelopes ---------- - -Introduction -~~~~~~~~~~~~ -Envelopes control how the amplitude, the frequency, or the -filter changes over time. - -Amplitude Envelopes -~~~~~~~~~~~~~~~~~~~ - -These envelopes controls the amplitude of the sound. -In ZynAddSubFX, amplitude envelopes can be linear or logarithmic. -In the next image, it is shown the differences between these envelopes. - -image::images/envelope1.png[Alt text] - -The amplitude envelope is divided into: - -* *Attack*: Begins at the Note On. The volume starts from 0 to the maximum. -In ZynAddSubFX, the attack is always linear. -* *Decay*: The volume drops from the maximum value to a level called "Sustain level" -* *Sustain*: The volume remains constant until the key is depressed (Note Off). -After this, the last stage take place. -* *Release*: The volume drops to zero - - -Frequency Envelopes -~~~~~~~~~~~~~~~~~~~ - -These envelopes controls the frequency (more exactly, the pitch) of -the oscillators. -The following picture draws the stages of these envelopes. - -image::images/envelope2.png[Alt text] - -The dotted line represents the real pitch of the sound without the -envelope. - -The frequency envelopes are divided into 3 stages: - -* *Attack*: Begins at the Note On. The frequency starts from a certain value and -glides to the real frequency of the note. -* *Sustain*: The frequency is the same on over the sustain period -* *Release*: This stage begins on Note Off and glides the frequency of the note -to a certain -value - -Filter Envelopes -~~~~~~~~~~~~~~~~ -These envelopes controls the cutoff frequency of the filters and are divided -into - -image:images/envelope3.png[Alt Text] - -* *Attack*: Begins at the Note On. The cutoff frequency starts from a certain value and glides to another value -* *Decay*: The cutoff frequency continues to glide to the real cutoff frequency value of the filter (dotted line) -* *Sustain*: the cutoff frequency is the same on over the sustain period (dotted line) -* *Release*: this stage begins on Note Off and glides the filter cutoff frequency of the note to a certain value - -Freemode Envelopes -~~~~~~~~~~~~~~~~~~ - -For all envelope there is a mode that allows the user to set an arbitrary number of stages and control points. This mode is called Freemode. - -image:images/envelope4.png[Alt Text] - -Only stage that always remains defined is the Sustain, where the envelopes freezes until a Note Off event. - -User Interface -~~~~~~~~~~~~~~ -All the envelope types has some common controls: - -* *E*: Shows a window that you can view the real envelope shape or convert to free mode to edit it -* *Stretch*: How the envelope is stretched according the note. -On the higher notes the envelopes are shorter than lower notes. -In the leftmost value, the stretch is zero. -The rightmost use a stretch of 200%; this means that the envelope is stretched about 4 times/octave. -* *frcR*: Forced release. -This means that if this option is turned on, the release will go to the final value, even if the sustain stage is not reached. Usually, this must be set. - - -The parameters for Amplitude Envelopes for ZynAddSubFX are: - -image:images/uienvelope3.jpg[Alt Text] - -* *A.dt*: Attack duration -* *D.dt*: Decay duration -* *S.Val*: Sustain value -* *R.dt*: Release time -* *L*: If this option is set, the envelope is linear, otherwise, it will be -logarithmic - - -For Frequency Envelopes the interface has the following parameters: - -image:images/uienvelope2.jpg[Alt Text] - -* *A.val*: Attack value -* *A.dt*: Attack duration -* *R.dt*: Release time -* *R.val*: Release value - - -Filter Envelopes has the parameters: - -image:images/uienvelope1.jpg[Alt Text] - -* *A.val*: Attack value -* *A.dt*: Attack duration -* *D.val*: Decay value -* *D.dt*: Decay time -* *R.dt*: Release time -* *R.val*: Release value - -The Freemode envelopes has a separate window to set the parameters and controls: - -image:images/uienvelope0.jpg[] - -* *Control points*: You can move the points using the mouse. -In the right on the windows, it is shown the total duration of the envelope. -If the mouse button will be pressed on a control point, it will be shown the -duration of the stage where the point is. -* *FreeMode*: this button activates or deactivates the freemode mode. -* *Add Point*: Adds the point next to the current selected point. -You can select a point by clicking on it. -* *Delete point*: Removes the point from the envelope. -* *Sust.*: Set the sustain point. It is shown using the yellow line. -* *Str.*: Envelope stretch - - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/filter.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/filter.txt deleted file mode 100644 index b0f1c75d392..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/filter.txt +++ /dev/null @@ -1,81 +0,0 @@ -[[filters]] -Filters -------- -:Author: Mark McCurry -:Date: June 24, 2012 - -ZynAddSubFX offers several different types of filters, which can be used to -shape the spectrum of a signal. -The primary parameters that affect the characteristics of the filter are the -cutoff, resonance, filter stages, and the filter type. - -* *Cutoff*: This value determines which frequency marks the changing point for - the filter. In a low pass filter, this value marks the point where - higher frequencies are attenuated. -* *Resonance*: The resonance of a filter determines how much excess energy is - present at the cutoff frequency. In ZynAddSubFX, this is - represented by the Q-factor, which is defined to be the cutoff - frequency divided by the bandwidth. In other words higher Q - values result in a much more narrow resonant spike. -* *Stages*: The number of stages in a given filter describes how sharply it is - able to make changes in the frequency response. - -The basic 'analog' filters that ZynAddSubFX offers are shown below, with the -center frequency being marked by the red line. -The 'state variable' filters should look quite similar. - -image:images/filter0.png[] - -As previously mentioned, the Q value of a filter affects how concentrated the -signal's energy is at the cutoff frequency; The result of differing Q values are -below. - -TIP: For many classical analog sounds, high Q values were used on sweeping -filters. A simple high Q low pass filter modulated by a strong envelope is -usually sufficient to get a good sound. - -image:images/filter1.png[] - -Lastly, the affect of the order of the filter can be seen below. -This is roughly synonymous with the number of stages of the filter. -For more complex patches it is important to realize that the extra sharpness in -the filter does not come for free as it requires many more calculations being -performed; This phenomena is the most visible in subsynth, where it is easy to -need several hundred filter stages to produce a given note. - -image:images/filter2.png[] - - - -There are different types of filters. The number of poles define what will -happen at a given frequency. Mathematically, the filters are functions which -have poles that correspond to that frequency. Usually, two poles mean that the -function has more "steepness", and that you can set the exact value of the -function at the poles by defining the "resonance value". Filters with two poles -are also often referenced -as http://de.wikipedia.org/wiki/Butterworth-Filter[Butterworth Filters]. - -******************************************************************** -For the interested, functions having poles means that we are given a quotient of -polynomials. The denominator has degree 1 or 2, depending on the filter having -one or two poles. In the file _DSP/AnalogFilter.cpp_, -_AnalogFilter::computefiltercoefs()_ sets the coefficients (depending on the -filter type), and _AnalogFilter::singlefilterout()_ shows the whole polynomial -(in a formula where no quotient is needed). -******************************************************************** - -User Interface -~~~~~~~~~~~~~~ - -image:images/uifilter.png[] - -* *C.freq*: Cutoff frequency -* *Q*: Level of resonance for the filter -* *V.SnsA.*: Velocity sensing amount for filter cutoff -* *V.Sns.*: Velocity sensing function -* *freq.tr*: Frequency tracking amount. When this parameter is positive, higher - note frequencies shift the filter's cutoff frequency higher. -* *gain*: Additional gain/attenuation for filter -* *St*: Filter stages - -NOTE: TODO add a lengthy section on the formant filter setup diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/ad-note.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/ad-note.tex deleted file mode 100644 index 4dd3f3cd810..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/ad-note.tex +++ /dev/null @@ -1,37 +0,0 @@ -\documentclass{standalone} -\usepackage{tikz} -\usetikzlibrary{matrix,shapes,chains,scopes} -\begin{document} -\input{fig.sty} -\begin{tikzpicture} - \matrix (mtx) [matrix of nodes, row sep=5mm, column sep=5mm] { - & - |[lfo]| Freq LFO & - |[lfo]| Filter LFO & - |[lfo]| Amp LFO & - &\\ - |[block]| Base Fq. & - |[block]| Voices & - |[block]| Filter & - |[block, shape=isosceles triangle]| Volume & - {Output} \\ - & - |[env]| Freq Env& - |[env]| Filter Env& - |[env]| Amp Env&\\ - }; - - { [start chain=trunk] - \chainin (mtx-2-1)[join=by tip]; - \chainin (mtx-2-2)[join=by tip]; - \chainin (mtx-2-3)[join=by tip]; - \chainin (mtx-2-4)[join=by tip]; - \chainin (mtx-2-5)[join=by tip]; - } - \foreach \i in {2,3,4} - { - \draw[->] (mtx-1-\i) -- (mtx-2-\i); - \draw[->] (mtx-3-\i) -- (mtx-2-\i); - } -\end{tikzpicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/chorus.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/chorus.tex deleted file mode 100644 index 87727e36df6..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/chorus.tex +++ /dev/null @@ -1,38 +0,0 @@ -\documentclass[12pt]{report} -\pagestyle{empty} -\usepackage{pst-sigsys} -\usepackage{auto-pst-pdf} -\begin{document} -\begin{pspicture}[showgrid=false](0,-1)(8,2) - %Style - \psset{framesize=1 .65} - \psset{style=Arrow} - - %In/Out - \rput(0,0){\rnode{in}{$x[n]$}} - \rput(8,0){\rnode{out}{$y[n]$}} - - %Crossover - \psfblock[framesize=2 .65](1.5,0){cross}{Crossover} - - %Feedback over fractional delay - \pscircleop(3,0){comb} - \psfblock[framesize=1.2 .65](4.5,0){delay}{$z^{-n.m}$} - \pnode(5.5,0){decoration} - \pscircleop[operation=times](4,1){fb} - \rput(4,1.5){Feedback} - \ncangle[angleA=90]{decoration}{fb} - \ncangle[angleA=180,angleB=90]{fb}{comb} - - %subtract? - \pscircleop[operation=times] (6,0){sub} - \rput(6,-0.5){Subtract} - - %Panning - \pscircleop[operation=times] (7,0){pan} - \rput(7,0.5){Panning} - - %Connections - \nclist{ncline}{in,cross,comb,delay,sub,pan,out} -\end{pspicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/distort.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/distort.tex deleted file mode 100644 index eb6b3a9ad2c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/distort.tex +++ /dev/null @@ -1,44 +0,0 @@ -\documentclass[11pt]{report} -\pagestyle{empty} -\usepackage{pst-sigsys} -\usepackage{auto-pst-pdf} -\begin{document} -\begin{pspicture}[showgrid=false](0,-2)(10,2) - %Style - \psset{framesize=1 .65} - \psset{style=Arrow} - - %In/Out - \rput(0,0){\rnode{in}{$x[n]$}} - \rput(9.5,0){\rnode{out}{$y[n]$}} - - %Panning - \rput(1,0.5){Panning} - \pscircleop[operation=times] (1,0){pan} - \ncline{in}{pan} - - %Preamp - \rput(2,-0.5){Preamp} - \pscircleop[operation=times] (2,0){preamp} - \ncline{pan}{preamp} - - %Filtering - \psfblock(3,0){fil1}{Filter} - \ncline{preamp}{fil1} - - %Distortion - \psfblock(4.5,0){shape}{$H(n)$} - \ncline{fil1}{shape} - - %Filtering - \psfblock(6,0){fil2}{Filter} - \ncline{shape}{fil2} - - %Crossover - \psfblock[framesize=1.8 .65](8,0){cross}{Crossover} - \ncline{fil2}{cross} - \ncline{cross}{out} - - -\end{pspicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/dynamic.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/dynamic.tex deleted file mode 100644 index aba633099ce..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/dynamic.tex +++ /dev/null @@ -1,46 +0,0 @@ -\documentclass[11pt]{report} -\pagestyle{empty} -\usepackage{pst-sigsys} -\usepackage{auto-pst-pdf} -\begin{document} -\begin{pspicture}[showgrid=false](0,0)(8,2) - %Style - \psset{framesize=1 .65} - \psset{style=Arrow} - - %In/Out - \rput(0,0){\rnode{in}{$x[n]$}} - \rput(8,0){\rnode{out}{$y[n]$}} - - %Smoothing - \psfblock(1,1){smooth}{LPF} - \rput(1,1.6){smooth} - - %Sensing - \pscircleop[operation=times](2.5,1){sense} - \rput(2.5,1.5){sense} - - %Combine - \pscircleop(4,1){comb} - - %Depth - \pscircleop[operation=times](5.5,1){depth} - \rput(5.5,1.5){depth} - - %LFO - \psfblock(7,1){lfo}{LFO} - - %Filter - \psfblock(4,0){fil}{Filter} - - %Panning - \pscircleop[operation=times] (5.5,0){pan} - \rput(5.5,-0.5){Panning} - - %Connections - \pnode(1,0){decoration} - \nclist{ncline}{in,fil,pan,out} - \nclist{ncline}{decoration,smooth,sense,comb,fil} - \nclist{ncline}{lfo,depth,comb} -\end{pspicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/echo.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/echo.tex deleted file mode 100644 index 22248b4bff0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/echo.tex +++ /dev/null @@ -1,43 +0,0 @@ -\documentclass[11pt]{report} -\pagestyle{empty} -\usepackage{pst-sigsys} -\usepackage{auto-pst-pdf} -\begin{document} -\begin{pspicture}[showgrid=false](0,0)(8,2) - %Style - \psset{framesize=1 .65} - \psset{style=Arrow} - - %In/Out - \rput(0,0){\rnode{in}{$x[n]$}} - \rput(8,0){\rnode{out}{$y[n]$}} - - %Panning - \rput(1,0.5){Panning} - \pscircleop[operation=times] (1,0){pan} - \ncline{in}{pan} - - %Crossover - \psfblock[framesize=1.8 .65](6,0){cross}{Crossover} - - %Feedback - \rput(4,1.5){Feedback} - \pscircleop[operation=times](4,1){fb} - \ncangle[angleA=90,angleB=0]{cross}{fb} - \pscircleop(2,0){combine} - \ncline{pan}{combine} - \ncangle[angleA=180,angleB=90]{fb}{combine} - - %Dampining - \psfblock(3,0){hidamp}{LPF} - \ncline{combine}{hidamp} - - %Delay - \psfblock(4.3,0){delay}{$z^{-n}$} - \ncline{hidamp}{delay} - \ncline{delay}{cross} - \ncline{cross}{out} - - -\end{pspicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/fig.sty b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/fig.sty deleted file mode 100644 index 076954a09a7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/fig.sty +++ /dev/null @@ -1,14 +0,0 @@ -\tikzset{ ->=stealth, -thick, -block/.style={rectangle, draw=black!50, thick, - top color=white, - bottom color=red!50!black!20, - font=\itshape}, -op/.style={circle, draw=black!50, thick, - top color=white,bottom color=black!20, - font=\ttfamily}, -lfo/.style={block,bottom color=orange!80}, -env/.style={block,bottom color=yellow!80}, -tip/.style={->,shorten >=1pt} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/reverb.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/reverb.tex deleted file mode 100644 index ead3c5f6ee9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/reverb.tex +++ /dev/null @@ -1,50 +0,0 @@ -\documentclass{standalone} -\usepackage{tikz} -\usetikzlibrary{matrix,shapes,chains,scopes} -\begin{document} -\input{fig.sty} - -\begin{tikzpicture}[ - point/.style={coordinate}, - every on chain/.style={rounded corners}] - %Style - - \matrix[row sep=5mm, column sep=5mm] { - & - \node (fb) {$f_b$};& - \node (del) {$Delay$}; - &&&&& \\ - & - \node[op] (pb1) {$\times$};& - \node[block] (pb2) {$z^{-n}$}; & - &&&& \\ - - \node (p1) {$x[n]$}; & - \node[op] (p2) {$+$}; & - \node[point] (p3) {};& - \node[block] (p4) {HP/LP}; & - \node[block] (p5) {Comb Filter}; & - \node[block] (p6) {Allpass}; & - \node (p7) {$y[n]$}; \\ - }; - - \draw[->] (fb) -- (pb1); - \draw[->] (del) -- (pb2); - { [start chain=trunk] - \chainin (p1)[join=by tip]; - \chainin (p2)[join=by tip] ; - \chainin (p3)[join=by {}]; - %\chainin[join by={}] (p3); - { [start branch] - \chainin (pb2)[join=by tip]; - \chainin (pb1)[join=by tip]; - \chainin (p2)[join=by tip]; - } - \chainin (p4)[join=by tip]; - \chainin (p5)[join=by tip]; - \chainin (p6)[join=by tip]; - \chainin (p7)[join=by tip]; - } - -\end{tikzpicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/velf.tex b/plugins/zynaddsubfx/zynaddsubfx/doc/gen/velf.tex deleted file mode 100644 index 63884424d26..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/gen/velf.tex +++ /dev/null @@ -1,16 +0,0 @@ -\documentclass{standalone} -\usepackage{tikz,pgfplots} -\begin{document} -\begin{tikzpicture} - \begin{axis}[domain=0:1,samples=128,no markers, - xlabel=Note Velocity,ylabel=Param Magnitude, - legend style={ cells={anchor=east}, legend pos=outer north east}] - \addplot gnuplot{x^8^1}; - \addlegendentry{max sensing} - \addplot gnuplot{x^(8^-1)}; - \addlegendentry{min sensing} - \addplot gnuplot{x}; - \addlegendentry{avg sensing} - \end{axis} -\end{tikzpicture} -\end{document} diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/getting.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/getting.txt deleted file mode 100644 index 19572086af7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/getting.txt +++ /dev/null @@ -1,65 +0,0 @@ -Appendix C: Getting ZynAddSubFX -------------------------------- - -Usually there are several methods to obtain a copy of ZynAddSubFX. - -SourceForge:: - http://sourceforge.net/projects/zynaddsubfx/files/ -Distribuition:: - apt/yum/others -Git:: - git clone git://git.code.sf.net/p/zynaddsubfx/code zynaddsubfx - -Introduction to Git -~~~~~~~~~~~~~~~~~~~ - -For those who want to live on the bleeding edge or who want to assist with -making sure that the next release has fewer bugs, you will want to get aquanted -with git. -Git is used to manage the source code for this project and can be used to -quickly and easily get an up-to-date copy of the source code. - -Getting the Source Code -^^^^^^^^^^^^^^^^^^^^^^^ - -In order to get a copy of the ZynAddSubFX source code, all that needs to be done is: - ---------------------------------------------- -git clone git://git.code.sf.net/p/zynaddsubfx/code zynaddsubfx - -cd zynaddsubfx - -#Download additional resources -git submodule init -git submodule update ---------------------------------------------- - -You should now be in the directory of the source code. - -For simple steps on building, please see Appendix B of the manual. - -Checking out a branch -^^^^^^^^^^^^^^^^^^^^^ - -Lets say that development has extended into the creation of a new feature that -you want to preview. -For the sake of this guide, lets assume that the name of the branch that the -feature is on is foo. - ------------------------------------------ -#checkout the foo branch from sourceforge -git checkout --track -b foo origin/foo - -#lets checkout the primary branch again -git checkout master - -#hop back to the other branch -git checkout foo ----------------------------------------- - -Now one should be able to change branches and go into the build directory (as -described in Appendix B) and recompile ZynAddSubFX. - -NOTE: When using branches other than the master be aware that stability may - suffer - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-global.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-global.png deleted file mode 100644 index 9479a91c5d0..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-global.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-voice.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-voice.png deleted file mode 100644 index 8ee7b5f460e..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/ad-voice.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope1.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope1.png deleted file mode 100644 index fb41b7c1c22..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope1.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope2.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope2.png deleted file mode 100644 index 2a241bc9ecc..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope2.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope3.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope3.png deleted file mode 100644 index 46de2438fd4..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope3.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope4.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope4.png deleted file mode 100644 index 6f9b3e9bb19..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/envelope4.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter0.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter0.png deleted file mode 100644 index 3545da5b3a7..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter0.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter1.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter1.png deleted file mode 100644 index 35ffb1759c4..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter1.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter2.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter2.png deleted file mode 100644 index 836a5143b6c..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/filter2.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo0.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo0.png deleted file mode 100644 index 381e7db36e2..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo0.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo1.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo1.png deleted file mode 100644 index db20026c21a..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo1.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo2.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo2.png deleted file mode 100644 index 5eaeffb9f74..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/lfo2.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/phaser-spectrogram.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/phaser-spectrogram.jpg deleted file mode 100644 index d6aa804584e..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/phaser-spectrogram.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uicontroller.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uicontroller.png deleted file mode 100644 index 89b81c327e1..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uicontroller.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope0.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope0.jpg deleted file mode 100644 index b5b4593a956..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope0.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope1.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope1.jpg deleted file mode 100644 index 0db6fe7b352..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope1.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope2.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope2.jpg deleted file mode 100644 index c9006f173f8..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope2.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope3.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope3.jpg deleted file mode 100644 index bba11d866e0..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uienvelope3.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uifilter.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uifilter.png deleted file mode 100644 index f78da896f76..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uifilter.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uilfo.jpg b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uilfo.jpg deleted file mode 100644 index b8f2c140499..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uilfo.jpg and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uimain.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uimain.png deleted file mode 100644 index 5472fa544e6..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uimain.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uioscil.png b/plugins/zynaddsubfx/zynaddsubfx/doc/images/uioscil.png deleted file mode 100644 index 2f891c05549..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/doc/images/uioscil.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/intro.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/intro.txt deleted file mode 100644 index c3d3168b88c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/intro.txt +++ /dev/null @@ -1,59 +0,0 @@ -Getting Started ---------------- - -ZynAddSubFX is a fairly complex software synthesizer with a very large number of -controls. -As such, it is not alway obvious how to use ZynAddSubFX. - -Many applications under Linux transport MIDI over ALSA and transmit audio over -JACK. -ZynAddSubFX can be run in this configuration by running: - ------------------------------- -zynaddsubfx -I alsa -O jack -a ------------------------------- - -This sets the input driver to be alsa and the output driver to be jack, which -should attempt to autoconnect to your soundcard as per the '-a' flag. -If this is your first time running ZynAddSubFX, you will see a screen that lets -you choose between the advanced and beginner interface. -Currently the beginner interface is deprecated, so the advanced one is -recommended. - -Now you should be able to see ZynAddSubFX's main window, from which you can -setup patches, effects, and general configurations, but more importatnly it -provides links into the parameters of the patches. -ZynAddSubFX is a powerful tool with a number of base patches, but its true power -lies in the ability to make your own patches. - -.Main Window -image::./images/uimain.png[] - -For basic usage, you will want to use the button to the right of the enabled -label. -This button will allow for one to select the desired instrument from the banks -that ZynAddSubFX has available. -To play notes in ZynAddSubFX, either utilize the builtin virtual keyboard -(accessible via the vK button) or connect your keyboard to the system and use -*aconnect* to connect it to ZynAddSubFX (assuming that ALSA was used). - -This main window provides access to a number of more advanced features. -Some of these features are: - -* System Effects -* Insertion Effects -* Recording -* Part Settings (instrument level settings) -* Master Settings -* Microtonal Settings - -For instance to use the recording feature, a wave file must be selected from the -recording menu and then the recording can be started with the record button and -stopped with the stop button. -This is a simple and quick way of recording some samples from ZynAddSubFX, -though there are more full featured options available via JACK recording tools. - -NOTE: After hitting record, the wave file will not start recording until a new -key has been pressed via either an external midi source or the virtual keyboard -Both system and insertion effects can be accessed, the properties are available as well as properties of each -instrument. diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/lfo.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/lfo.txt deleted file mode 100644 index 082321d4526..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/lfo.txt +++ /dev/null @@ -1,65 +0,0 @@ -LFO ---- -:author: Paul Nasca - -Introduction -~~~~~~~~~~~~ - -"LFO" means Low Frequency Oscillator. -These oscillators are not used to make sounds by themselves, but they changes -somes parameters (like the frequencies, the amplitudes or the filters). - -The LFOs has some basic parameters: - -* *Delay*: This parameter sets how much time takes since the start of the - note to the start of the LFO -* *Start Phase*: The possition that a LFO will start at -* *Frequency*: How fast the LFO is (i.e. how fast the parameter's controlled by - the LFO changes) -* *Depth*: The amplitude of the LFO (i.e. how much the parameter's controlled - by the LFO changes) - -image:images/lfo0.png[] - -Another important LFO parameter is the shape. -There are many LFO Types according to the shape. -ZynAddSubFX supports the folowing LFO shapes: - -image:images/lfo1.png[] - -Another parameter is the LFO Randomness. -It modifies the LFO amplitude or the LFO frequency at random. -In ZynAddSubFX you can choose how much the LFO frequency or LFO amplitude -changes by this parameter. -In the folowing images are shown some examples of randomness and how changes -the shape of a triangle LFO. - -image:images/lfo2.png[] - -Other parameters are: - -* *Continous mode*: If this mode is used, the LFO will not start from "zero" on each new note, but it will be continuous. This is very usefull if you apply on filters to make interesting sweeps. -* *Stretch*: It controlls how much the LFO frequency changes according to the -note's frequency. -It can vary from negative stretch (the LFO frequency is decreased on higher -notes) to zero (the LFO frequency will be the same on all notes) to positive -stretch (the LFO frequency will be increased on higher notes). - -User Interface -~~~~~~~~~~~~~~ - -In ZynAddSubFX, LFO parameters are shown as: - -image:images/uilfo.jpg[] - -Theese parameters are: - -* *Freq*: LFO Frequency -* *Depth*: LFO Depth -* *Start*: LFO Start Phase - -If this knob is at the lowest value, the LFO Start Phase will be random. -* *Delay*: LFO Delay -* *A.R.*: LFO Amplitude Randomnes -* *F.R.*: LFO Frequency Randomness -* *C.*: LFO Continous Mode -* *Str.*: LFO Stretch - in the image above the LFO stretch is set to zero diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/mididefaults.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/mididefaults.txt deleted file mode 100644 index c8f33c4f412..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/mididefaults.txt +++ /dev/null @@ -1,22 +0,0 @@ -Appendex A: MIDI Defaults -------------------------- - -.Default MIDI Connections -[literal] -001 - Modulation Wheel -007 - Volume -010 - Pan -011 - Expression -064 - Sustain -065 - Portamento Enable -071 - Filter Q -074 - Filter Cutoff -075 - Bandwidth(*) -076 - Modulation Amplitude(*) -077 - Resonance Center Frequency(*) -078 - Resonance Bandwidth(*) -120 - All Sounds Off -121 - Reset All Controllers -123 - All Notes Off - -The entries with `(*)` are not within the General Midi specification diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/nrpn.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/nrpn.txt deleted file mode 100644 index 94339ade64c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/nrpn.txt +++ /dev/null @@ -1,162 +0,0 @@ -NRPN (Non Registered Parameters Number) ---------------------------------------- - -NRPNs can control all system and insertion effect parameters. -For example, you may change the reverb time when playing to keyboard or -flanger's lfo frequency. -You can disable the NRPN receiving by deselecting the "NRPN" checkbox from the -main window (near "Master Keyshift" counter). -The controls can be sent on any midi channel -(the midi channels numbers are ignored). - -The parameters are: - -- NRPN coarse (99 or 0x63)sets the system/insertion effects (4 for system effects or 8 for insertion effects) -- NRPN fine (98 or 0x62)sets the number of the effect (first effect is 0) -- Data entry coarse (6) sets the parameter number of effect to change(see below) -- Data entry fine (26) sets the parameter of the effect - -You have to send NRPN coarse/fine before sending Data entry coarse/fine. -If the effect/parameter doesn't exists or is set to none, then the NRPN is -ignored. - -Example(all values in this example are hex): - - B0 63 08 // Select the insertion effects - B0 62 01 // Select the second effect (remember: the first is 00 and not 01) - B0 06 00 // Select the effect parameter 00 - B0 26 7F // Change the parameter of effect to the value 7F (127) - -WARNING: Changing of some of the effect parameters produces clicks when sounds -passes thru these effects. -I advise you to change only when the sound volume that passes thru the effect to be very low (or silence). -Some parameters produce clicks when are changed very fast. - -Here are the effects parameter number (for Data entry coarse). -The parameters that produces clicks are written in [red]#red# and have (AC) -after their entry (always clicks). -The parameter that produces clicks only when they are changed fast are written -in [orange]#orange# and have a (FC) after the entry (Fast Clicks). -Most parameters has the range from 0 to 127. -When parameters have another range, it is written as [low...high] . - -Reverb -~~~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -02 - Reverb Time -[orange]#03 - Initial Delay (FC)# -04 - Initial Delay Feedback -[grey]#05 - reserved# -[grey]#06 - reserved# -07 - Low Pass -08 - High Pass -09 - High Frequency Damping [64..127] 64=no damping -[red]#10 - Reverb Type [0..1] 0 - Random, 1 - Freeverb (AC)# -[red]#11 - Room Size (AC)#+ - -Echo -~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -[red]#02 - Delay (AC)# -[red]#03 - Delay between left and right (AC)# -[orange]#04 - Left/Right Crossing (FC)# -05 - Feedback -06 - High Frequency Damp+ - - -Chorus -~~~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -02 - LFO Frequency -03 - LFO Randomness -04 - LFO Type [0..1] -05 - LFO Stereo Difference -06 - LFO Depth -07 - Delay -08 - Feedback -[orange]#09 - Left/Right Crossing (FC)# -[grey]#10 - reserved# -[red]#11 - Mode [0..1] (0=add, 1=subtract) (AC)#+ - -Phaser -~~~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -02 - LFO Frequency -03 - LFO Randomness -04 - LFO Type [0..1] -05 - LFO Stereo Difference -06 - LFO Depth -07 - Feedback -[red]#08 - Number of stages [0..11] (AC)# -[orange]#09 - Let/Right Crossing (FC)# -[red]#10 - Mode [0..1] (0=add, 1=subtract) (AC)# -11 - Phase+ - -AlienWah -~~~~~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -02 - LFO Frequency -03 - LFO Randomness -04 - LFO Type [0..1] -05 - LFO Stereo Difference -06 - LFO Depth -07 - Feedback -08 - Delay [0..100] -[orange]#09 - Left/Right Crossing (FC)# -10 - Phase+ - -Distorsion -~~~~~~~~~~ - -[verse] -+[orange]#00 - Volume or Dry/Wet (FC)# -[orange]#01 - Pan (FC)# -02 - Left/Right Crossing -[orange]#03 - Drive (FC)# -[orange]#04 - Level (FC)# -05 - Type [0..11] -06 - Invert the signal (negate) [0..1] -07 - Low Pass -08 - High Pass -09 - Mode [0.1] (0=mono,1=stereo)+ - -EQ -~~ - -[verse] -+[orange]#00 - Gain (FC)#+ - -All other settings of the EQ are shown in a different way. -The N represent the band ("B." setting in the UI) and the first band is 0 -(and not 1), like it is shown in the UI. -Change the "N" with the band you like. -If you want to change a band that doesn't exist, the NRPN will be ignored. - -[verse] -+[red]#10+N*5 - Change the mode of the filter [0..9] (AC)# -11+N*5 - Band's filter frequency -12+N*5 - Band's filter gain -13+N*5 - Band's filter Q (bandwidth or resonance) -[grey]#14+N*5 - reserved#+ - -Example of setting the gain on the second band: - -. The bands start counting from 0, so the second band is 1 => N=1. -. The formula is 12+N*5 => 12+1*5=17, so the number of effect parameter -. (for Data entry coarse) is 17. - diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/saving.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/saving.txt deleted file mode 100644 index a45b6631de7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/saving.txt +++ /dev/null @@ -1,55 +0,0 @@ -Persistence ------------ - -As with most applications ZynAddSubFX allows for one to ave your work and reload -it. - -Saving it all -~~~~~~~~~~~~~ - -One of the simplest ways to save your work is to save the entire session. -This can be done through the File menu and will result in the creation of an -.xmz file. -Once created, this file will hold the settings for all settings within that -session, such as microtonal tunings, all patches, system effects, insertion -effects, etc... - -Saving Parts -~~~~~~~~~~~~ - -In many cases saving everything is not what is desired. -Saving a patch later on is one such example. - -Patches -^^^^^^^ -In order to save a patch, one can either save it from the instruments menu or -through the bank window. - -With the instrument menu, one can just save the file to any given location with -the .xiz extension. - -With the banks menu, one can assign a patch to a given slot with a bank. -This instrument will remain here for future use until it is deleted. -To see the physical location of the .xiz file, one should check the -File->Settings->Bank_Root_Dirs window to see the paths for banks. - -NOTE: You need to have write permissions to add instruments to the bank. - -Presets -^^^^^^^ -Have a favorite setting for an envelope, a difficult to reproduce oscillator? -Then presets are for you. -Presets allow for one to save the settings for any of the components which -support copy/paste operations. -This is done with preset files (.xpz), which get stored in the folders indicated -by File->Settings->Preset_Root_Dirs. - -Summary -~~~~~~~ - -.Extension Summary -[literal] -xmz Everything -xiz Instrument -xsz Scale Settings -xpz Presets diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.1.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.1.txt deleted file mode 100644 index 854476cf5e8..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.1.txt +++ /dev/null @@ -1,82 +0,0 @@ -ZYNADDSUBFX(1) -============== -:doctype: manpage - -NAME ----- -zynaddsubfx - a software synthesizer - -SYNOPSIS --------- -*zynaddsubfx* ['OPTIONS'] - -DESCRIPTION ------------ - -*zynaddsubfx* is a polyphonic multimbral synthesizer, which supports three -synthesis engines and numerous effects to generate sound. - -1) ADsynth generates sounds by adding a number of voices. - Each voice has filters, envelopes, LFOs, morphing, modulation - (Ring Modulation, Phase Modulation... the modulators can have any - shape), resonance, etc... - Each voice includes a waveform generator with up to 128 sine/non-sine - harmonics. - You can use Fourier synthesis or if you don't like it you - can wave-shaping/filtering of functions. - -2) SUBsynth is a simple engine which makes sounds through - harmonic filtering of white noise - -3) PADsynth is an engine that makes very beautiful pads and other instruments, - which can be exported for use with other programs. - -Midi and audio support exists for OSS, ALSA, JACK, and others... - -OPTIONS -------- - -*-h, --help*:: - Display command-line help and exit -*-v, --version*:: - Display version and exit -*-l, --load=FILE*:: - Loads a .xmz file -*-L, --load-instrument*=FILE:: - Loads a .xiz file -*-r --sample-rate*=SR:: - Set the sample rate SR -*-b, --buffer-size*=SR:: - Set the buffer size, which determines the granularity of how often parameter - changes can be applied -*-o, --oscil-size*=OS:: - Set the ADsynth oscillator size -*-S, --swap*:: - Swap Left and Right output channels -*-D, --dump*:: - Dumps midi note ON/OFF commands -*-U, --no-gui*:: - Run ZynAddSubFX without user interface -*-N, --named*=Name:: - Postfix IO Name when possible -*-a, --auto-connect*:: - AutoConnect when using JACK -*-O, --output*=engine:: - Set Output Engine -*-I, --input*=engine:: - Set Input Engine -*-e, --exec-after-init*=command:: - Run post-initialization script. This script will be run after midi and audio - drivers have been initialized. - -BUGS ----- -Please report any bugs to either the mailing list - zynaddsubfx-user@lists.sourceforge.net -or the bugtracker - http://sourceforge.net/tracker/?group_id=62934 - -AUTHOR ------- -ZynAddSubFX was originally written by Nasca Octavian Paul. It is currently being -maintained by Mark McCurry. diff --git a/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.txt b/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.txt deleted file mode 100644 index 26cd2dd219a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/doc/zynaddsubfx.txt +++ /dev/null @@ -1,31 +0,0 @@ -Zynaddsubfx -=========== -:Author: Paul Nasca and Mark McCurry - -This documentation is a work in progress - -include::intro.txt[] - -include::filter.txt[] - -include::lfo.txt[] - -include::envelope.txt[] - -include::adsynth.txt[] - -include::controller.txt[] - -include::effects.txt[] - -///////////////////////////// -include::nrpn.txt[] -///////////////////////////// - -include::saving.txt[] - -include::mididefaults.txt[] - -include::build.txt[] - -include::getting.txt[] diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key.png deleted file mode 100644 index d90b6097f0a..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key_pressed.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key_pressed.png deleted file mode 100644 index e33750db182..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/black_key_pressed.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/knob.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/knob.png deleted file mode 100644 index 93f2cbe0fb7..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/knob.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/module_backdrop.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/module_backdrop.png deleted file mode 100644 index 2cba79553e9..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/module_backdrop.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key.png deleted file mode 100644 index e9125f29054..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key_pressed.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key_pressed.png deleted file mode 100644 index f4d08470e5c..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/white_key_pressed.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/window_backdrop.png b/plugins/zynaddsubfx/zynaddsubfx/pixmaps/window_backdrop.png deleted file mode 100644 index 3010fcb8453..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/pixmaps/window_backdrop.png and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/CMakeLists.txt deleted file mode 100644 index 786231a732a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/CMakeLists.txt +++ /dev/null @@ -1,384 +0,0 @@ -#checking include/library paths -message(STATUS "Checking Include Path" $ENV{CMAKE_INCLUDE_PATH} ${CMAKE_INCLUDE_PATH}) -message(STATUS "Checking Library Path" $ENV{CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH}) - -#Dependency check -find_package(PkgConfig REQUIRED) -find_package(zlib REQUIRED) -pkg_check_modules(FFTW REQUIRED fftw3) -pkg_check_modules(MXML REQUIRED mxml) -find_package(Threads REQUIRED) -find_package(OSS) -find_package(Alsa) -pkg_check_modules(JACK jack) -pkg_check_modules(PORTAUDIO portaudio-2.0>=19) -set(FLTK_SKIP_OPENGL true) -pkg_check_modules(NTK ntk) -pkg_check_modules(NTK_IMAGES ntk_images) -find_package(FLTK) -find_package(OpenGL) #for FLTK -find_package(CxxTest) -if(CXXTEST_FOUND) - set(CXXTEST_USE_PYTHON TRUE) -endif() -# lash -pkg_search_module(LASH lash-1.0) -mark_as_advanced(LASH_LIBRARIES) -pkg_search_module(DSSI dssi>=0.9.0) -mark_as_advanced(DSSI_LIBRARIES) -pkg_search_module(LIBLO liblo>=0.26) -mark_as_advanced(LIBLO_LIBRARIES) - -CHECK_FUNCTION_EXISTS(sched_setscheduler HAVE_SCHEDULER) - -execute_process(COMMAND echo fistpl 0 - COMMAND as - - ERROR_VARIABLE AVOID_ASM) - -######### Settings ########### -# NOTE: These cache variables should normally not be changed in this -# file, but either in in CMakeCache.txt before compile, or by passing -# parameters directly into cmake using the -D flag. -SET (GuiModule fltk CACHE STRING "GUI module, either fltk, ntk or off") -SET (CompileTests ${CXXTEST_FOUND} CACHE BOOL "whether tests should be compiled in or not") -SET (AlsaEnable ${ALSA_FOUND} CACHE BOOL - "Enable support for Advanced Linux Sound Architecture") -SET (JackEnable ${JACK_FOUND} CACHE BOOL - "Enable support for JACK Audio Connection toolKit") -SET (OssEnable ${OSS_FOUND} CACHE BOOL - "Enable support for Open Sound System") -SET (PaEnable ${PORTAUDIO_FOUND} CACHE BOOL - "Enable support for Port Audio System") -SET (LashEnable ${LASH_FOUND} CACHE BOOL - "Enable LASH Audio Session Handler") -SET (DssiEnable ${DSSI_FOUND} CACHE BOOL - "Enable DSSI Plugin compilation") -SET (LibloEnable ${LIBLO_FOUND} CACHE BOOL - "Enable Liblo") - -# Now, handle the incoming settings and set define flags/variables based -# on this - -# Add version information -add_definitions(-DVERSION="${VERSION}") - -message(STATUS "Building on a '${CMAKE_SYSTEM_NAME}' System") - -if(NOT "Darwin" STREQUAL ${CMAKE_SYSTEM_NAME}) - # Add scheduler function existance info (OSX compatiability) - add_definitions(-DHAVE_SCHEDULER=${HAVE_SCHEDULER}) -endif() - - -# Give a good guess on the best Input/Output default backends -if (JackEnable) - SET (DefaultOutput jack CACHE STRING - "Default Output module: [null, alsa, oss, jack, portaudio]") - # Override with perhaps more helpful midi backends - if (AlsaEnable) - SET (DefaultInput alsa CACHE STRING - "Default Input module: [null, alsa, oss, jack]") - elseif (OssEnable) - SET (DefaultInput oss CACHE STRING - "Default Input module: [null, alsa, oss, jack]") - else () - SET (DefaultInput jack CACHE STRING - "Default Input module: [null, alsa, oss, jack]") - endif () -elseif (AlsaEnable) - SET (DefaultOutput alsa CACHE STRING - "Default Output module: [null, alsa, oss, jack, portaudio]") - SET (DefaultInput alsa CACHE STRING - "Default Input module: [null, alsa, oss, jack]") -elseif (OssEnable) - SET (DefaultOutput oss CACHE STRING - "Default Output module: [null, alsa, oss, jack, portaudio]") - SET (DefaultInput oss CACHE STRING - "Default Input module: [null, alsa, oss, jack]") -else() - SET (DefaultOutput null CACHE STRING - "Default Output module: [null, alsa, oss, jack, portaudio]") - SET (DefaultInput null CACHE STRING - "Default Input module: [null, alsa, oss, jack]") -endif() - - - -if (GuiModule STREQUAL qt AND QT_FOUND) - set (QtGui TRUE) -elseif(GuiModule STREQUAL ntk AND NTK_FOUND) - set (NtkGui TRUE) -elseif(GuiModule STREQUAL fltk AND FLTK_FOUND) - set (FltkGui TRUE) -elseif(GuiModule STREQUAL off) - add_definitions(-DDISABLE_GUI) -else () - set (GuiModule off CACHE STRING "GUI module, either fltk, qt or off") - add_definitions(-DDISABLE_GUI) - message(STATUS "GUI module defaulting to off") -endif() - - -#Build Flags -option (BuildForAMD_X86_64 "Build for AMD x86_64 system" OFF) -option (BuildForCore2_X86_64 "Build for Intel Core2 x86_64 system" OFF) -option (BuildForDebug "Include gdb debugging support" OFF) - -set(CMAKE_BUILD_TYPE "Release") - -set (BuildOptions_x86_64AMD - "-O3 -march=athlon64 -m64 -Wall -ffast-math -fno-finite-math-only -fomit-frame-pointer" - CACHE STRING "X86_64 compiler options" -) - -set (BuildOptions_X86_64Core2 - "-O3 -march=core2 -m64 -Wall -ffast-math -fno-finite-math-only -fomit-frame-pointer" - CACHE STRING "X86_64 compiler options" -) - -set (BuildOptionsBasic - "-O3 -msse -msse2 -mfpmath=sse -ffast-math -fomit-frame-pointer" - CACHE STRING "basic X86 complier options" -) - -set (BuildOptionsDebug - "-O0 -g3 -ggdb -Wall -Wpointer-arith" CACHE STRING "Debug build flags") - -########### Settings dependant code ########### -# From here on, the setting variables have been prepared so concentrate -# on the actual compiling. - -if(AlsaEnable) - list(APPEND AUDIO_LIBRARIES ${ASOUND_LIBRARY}) - list(APPEND AUDIO_LIBRARY_DIRS ${ASOUND_LIBRARY_DIRS}) - add_definitions(-DALSA=1) -endif(AlsaEnable) - -if(JackEnable) - list(APPEND AUDIO_LIBRARIES ${JACK_LIBRARIES}) - list(APPEND AUDIO_LIBRARY_DIRS ${JACK_LIBRARY_DIRS}) - add_definitions(-DJACK=1) -endif(JackEnable) - -if(OssEnable) - add_definitions(-DOSS=1) -endif(OssEnable) - -if(PaEnable) - include_directories(${PORTAUDIO_INCLUDE_DIR}) - add_definitions(-DPORTAUDIO=1) - list(APPEND AUDIO_LIBRARIES ${PORTAUDIO_LIBRARIES}) - list(APPEND AUDIO_LIBRARY_DIRS ${PORTAUDIO_LIBRARY_DIRS}) -endif() - -if (CompileTests) - ENABLE_TESTING() -endif() - -if(LashEnable) - include_directories(${LASH_INCLUDE_DIRS}) - add_definitions(-DLASH=1) - list(APPEND AUDIO_LIBRARIES ${LASH_LIBRARIES}) - list(APPEND AUDIO_LIBRARY_DIRS ${LASH_LIBRARY_DIRS}) - message(STATUS "Compiling with lash") -endif() -if(LibloEnable) - include_directories(${LIBLO_INCLUDE_DIRS}) - add_definitions(-DUSE_NSM=1) - list(APPEND AUDIO_LIBRARIES ${LIBLO_LIBRARIES}) - list(APPEND AUDIO_LIBRARY_DIRS ${LIBLO_LIBRARY_DIRS}) - message(STATUS "Compiling with liblo") -endif() - -# other include directories -include_directories(${ZLIB_INCLUDE_DIRS} ${MXML_INCLUDE_DIRS}) - -add_definitions( - -g #TODO #todo put in a better location - -Wall - -Wextra - ) -if(NOT AVOID_ASM) - message(STATUS "Compiling with x86 opcode support") - add_definitions(-DASM_F2I_YES) -endif() - -if (BuildForDebug) - set (CMAKE_BUILD_TYPE "Debug") - set (CMAKE_CXX_FLAGS_DEBUG ${BuildOptionsDebug}) - message (STATUS "Building for ${CMAKE_BUILD_TYPE}, flags: ${CMAKE_CXX_FLAGS_DEBUG}") -else (BuildForDebug) - set (CMAKE_BUILD_TYPE "Release") - if (BuildForAMD_X86_64) - set (CMAKE_CXX_FLAGS_RELEASE ${BuildOptions_x86_64AMD}) - else (BuildForAMD_X86_64) - if (BuildForCore2_X86_64) - set (CMAKE_CXX_FLAGS_RELEASE ${BuildOptions_X86_64Core2}) - else (BuildForCore2_X86_64) - set (CMAKE_CXX_FLAGS_RELEASE ${BuildOptionsBasic}) - endif (BuildForCore2_X86_64) - endif (BuildForAMD_X86_64) - message (STATUS "Building for ${CMAKE_BUILD_TYPE}, flags: ${CMAKE_CXX_FLAGS_RELEASE}") -endif (BuildForDebug) - -add_definitions(-fPIC) - -if(FLTK_FOUND) - mark_as_advanced(FORCE FLTK_BASE_LIBRARY) - mark_as_advanced(FORCE FLTK_CONFIG_SCRIPT) - mark_as_advanced(FORCE FLTK_DIR) - mark_as_advanced(FORCE FLTK_FLUID_EXECUTABLE) - mark_as_advanced(FORCE FLTK_FORMS_LIBRARY) - mark_as_advanced(FORCE FLTK_GL_LIBRARY) - mark_as_advanced(FORCE FLTK_IMAGES_LIBRARY) - mark_as_advanced(FORCE FLTK_INCLUDE_DIR) - mark_as_advanced(FORCE FLTK_MATH_LIBRARY) -endif(FLTK_FOUND) - -if(NTK_FOUND) - mark_as_advanced(FORCE NTK_BASE_LIBRARY) - mark_as_advanced(FORCE NTK_CONFIG_SCRIPT) - mark_as_advanced(FORCE NTK_DIR) - mark_as_advanced(FORCE FLTK_FLUID_EXECUTABLE) - mark_as_advanced(FORCE NTK_FORMS_LIBRARY) - mark_as_advanced(FORCE NTK_GL_LIBRARY) - mark_as_advanced(FORCE NTK_IMAGES_LIBRARY) - mark_as_advanced(FORCE NTK_INCLUDE_DIR) - mark_as_advanced(FORCE NTK_MATH_LIBRARY) -endif(NTK_FOUND) - -if(FltkGui) - #UGLY WORKAROUND - find_program (FLTK_CONFIG fltk-config) - if (FLTK_CONFIG) - execute_process (COMMAND ${FLTK_CONFIG} --use-images --ldflags OUTPUT_VARIABLE FLTK_LDFLAGS) - string(STRIP ${FLTK_LDFLAGS} FLTK_LIBRARIES) - endif() - - message(STATUS ${FLTK_LDFLAGS}) - - - set(GUI_LIBRARIES ${FLTK_LIBRARIES} ${FLTK_LIBRARIES} ${OPENGL_LIBRARIES} zynaddsubfx_gui) - - add_definitions(-DFLTK_GUI) - message(STATUS "Will build FLTK gui") - - include_directories( - ${FLTK_INCLUDE_DIR} - "${CMAKE_CURRENT_SOURCE_DIR}/UI" - "${CMAKE_CURRENT_BINARY_DIR}/UI" - ) - - add_subdirectory(UI) -endif() - -if(NtkGui) - - find_program( FLTK_FLUID_EXECUTABLE ntk-fluid) - - message(STATUS ${NTK_LDFLAGS} ${NTK_IMAGES_LDFLAGS}) - - set(GUI_LIBRARIES ${NTK_LIBRARIES} ${NTK_IMAGES_LIBRARIES} ${OPENGL_LIBRARIES} zynaddsubfx_gui) - - add_definitions(-DNTK_GUI) - - message(STATUS "Will build NTK gui") - - include_directories( - ${NTK_INCLUDE_DIRS} - "${CMAKE_CURRENT_SOURCE_DIR}/UI" - "${CMAKE_CURRENT_BINARY_DIR}/UI" - ) - - add_subdirectory(UI) -endif() - -########### General section ############## -# Following this should be only general compilation code, and no mention -# of module-specific variables - -link_directories(${AUDIO_LIBRARY_DIRS} ${ZLIB_LIBRARY_DIRS} ${FFTW_LIBRARY_DIRS} ${MXML_LIBRARY_DIRS} ${FLTK_LIBRARY_DIRS} ${NTK_LIBRARY_DIRS}) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ) - - - -set(NONGUI_LIBRARIES - zynaddsubfx_misc - zynaddsubfx_synth - zynaddsubfx_effect - zynaddsubfx_params - zynaddsubfx_dsp - zynaddsubfx_nio - ) - -add_subdirectory(Misc) -add_subdirectory(Synth) -add_subdirectory(Effects) -add_subdirectory(Params) -add_subdirectory(DSP) -add_subdirectory(Nio) - -add_library(zynaddsubfx_core STATIC - ${zynaddsubfx_dsp_SRCS} - ${zynaddsubfx_effect_SRCS} - ${zynaddsubfx_misc_SRCS} - ${zynaddsubfx_params_SRCS} - ${zynaddsubfx_synth_SRCS} - ) - -target_link_libraries(zynaddsubfx_core - ${ZLIB_LIBRARIES} - ${FFTW_LIBRARIES} - ${MXML_LIBRARIES} - ${OS_LIBRARIES} - pthread) - -if(CompileTests) - add_subdirectory(Tests) -endif(CompileTests) - -message(STATUS "using link directories: ${AUDIO_LIBRARY_DIRS} ${ZLIB_LIBRARY_DIRS} ${FFTW_LIBRARY_DIRS} ${MXML_LIBRARY_DIRS} ${FLTK_LIBRARY_DIRS}") - - -add_executable(zynaddsubfx main.cpp) - -target_link_libraries(zynaddsubfx - zynaddsubfx_core - zynaddsubfx_nio - ${GUI_LIBRARIES} - ${NIO_LIBRARIES} - ${AUDIO_LIBRARIES} - ) - -if (DssiEnable) - add_library(zynaddsubfx_dssi SHARED - Output/DSSIaudiooutput.cpp - ) - - target_link_libraries(zynaddsubfx_dssi - zynaddsubfx_core - ${OS_LIBRARIES} - ) - if (${CMAKE_SIZEOF_VOID_P} EQUAL "8") - install(TARGETS zynaddsubfx_dssi LIBRARY DESTINATION lib64/dssi/) - else () - install(TARGETS zynaddsubfx_dssi LIBRARY DESTINATION lib/dssi/) - endif () -endif() - -message(STATUS "Link libraries: ${ZLIB_LIBRARY} ${FFTW_LIBRARY} ${MXML_LIBRARIES} ${AUDIO_LIBRARIES} ${OS_LIBRARIES}") -install(TARGETS zynaddsubfx - RUNTIME DESTINATION bin - ) - -if(NtkGui) -install(DIRECTORY ../pixmaps DESTINATION share/zynaddsubfx) -add_definitions(-DPIXMAP_PATH="${CMAKE_INSTALL_PREFIX}/share/zynaddsubfx/pixmaps/") -add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") -endif(NtkGui) - -include(CTest) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.cpp deleted file mode 100644 index 58f46a213e8..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AnalogFilter.cpp - Several analog filters (lowpass, highpass...) - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include //memcpy -#include -#include - -#include "../Misc/Util.h" -#include "AnalogFilter.h" - -AnalogFilter::AnalogFilter(unsigned char Ftype, - float Ffreq, - float Fq, - unsigned char Fstages, - unsigned int srate, int bufsize) - :Filter(srate, bufsize), - type(Ftype), - stages(Fstages), - freq(Ffreq), - q(Fq), - gain(1.0), - abovenq(false), - oldabovenq(false) -{ - for(int i = 0; i < 3; ++i) - coeff.c[i] = coeff.d[i] = oldCoeff.c[i] = oldCoeff.d[i] = 0.0f; - if(stages >= MAX_FILTER_STAGES) - stages = MAX_FILTER_STAGES; - cleanup(); - firsttime = false; - setfreq_and_q(Ffreq, Fq); - firsttime = true; - coeff.d[0] = 0; //this is not used - outgain = 1.0f; -} - -AnalogFilter::~AnalogFilter() -{} - -void AnalogFilter::cleanup() -{ - for(int i = 0; i < MAX_FILTER_STAGES + 1; ++i) { - history[i].x1 = 0.0f; - history[i].x2 = 0.0f; - history[i].y1 = 0.0f; - history[i].y2 = 0.0f; - oldHistory[i] = history[i]; - } - needsinterpolation = false; -} - -void AnalogFilter::computefiltercoefs(void) -{ - float tmp; - bool zerocoefs = false; //this is used if the freq is too high - - //do not allow frequencies bigger than samplerate/2 - float freq = this->freq; - if(freq > (halfsamplerate_f - 500.0f)) { - freq = halfsamplerate_f - 500.0f; - zerocoefs = true; - } - if(freq < 0.1f) - freq = 0.1f; - //do not allow bogus Q - if(q < 0.0f) - q = 0.0f; - float tmpq, tmpgain; - if(stages == 0) { - tmpq = q; - tmpgain = gain; - } - else { - tmpq = (q > 1.0f) ? powf(q, 1.0f / (stages + 1)) : q; - tmpgain = powf(gain, 1.0f / (stages + 1)); - } - - //Alias Terms - float *c = coeff.c; - float *d = coeff.d; - - //General Constants - const float omega = 2 * PI * freq / samplerate_f; - const float sn = sinf(omega), cs = cosf(omega); - float alpha, beta; - - //most of theese are implementations of - //the "Cookbook formulae for audio EQ" by Robert Bristow-Johnson - //The original location of the Cookbook is: - //http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - switch(type) { - case 0: //LPF 1 pole - if(!zerocoefs) - tmp = expf(-2.0f * PI * freq / samplerate_f); - else - tmp = 0.0f; - c[0] = 1.0f - tmp; - c[1] = 0.0f; - c[2] = 0.0f; - d[1] = tmp; - d[2] = 0.0f; - order = 1; - break; - case 1: //HPF 1 pole - if(!zerocoefs) - tmp = expf(-2.0f * PI * freq / samplerate_f); - else - tmp = 0.0f; - c[0] = (1.0f + tmp) / 2.0f; - c[1] = -(1.0f + tmp) / 2.0f; - c[2] = 0.0f; - d[1] = tmp; - d[2] = 0.0f; - order = 1; - break; - case 2: //LPF 2 poles - if(!zerocoefs) { - alpha = sn / (2.0f * tmpq); - tmp = 1 + alpha; - c[1] = (1.0f - cs) / tmp; - c[0] = c[2] = c[1] / 2.0f; - d[1] = -2.0f * cs / tmp * -1.0f; - d[2] = (1.0f - alpha) / tmp * -1.0f; - } - else { - c[0] = 1.0f; - c[1] = c[2] = d[1] = d[2] = 0.0f; - } - order = 2; - break; - case 3: //HPF 2 poles - if(!zerocoefs) { - alpha = sn / (2.0f * tmpq); - tmp = 1 + alpha; - c[0] = (1.0f + cs) / 2.0f / tmp; - c[1] = -(1.0f + cs) / tmp; - c[2] = (1.0f + cs) / 2.0f / tmp; - d[1] = -2.0f * cs / tmp * -1.0f; - d[2] = (1.0f - alpha) / tmp * -1.0f; - } - else - c[0] = c[1] = c[2] = d[1] = d[2] = 0.0f; - order = 2; - break; - case 4: //BPF 2 poles - if(!zerocoefs) { - alpha = sn / (2.0f * tmpq); - tmp = 1.0f + alpha; - c[0] = alpha / tmp *sqrtf(tmpq + 1.0f); - c[1] = 0.0f; - c[2] = -alpha / tmp *sqrtf(tmpq + 1.0f); - d[1] = -2.0f * cs / tmp * -1.0f; - d[2] = (1.0f - alpha) / tmp * -1.0f; - } - else - c[0] = c[1] = c[2] = d[1] = d[2] = 0.0f; - order = 2; - break; - case 5: //NOTCH 2 poles - if(!zerocoefs) { - alpha = sn / (2.0f * sqrtf(tmpq)); - tmp = 1.0f + alpha; - c[0] = 1.0f / tmp; - c[1] = -2.0f * cs / tmp; - c[2] = 1.0f / tmp; - d[1] = -2.0f * cs / tmp * -1.0f; - d[2] = (1.0f - alpha) / tmp * -1.0f; - } - else { - c[0] = 1.0f; - c[1] = c[2] = d[1] = d[2] = 0.0f; - } - order = 2; - break; - case 6: //PEAK (2 poles) - if(!zerocoefs) { - tmpq *= 3.0f; - alpha = sn / (2.0f * tmpq); - tmp = 1.0f + alpha / tmpgain; - c[0] = (1.0f + alpha * tmpgain) / tmp; - c[1] = (-2.0f * cs) / tmp; - c[2] = (1.0f - alpha * tmpgain) / tmp; - d[1] = -2.0f * cs / tmp * -1.0f; - d[2] = (1.0f - alpha / tmpgain) / tmp * -1.0f; - } - else { - c[0] = 1.0f; - c[1] = c[2] = d[1] = d[2] = 0.0f; - } - order = 2; - break; - case 7: //Low Shelf - 2 poles - if(!zerocoefs) { - tmpq = sqrtf(tmpq); - alpha = sn / (2.0f * tmpq); - beta = sqrtf(tmpgain) / tmpq; - tmp = (tmpgain + 1.0f) + (tmpgain - 1.0f) * cs + beta * sn; - - c[0] = tmpgain - * ((tmpgain - + 1.0f) - (tmpgain - 1.0f) * cs + beta * sn) / tmp; - c[1] = 2.0f * tmpgain - * ((tmpgain - 1.0f) - (tmpgain + 1.0f) * cs) / tmp; - c[2] = tmpgain - * ((tmpgain - + 1.0f) - (tmpgain - 1.0f) * cs - beta * sn) / tmp; - d[1] = -2.0f * ((tmpgain - 1.0f) + (tmpgain + 1.0f) * cs) - / tmp * -1.0f; - d[2] = ((tmpgain + 1.0f) + (tmpgain - 1.0f) * cs - beta * sn) - / tmp * -1.0f; - } - else { - c[0] = tmpgain; - c[1] = c[2] = d[1] = d[2] = 0.0f; - } - order = 2; - break; - case 8: //High Shelf - 2 poles - if(!zerocoefs) { - tmpq = sqrtf(tmpq); - alpha = sn / (2.0f * tmpq); - beta = sqrtf(tmpgain) / tmpq; - tmp = (tmpgain + 1.0f) - (tmpgain - 1.0f) * cs + beta * sn; - - c[0] = tmpgain - * ((tmpgain - + 1.0f) + (tmpgain - 1.0f) * cs + beta * sn) / tmp; - c[1] = -2.0f * tmpgain - * ((tmpgain - 1.0f) + (tmpgain + 1.0f) * cs) / tmp; - c[2] = tmpgain - * ((tmpgain - + 1.0f) + (tmpgain - 1.0f) * cs - beta * sn) / tmp; - d[1] = 2.0f * ((tmpgain - 1.0f) - (tmpgain + 1.0f) * cs) - / tmp * -1.0f; - d[2] = ((tmpgain + 1.0f) - (tmpgain - 1.0f) * cs - beta * sn) - / tmp * -1.0f; - } - else { - c[0] = 1.0f; - c[1] = c[2] = d[1] = d[2] = 0.0f; - } - order = 2; - break; - default: //wrong type - type = 0; - computefiltercoefs(); - break; - } -} - - -void AnalogFilter::setfreq(float frequency) -{ - if(frequency < 0.1f) - frequency = 0.1f; - float rap = freq / frequency; - if(rap < 1.0f) - rap = 1.0f / rap; - - oldabovenq = abovenq; - abovenq = frequency > (halfsamplerate_f - 500.0f); - - bool nyquistthresh = (abovenq ^ oldabovenq); - - - //if the frequency is changed fast, it needs interpolation - if((rap > 3.0f) || nyquistthresh) { //(now, filter and coeficients backup) - oldCoeff = coeff; - for(int i = 0; i < MAX_FILTER_STAGES + 1; ++i) - oldHistory[i] = history[i]; - if(!firsttime) - needsinterpolation = true; - } - freq = frequency; - computefiltercoefs(); - firsttime = false; -} - -void AnalogFilter::setfreq_and_q(float frequency, float q_) -{ - q = q_; - setfreq(frequency); -} - -void AnalogFilter::setq(float q_) -{ - q = q_; - computefiltercoefs(); -} - -void AnalogFilter::settype(int type_) -{ - type = type_; - computefiltercoefs(); -} - -void AnalogFilter::setgain(float dBgain) -{ - gain = dB2rap(dBgain); - computefiltercoefs(); -} - -void AnalogFilter::setstages(int stages_) -{ - if(stages_ >= MAX_FILTER_STAGES) - stages_ = MAX_FILTER_STAGES - 1; - stages = stages_; - cleanup(); - computefiltercoefs(); -} - -inline void AnalogBiquadFilterA(const float coeff[5], float &src, float work[4]) -{ - work[3] = src*coeff[0] - + work[0]*coeff[1] - + work[1]*coeff[2] - + work[2]*coeff[3] - + work[3]*coeff[4]; - work[1] = src; - src = work[3]; -} - -inline void AnalogBiquadFilterB(const float coeff[5], float &src, float work[4]) -{ - work[2] = src*coeff[0] - + work[1]*coeff[1] - + work[0]*coeff[2] - + work[3]*coeff[3] - + work[2]*coeff[4]; - work[0] = src; - src = work[2]; -} - -void AnalogFilter::singlefilterout(float *smp, fstage &hist, - const Coeff &coeff) -{ - assert((buffersize % 8) == 0); - if(order == 1) { //First order filter - for(int i = 0; i < buffersize; ++i) { - float y0 = smp[i] * coeff.c[0] + hist.x1 * coeff.c[1] - + hist.y1 * coeff.d[1]; - hist.y1 = y0; - hist.x1 = smp[i]; - smp[i] = y0; - } - } else if(order == 2) {//Second order filter - const float coeff_[5] = {coeff.c[0], coeff.c[1], coeff.c[2], coeff.d[1], coeff.d[2]}; - float work[4] = {hist.x1, hist.x2, hist.y1, hist.y2}; - for(int i = 0; i < buffersize; i+=8) { - AnalogBiquadFilterA(coeff_, smp[i + 0], work); - AnalogBiquadFilterB(coeff_, smp[i + 1], work); - AnalogBiquadFilterA(coeff_, smp[i + 2], work); - AnalogBiquadFilterB(coeff_, smp[i + 3], work); - AnalogBiquadFilterA(coeff_, smp[i + 4], work); - AnalogBiquadFilterB(coeff_, smp[i + 5], work); - AnalogBiquadFilterA(coeff_, smp[i + 6], work); - AnalogBiquadFilterB(coeff_, smp[i + 7], work); - } - hist.x1 = work[0]; - hist.x2 = work[1]; - hist.y1 = work[2]; - hist.y2 = work[3]; - } -} - -void AnalogFilter::filterout(float *smp) -{ - for(int i = 0; i < stages + 1; ++i) - singlefilterout(smp, history[i], coeff); - - if(needsinterpolation) { - //Merge Filter at old coeff with new coeff - float ismp[buffersize]; - memcpy(ismp, smp, bufferbytes); - - for(int i = 0; i < stages + 1; ++i) - singlefilterout(ismp, oldHistory[i], oldCoeff); - - for(int i = 0; i < buffersize; ++i) { - float x = (float)i / buffersize_f; - smp[i] = ismp[i] * (1.0f - x) + smp[i] * x; - } - needsinterpolation = false; - } - - for(int i = 0; i < buffersize; ++i) - smp[i] *= outgain; -} - -float AnalogFilter::H(float freq) -{ - float fr = freq / samplerate_f * PI * 2.0f; - float x = coeff.c[0], y = 0.0f; - for(int n = 1; n < 3; ++n) { - x += cosf(n * fr) * coeff.c[n]; - y -= sinf(n * fr) * coeff.c[n]; - } - float h = x * x + y * y; - x = 1.0f; - y = 0.0f; - for(int n = 1; n < 3; ++n) { - x -= cosf(n * fr) * coeff.d[n]; - y += sinf(n * fr) * coeff.d[n]; - } - h = h / (x * x + y * y); - return powf(h, (stages + 1.0f) / 2.0f); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.h deleted file mode 100644 index 8a012d47daf..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/AnalogFilter.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Analog Filter.h - Several analog filters (lowpass, highpass...) - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ANALOG_FILTER_H -#define ANALOG_FILTER_H - -#include "../globals.h" -#include "Filter.h" - -/**Implementation of Several analog filters (lowpass, highpass...) - * Implemented with IIR filters - * Coefficients generated with "Cookbook formulae for audio EQ"*/ -class AnalogFilter:public Filter -{ - public: - AnalogFilter(unsigned char Ftype, float Ffreq, float Fq, - unsigned char Fstages, unsigned int srate, int bufsize); - ~AnalogFilter(); - void filterout(float *smp); - void setfreq(float frequency); - void setfreq_and_q(float frequency, float q_); - void setq(float q_); - - void settype(int type_); - void setgain(float dBgain); - void setstages(int stages_); - void cleanup(); - - float H(float freq); //Obtains the response for a given frequency - - private: - struct fstage { - float x1, x2; //Input History - float y1, y2; //Output History - } history[MAX_FILTER_STAGES + 1], oldHistory[MAX_FILTER_STAGES + 1]; - - struct Coeff { - float c[3], //Feed Forward - d[3]; //Feed Back - } coeff, oldCoeff; - //old coeffs are used for interpolation when paremeters change quickly - - //Apply IIR filter to Samples, with coefficients, and past history - void singlefilterout(float *smp, fstage &hist, const Coeff &coeff); - //Update coeff and order - void computefiltercoefs(void); - - int type; //The type of the filter (LPF1,HPF1,LPF2,HPF2...) - int stages; //how many times the filter is applied (0->1,1->2,etc.) - float freq; //Frequency given in Hz - float q; //Q factor (resonance or Q factor) - float gain; //the gain of the filter (if are shelf/peak) filters - - int order; //the order of the filter (number of poles) - - bool needsinterpolation, //Interpolation between coeff changes - firsttime; //First Iteration of filter - bool abovenq, //if the frequency is above the nyquist - oldabovenq; //if the last time was above nyquist - //(used to see if it needs interpolation) -}; - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/CMakeLists.txt deleted file mode 100644 index 84ac3853f84..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(zynaddsubfx_dsp_SRCS - DSP/AnalogFilter.cpp - DSP/FFTwrapper.cpp - DSP/Filter.cpp - DSP/FormantFilter.cpp - DSP/SVFilter.cpp - DSP/Unison.cpp - PARENT_SCOPE -) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.cpp deleted file mode 100644 index 4d995b035a5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FFTwrapper.c - A wrapper for Fast Fourier Transforms - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include "FFTwrapper.h" - -FFTwrapper::FFTwrapper(int fftsize_) -{ - fftsize = fftsize_; - time = new fftw_real[fftsize]; - fft = new fftwf_complex[fftsize + 1]; - planfftw = fftwf_plan_dft_r2c_1d(fftsize, - time, - fft, - FFTW_ESTIMATE); - planfftw_inv = fftwf_plan_dft_c2r_1d(fftsize, - fft, - time, - FFTW_ESTIMATE); -} - -FFTwrapper::~FFTwrapper() -{ - fftwf_destroy_plan(planfftw); - fftwf_destroy_plan(planfftw_inv); - - delete [] time; - delete [] fft; -} - -void FFTwrapper::smps2freqs(const float *smps, fft_t *freqs) -{ - //Load data - for(int i = 0; i < fftsize; ++i) - time[i] = smps[i]; - - //DFT - fftwf_execute(planfftw); - - //Grab data - memcpy((void *)freqs, (const void *)fft, fftsize * sizeof(fftw_real)); -} - -void FFTwrapper::freqs2smps(const fft_t *freqs, float *smps) -{ - //Load data - memcpy((void *)fft, (const void *)freqs, fftsize * sizeof(fftw_real)); - - //clear unused freq channel - fft[fftsize / 2][0] = 0.0f; - fft[fftsize / 2][1] = 0.0f; - - //IDFT - fftwf_execute(planfftw_inv); - - //Grab data - for(int i = 0; i < fftsize; ++i) - smps[i] = static_cast(time[i]); -} - -void FFT_cleanup() -{ - fftwf_cleanup(); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.h deleted file mode 100644 index 6eb603336fd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FFTwrapper.h - A wrapper for Fast Fourier Transforms - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FFT_WRAPPER_H -#define FFT_WRAPPER_H -#include -#include -typedef float fftw_real; -typedef std::complex fft_t; - -/**A wrapper for the FFTW library (Fast Fourier Transforms)*/ -class FFTwrapper -{ - public: - /**Constructor - * @param fftsize The size of samples to be fed to fftw*/ - FFTwrapper(int fftsize_); - /**Destructor*/ - ~FFTwrapper(); - /**Convert Samples to Frequencies using Fourier Transform - * @param smps Pointer to Samples to be converted; has length fftsize_ - * @param freqs Structure FFTFREQS which stores the frequencies*/ - void smps2freqs(const float *smps, fft_t *freqs); - void freqs2smps(const fft_t *freqs, float *smps); - private: - int fftsize; - fftw_real *time; - fftwf_complex *fft; - fftwf_plan planfftw, planfftw_inv; -}; - -void FFT_cleanup(); -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.cpp deleted file mode 100644 index 9487fb47587..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Filter.cpp - Filters, uses analog,formant,etc. filters - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include - -#include "Filter.h" -#include "AnalogFilter.h" -#include "FormantFilter.h" -#include "SVFilter.h" -#include "../Params/FilterParams.h" - -Filter::Filter(unsigned int srate, int bufsize) - : outgain(1.0f), - samplerate(srate), - buffersize(bufsize) -{ - alias(); -} - -Filter *Filter::generate(FilterParams *pars, unsigned int srate, int bufsize) -{ - if (srate == 0) - srate = synth->samplerate; - if (bufsize == 0) - bufsize = synth->buffersize; - - unsigned char Ftype = pars->Ptype; - unsigned char Fstages = pars->Pstages; - - Filter *filter; - switch(pars->Pcategory) { - case 1: - filter = new FormantFilter(pars, srate, bufsize); - break; - case 2: - filter = new SVFilter(Ftype, 1000.0f, pars->getq(), Fstages, srate, bufsize); - filter->outgain = dB2rap(pars->getgain()); - if(filter->outgain > 1.0f) - filter->outgain = sqrt(filter->outgain); - break; - default: - filter = new AnalogFilter(Ftype, 1000.0f, pars->getq(), Fstages, srate, bufsize); - if((Ftype >= 6) && (Ftype <= 8)) - filter->setgain(pars->getgain()); - else - filter->outgain = dB2rap(pars->getgain()); - break; - } - return filter; -} - -float Filter::getrealfreq(float freqpitch) -{ - return powf(2.0f, freqpitch + 9.96578428f); //log2(1000)=9.95748f -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.h deleted file mode 100644 index 52e3675c17a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Filter.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Filter.h - Filters, uses analog,formant,etc. filters - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FILTER_H -#define FILTER_H - -#include "../globals.h" - -class Filter -{ - public: - static float getrealfreq(float freqpitch); - static Filter *generate(class FilterParams * pars, unsigned int srate = 0, int bufsize = 0); - - Filter(unsigned int srate, int bufsize); - virtual ~Filter() {} - virtual void filterout(float *smp) = 0; - virtual void setfreq(float frequency) = 0; - virtual void setfreq_and_q(float frequency, float q_) = 0; - virtual void setq(float q_) = 0; - virtual void setgain(float dBgain) = 0; - - protected: - float outgain; - - // current setup - unsigned int samplerate; - int buffersize; - - // alias for above terms - float samplerate_f; - float halfsamplerate_f; - float buffersize_f; - int bufferbytes; - - inline void alias() - { - samplerate_f = samplerate; - halfsamplerate_f = samplerate_f / 2.0f; - buffersize_f = buffersize; - bufferbytes = buffersize * sizeof(float); - } -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.cpp deleted file mode 100644 index 36db5f6d1c9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FormantFilter.cpp - formant filters - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "../Misc/Util.h" -#include "FormantFilter.h" -#include "AnalogFilter.h" -#include "../Params/FilterParams.h" - -FormantFilter::FormantFilter(FilterParams *pars, unsigned int srate, int bufsize) - : Filter(srate, bufsize) -{ - numformants = pars->Pnumformants; - for(int i = 0; i < numformants; ++i) - formant[i] = new AnalogFilter(4 /*BPF*/, 1000.0f, 10.0f, pars->Pstages, srate, bufsize); - cleanup(); - - for(int j = 0; j < FF_MAX_VOWELS; ++j) - for(int i = 0; i < numformants; ++i) { - formantpar[j][i].freq = pars->getformantfreq( - pars->Pvowels[j].formants[i].freq); - formantpar[j][i].amp = pars->getformantamp( - pars->Pvowels[j].formants[i].amp); - formantpar[j][i].q = pars->getformantq( - pars->Pvowels[j].formants[i].q); - } - - for(int i = 0; i < FF_MAX_FORMANTS; ++i) - oldformantamp[i] = 1.0f; - for(int i = 0; i < numformants; ++i) { - currentformants[i].freq = 1000.0f; - currentformants[i].amp = 1.0f; - currentformants[i].q = 2.0f; - } - - formantslowness = powf(1.0f - (pars->Pformantslowness / 128.0f), 3.0f); - - sequencesize = pars->Psequencesize; - if(sequencesize == 0) - sequencesize = 1; - for(int k = 0; k < sequencesize; ++k) - sequence[k].nvowel = pars->Psequence[k].nvowel; - - vowelclearness = powf(10.0f, (pars->Pvowelclearness - 32.0f) / 48.0f); - - sequencestretch = powf(0.1f, (pars->Psequencestretch - 32.0f) / 48.0f); - if(pars->Psequencereversed) - sequencestretch *= -1.0f; - - outgain = dB2rap(pars->getgain()); - - oldinput = -1.0f; - Qfactor = 1.0f; - oldQfactor = Qfactor; - firsttime = 1; -} - -FormantFilter::~FormantFilter() -{ - for(int i = 0; i < numformants; ++i) - delete (formant[i]); -} - -void FormantFilter::cleanup() -{ - for(int i = 0; i < numformants; ++i) - formant[i]->cleanup(); -} - -void FormantFilter::setpos(float input) -{ - int p1, p2; - - if(firsttime != 0) - slowinput = input; - else - slowinput = slowinput - * (1.0f - formantslowness) + input * formantslowness; - - if((fabsf(oldinput - input) < 0.001f) && (fabsf(slowinput - input) < 0.001f) - && (fabsf(Qfactor - oldQfactor) < 0.001f)) { - // oldinput=input; daca setez asta, o sa faca probleme la schimbari foarte lente - firsttime = 0; - return; - } - else - oldinput = input; - - float pos = fmodf(input * sequencestretch, 1.0f); - if(pos < 0.0f) - pos += 1.0f; - - F2I(pos * sequencesize, p2); - p1 = p2 - 1; - if(p1 < 0) - p1 += sequencesize; - - pos = fmodf(pos * sequencesize, 1.0f); - if(pos < 0.0f) - pos = 0.0f; - else - if(pos > 1.0f) - pos = 1.0f; - pos = - (atanf((pos * 2.0f - - 1.0f) - * vowelclearness) / atanf(vowelclearness) + 1.0f) * 0.5f; - - p1 = sequence[p1].nvowel; - p2 = sequence[p2].nvowel; - - if(firsttime != 0) { - for(int i = 0; i < numformants; ++i) { - currentformants[i].freq = - formantpar[p1][i].freq - * (1.0f - pos) + formantpar[p2][i].freq * pos; - currentformants[i].amp = - formantpar[p1][i].amp - * (1.0f - pos) + formantpar[p2][i].amp * pos; - currentformants[i].q = - formantpar[p1][i].q * (1.0f - pos) + formantpar[p2][i].q * pos; - formant[i]->setfreq_and_q(currentformants[i].freq, - currentformants[i].q * Qfactor); - oldformantamp[i] = currentformants[i].amp; - } - firsttime = 0; - } - else - for(int i = 0; i < numformants; ++i) { - currentformants[i].freq = - currentformants[i].freq * (1.0f - formantslowness) - + (formantpar[p1][i].freq - * (1.0f - pos) + formantpar[p2][i].freq * pos) - * formantslowness; - - currentformants[i].amp = - currentformants[i].amp * (1.0f - formantslowness) - + (formantpar[p1][i].amp * (1.0f - pos) - + formantpar[p2][i].amp * pos) * formantslowness; - - currentformants[i].q = currentformants[i].q - * (1.0f - formantslowness) - + (formantpar[p1][i].q * (1.0f - pos) - + formantpar[p2][i].q - * pos) * formantslowness; - - - formant[i]->setfreq_and_q(currentformants[i].freq, - currentformants[i].q * Qfactor); - } - - oldQfactor = Qfactor; -} - -void FormantFilter::setfreq(float frequency) -{ - setpos(frequency); -} - -void FormantFilter::setq(float q_) -{ - Qfactor = q_; - for(int i = 0; i < numformants; ++i) - formant[i]->setq(Qfactor * currentformants[i].q); -} - -void FormantFilter::setgain(float /*dBgain*/) -{} - -inline float log_2(float x) -{ - return logf(x) / logf(2.0f); -} - -void FormantFilter::setfreq_and_q(float frequency, float q_) -{ - //Convert form real freq[Hz] - const float freq = log_2(frequency) - 9.96578428f; //log2(1000)=9.95748f. - - Qfactor = q_; - setpos(freq); -} - - -void FormantFilter::filterout(float *smp) -{ - float inbuffer[buffersize]; - - memcpy(inbuffer, smp, bufferbytes); - memset(smp, 0, bufferbytes); - - for(int j = 0; j < numformants; ++j) { - float tmpbuf[buffersize]; - for(int i = 0; i < buffersize; ++i) - tmpbuf[i] = inbuffer[i] * outgain; - formant[j]->filterout(tmpbuf); - - if(ABOVE_AMPLITUDE_THRESHOLD(oldformantamp[j], currentformants[j].amp)) - for(int i = 0; i < buffersize; ++i) - smp[i] += tmpbuf[i] - * INTERPOLATE_AMPLITUDE(oldformantamp[j], - currentformants[j].amp, - i, - buffersize); - else - for(int i = 0; i < buffersize; ++i) - smp[i] += tmpbuf[i] * currentformants[j].amp; - oldformantamp[j] = currentformants[j].amp; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.h deleted file mode 100644 index 715f00f033f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/FormantFilter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FormantFilter.h - formant filter - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FORMANT_FILTER_H -#define FORMANT_FILTER_H - -#include "../globals.h" -#include "Filter.h" - - -class FormantFilter:public Filter -{ - public: - FormantFilter(class FilterParams *pars, unsigned int srate, int bufsize); - ~FormantFilter(); - void filterout(float *smp); - void setfreq(float frequency); - void setfreq_and_q(float frequency, float q_); - void setq(float q_); - void setgain(float dBgain); - - void cleanup(void); - - private: - void setpos(float input); - - - class AnalogFilter * formant[FF_MAX_FORMANTS]; - - struct { - float freq, amp, q; //frequency,amplitude,Q - } formantpar[FF_MAX_VOWELS][FF_MAX_FORMANTS], - currentformants[FF_MAX_FORMANTS]; - - struct { - unsigned char nvowel; - } sequence [FF_MAX_SEQUENCE]; - - float oldformantamp[FF_MAX_FORMANTS]; - - int sequencesize, numformants, firsttime; - float oldinput, slowinput; - float Qfactor, formantslowness, oldQfactor; - float vowelclearness, sequencestretch; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.cpp deleted file mode 100644 index 5e27c39c3d0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SVFilter.cpp - Several state-variable filters - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include -#ifndef WIN32 -#include -#endif -#include "../Misc/Util.h" -#include "SVFilter.h" - -SVFilter::SVFilter(unsigned char Ftype, float Ffreq, float Fq, - unsigned char Fstages, unsigned int srate, int bufsize) - :Filter(srate, bufsize), - type(Ftype), - stages(Fstages), - freq(Ffreq), - q(Fq), - gain(1.0f), - needsinterpolation(false), - firsttime(true) -{ - if(stages >= MAX_FILTER_STAGES) - stages = MAX_FILTER_STAGES; - outgain = 1.0f; - cleanup(); - setfreq_and_q(Ffreq, Fq); -} - -SVFilter::~SVFilter() -{} - -void SVFilter::cleanup() -{ - for(int i = 0; i < MAX_FILTER_STAGES + 1; ++i) - st[i].low = st[i].high = st[i].band = st[i].notch = 0.0f; - oldabovenq = false; - abovenq = false; -} - -void SVFilter::computefiltercoefs(void) -{ - par.f = freq / samplerate_f * 4.0f; - if(par.f > 0.99999f) - par.f = 0.99999f; - par.q = 1.0f - atanf(sqrtf(q)) * 2.0f / PI; - par.q = powf(par.q, 1.0f / (stages + 1)); - par.q_sqrt = sqrtf(par.q); -} - - -void SVFilter::setfreq(float frequency) -{ - if(frequency < 0.1f) - frequency = 0.1f; - float rap = freq / frequency; - if(rap < 1.0f) - rap = 1.0f / rap; - - oldabovenq = abovenq; - abovenq = frequency > (samplerate_f / 2 - 500.0f); - - bool nyquistthresh = (abovenq ^ oldabovenq); - - //if the frequency is changed fast, it needs interpolation - if((rap > 3.0f) || nyquistthresh) { //(now, filter and coeficients backup) - if(!firsttime) - needsinterpolation = true; - ipar = par; - } - freq = frequency; - computefiltercoefs(); - firsttime = false; -} - -void SVFilter::setfreq_and_q(float frequency, float q_) -{ - q = q_; - setfreq(frequency); -} - -void SVFilter::setq(float q_) -{ - q = q_; - computefiltercoefs(); -} - -void SVFilter::settype(int type_) -{ - type = type_; - computefiltercoefs(); -} - -void SVFilter::setgain(float dBgain) -{ - gain = dB2rap(dBgain); - computefiltercoefs(); -} - -void SVFilter::setstages(int stages_) -{ - if(stages_ >= MAX_FILTER_STAGES) - stages_ = MAX_FILTER_STAGES - 1; - stages = stages_; - cleanup(); - computefiltercoefs(); -} - -void SVFilter::singlefilterout(float *smp, fstage &x, parameters &par) -{ - float *out = NULL; - switch(type) { - case 0: - out = &x.low; - break; - case 1: - out = &x.high; - break; - case 2: - out = &x.band; - break; - case 3: - out = &x.notch; - break; - default: -#ifndef WIN32 - errx(1, "Impossible SVFilter type encountered [%d]", type); -#endif - break; - } - - for(int i = 0; i < buffersize; ++i) { - x.low = x.low + par.f * x.band; - x.high = par.q_sqrt * smp[i] - x.low - par.q * x.band; - x.band = par.f * x.high + x.band; - x.notch = x.high + x.low; - smp[i] = *out; - } -} - -void SVFilter::filterout(float *smp) -{ - for(int i = 0; i < stages + 1; ++i) - singlefilterout(smp, st[i], par); - - if(needsinterpolation) { - float ismp[buffersize]; - memcpy(ismp, smp, bufferbytes); - - for(int i = 0; i < stages + 1; ++i) - singlefilterout(ismp, st[i], ipar); - - for(int i = 0; i < buffersize; ++i) { - float x = i / buffersize_f; - smp[i] = ismp[i] * (1.0f - x) + smp[i] * x; - } - needsinterpolation = false; - } - - for(int i = 0; i < buffersize; ++i) - smp[i] *= outgain; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.h deleted file mode 100644 index e9d002c7b3b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/SVFilter.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SV Filter.h - Several state-variable filters - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SV_FILTER_H -#define SV_FILTER_H - -#include "../globals.h" -#include "Filter.h" - -class SVFilter:public Filter -{ - public: - SVFilter(unsigned char Ftype, - float Ffreq, - float Fq, - unsigned char Fstages, - unsigned int srate, int bufsize); - ~SVFilter(); - void filterout(float *smp); - void setfreq(float frequency); - void setfreq_and_q(float frequency, float q_); - void setq(float q_); - - void settype(int type_); - void setgain(float dBgain); - void setstages(int stages_); - void cleanup(); - - private: - struct fstage { - float low, high, band, notch; - } st[MAX_FILTER_STAGES + 1]; - - struct parameters { - float f, q, q_sqrt; - } par, ipar; - - void singlefilterout(float *smp, fstage &x, parameters &par); - void computefiltercoefs(void); - int type; // The type of the filter (LPF1,HPF1,LPF2,HPF2...) - int stages; // how many times the filter is applied (0->1,1->2,etc.) - float freq; // Frequency given in Hz - float q; // Q factor (resonance or Q factor) - float gain; // the gain of the filter (if are shelf/peak) filters - - bool abovenq, //if the frequency is above the nyquist - oldabovenq; - bool needsinterpolation, firsttime; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.cpp deleted file mode 100644 index 540a7ef1152..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Unison.cpp - Unison effect (multivoice chorus) - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#ifndef WIN32 -#include -#endif - -#include "Unison.h" - -Unison::Unison(int update_period_samples_, float max_delay_sec_, float srate_f) - :unison_size(0), - base_freq(1.0f), - uv(NULL), - update_period_samples(update_period_samples_), - update_period_sample_k(0), - max_delay((int)(srate_f * max_delay_sec_) + 1), - delay_k(0), - first_time(false), - delay_buffer(NULL), - unison_amplitude_samples(0.0f), - unison_bandwidth_cents(10.0f), - samplerate_f(srate_f) -{ - if(max_delay < 10) - max_delay = 10; - delay_buffer = new float[max_delay]; - memset(delay_buffer, 0, max_delay * sizeof(float)); - setSize(1); -} - -Unison::~Unison() { - delete [] delay_buffer; - delete [] uv; -} - -void Unison::setSize(int new_size) -{ - if(new_size < 1) - new_size = 1; - unison_size = new_size; - if(uv) - delete [] uv; - uv = new UnisonVoice[unison_size]; - first_time = true; - updateParameters(); -} - -void Unison::setBaseFrequency(float freq) -{ - base_freq = freq; - updateParameters(); -} - -void Unison::setBandwidth(float bandwidth) -{ - if(bandwidth < 0) - bandwidth = 0.0f; - if(bandwidth > 1200.0f) - bandwidth = 1200.0f; - - /* If the bandwidth is too small, the audio may cancel itself out - * (due to the sign change of the outputs) - * TODO figure out the acceptable lower bound and codify it - */ - unison_bandwidth_cents = bandwidth; - updateParameters(); -} - -void Unison::updateParameters(void) -{ - if(!uv) - return; - float increments_per_second = samplerate_f - / (float) update_period_samples; -// printf("#%g, %g\n",increments_per_second,base_freq); - for(int i = 0; i < unison_size; ++i) { - float base = powf(UNISON_FREQ_SPAN, SYNTH_T::numRandom() * 2.0f - 1.0f); - uv[i].relative_amplitude = base; - float period = base / base_freq; - float m = 4.0f / (period * increments_per_second); - if(SYNTH_T::numRandom() < 0.5f) - m = -m; - uv[i].step = m; -// printf("%g %g\n",uv[i].relative_amplitude,period); - } - - float max_speed = powf(2.0f, unison_bandwidth_cents / 1200.0f); - unison_amplitude_samples = 0.125f * (max_speed - 1.0f) - * samplerate_f / base_freq; - - //If functions exceed this limit, they should have requested a bigguer delay - //and thus are buggy - if(unison_amplitude_samples >= max_delay - 1) { -#ifndef WIN32 - warnx("BUG: Unison amplitude samples too big"); - warnx("Unision max_delay should be larger"); -#endif - unison_amplitude_samples = max_delay - 2; - } - - updateUnisonData(); -} - -void Unison::process(int bufsize, float *inbuf, float *outbuf) -{ - if(!uv) - return; - if(!outbuf) - outbuf = inbuf; - - float volume = 1.0f / sqrtf(unison_size); - float xpos_step = 1.0f / (float) update_period_samples; - float xpos = (float) update_period_sample_k * xpos_step; - for(int i = 0; i < bufsize; ++i) { - if(update_period_sample_k++ >= update_period_samples) { - updateUnisonData(); - update_period_sample_k = 0; - xpos = 0.0f; - } - xpos += xpos_step; - float in = inbuf[i], out = 0.0f; - float sign = 1.0f; - for(int k = 0; k < unison_size; ++k) { - float vpos = uv[k].realpos1 * (1.0f - xpos) + uv[k].realpos2 * xpos; //optimize - float pos = (float)(delay_k + max_delay) - vpos - 1.0f; - int posi; - F2I(pos, posi); //optimize! - int posi_next = posi + 1; - if(posi >= max_delay) - posi -= max_delay; - if(posi_next >= max_delay) - posi_next -= max_delay; - float posf = pos - floorf(pos); - out += ((1.0f - posf) * delay_buffer[posi] + posf - * delay_buffer[posi_next]) * sign; - sign = -sign; - } - outbuf[i] = out * volume; -// printf("%d %g\n",i,outbuf[i]); - delay_buffer[delay_k] = in; - delay_k = (++delay_k < max_delay) ? delay_k : 0; - } -} - -void Unison::updateUnisonData() -{ - if(!uv) - return; - - for(int k = 0; k < unison_size; ++k) { - float pos = uv[k].position; - float step = uv[k].step; - pos += step; - if(pos <= -1.0f) { - pos = -1.0f; - step = -step; - } - else - if(pos >= 1.0f) { - pos = 1.0f; - step = -step; - } - float vibratto_val = (pos - 0.333333333f * pos * pos * pos) * 1.5f; //make the vibratto lfo smoother - - //Relative amplitude is utilized, so the delay may be larger than the - //whole buffer, if the buffer is too small, this indicates a buggy call - //to Unison() - float newval = 1.0f + 0.5f - * (vibratto_val + 1.0f) * unison_amplitude_samples - * uv[k].relative_amplitude; - - if(first_time) - uv[k].realpos1 = uv[k].realpos2 = newval; - else { - uv[k].realpos1 = uv[k].realpos2; - uv[k].realpos2 = newval; - } - - uv[k].position = pos; - uv[k].step = step; - } - first_time = false; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.h b/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.h deleted file mode 100644 index bca5ee8596d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/DSP/Unison.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Unison.h - Unison effect (multivoice chorus) - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef UNISON_H -#define UNISON_H - -#include "../Misc/Util.h" - -//how much the unison frequencies varies (always >= 1.0) -#define UNISON_FREQ_SPAN 2.0f - -class Unison -{ - public: - Unison(int update_period_samples_, float max_delay_sec_, float srate_f); - ~Unison(); - - void setSize(int new_size); - void setBaseFrequency(float freq); - void setBandwidth(float bandwidth_cents); - - void process(int bufsize, float *inbuf, float *outbuf = NULL); - - private: - void updateParameters(void); - void updateUnisonData(void); - - int unison_size; - float base_freq; - struct UnisonVoice { - float step; //base LFO - float position; - float realpos1; //the position regarding samples - float realpos2; - float relative_amplitude; - float lin_fpos; - float lin_ffreq; - UnisonVoice() { - position = RND * 1.8f - 0.9f; - realpos1 = 0.0f; - realpos2 = 0.0f; - step = 0.0f; - relative_amplitude = 1.0f; - } - } *uv; - - int update_period_samples; - int update_period_sample_k; - int max_delay, delay_k; - bool first_time; - float *delay_buffer; - float unison_amplitude_samples; - float unison_bandwidth_cents; - - // current setup - float samplerate_f; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.cpp deleted file mode 100644 index fae1860b668..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Alienwah.cpp - "AlienWah" effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Alienwah.h" - -Alienwah::Alienwah(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), - lfo(srate, bufsize), - oldl(NULL), - oldr(NULL) -{ - setpreset(Ppreset); - cleanup(); - oldclfol = complex(fb, 0.0f); - oldclfor = complex(fb, 0.0f); -} - -Alienwah::~Alienwah() -{ - if(oldl != NULL) - delete [] oldl; - if(oldr != NULL) - delete [] oldr; -} - - -//Apply the effect -void Alienwah::out(const Stereo &smp) -{ - float lfol, lfor; //Left/Right LFOs - complex clfol, clfor; - /**\todo Rework, as optimization can be used when the new complex type is - * utilized. - * Before all calculations needed to be done with individual float, - * but now they can be done together*/ - lfo.effectlfoout(&lfol, &lfor); - lfol *= depth * PI * 2.0f; - lfor *= depth * PI * 2.0f; - clfol = complex(cosf(lfol + phase) * fb, sinf(lfol + phase) * fb); //rework - clfor = complex(cosf(lfor + phase) * fb, sinf(lfor + phase) * fb); //rework - - for(int i = 0; i < buffersize; ++i) { - float x = ((float) i) / buffersize_f; - float x1 = 1.0f - x; - //left - complex tmp = clfol * x + oldclfol * x1; - - complex out = tmp * oldl[oldk]; - out += (1 - fabs(fb)) * smp.l[i] * pangainL; - - oldl[oldk] = out; - float l = out.real() * 10.0f * (fb + 0.1f); - - //right - tmp = clfor * x + oldclfor * x1; - - out = tmp * oldr[oldk]; - out += (1 - fabs(fb)) * smp.r[i] * pangainR; - - oldr[oldk] = out; - float r = out.real() * 10.0f * (fb + 0.1f); - - - if(++oldk >= Pdelay) - oldk = 0; - //LRcross - efxoutl[i] = l * (1.0f - lrcross) + r * lrcross; - efxoutr[i] = r * (1.0f - lrcross) + l * lrcross; - } - - oldclfol = clfol; - oldclfor = clfor; -} - -//Cleanup the effect -void Alienwah::cleanup(void) -{ - for(int i = 0; i < Pdelay; ++i) { - oldl[i] = complex(0.0f, 0.0f); - oldr[i] = complex(0.0f, 0.0f); - } - oldk = 0; -} - - -//Parameter control -void Alienwah::setdepth(unsigned char _Pdepth) -{ - Pdepth = _Pdepth; - depth = Pdepth / 127.0f; -} - -void Alienwah::setfb(unsigned char _Pfb) -{ - Pfb = _Pfb; - fb = fabs((Pfb - 64.0f) / 64.1f); - fb = sqrtf(fb); - if(fb < 0.4f) - fb = 0.4f; - if(Pfb < 64) - fb = -fb; -} - -void Alienwah::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - outvolume = Pvolume / 127.0f; - if(insertion == 0) - volume = 1.0f; - else - volume = outvolume; -} - -void Alienwah::setphase(unsigned char _Pphase) -{ - Pphase = _Pphase; - phase = (Pphase - 64.0f) / 64.0f * PI; -} - -void Alienwah::setdelay(unsigned char _Pdelay) -{ - if(oldl != NULL) - delete [] oldl; - if(oldr != NULL) - delete [] oldr; - Pdelay = (_Pdelay >= MAX_ALIENWAH_DELAY) ? MAX_ALIENWAH_DELAY : _Pdelay; - oldl = new complex[Pdelay]; - oldr = new complex[Pdelay]; - cleanup(); -} - -void Alienwah::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 11; - const int NUM_PRESETS = 4; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //AlienWah1 - {127, 64, 70, 0, 0, 62, 60, 105, 25, 0, 64}, - //AlienWah2 - {127, 64, 73, 106, 0, 101, 60, 105, 17, 0, 64}, - //AlienWah3 - {127, 64, 63, 0, 1, 100, 112, 105, 31, 0, 42}, - //AlienWah4 - {93, 64, 25, 0, 1, 66, 101, 11, 47, 0, 86} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - if(insertion == 0) - changepar(0, presets[npreset][0] / 2); //lower the volume if this is system effect - Ppreset = npreset; -} - - -void Alienwah::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setfb(value); - break; - case 8: - setdelay(value); - break; - case 9: - setlrcross(value); - break; - case 10: - setphase(value); - break; - } -} - -unsigned char Alienwah::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return lfo.Pfreq; - case 3: return lfo.Prandomness; - case 4: return lfo.PLFOtype; - case 5: return lfo.Pstereo; - case 6: return Pdepth; - case 7: return Pfb; - case 8: return Pdelay; - case 9: return Plrcross; - case 10: return Pphase; - default: return 0; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.h deleted file mode 100644 index 52019ac9471..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Alienwah.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Alienwah.h - "AlienWah" effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ALIENWAH_H -#define ALIENWAH_H - -#include -#include "Effect.h" -#include "EffectLFO.h" - -using namespace std; - -#define MAX_ALIENWAH_DELAY 100 - -/**"AlienWah" Effect*/ -class Alienwah:public Effect -{ - public: - /** - * Constructor - * @param insertion_ true for insertion Effect - * @param efxoutl_ Pointer to Alienwah's left channel output buffer - * @param efxoutr_ Pointer to Alienwah's left channel output buffer - * @return Initialized Alienwah - */ - Alienwah(bool insertion_, - float *const efxoutl_, - float *const efxoutr_, - unsigned int srate, int bufsize); - ~Alienwah(); - void out(const Stereo &smp); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(void); - - private: - //Alienwah Parameters - EffectLFO lfo; //lfo-ul Alienwah - unsigned char Pvolume; - unsigned char Pdepth; //the depth of the Alienwah - unsigned char Pfb; //feedback - unsigned char Pdelay; - unsigned char Pphase; - - - //Control Parameters - void setvolume(unsigned char _Pvolume); - void setdepth(unsigned char _Pdepth); - void setfb(unsigned char _Pfb); - void setdelay(unsigned char _Pdelay); - void setphase(unsigned char _Pphase); - - //Internal Values - float fb, depth, phase; - complex *oldl, *oldr; - complex oldclfol, oldclfor; - int oldk; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/CMakeLists.txt deleted file mode 100644 index 803cbca1b67..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(zynaddsubfx_effect_SRCS - Effects/Alienwah.cpp - Effects/Chorus.cpp - Effects/Distorsion.cpp - Effects/DynamicFilter.cpp - Effects/Echo.cpp - Effects/Effect.cpp - Effects/EffectLFO.cpp - Effects/EffectMgr.cpp - Effects/EQ.cpp - Effects/Phaser.cpp - Effects/Reverb.cpp - PARENT_SCOPE -) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.cpp deleted file mode 100644 index 7e95a21539c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Chorus.cpp - Chorus and Flange effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Chorus.h" -#include - -using namespace std; - -Chorus::Chorus(bool insertion_, float *const efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), - lfo(srate, bufsize), - maxdelay((int)(MAX_CHORUS_DELAY / 1000.0f * samplerate_f)), - delaySample(new float[maxdelay], new float[maxdelay]) -{ - dlk = 0; - drk = 0; - setpreset(Ppreset); - changepar(1, 64); - lfo.effectlfoout(&lfol, &lfor); - dl2 = getdelay(lfol); - dr2 = getdelay(lfor); - cleanup(); -} - -Chorus::~Chorus() -{ - delete [] delaySample.l; - delete [] delaySample.r; -} - -//get the delay value in samples; xlfo is the current lfo value -float Chorus::getdelay(float xlfo) -{ - float result = - (Pflangemode) ? 0 : (delay + xlfo * depth) * samplerate_f; - - //check if delay is too big (caused by bad setdelay() and setdepth() - if((result + 0.5f) >= maxdelay) { - cerr - << - "WARNING: Chorus.cpp::getdelay(..) too big delay (see setdelay and setdepth funcs.)" - << endl; - result = maxdelay - 1.0f; - } - return result; -} - -//Apply the effect -void Chorus::out(const Stereo &input) -{ - const float one = 1.0f; - dl1 = dl2; - dr1 = dr2; - lfo.effectlfoout(&lfol, &lfor); - - dl2 = getdelay(lfol); - dr2 = getdelay(lfor); - - for(int i = 0; i < buffersize; ++i) { - float inL = input.l[i]; - float inR = input.r[i]; - //LRcross - Stereo tmpc(inL, inR); - inL = tmpc.l * (1.0f - lrcross) + tmpc.r * lrcross; - inR = tmpc.r * (1.0f - lrcross) + tmpc.l * lrcross; - - //Left channel - - //compute the delay in samples using linear interpolation between the lfo delays - float mdel = - (dl1 * (buffersize - i) + dl2 * i) / buffersize_f; - if(++dlk >= maxdelay) - dlk = 0; - float tmp = dlk - mdel + maxdelay * 2.0f; //where should I get the sample from - - dlhi = (int) tmp; - dlhi %= maxdelay; - - float dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - float dllo = 1.0f - fmod(tmp, one); - efxoutl[i] = cinterpolate(delaySample.l, maxdelay, dlhi2) * dllo - + cinterpolate(delaySample.l, maxdelay, - dlhi) * (1.0f - dllo); - delaySample.l[dlk] = inL + efxoutl[i] * fb; - - //Right channel - - //compute the delay in samples using linear interpolation between the lfo delays - mdel = (dr1 * (buffersize - i) + dr2 * i) / buffersize_f; - if(++drk >= maxdelay) - drk = 0; - tmp = drk * 1.0f - mdel + maxdelay * 2.0f; //where should I get the sample from - - dlhi = (int) tmp; - dlhi %= maxdelay; - - dlhi2 = (dlhi - 1 + maxdelay) % maxdelay; - dllo = 1.0f - fmodf(tmp, one); - efxoutr[i] = cinterpolate(delaySample.r, maxdelay, dlhi2) * dllo - + cinterpolate(delaySample.r, maxdelay, - dlhi) * (1.0f - dllo); - delaySample.r[dlk] = inR + efxoutr[i] * fb; - } - - if(Poutsub) - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] *= -1.0f; - efxoutr[i] *= -1.0f; - } - - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] *= pangainL; - efxoutr[i] *= pangainR; - } -} - -//Cleanup the effect -void Chorus::cleanup(void) -{ - memset(delaySample.l, 0, maxdelay * sizeof(float)); - memset(delaySample.r, 0, maxdelay * sizeof(float)); -} - -//Parameter control -void Chorus::setdepth(unsigned char _Pdepth) -{ - Pdepth = _Pdepth; - depth = (powf(8.0f, (Pdepth / 127.0f) * 2.0f) - 1.0f) / 1000.0f; //seconds -} - -void Chorus::setdelay(unsigned char _Pdelay) -{ - Pdelay = _Pdelay; - delay = (powf(10.0f, (Pdelay / 127.0f) * 2.0f) - 1.0f) / 1000.0f; //seconds -} - -void Chorus::setfb(unsigned char _Pfb) -{ - Pfb = _Pfb; - fb = (Pfb - 64.0f) / 64.1f; -} - -void Chorus::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - outvolume = Pvolume / 127.0f; - volume = (!insertion) ? 1.0f : outvolume; -} - - -void Chorus::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 12; - const int NUM_PRESETS = 10; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Chorus1 - {64, 64, 50, 0, 0, 90, 40, 85, 64, 119, 0, 0}, - //Chorus2 - {64, 64, 45, 0, 0, 98, 56, 90, 64, 19, 0, 0}, - //Chorus3 - {64, 64, 29, 0, 1, 42, 97, 95, 90, 127, 0, 0}, - //Celeste1 - {64, 64, 26, 0, 0, 42, 115, 18, 90, 127, 0, 0}, - //Celeste2 - {64, 64, 29, 117, 0, 50, 115, 9, 31, 127, 0, 1}, - //Flange1 - {64, 64, 57, 0, 0, 60, 23, 3, 62, 0, 0, 0}, - //Flange2 - {64, 64, 33, 34, 1, 40, 35, 3, 109, 0, 0, 0}, - //Flange3 - {64, 64, 53, 34, 1, 94, 35, 3, 54, 0, 0, 1}, - //Flange4 - {64, 64, 40, 0, 1, 62, 12, 19, 97, 0, 0, 0}, - //Flange5 - {64, 64, 55, 105, 0, 24, 39, 19, 17, 0, 0, 1} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void Chorus::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setdelay(value); - break; - case 8: - setfb(value); - break; - case 9: - setlrcross(value); - break; - case 10: - Pflangemode = (value > 1) ? 1 : value; - break; - case 11: - Poutsub = (value > 1) ? 1 : value; - break; - } -} - -unsigned char Chorus::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return lfo.Pfreq; - case 3: return lfo.Prandomness; - case 4: return lfo.PLFOtype; - case 5: return lfo.Pstereo; - case 6: return Pdepth; - case 7: return Pdelay; - case 8: return Pfb; - case 9: return Plrcross; - case 10: return Pflangemode; - case 11: return Poutsub; - default: return 0; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.h deleted file mode 100644 index 7772d466875..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Chorus.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Chorus.h - Chorus and Flange effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef CHORUS_H -#define CHORUS_H -#include "Effect.h" -#include "EffectLFO.h" -#include "../Misc/Stereo.h" - -#define MAX_CHORUS_DELAY 250.0f //ms - -/**Chorus and Flange effects*/ -class Chorus:public Effect -{ - public: - Chorus(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - /**Destructor*/ - ~Chorus(); - void out(const Stereo &input); - void setpreset(unsigned char npreset); - /** - * Sets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# LFO Frequency - * -# LFO Randomness - * -# LFO Type - * -# LFO stereo - * -# Depth - * -# Delay - * -# Feedback - * -# Flange Mode - * -# Subtractive - * @param npar number of chosen parameter - * @param value the new value - */ - void changepar(int npar, unsigned char value); - /** - * Gets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# LFO Frequency - * -# LFO Randomness - * -# LFO Type - * -# LFO stereo - * -# Depth - * -# Delay - * -# Feedback - * -# Flange Mode - * -# Subtractive - * @param npar number of chosen parameter - * @return the value of the parameter - */ - unsigned char getpar(int npar) const; - void cleanup(void); - - private: - //Chorus Parameters - unsigned char Pvolume; - unsigned char Pdepth; //the depth of the Chorus(ms) - unsigned char Pdelay; //the delay (ms) - unsigned char Pfb; //feedback - unsigned char Pflangemode; //how the LFO is scaled, to result chorus or flange - unsigned char Poutsub; //if I wish to substract the output instead of the adding it - EffectLFO lfo; //lfo-ul chorus - - - //Parameter Controls - void setvolume(unsigned char _Pvolume); - void setdepth(unsigned char _Pdepth); - void setdelay(unsigned char _Pdelay); - void setfb(unsigned char _Pfb); - - //Internal Values - float depth, delay, fb; - float dl1, dl2, dr1, dr2, lfol, lfor; - int maxdelay; - Stereo delaySample; - int dlk, drk, dlhi; - float getdelay(float xlfo); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.cpp deleted file mode 100644 index 5d5c8f6f93c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Distorsion.cpp - Distorsion effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Distorsion.h" -#include "../DSP/AnalogFilter.h" -#include "../Misc/WaveShapeSmps.h" -#include - -Distorsion::Distorsion(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), - Pvolume(50), - Pdrive(90), - Plevel(64), - Ptype(0), - Pnegate(0), - Plpf(127), - Phpf(0), - Pstereo(0), - Pprefiltering(0) -{ - lpfl = new AnalogFilter(2, 22000, 1, 0, srate, bufsize); - lpfr = new AnalogFilter(2, 22000, 1, 0, srate, bufsize); - hpfl = new AnalogFilter(3, 20, 1, 0, srate, bufsize); - hpfr = new AnalogFilter(3, 20, 1, 0, srate, bufsize); - setpreset(Ppreset); - cleanup(); -} - -Distorsion::~Distorsion() -{ - delete lpfl; - delete lpfr; - delete hpfl; - delete hpfr; -} - -//Cleanup the effect -void Distorsion::cleanup(void) -{ - lpfl->cleanup(); - hpfl->cleanup(); - lpfr->cleanup(); - hpfr->cleanup(); -} - - -//Apply the filters -void Distorsion::applyfilters(float *efxoutl, float *efxoutr) -{ - lpfl->filterout(efxoutl); - hpfl->filterout(efxoutl); - if(Pstereo != 0) { //stereo - lpfr->filterout(efxoutr); - hpfr->filterout(efxoutr); - } -} - - -//Effect output -void Distorsion::out(const Stereo &smp) -{ - float inputvol = powf(5.0f, (Pdrive - 32.0f) / 127.0f); - if(Pnegate) - inputvol *= -1.0f; - - if(Pstereo) //Stereo - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] = smp.l[i] * inputvol * pangainL; - efxoutr[i] = smp.r[i] * inputvol * pangainR; - } - else //Mono - for(int i = 0; i < buffersize; ++i) - efxoutl[i] = (smp.l[i] * pangainL + smp.r[i] * pangainR) * inputvol; - - if(Pprefiltering) - applyfilters(efxoutl, efxoutr); - - waveShapeSmps(buffersize, efxoutl, Ptype + 1, Pdrive); - if(Pstereo) - waveShapeSmps(buffersize, efxoutr, Ptype + 1, Pdrive); - - if(!Pprefiltering) - applyfilters(efxoutl, efxoutr); - - if(!Pstereo) - memcpy(efxoutr, efxoutl, bufferbytes); - - float level = dB2rap(60.0f * Plevel / 127.0f - 40.0f); - for(int i = 0; i < buffersize; ++i) { - float lout = efxoutl[i]; - float rout = efxoutr[i]; - float l = lout * (1.0f - lrcross) + rout * lrcross; - float r = rout * (1.0f - lrcross) + lout * lrcross; - lout = l; - rout = r; - - efxoutl[i] = lout * 2.0f * level; - efxoutr[i] = rout * 2.0f * level; - } -} - - -//Parameter control -void Distorsion::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - - if(insertion == 0) { - outvolume = powf(0.01f, (1.0f - Pvolume / 127.0f)) * 4.0f; - volume = 1.0f; - } - else - volume = outvolume = Pvolume / 127.0f; - if(Pvolume == 0) - cleanup(); -} - -void Distorsion::setlpf(unsigned char _Plpf) -{ - Plpf = _Plpf; - float fr = expf(powf(Plpf / 127.0f, 0.5f) * logf(25000.0f)) + 40.0f; - lpfl->setfreq(fr); - lpfr->setfreq(fr); -} - -void Distorsion::sethpf(unsigned char _Phpf) -{ - Phpf = _Phpf; - float fr = expf(powf(Phpf / 127.0f, 0.5f) * logf(25000.0f)) + 20.0f; - hpfl->setfreq(fr); - hpfr->setfreq(fr); -} - - -void Distorsion::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 11; - const int NUM_PRESETS = 6; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Overdrive 1 - {127, 64, 35, 56, 70, 0, 0, 96, 0, 0, 0}, - //Overdrive 2 - {127, 64, 35, 29, 75, 1, 0, 127, 0, 0, 0}, - //A. Exciter 1 - {64, 64, 35, 75, 80, 5, 0, 127, 105, 1, 0}, - //A. Exciter 2 - {64, 64, 35, 85, 62, 1, 0, 127, 118, 1, 0}, - //Guitar Amp - {127, 64, 35, 63, 75, 2, 0, 55, 0, 0, 0}, - //Quantisize - {127, 64, 35, 88, 75, 4, 0, 127, 0, 1, 0} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - if(!insertion) //lower the volume if this is system effect - changepar(0, (int) (presets[npreset][0] / 1.5f)); - Ppreset = npreset; - cleanup(); -} - - -void Distorsion::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - setlrcross(value); - break; - case 3: - Pdrive = value; - break; - case 4: - Plevel = value; - break; - case 5: - if(value > 13) - Ptype = 13; //this must be increased if more distorsion types are added - else - Ptype = value; - break; - case 6: - if(value > 1) - Pnegate = 1; - else - Pnegate = value; - break; - case 7: - setlpf(value); - break; - case 8: - sethpf(value); - break; - case 9: - Pstereo = (value > 1) ? 1 : value; - break; - case 10: - Pprefiltering = value; - break; - } -} - -unsigned char Distorsion::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return Plrcross; - case 3: return Pdrive; - case 4: return Plevel; - case 5: return Ptype; - case 6: return Pnegate; - case 7: return Plpf; - case 8: return Phpf; - case 9: return Pstereo; - case 10: return Pprefiltering; - default: return 0; //in case of bogus parameter number - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.h deleted file mode 100644 index 9d577ddd804..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Distorsion.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Distorsion.h - Distorsion Effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef DISTORSION_H -#define DISTORSION_H - -#include "Effect.h" - -/**Distortion Effect*/ -class Distorsion:public Effect -{ - public: - Distorsion(bool insertion, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~Distorsion(); - void out(const Stereo &smp); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(void); - void applyfilters(float *efxoutl, float *efxoutr); - - private: - //Parameters - unsigned char Pvolume; //Volume or E/R - unsigned char Pdrive; //the input amplification - unsigned char Plevel; //the output amplification - unsigned char Ptype; //Distorsion type - unsigned char Pnegate; //if the input is negated - unsigned char Plpf; //lowpass filter - unsigned char Phpf; //highpass filter - unsigned char Pstereo; //0=mono, 1=stereo - unsigned char Pprefiltering; //if you want to do the filtering before the distorsion - - void setvolume(unsigned char _Pvolume); - void setlpf(unsigned char _Plpf); - void sethpf(unsigned char _Phpf); - - //Real Parameters - class AnalogFilter * lpfl, *lpfr, *hpfl, *hpfr; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.cpp deleted file mode 100644 index 650a882bec2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - DynamicFilter.cpp - "WahWah" effect and others - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "DynamicFilter.h" -#include "../DSP/Filter.h" - -DynamicFilter::DynamicFilter(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, new FilterParams(0, 64, 64), 0, srate, bufsize), - lfo(srate, bufsize), - Pvolume(110), - Pdepth(0), - Pampsns(90), - Pampsnsinv(0), - Pampsmooth(60), - filterl(NULL), - filterr(NULL) -{ - setpreset(Ppreset); - cleanup(); -} - -DynamicFilter::~DynamicFilter() -{ - delete filterpars; - delete filterl; - delete filterr; -} - - -// Apply the effect -void DynamicFilter::out(const Stereo &smp) -{ - if(filterpars->changed) { - filterpars->changed = false; - cleanup(); - } - - float lfol, lfor; - lfo.effectlfoout(&lfol, &lfor); - lfol *= depth * 5.0f; - lfor *= depth * 5.0f; - const float freq = filterpars->getfreq(); - const float q = filterpars->getq(); - - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] = smp.l[i]; - efxoutr[i] = smp.r[i]; - - const float x = (fabsf(smp.l[i]) + fabsf(smp.r[i])) * 0.5f; - ms1 = ms1 * (1.0f - ampsmooth) + x * ampsmooth + 1e-10; - } - - const float ampsmooth2 = powf(ampsmooth, 0.2f) * 0.3f; - ms2 = ms2 * (1.0f - ampsmooth2) + ms1 * ampsmooth2; - ms3 = ms3 * (1.0f - ampsmooth2) + ms2 * ampsmooth2; - ms4 = ms4 * (1.0f - ampsmooth2) + ms3 * ampsmooth2; - const float rms = (sqrtf(ms4)) * ampsns; - - const float frl = Filter::getrealfreq(freq + lfol + rms); - const float frr = Filter::getrealfreq(freq + lfor + rms); - - filterl->setfreq_and_q(frl, q); - filterr->setfreq_and_q(frr, q); - - filterl->filterout(efxoutl); - filterr->filterout(efxoutr); - - //panning - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] *= pangainL; - efxoutr[i] *= pangainR; - } -} - -// Cleanup the effect -void DynamicFilter::cleanup(void) -{ - reinitfilter(); - ms1 = ms2 = ms3 = ms4 = 0.0f; -} - - -//Parameter control -void DynamicFilter::setdepth(unsigned char _Pdepth) -{ - Pdepth = _Pdepth; - depth = powf(Pdepth / 127.0f, 2.0f); -} - - -void DynamicFilter::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - outvolume = Pvolume / 127.0f; - if(!insertion) - volume = 1.0f; - else - volume = outvolume; -} - -void DynamicFilter::setampsns(unsigned char _Pampsns) -{ - Pampsns = _Pampsns; - ampsns = powf(Pampsns / 127.0f, 2.5f) * 10.0f; - if(Pampsnsinv) - ampsns = -ampsns; - ampsmooth = expf(-Pampsmooth / 127.0f * 10.0f) * 0.99f; -} - -void DynamicFilter::reinitfilter(void) -{ - delete filterl; - delete filterr; - filterl = Filter::generate(filterpars, samplerate, buffersize); - filterr = Filter::generate(filterpars, samplerate, buffersize); -} - -void DynamicFilter::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 10; - const int NUM_PRESETS = 5; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //WahWah - {110, 64, 80, 0, 0, 64, 0, 90, 0, 60}, - //AutoWah - {110, 64, 70, 0, 0, 80, 70, 0, 0, 60}, - //Sweep - {100, 64, 30, 0, 0, 50, 80, 0, 0, 60}, - //VocalMorph1 - {110, 64, 80, 0, 0, 64, 0, 64, 0, 60}, - //VocalMorph1 - {127, 64, 50, 0, 0, 96, 64, 0, 0, 60} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - - filterpars->defaults(); - - switch(npreset) { - case 0: - filterpars->Pcategory = 0; - filterpars->Ptype = 2; - filterpars->Pfreq = 45; - filterpars->Pq = 64; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - break; - case 1: - filterpars->Pcategory = 2; - filterpars->Ptype = 0; - filterpars->Pfreq = 72; - filterpars->Pq = 64; - filterpars->Pstages = 0; - filterpars->Pgain = 64; - break; - case 2: - filterpars->Pcategory = 0; - filterpars->Ptype = 4; - filterpars->Pfreq = 64; - filterpars->Pq = 64; - filterpars->Pstages = 2; - filterpars->Pgain = 64; - break; - case 3: - filterpars->Pcategory = 1; - filterpars->Ptype = 0; - filterpars->Pfreq = 50; - filterpars->Pq = 70; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - - filterpars->Psequencesize = 2; - // "I" - filterpars->Pvowels[0].formants[0].freq = 34; - filterpars->Pvowels[0].formants[0].amp = 127; - filterpars->Pvowels[0].formants[0].q = 64; - filterpars->Pvowels[0].formants[1].freq = 99; - filterpars->Pvowels[0].formants[1].amp = 122; - filterpars->Pvowels[0].formants[1].q = 64; - filterpars->Pvowels[0].formants[2].freq = 108; - filterpars->Pvowels[0].formants[2].amp = 112; - filterpars->Pvowels[0].formants[2].q = 64; - // "A" - filterpars->Pvowels[1].formants[0].freq = 61; - filterpars->Pvowels[1].formants[0].amp = 127; - filterpars->Pvowels[1].formants[0].q = 64; - filterpars->Pvowels[1].formants[1].freq = 71; - filterpars->Pvowels[1].formants[1].amp = 121; - filterpars->Pvowels[1].formants[1].q = 64; - filterpars->Pvowels[1].formants[2].freq = 99; - filterpars->Pvowels[1].formants[2].amp = 117; - filterpars->Pvowels[1].formants[2].q = 64; - break; - case 4: - filterpars->Pcategory = 1; - filterpars->Ptype = 0; - filterpars->Pfreq = 64; - filterpars->Pq = 70; - filterpars->Pstages = 1; - filterpars->Pgain = 64; - - filterpars->Psequencesize = 2; - filterpars->Pnumformants = 2; - filterpars->Pvowelclearness = 0; - - filterpars->Pvowels[0].formants[0].freq = 70; - filterpars->Pvowels[0].formants[0].amp = 127; - filterpars->Pvowels[0].formants[0].q = 64; - filterpars->Pvowels[0].formants[1].freq = 80; - filterpars->Pvowels[0].formants[1].amp = 122; - filterpars->Pvowels[0].formants[1].q = 64; - - filterpars->Pvowels[1].formants[0].freq = 20; - filterpars->Pvowels[1].formants[0].amp = 127; - filterpars->Pvowels[1].formants[0].q = 64; - filterpars->Pvowels[1].formants[1].freq = 100; - filterpars->Pvowels[1].formants[1].amp = 121; - filterpars->Pvowels[1].formants[1].q = 64; - break; - } - -// for (int i=0;i<5;i++){ -// printf("freq=%d amp=%d q=%d\n",filterpars->Pvowels[0].formants[i].freq,filterpars->Pvowels[0].formants[i].amp,filterpars->Pvowels[0].formants[i].q); -// }; - if(insertion == 0) //lower the volume if this is system effect - changepar(0, presets[npreset][0] * 0.5f); - Ppreset = npreset; - reinitfilter(); -} - - -void DynamicFilter::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setampsns(value); - break; - case 8: - Pampsnsinv = value; - setampsns(Pampsns); - break; - case 9: - Pampsmooth = value; - setampsns(Pampsns); - break; - } -} - -unsigned char DynamicFilter::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return lfo.Pfreq; - case 3: return lfo.Prandomness; - case 4: return lfo.PLFOtype; - case 5: return lfo.Pstereo; - case 6: return Pdepth; - case 7: return Pampsns; - case 8: return Pampsnsinv; - case 9: return Pampsmooth; - default: return 0; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.h deleted file mode 100644 index 91d1f5e49af..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/DynamicFilter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - DynamicFilter.h - "WahWah" effect and others - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef DYNAMICFILTER_H -#define DYNAMICFILTER_H - -#include "Effect.h" -#include "EffectLFO.h" - -/**DynamicFilter Effect*/ -class DynamicFilter:public Effect -{ - public: - DynamicFilter(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~DynamicFilter(); - void out(const Stereo &smp); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(void); - - private: - //Parametrii DynamicFilter - EffectLFO lfo; //lfo-ul DynamicFilter - unsigned char Pvolume; //Volume - unsigned char Pdepth; //the depth of the lfo - unsigned char Pampsns; //how the filter varies according to the input amplitude - unsigned char Pampsnsinv; //if the filter freq is lowered if the input amplitude rises - unsigned char Pampsmooth; //how smooth the input amplitude changes the filter - - //Parameter Control - void setvolume(unsigned char _Pvolume); - void setdepth(unsigned char _Pdepth); - void setampsns(unsigned char _Pampsns); - - void reinitfilter(void); - - //Internal Values - float depth, ampsns, ampsmooth; - - class Filter * filterl, *filterr; - float ms1, ms2, ms3, ms4; //mean squares -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.cpp deleted file mode 100644 index 35db4d44c82..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EQ.cpp - EQ effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "EQ.h" -#include "../DSP/AnalogFilter.h" - -EQ::EQ(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize) -{ - for(int i = 0; i < MAX_EQ_BANDS; ++i) { - filter[i].Ptype = 0; - filter[i].Pfreq = 64; - filter[i].Pgain = 64; - filter[i].Pq = 64; - filter[i].Pstages = 0; - filter[i].l = new AnalogFilter(6, 1000.0f, 1.0f, 0, srate, bufsize); - filter[i].r = new AnalogFilter(6, 1000.0f, 1.0f, 0, srate, bufsize); - } - //default values - Pvolume = 50; - - setpreset(Ppreset); - cleanup(); -} - -EQ::~EQ() -{ - for(int i = 0; i < MAX_EQ_BANDS; ++i) { - delete filter[i].l; - delete filter[i].r; - } -} - - -// Cleanup the effect -void EQ::cleanup(void) -{ - for(int i = 0; i < MAX_EQ_BANDS; ++i) { - filter[i].l->cleanup(); - filter[i].r->cleanup(); - } -} - -//Effect output -void EQ::out(const Stereo &smp) -{ - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] = smp.l[i] * volume; - efxoutr[i] = smp.r[i] * volume; - } - - for(int i = 0; i < MAX_EQ_BANDS; ++i) { - if(filter[i].Ptype == 0) - continue; - filter[i].l->filterout(efxoutl); - filter[i].r->filterout(efxoutr); - } -} - - -//Parameter control -void EQ::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - outvolume = powf(0.005f, (1.0f - Pvolume / 127.0f)) * 10.0f; - volume = (!insertion) ? 1.0f : outvolume; -} - - -void EQ::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 1; - const int NUM_PRESETS = 2; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - {67}, //EQ 1 - {67} //EQ 2 - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void EQ::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - } - if(npar < 10) - return; - - int nb = (npar - 10) / 5; //number of the band (filter) - if(nb >= MAX_EQ_BANDS) - return; - int bp = npar % 5; //band paramenter - - float tmp; - switch(bp) { - case 0: - filter[nb].Ptype = value; - if(value > 9) - filter[nb].Ptype = 0; //has to be changed if more filters will be added - if(filter[nb].Ptype != 0) { - filter[nb].l->settype(value - 1); - filter[nb].r->settype(value - 1); - } - break; - case 1: - filter[nb].Pfreq = value; - tmp = 600.0f * powf(30.0f, (value - 64.0f) / 64.0f); - filter[nb].l->setfreq(tmp); - filter[nb].r->setfreq(tmp); - break; - case 2: - filter[nb].Pgain = value; - tmp = 30.0f * (value - 64.0f) / 64.0f; - filter[nb].l->setgain(tmp); - filter[nb].r->setgain(tmp); - break; - case 3: - filter[nb].Pq = value; - tmp = powf(30.0f, (value - 64.0f) / 64.0f); - filter[nb].l->setq(tmp); - filter[nb].r->setq(tmp); - break; - case 4: - filter[nb].Pstages = value; - if(value >= MAX_FILTER_STAGES) - filter[nb].Pstages = MAX_FILTER_STAGES - 1; - filter[nb].l->setstages(value); - filter[nb].r->setstages(value); - break; - } -} - -unsigned char EQ::getpar(int npar) const -{ - switch(npar) { - case 0: - return Pvolume; - break; - } - - if(npar < 10) - return 0; - - int nb = (npar - 10) / 5; //number of the band (filter) - if(nb >= MAX_EQ_BANDS) - return 0; - int bp = npar % 5; //band paramenter - switch(bp) { - case 0: - return filter[nb].Ptype; - break; - case 1: - return filter[nb].Pfreq; - break; - case 2: - return filter[nb].Pgain; - break; - case 3: - return filter[nb].Pq; - break; - case 4: - return filter[nb].Pstages; - break; - default: return 0; //in case of bogus parameter number - } -} - - -float EQ::getfreqresponse(float freq) -{ - float resp = 1.0f; - for(int i = 0; i < MAX_EQ_BANDS; ++i) { - if(filter[i].Ptype == 0) - continue; - resp *= filter[i].l->H(freq); - } - return rap2dB(resp * outvolume); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.h deleted file mode 100644 index 209b27740d5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EQ.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EQ.h - EQ Effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EQ_H -#define EQ_H - -#include "Effect.h" - -/**EQ Effect*/ -class EQ:public Effect -{ - public: - EQ(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~EQ(); - void out(const Stereo &smp); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(void); - float getfreqresponse(float freq); - - private: - //Parameters - unsigned char Pvolume; - - void setvolume(unsigned char _Pvolume); - - struct { - //parameters - unsigned char Ptype, Pfreq, Pgain, Pq, Pstages; - //internal values - class AnalogFilter * l, *r; - } filter[MAX_EQ_BANDS]; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.cpp deleted file mode 100644 index 712f291dad0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Echo.cpp - Echo effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2009-2010 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Echo.h" - -#define MAX_DELAY 2 - -Echo::Echo(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), - samplerate(srate), - Pvolume(50), - Pdelay(60), - Plrdelay(100), - Pfb(40), - Phidamp(60), - delayTime(1), - lrdelay(0), - avgDelay(0), - delay(new float[(int)(MAX_DELAY * srate)], - new float[(int)(MAX_DELAY * srate)]), - old(0.0f), - pos(0), - delta(1), - ndelta(1) -{ - initdelays(); - setpreset(Ppreset); -} - -Echo::~Echo() -{ - delete[] delay.l; - delete[] delay.r; -} - -//Cleanup the effect -void Echo::cleanup(void) -{ - memset(delay.l, 0, MAX_DELAY * samplerate * sizeof(float)); - memset(delay.r, 0, MAX_DELAY * samplerate * sizeof(float)); - old = Stereo(0.0f); -} - -inline int max(int a, int b) -{ - return a > b ? a : b; -} - -//Initialize the delays -void Echo::initdelays(void) -{ - cleanup(); - //number of seconds to delay left chan - float dl = avgDelay - lrdelay; - - //number of seconds to delay right chan - float dr = avgDelay + lrdelay; - - ndelta.l = max(1, (int) (dl * samplerate)); - ndelta.r = max(1, (int) (dr * samplerate)); -} - -//Effect output -void Echo::out(const Stereo &input) -{ - for(int i = 0; i < buffersize; ++i) { - float ldl = delay.l[pos.l]; - float rdl = delay.r[pos.r]; - ldl = ldl * (1.0f - lrcross) + rdl * lrcross; - rdl = rdl * (1.0f - lrcross) + ldl * lrcross; - - efxoutl[i] = ldl * 2.0f; - efxoutr[i] = rdl * 2.0f; - - ldl = input.l[i] * pangainL - ldl * fb; - rdl = input.r[i] * pangainR - rdl * fb; - - //LowPass Filter - old.l = delay.l[(pos.l + delta.l) % (MAX_DELAY * samplerate)] = - ldl * hidamp + old.l * (1.0f - hidamp); - old.r = delay.r[(pos.r + delta.r) % (MAX_DELAY * samplerate)] = - rdl * hidamp + old.r * (1.0f - hidamp); - - //increment - ++pos.l; // += delta.l; - ++pos.r; // += delta.r; - - //ensure that pos is still in bounds - pos.l %= MAX_DELAY * samplerate; - pos.r %= MAX_DELAY * samplerate; - - //adjust delay if needed - delta.l = (15 * delta.l + ndelta.l) / 16; - delta.r = (15 * delta.r + ndelta.r) / 16; - } -} - - -//Parameter control -void Echo::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - - if(insertion == 0) { - outvolume = powf(0.01f, (1.0f - Pvolume / 127.0f)) * 4.0f; - volume = 1.0f; - } - else - volume = outvolume = Pvolume / 127.0f; - if(Pvolume == 0) - cleanup(); -} - -void Echo::setdelay(unsigned char _Pdelay) -{ - Pdelay = _Pdelay; - avgDelay = (Pdelay / 127.0f * 1.5f); //0 .. 1.5 sec - initdelays(); -} - -void Echo::setlrdelay(unsigned char _Plrdelay) -{ - float tmp; - Plrdelay = _Plrdelay; - tmp = - (powf(2.0f, fabsf(Plrdelay - 64.0f) / 64.0f * 9.0f) - 1.0f) / 1000.0f; - if(Plrdelay < 64.0f) - tmp = -tmp; - lrdelay = tmp; - initdelays(); -} - -void Echo::setfb(unsigned char _Pfb) -{ - Pfb = _Pfb; - fb = Pfb / 128.0f; -} - -void Echo::sethidamp(unsigned char _Phidamp) -{ - Phidamp = _Phidamp; - hidamp = 1.0f - Phidamp / 127.0f; -} - -void Echo::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 7; - const int NUM_PRESETS = 9; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - {67, 64, 35, 64, 30, 59, 0 }, //Echo 1 - {67, 64, 21, 64, 30, 59, 0 }, //Echo 2 - {67, 75, 60, 64, 30, 59, 10}, //Echo 3 - {67, 60, 44, 64, 30, 0, 0 }, //Simple Echo - {67, 60, 102, 50, 30, 82, 48}, //Canyon - {67, 64, 44, 17, 0, 82, 24}, //Panning Echo 1 - {81, 60, 46, 118, 100, 68, 18}, //Panning Echo 2 - {81, 60, 26, 100, 127, 67, 36}, //Panning Echo 3 - {62, 64, 28, 64, 100, 90, 55} //Feedback Echo - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - if(insertion) - setvolume(presets[npreset][0] / 2); //lower the volume if this is insertion effect - Ppreset = npreset; -} - - -void Echo::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - setdelay(value); - break; - case 3: - setlrdelay(value); - break; - case 4: - setlrcross(value); - break; - case 5: - setfb(value); - break; - case 6: - sethidamp(value); - break; - } -} - -unsigned char Echo::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return Pdelay; - case 3: return Plrdelay; - case 4: return Plrcross; - case 5: return Pfb; - case 6: return Phidamp; - default: return 0; // in case of bogus parameter number - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.h deleted file mode 100644 index 4eb606b8224..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Echo.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Echo.h - Echo Effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ECHO_H -#define ECHO_H - -#include "Effect.h" -#include "../Misc/Stereo.h" - -/**Echo Effect*/ -class Echo:public Effect -{ - public: - Echo(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~Echo(); - - void out(const Stereo &input); - void setpreset(unsigned char npreset); - /** - * Sets the value of the chosen variable - * - * The possible parameters are: - * -# Volume - * -# Panning - * -# Delay - * -# L/R Delay - * -# L/R Crossover - * -# Feedback - * -# Dampening - * @param npar number of chosen parameter - * @param value the new value - */ - void changepar(int npar, unsigned char value); - - /** - * Gets the specified parameter - * - * The possible parameters are - * -# Volume - * -# Panning - * -# Delay - * -# L/R Delay - * -# L/R Crossover - * -# Feedback - * -# Dampening - * @param npar number of chosen parameter - * @return value of parameter - */ - unsigned char getpar(int npar) const; - int getnumparams(void); - void cleanup(void); - private: - int samplerate; - - //Parameters - unsigned char Pvolume; /**<#1 Volume or Dry/Wetness*/ - unsigned char Pdelay; /**<#3 Delay of the Echo*/ - unsigned char Plrdelay; /**<#4 L/R delay difference*/ - unsigned char Pfb; /**<#6Feedback*/ - unsigned char Phidamp; /**<#7Dampening of the Echo*/ - - void setvolume(unsigned char _Pvolume); - void setdelay(unsigned char _Pdelay); - void setlrdelay(unsigned char _Plrdelay); - void setfb(unsigned char _Pfb); - void sethidamp(unsigned char _Phidamp); - - //Real Parameters - float fb, hidamp; - //Left/Right delay lengths - Stereo delayTime; - float lrdelay; - float avgDelay; - - void initdelays(void); - //2 channel ring buffer - Stereo delay; - Stereo old; - - //position of reading/writing from delaysample - Stereo pos; - //step size for delay buffer - Stereo delta; - Stereo ndelta; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.cpp deleted file mode 100644 index bc1c0b00665..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Effect.cpp - this class is inherited by the all effects(Reverb, Echo, ..) - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright 2011, Alan Calvert - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Effect.h" -#include "../Params/FilterParams.h" -#include - -Effect::Effect(bool insertion_, float *efxoutl_, float *efxoutr_, - FilterParams *filterpars_, unsigned char Ppreset_, - unsigned int srate, int bufsize) - :Ppreset(Ppreset_), - efxoutl(efxoutl_), - efxoutr(efxoutr_), - filterpars(filterpars_), - insertion(insertion_), - samplerate(srate), - buffersize(bufsize) -{ - alias(); -} - -void Effect::out(float *const smpsl, float *const smpsr) -{ - out(Stereo(smpsl, smpsr)); -} - -void Effect::crossover(float &a, float &b, float crossover) -{ - float tmpa = a; - float tmpb = b; - a = tmpa * (1.0f - crossover) + tmpb * crossover; - b = tmpb * (1.0f - crossover) + tmpa * crossover; -} - -void Effect::setpanning(char Ppanning_) -{ - Ppanning = Ppanning_; - float t = (Ppanning > 0) ? (float)(Ppanning - 1) / 126.0f : 0.0f; - pangainL = cosf(t * PI / 2.0f); - pangainR = cosf((1.0f - t) * PI / 2.0f); -} - -void Effect::setlrcross(char Plrcross_) -{ - Plrcross = Plrcross_; - lrcross = (float)Plrcross / 127.0f; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.h deleted file mode 100644 index d53bb9b71b9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Effect.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Effect.h - this class is inherited by the all effects(Reverb, Echo, ..) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EFFECT_H -#define EFFECT_H - -#include "../Misc/Util.h" -#include "../globals.h" -#include "../Params/FilterParams.h" -#include "../Misc/Stereo.h" - -class FilterParams; - -/**this class is inherited by the all effects(Reverb, Echo, ..)*/ -class Effect -{ - public: - /** - * Effect Constructor - * @param insertion_ 1 when it is an insertion Effect - * @param efxoutl_ Effect output buffer Left channel - * @param efxoutr_ Effect output buffer Right channel - * @param filterpars_ pointer to FilterParams array - * @param Ppreset_ chosen preset - * @return Initialized Effect object*/ - Effect(bool insertion_, float *efxoutl_, float *efxoutr_, - FilterParams *filterpars_, unsigned char Ppreset_, - unsigned int srate, int bufsize); - virtual ~Effect() {} - /** - * Choose a preset - * @param npreset number of chosen preset*/ - virtual void setpreset(unsigned char npreset) = 0; - /**Change parameter npar to value - * @param npar chosen parameter - * @param value chosen new value*/ - virtual void changepar(int npar, unsigned char value) = 0; - /**Get the value of parameter npar - * @param npar chosen parameter - * @return the value of the parameter in an unsigned char or 0 if it - * does not exist*/ - virtual unsigned char getpar(int npar) const = 0; - /**Output result of effect based on the given buffers - * - * This method should result in the effect generating its results - * and placing them into the efxoutl and efxoutr buffers. - * Every Effect should overide this method. - * - * @param smpsl Input buffer for the Left channel - * @param smpsr Input buffer for the Right channel - */ - void out(float *const smpsl, float *const smpsr); - virtual void out(const Stereo &smp) = 0; - /**Reset the state of the effect*/ - virtual void cleanup(void) {} - virtual float getfreqresponse(float freq) { return freq; } - - unsigned char Ppreset; /** - -EffectLFO::EffectLFO(float srate_f, float bufsize_f) - :Pfreq(40), - Prandomness(0), - PLFOtype(0), - Pstereo(64), - xl(0.0f), - xr(0.0f), - ampl1(RND), - ampl2(RND), - ampr1(RND), - ampr2(RND), - lfornd(0.0f), - samplerate_f(srate_f), - buffersize_f(bufsize_f) -{ - updateparams(); -} - -EffectLFO::~EffectLFO() {} - -//Update the changed parameters -void EffectLFO::updateparams(void) -{ - float lfofreq = (powf(2.0f, Pfreq / 127.0f * 10.0f) - 1.0f) * 0.03f; - incx = fabsf(lfofreq) * buffersize_f / samplerate_f; - if(incx > 0.49999999f) - incx = 0.499999999f; //Limit the Frequency - - lfornd = Prandomness / 127.0f; - lfornd = (lfornd > 1.0f) ? 1.0f : lfornd; - - if(PLFOtype > 1) - PLFOtype = 1; //this has to be updated if more lfo's are added - lfotype = PLFOtype; - xr = fmodf(xl + (Pstereo - 64.0f) / 127.0f + 1.0f, 1.0f); -} - - -//Compute the shape of the LFO -float EffectLFO::getlfoshape(float x) -{ - float out; - switch(lfotype) { - case 1: //EffectLFO_TRIANGLE - if((x > 0.0f) && (x < 0.25f)) - out = 4.0f * x; - else - if((x > 0.25f) && (x < 0.75f)) - out = 2.0f - 4.0f * x; - else - out = 4.0f * x - 4.0f; - break; - //when adding more, ensure ::updateparams() gets updated - default: - out = cosf(x * 2.0f * PI); //EffectLFO_SINE - } - return out; -} - -//LFO output -void EffectLFO::effectlfoout(float *outl, float *outr) -{ - float out; - - out = getlfoshape(xl); - if((lfotype == 0) || (lfotype == 1)) - out *= (ampl1 + xl * (ampl2 - ampl1)); - xl += incx; - if(xl > 1.0f) { - xl -= 1.0f; - ampl1 = ampl2; - ampl2 = (1.0f - lfornd) + lfornd * RND; - } - *outl = (out + 1.0f) * 0.5f; - - out = getlfoshape(xr); - if((lfotype == 0) || (lfotype == 1)) - out *= (ampr1 + xr * (ampr2 - ampr1)); - xr += incx; - if(xr > 1.0f) { - xr -= 1.0f; - ampr1 = ampr2; - ampr2 = (1.0f - lfornd) + lfornd * RND; - } - *outr = (out + 1.0f) * 0.5f; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectLFO.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectLFO.h deleted file mode 100644 index 82cbf87f775..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectLFO.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectLFO.h - Stereo LFO used by some effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef EFFECT_LFO_H -#define EFFECT_LFO_H - -/**LFO for some of the Effect objects - * \todo see if this should inherit LFO*/ -class EffectLFO -{ - public: - EffectLFO(float srate_f, float bufsize_f); - ~EffectLFO(); - void effectlfoout(float *outl, float *outr); - void updateparams(void); - unsigned char Pfreq; - unsigned char Prandomness; - unsigned char PLFOtype; - unsigned char Pstereo; // 64 is centered - private: - float getlfoshape(float x); - - float xl, xr; - float incx; - float ampl1, ampl2, ampr1, ampr2; //necessary for "randomness" - float lfornd; - char lfotype; - - // current setup - float samplerate_f; - float buffersize_f; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.cpp deleted file mode 100644 index 08d4f1d8886..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectMgr.cpp - Effect manager, an interface betwen the program and effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "EffectMgr.h" -#include "Effect.h" -#include "Reverb.h" -#include "Echo.h" -#include "Chorus.h" -#include "Distorsion.h" -#include "EQ.h" -#include "DynamicFilter.h" -#include "../Misc/XMLwrapper.h" -#include "../Params/FilterParams.h" - -#include -using namespace std; - -EffectMgr::EffectMgr(const bool insertion_, pthread_mutex_t *mutex_) - :insertion(insertion_), - efxoutl(new float[synth->buffersize]), - efxoutr(new float[synth->buffersize]), - filterpars(NULL), - nefx(0), - efx(NULL), - mutex(mutex_), - dryonly(false) -{ - setpresettype("Peffect"); - memset(efxoutl, 0, synth->bufferbytes); - memset(efxoutr, 0, synth->bufferbytes); - defaults(); -} - - -EffectMgr::~EffectMgr() -{ - delete efx; - delete [] efxoutl; - delete [] efxoutr; -} - -void EffectMgr::defaults(void) -{ - changeeffect(0); - setdryonly(false); -} - -//Change the effect -void EffectMgr::changeeffect(int _nefx) -{ - cleanup(); - if(nefx == _nefx) - return; - nefx = _nefx; - memset(efxoutl, 0, synth->bufferbytes); - memset(efxoutr, 0, synth->bufferbytes); - delete efx; - switch(nefx) { - case 1: - efx = new Reverb(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 2: - efx = new Echo(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 3: - efx = new Chorus(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 4: - efx = new Phaser(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 5: - efx = new Alienwah(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 6: - efx = new Distorsion(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 7: - efx = new EQ(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - case 8: - efx = new DynamicFilter(insertion, efxoutl, efxoutr, synth->samplerate, synth->buffersize); - break; - //put more effect here - default: - efx = NULL; - break; //no effect (thru) - } - - if(efx) - filterpars = efx->filterpars; -} - -//Obtain the effect number -int EffectMgr::geteffect(void) -{ - return nefx; -} - -// Cleanup the current effect -void EffectMgr::cleanup(void) -{ - if(efx) - efx->cleanup(); -} - - -// Get the preset of the current effect -unsigned char EffectMgr::getpreset(void) -{ - if(efx) - return efx->Ppreset; - else - return 0; -} - -// Change the preset of the current effect -void EffectMgr::changepreset_nolock(unsigned char npreset) -{ - if(efx) - efx->setpreset(npreset); -} - -//Change the preset of the current effect(with thread locking) -void EffectMgr::changepreset(unsigned char npreset) -{ - pthread_mutex_lock(mutex); - changepreset_nolock(npreset); - pthread_mutex_unlock(mutex); -} - - -//Change a parameter of the current effect -void EffectMgr::seteffectpar_nolock(int npar, unsigned char value) -{ - if(!efx) - return; - efx->changepar(npar, value); -} - -// Change a parameter of the current effect (with thread locking) -void EffectMgr::seteffectpar(int npar, unsigned char value) -{ - pthread_mutex_lock(mutex); - seteffectpar_nolock(npar, value); - pthread_mutex_unlock(mutex); -} - -//Get a parameter of the current effect -unsigned char EffectMgr::geteffectpar(int npar) -{ - if(!efx) - return 0; - return efx->getpar(npar); -} - -// Apply the effect -void EffectMgr::out(float *smpsl, float *smpsr) -{ - if(!efx) { - if(!insertion) - for(int i = 0; i < synth->buffersize; ++i) { - smpsl[i] = 0.0f; - smpsr[i] = 0.0f; - efxoutl[i] = 0.0f; - efxoutr[i] = 0.0f; - } - return; - } - for(int i = 0; i < synth->buffersize; ++i) { - smpsl[i] += denormalkillbuf[i]; - smpsr[i] += denormalkillbuf[i]; - efxoutl[i] = 0.0f; - efxoutr[i] = 0.0f; - } - efx->out(smpsl, smpsr); - - float volume = efx->volume; - - if(nefx == 7) { //this is need only for the EQ effect - memcpy(smpsl, efxoutl, synth->bufferbytes); - memcpy(smpsr, efxoutr, synth->bufferbytes); - return; - } - - //Insertion effect - if(insertion != 0) { - float v1, v2; - if(volume < 0.5f) { - v1 = 1.0f; - v2 = volume * 2.0f; - } - else { - v1 = (1.0f - volume) * 2.0f; - v2 = 1.0f; - } - if((nefx == 1) || (nefx == 2)) - v2 *= v2; //for Reverb and Echo, the wet function is not liniar - - if(dryonly) //this is used for instrument effect only - for(int i = 0; i < synth->buffersize; ++i) { - smpsl[i] *= v1; - smpsr[i] *= v1; - efxoutl[i] *= v2; - efxoutr[i] *= v2; - } - else // normal instrument/insertion effect - for(int i = 0; i < synth->buffersize; ++i) { - smpsl[i] = smpsl[i] * v1 + efxoutl[i] * v2; - smpsr[i] = smpsr[i] * v1 + efxoutr[i] * v2; - } - } - else // System effect - for(int i = 0; i < synth->buffersize; ++i) { - efxoutl[i] *= 2.0f * volume; - efxoutr[i] *= 2.0f * volume; - smpsl[i] = efxoutl[i]; - smpsr[i] = efxoutr[i]; - } -} - - -// Get the effect volume for the system effect -float EffectMgr::sysefxgetvolume(void) -{ - return (!efx) ? 1.0f : efx->outvolume; -} - - -// Get the EQ response -float EffectMgr::getEQfreqresponse(float freq) -{ - return (nefx == 7) ? efx->getfreqresponse(freq) : 0.0f; -} - - -void EffectMgr::setdryonly(bool value) -{ - dryonly = value; -} - -void EffectMgr::add2XML(XMLwrapper *xml) -{ - xml->addpar("type", geteffect()); - - if(!efx || !geteffect()) - return; - xml->addpar("preset", efx->Ppreset); - - xml->beginbranch("EFFECT_PARAMETERS"); - for(int n = 0; n < 128; ++n) { - int par = geteffectpar(n); - if(par == 0) - continue; - xml->beginbranch("par_no", n); - xml->addpar("par", par); - xml->endbranch(); - } - if(filterpars) { - xml->beginbranch("FILTER"); - filterpars->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); -} - -void EffectMgr::getfromXML(XMLwrapper *xml) -{ - changeeffect(xml->getpar127("type", geteffect())); - - if(!efx || !geteffect()) - return; - - efx->Ppreset = xml->getpar127("preset", efx->Ppreset); - - if(xml->enterbranch("EFFECT_PARAMETERS")) { - for(int n = 0; n < 128; ++n) { - seteffectpar_nolock(n, 0); //erase effect parameter - if(xml->enterbranch("par_no", n) == 0) - continue; - int par = geteffectpar(n); - seteffectpar_nolock(n, xml->getpar127("par", par)); - xml->exitbranch(); - } - if(filterpars) - if(xml->enterbranch("FILTER")) { - filterpars->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - cleanup(); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.h deleted file mode 100644 index 256a8d81dc9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/EffectMgr.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EffectMgr.h - Effect manager, an interface betwen the program and effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef EFFECTMGR_H -#define EFFECTMGR_H - -#include - -#include "Alienwah.h" -#include "Phaser.h" -#include "../Params/Presets.h" - -class Effect; -class FilterParams; -class XMLwrapper; - -#include "Distorsion.h" -#include "EQ.h" -#include "DynamicFilter.h" -#include "../Misc/XMLwrapper.h" -#include "../Params/FilterParams.h" -#include "../Params/Presets.h" - -/**Effect manager, an interface betwen the program and effects*/ -class EffectMgr:public Presets -{ - public: - EffectMgr(const bool insertion_, pthread_mutex_t *mutex_); - ~EffectMgr(); - - void add2XML(XMLwrapper *xml); - void defaults(void); - void getfromXML(XMLwrapper *xml); - - void out(float *smpsl, float *smpsr); - - void setdryonly(bool value); - - /**get the output(to speakers) volume of the systemeffect*/ - float sysefxgetvolume(void); - - void cleanup(void); - - void changeeffect(int nefx_); - int geteffect(void); - void changepreset(unsigned char npreset); - void changepreset_nolock(unsigned char npreset); - unsigned char getpreset(void); - void seteffectpar(int npar, unsigned char value); - void seteffectpar_nolock(int npar, unsigned char value); - unsigned char geteffectpar(int npar); - - const bool insertion; - float *efxoutl, *efxoutr; - - // used by UI - float getEQfreqresponse(float freq); - - FilterParams *filterpars; - - private: - int nefx; - Effect *efx; - pthread_mutex_t *mutex; - bool dryonly; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.cpp deleted file mode 100644 index 66a9283e331..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.cpp +++ /dev/null @@ -1,470 +0,0 @@ -/* - - Phaser.cpp - Phasing and Approximate digital model of an analog JFET phaser. - Analog modeling implemented by Ryan Billing aka Transmogrifox. - ZynAddSubFX - a software synthesizer - - Phaser.cpp - Phaser effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2009-2010 Ryan Billing - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Ryan Billing - Mark McCurry - - DSP analog modeling theory & practice largely influenced by various CCRMA publications, particularly works by Julius O. Smith. - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "Phaser.h" - -using namespace std; - -#define PHASER_LFO_SHAPE 2 -#define ONE_ 0.99999f // To prevent LFO ever reaching 1.0f for filter stability purposes -#define ZERO_ 0.00001f // Same idea as above. - -Phaser::Phaser(const int &insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), lfo(srate, bufsize), old(NULL), xn1(NULL), - yn1(NULL), diff(0.0f), oldgain(0.0f), fb(0.0f) -{ - analog_setup(); - setpreset(Ppreset); - cleanup(); -} - -void Phaser::analog_setup() -{ - //model mismatch between JFET devices - offset[0] = -0.2509303f; - offset[1] = 0.9408924f; - offset[2] = 0.998f; - offset[3] = -0.3486182f; - offset[4] = -0.2762545f; - offset[5] = -0.5215785f; - offset[6] = 0.2509303f; - offset[7] = -0.9408924f; - offset[8] = -0.998f; - offset[9] = 0.3486182f; - offset[10] = 0.2762545f; - offset[11] = 0.5215785f; - - barber = 0; //Deactivate barber pole phasing by default - - mis = 1.0f; - Rmin = 625.0f; // 2N5457 typical on resistance at Vgs = 0 - Rmax = 22000.0f; // Resistor parallel to FET - Rmx = Rmin / Rmax; - Rconst = 1.0f + Rmx; // Handle parallel resistor relationship - C = 0.00000005f; // 50 nF - CFs = 2.0f * samplerate_f * C; - invperiod = 1.0f / buffersize_f; -} - -Phaser::~Phaser() -{ - if(old.l) - delete[] old.l; - if(xn1.l) - delete[] xn1.l; - if(yn1.l) - delete[] yn1.l; - if(old.r) - delete[] old.r; - if(xn1.r) - delete[] xn1.r; - if(yn1.r) - delete[] yn1.r; -} - -/* - * Effect output - */ -void Phaser::out(const Stereo &input) -{ - if(Panalog) - AnalogPhase(input); - else - normalPhase(input); -} - -void Phaser::AnalogPhase(const Stereo &input) -{ - Stereo gain(0.0f), lfoVal(0.0f), mod(0.0f), g(0.0f), b(0.0f), hpf( - 0.0f); - - lfo.effectlfoout(&lfoVal.l, &lfoVal.r); - mod.l = lfoVal.l * width + (depth - 0.5f); - mod.r = lfoVal.r * width + (depth - 0.5f); - - mod.l = limit(mod.l, ZERO_, ONE_); - mod.r = limit(mod.r, ZERO_, ONE_); - - if(Phyper) { - //Triangle wave squared is approximately sin on bottom, tri on top - //Result is exponential sweep more akin to filter in synth with - //exponential generator circuitry. - mod.l *= mod.l; - mod.r *= mod.r; - } - - //g.l,g.r is Vp - Vgs. Typical FET drain-source resistance follows constant/[1-sqrt(Vp - Vgs)] - mod.l = sqrtf(1.0f - mod.l); - mod.r = sqrtf(1.0f - mod.r); - - diff.r = (mod.r - oldgain.r) * invperiod; - diff.l = (mod.l - oldgain.l) * invperiod; - - g = oldgain; - oldgain = mod; - - for(int i = 0; i < buffersize; ++i) { - g.l += diff.l; // Linear interpolation between LFO samples - g.r += diff.r; - - Stereo xn(input.l[i] * pangainL, input.r[i] * pangainR); - - if(barber) { - g.l = fmodf((g.l + 0.25f), ONE_); - g.r = fmodf((g.r + 0.25f), ONE_); - } - - xn.l = applyPhase(xn.l, g.l, fb.l, hpf.l, yn1.l, xn1.l); - xn.r = applyPhase(xn.r, g.r, fb.r, hpf.r, yn1.r, xn1.r); - - - fb.l = xn.l * feedback; - fb.r = xn.r * feedback; - efxoutl[i] = xn.l; - efxoutr[i] = xn.r; - } - - if(Poutsub) { - invSignal(efxoutl, buffersize); - invSignal(efxoutr, buffersize); - } -} - -float Phaser::applyPhase(float x, float g, float fb, - float &hpf, float *yn1, float *xn1) -{ - for(int j = 0; j < Pstages; ++j) { //Phasing routine - mis = 1.0f + offsetpct * offset[j]; - - //This is symmetrical. - //FET is not, so this deviates slightly, however sym dist. is - //better sounding than a real FET. - float d = (1.0f + 2.0f * (0.25f + g) * hpf * hpf * distortion) * mis; - Rconst = 1.0f + mis * Rmx; - - // This is 1/R. R is being modulated to control filter fc. - float b = (Rconst - g) / (d * Rmin); - float gain = (CFs - b) / (CFs + b); - yn1[j] = gain * (x + yn1[j]) - xn1[j]; - - //high pass filter: - //Distortion depends on the high-pass part of the AP stage. - hpf = yn1[j] + (1.0f - gain) * xn1[j]; - - xn1[j] = x; - x = yn1[j]; - if(j == 1) - x += fb; //Insert feedback after first phase stage - } - return x; -} -void Phaser::normalPhase(const Stereo &input) -{ - Stereo gain(0.0f), lfoVal(0.0f); - - lfo.effectlfoout(&lfoVal.l, &lfoVal.r); - gain.l = - (expf(lfoVal.l - * PHASER_LFO_SHAPE) - 1) / (expf(PHASER_LFO_SHAPE) - 1.0f); - gain.r = - (expf(lfoVal.r - * PHASER_LFO_SHAPE) - 1) / (expf(PHASER_LFO_SHAPE) - 1.0f); - - gain.l = 1.0f - phase * (1.0f - depth) - (1.0f - phase) * gain.l * depth; - gain.r = 1.0f - phase * (1.0f - depth) - (1.0f - phase) * gain.r * depth; - - gain.l = limit(gain.l, ZERO_, ONE_); - gain.r = limit(gain.r, ZERO_, ONE_); - - for(int i = 0; i < buffersize; ++i) { - float x = (float) i / buffersize_f; - float x1 = 1.0f - x; - //TODO think about making panning an external feature - Stereo xn(input.l[i] * pangainL + fb.l, - input.r[i] * pangainR + fb.r); - - Stereo g(gain.l * x + oldgain.l * x1, - gain.r * x + oldgain.r * x1); - - xn.l = applyPhase(xn.l, g.l, old.l); - xn.r = applyPhase(xn.r, g.r, old.r); - - //Left/Right crossing - crossover(xn.l, xn.r, lrcross); - - fb.l = xn.l * feedback; - fb.r = xn.r * feedback; - efxoutl[i] = xn.l; - efxoutr[i] = xn.r; - } - - oldgain = gain; - - if(Poutsub) { - invSignal(efxoutl, buffersize); - invSignal(efxoutr, buffersize); - } -} - -float Phaser::applyPhase(float x, float g, float *old) -{ - for(int j = 0; j < Pstages * 2; ++j) { //Phasing routine - float tmp = old[j]; - old[j] = g * tmp + x; - x = tmp - g * old[j]; - } - return x; -} - -/* - * Cleanup the effect - */ -void Phaser::cleanup() -{ - fb = oldgain = Stereo(0.0f); - for(int i = 0; i < Pstages * 2; ++i) { - old.l[i] = 0.0f; - old.r[i] = 0.0f; - } - for(int i = 0; i < Pstages; ++i) { - xn1.l[i] = 0.0f; - yn1.l[i] = 0.0f; - xn1.r[i] = 0.0f; - yn1.r[i] = 0.0f; - } -} - -/* - * Parameter control - */ -void Phaser::setwidth(unsigned char Pwidth) -{ - this->Pwidth = Pwidth; - width = ((float)Pwidth / 127.0f); -} - -void Phaser::setfb(unsigned char Pfb) -{ - this->Pfb = Pfb; - feedback = (float) (Pfb - 64) / 64.2f; -} - -void Phaser::setvolume(unsigned char Pvolume) -{ - this->Pvolume = Pvolume; - outvolume = Pvolume / 127.0f; - if(insertion == 0) - volume = 1.0f; - else - volume = outvolume; -} - -void Phaser::setdistortion(unsigned char Pdistortion) -{ - this->Pdistortion = Pdistortion; - distortion = (float)Pdistortion / 127.0f; -} - -void Phaser::setoffset(unsigned char Poffset) -{ - this->Poffset = Poffset; - offsetpct = (float)Poffset / 127.0f; -} - -void Phaser::setstages(unsigned char Pstages) -{ - if(old.l) - delete[] old.l; - if(xn1.l) - delete[] xn1.l; - if(yn1.l) - delete[] yn1.l; - if(old.r) - delete[] old.r; - if(xn1.r) - delete[] xn1.r; - if(yn1.r) - delete[] yn1.r; - - - this->Pstages = min(MAX_PHASER_STAGES, (int)Pstages); - - old = Stereo(new float[Pstages * 2], - new float[Pstages * 2]); - - xn1 = Stereo(new float[Pstages], - new float[Pstages]); - - yn1 = Stereo(new float[Pstages], - new float[Pstages]); - - cleanup(); -} - -void Phaser::setphase(unsigned char Pphase) -{ - this->Pphase = Pphase; - phase = (Pphase / 127.0f); -} - -void Phaser::setdepth(unsigned char Pdepth) -{ - this->Pdepth = Pdepth; - depth = (float)(Pdepth) / 127.0f; -} - - -void Phaser::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 15; - const int NUM_PRESETS = 12; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Phaser - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - {64, 64, 36, 0, 0, 64, 110, 64, 1, 0, 0, 20, - 0, 0, - 0 }, - {64, 64, 35, 0, 0, 88, 40, 64, 3, 0, 0, 20, 0, 0, - 0 }, - {64, 64, 31, 0, 0, 66, 68, 107, 2, 0, 0, 20, 0, 0, - 0 }, - {39, 64, 22, 0, 0, 66, 67, 10, 5, 0, 1, 20, 0, 0, - 0 }, - {64, 64, 20, 0, 1, 110, 67, 78, 10, 0, 0, 20, 0, 0, - 0 }, - {64, 64, 53, 100, 0, 58, 37, 78, 3, 0, 0, 20, 0, 0, - 0 }, - //APhaser - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - {64, 64, 14, 0, 1, 64, 64, 40, 4, 10, 0, 110,1, 20, - 1 }, - {64, 64, 14, 5, 1, 64, 70, 40, 6, 10, 0, 110,1, 20, - 1 }, - {64, 64, 9, 0, 0, 64, 60, 40, 8, 10, 0, 40, 0, 20, - 1 }, - {64, 64, 14, 10, 0, 64, 45, 80, 7, 10, 1, 110,1, 20, - 1 }, - {25, 64, 127, 10, 0, 64, 25, 16, 8, 100, 0, 25, 0, 20, - 1 }, - {64, 64, 1, 10, 1, 64, 70, 40, 12, 10, 0, 110,1, 20, - 1 } - }; - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - Ppreset = npreset; -} - - -void Phaser::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - lfo.Pfreq = value; - lfo.updateparams(); - break; - case 3: - lfo.Prandomness = value; - lfo.updateparams(); - break; - case 4: - lfo.PLFOtype = value; - lfo.updateparams(); - barber = (2 == value); - break; - case 5: - lfo.Pstereo = value; - lfo.updateparams(); - break; - case 6: - setdepth(value); - break; - case 7: - setfb(value); - break; - case 8: - setstages(value); - break; - case 9: - setlrcross(value); - setoffset(value); - break; - case 10: - Poutsub = min((int)value, 1); - break; - case 11: - setphase(value); - setwidth(value); - break; - case 12: - Phyper = min((int)value, 1); - break; - case 13: - setdistortion(value); - break; - case 14: - Panalog = value; - break; - } -} - -unsigned char Phaser::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return lfo.Pfreq; - case 3: return lfo.Prandomness; - case 4: return lfo.PLFOtype; - case 5: return lfo.Pstereo; - case 6: return Pdepth; - case 7: return Pfb; - case 8: return Pstages; - case 9: return Plrcross; - return Poffset; //same - case 10: return Poutsub; - case 11: return Pphase; - return Pwidth; //same - case 12: return Phyper; - case 13: return Pdistortion; - case 14: return Panalog; - default: return 0; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.h deleted file mode 100644 index 47961870d6a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Phaser.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Phaser.h - Phaser effect - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2009-2010 Ryan Billing - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Ryan Billing - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PHASER_H -#define PHASER_H -#include "../globals.h" -#include "Effect.h" -#include "EffectLFO.h" - -#define MAX_PHASER_STAGES 12 - -class Phaser:public Effect -{ - public: - Phaser(const int &insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~Phaser(); - void out(const Stereo &input); - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - void cleanup(); - - private: - //Phaser parameters - EffectLFO lfo; //Phaser modulator - unsigned char Pvolume; //Used to set wet/dry mix - unsigned char Pdistortion; //Model distortion added by FET element - unsigned char Pdepth; //Depth of phaser sweep - unsigned char Pwidth; //Phaser width (LFO amplitude) - unsigned char Pfb; //feedback - unsigned char Poffset; //Model mismatch between variable resistors - unsigned char Pstages; //Number of first-order All-Pass stages - unsigned char Poutsub; //if I wish to subtract the output instead of adding - unsigned char Pphase; - unsigned char Phyper; //lfo^2 -- converts tri into hyper-sine - unsigned char Panalog; - - //Control parameters - void setvolume(unsigned char Pvolume); - void setdepth(unsigned char Pdepth); - void setfb(unsigned char Pfb); - void setdistortion(unsigned char Pdistortion); - void setwidth(unsigned char Pwidth); - void setoffset(unsigned char Poffset); - void setstages(unsigned char Pstages); - void setphase(unsigned char Pphase); - - //Internal Variables - bool barber; //Barber pole phasing flag - float distortion, width, offsetpct; - float feedback, depth, phase; - Stereo old, xn1, yn1; - Stereo diff, oldgain, fb; - float invperiod; - float offset[12]; - - float mis; - float Rmin; // 3N5457 typical on resistance at Vgs = 0 - float Rmax; // Resistor parallel to FET - float Rmx; // Rmin/Rmax to avoid division in loop - float Rconst; // Handle parallel resistor relationship - float C; // Capacitor - float CFs; // A constant derived from capacitor and resistor relationships - - void analog_setup(); - void AnalogPhase(const Stereo &input); - //analog case - float applyPhase(float x, float g, float fb, - float &hpf, float *yn1, float *xn1); - - void normalPhase(const Stereo &input); - float applyPhase(float x, float g, float *old); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.cpp deleted file mode 100644 index 74961b2f52d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Reverb.cpp - Reverberation effect - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Reverb.h" -#include "../Misc/Util.h" -#include "../DSP/AnalogFilter.h" -#include "../DSP/Unison.h" -#include - -Reverb::Reverb(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize) - :Effect(insertion_, efxoutl_, efxoutr_, NULL, 0, srate, bufsize), - // defaults - Pvolume(48), - Ptime(64), - Pidelay(40), - Pidelayfb(0), - Plpf(127), - Phpf(0), - Plohidamp(80), - Ptype(1), - Proomsize(64), - Pbandwidth(30), - roomsize(1.0f), - rs(1.0f), - bandwidth(NULL), - idelay(NULL), - lpf(NULL), - hpf(NULL) // no filter -{ - for(int i = 0; i < REV_COMBS * 2; ++i) { - comblen[i] = 800 + (int)(RND * 1400.0f); - combk[i] = 0; - lpcomb[i] = 0; - combfb[i] = -0.97f; - comb[i] = NULL; - } - - for(int i = 0; i < REV_APS * 2; ++i) { - aplen[i] = 500 + (int)(RND * 500.0f); - apk[i] = 0; - ap[i] = NULL; - } - setpreset(Ppreset); - cleanup(); //do not call this before the comb initialisation -} - - -Reverb::~Reverb() -{ - delete [] idelay; - delete hpf; - delete lpf; - - for(int i = 0; i < REV_APS * 2; ++i) - delete [] ap[i]; - for(int i = 0; i < REV_COMBS * 2; ++i) - delete [] comb[i]; - - if(bandwidth) - delete bandwidth; -} - -//Cleanup the effect -void Reverb::cleanup(void) -{ - int i, j; - for(i = 0; i < REV_COMBS * 2; ++i) { - lpcomb[i] = 0.0f; - for(j = 0; j < comblen[i]; ++j) - comb[i][j] = 0.0f; - } - - for(i = 0; i < REV_APS * 2; ++i) - for(j = 0; j < aplen[i]; ++j) - ap[i][j] = 0.0f; - - if(idelay) - for(i = 0; i < idelaylen; ++i) - idelay[i] = 0.0f; - if(hpf) - hpf->cleanup(); - if(lpf) - lpf->cleanup(); -} - -//Process one channel; 0=left, 1=right -void Reverb::processmono(int ch, float *output, float *inputbuf) -{ - //todo: implement the high part from lohidamp - - for(int j = REV_COMBS * ch; j < REV_COMBS * (ch + 1); ++j) { - int &ck = combk[j]; - const int comblength = comblen[j]; - float &lpcombj = lpcomb[j]; - - for(int i = 0; i < buffersize; ++i) { - float fbout = comb[j][ck] * combfb[j]; - fbout = fbout * (1.0f - lohifb) + lpcombj * lohifb; - lpcombj = fbout; - - comb[j][ck] = inputbuf[i] + fbout; - output[i] += fbout; - - if((++ck) >= comblength) - ck = 0; - } - } - - for(int j = REV_APS * ch; j < REV_APS * (1 + ch); ++j) { - int &ak = apk[j]; - const int aplength = aplen[j]; - for(int i = 0; i < buffersize; ++i) { - float tmp = ap[j][ak]; - ap[j][ak] = 0.7f * tmp + output[i]; - output[i] = tmp - 0.7f * ap[j][ak]; - if((++ak) >= aplength) - ak = 0; - } - } -} - -//Effect output -void Reverb::out(const Stereo &smp) -{ - if(!Pvolume && insertion) - return; - - float inputbuf[buffersize]; - for(int i = 0; i < buffersize; ++i) - inputbuf[i] = (smp.l[i] + smp.r[i]) / 2.0f; - - if(idelay) - for(int i = 0; i < buffersize; ++i) { - //Initial delay r - float tmp = inputbuf[i] + idelay[idelayk] * idelayfb; - inputbuf[i] = idelay[idelayk]; - idelay[idelayk] = tmp; - idelayk++; - if(idelayk >= idelaylen) - idelayk = 0; - } - - if(bandwidth) - bandwidth->process(buffersize, inputbuf); - - if(lpf) - lpf->filterout(inputbuf); - if(hpf) - hpf->filterout(inputbuf); - - processmono(0, efxoutl, inputbuf); //left - processmono(1, efxoutr, inputbuf); //right - - float lvol = rs / REV_COMBS * pangainL; - float rvol = rs / REV_COMBS * pangainR; - if(insertion != 0) { - lvol *= 2.0f; - rvol *= 2.0f; - } - for(int i = 0; i < buffersize; ++i) { - efxoutl[i] *= lvol; - efxoutr[i] *= rvol; - } -} - - -//Parameter control -void Reverb::setvolume(unsigned char _Pvolume) -{ - Pvolume = _Pvolume; - if(!insertion) { - outvolume = powf(0.01f, (1.0f - Pvolume / 127.0f)) * 4.0f; - volume = 1.0f; - } - else { - volume = outvolume = Pvolume / 127.0f; - if(Pvolume == 0) - cleanup(); - } -} - -void Reverb::settime(unsigned char _Ptime) -{ - Ptime = _Ptime; - float t = powf(60.0f, Ptime / 127.0f) - 0.97f; - - for(int i = 0; i < REV_COMBS * 2; ++i) - combfb[i] = - -expf((float)comblen[i] / samplerate_f * logf(0.001f) / t); - //the feedback is negative because it removes the DC -} - -void Reverb::setlohidamp(unsigned char _Plohidamp) -{ - Plohidamp = (_Plohidamp < 64) ? 64 : _Plohidamp; - //remove this when the high part from lohidamp is added - if(Plohidamp == 64) { - lohidamptype = 0; - lohifb = 0.0f; - } - else { - if(Plohidamp < 64) - lohidamptype = 1; - if(Plohidamp > 64) - lohidamptype = 2; - float x = fabsf((float)(Plohidamp - 64) / 64.1f); - lohifb = x * x; - } -} - -void Reverb::setidelay(unsigned char _Pidelay) -{ - Pidelay = _Pidelay; - float delay = powf(50.0f * Pidelay / 127.0f, 2.0f) - 1.0f; - - if(idelay) - delete [] idelay; - idelay = NULL; - - idelaylen = (int) (samplerate_f * delay / 1000); - if(idelaylen > 1) { - idelayk = 0; - idelay = new float[idelaylen]; - memset(idelay, 0, idelaylen * sizeof(float)); - } -} - -void Reverb::setidelayfb(unsigned char _Pidelayfb) -{ - Pidelayfb = _Pidelayfb; - idelayfb = Pidelayfb / 128.0f; -} - -void Reverb::sethpf(unsigned char _Phpf) -{ - Phpf = _Phpf; - if(Phpf == 0) { //No HighPass - if(hpf) - delete hpf; - hpf = NULL; - } - else { - float fr = expf(powf(Phpf / 127.0f, 0.5f) * logf(10000.0f)) + 20.0f; - if(hpf == NULL) - hpf = new AnalogFilter(3, fr, 1, 0, samplerate, buffersize); - else - hpf->setfreq(fr); - } -} - -void Reverb::setlpf(unsigned char _Plpf) -{ - Plpf = _Plpf; - if(Plpf == 127) { //No LowPass - if(lpf) - delete lpf; - lpf = NULL; - } - else { - float fr = expf(powf(Plpf / 127.0f, 0.5f) * logf(25000.0f)) + 40.0f; - if(!lpf) - lpf = new AnalogFilter(2, fr, 1, 0, samplerate, buffersize); - else - lpf->setfreq(fr); - } -} - -void Reverb::settype(unsigned char _Ptype) -{ - Ptype = _Ptype; - const int NUM_TYPES = 3; - const int combtunings[NUM_TYPES][REV_COMBS] = { - //this is unused (for random) - {0, 0, 0, 0, 0, 0, 0, 0 }, - //Freeverb by Jezar at Dreampoint - {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }, - //duplicate of Freeverb by Jezar at Dreampoint - {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 } - }; - - const int aptunings[NUM_TYPES][REV_APS] = { - //this is unused (for random) - {0, 0, 0, 0 }, - //Freeverb by Jezar at Dreampoint - {225, 341, 441, 556 }, - //duplicate of Freeverb by Jezar at Dreampoint - {225, 341, 441, 556 } - }; - - if(Ptype >= NUM_TYPES) - Ptype = NUM_TYPES - 1; - - // adjust the combs according to the samplerate - float samplerate_adjust = samplerate_f / 44100.0f; - float tmp; - for(int i = 0; i < REV_COMBS * 2; ++i) { - if(Ptype == 0) - tmp = 800.0f + (int)(RND * 1400.0f); - else - tmp = combtunings[Ptype][i % REV_COMBS]; - tmp *= roomsize; - if(i > REV_COMBS) - tmp += 23.0f; - tmp *= samplerate_adjust; //adjust the combs according to the samplerate - if(tmp < 10.0f) - tmp = 10.0f; - comblen[i] = (int) tmp; - combk[i] = 0; - lpcomb[i] = 0; - if(comb[i]) - delete [] comb[i]; - comb[i] = new float[comblen[i]]; - } - - for(int i = 0; i < REV_APS * 2; ++i) { - if(Ptype == 0) - tmp = 500 + (int)(RND * 500.0f); - else - tmp = aptunings[Ptype][i % REV_APS]; - tmp *= roomsize; - if(i > REV_APS) - tmp += 23.0f; - tmp *= samplerate_adjust; //adjust the combs according to the samplerate - if(tmp < 10) - tmp = 10; - aplen[i] = (int) tmp; - apk[i] = 0; - if(ap[i]) - delete [] ap[i]; - ap[i] = new float[aplen[i]]; - } - delete bandwidth; - bandwidth = NULL; - if(Ptype == 2) { //bandwidth - //TODO the size of the unison buffer may be too small, though this has - //not been verified yet. - //As this cannot be resized in a RT context, a good upper bound should - //be found - bandwidth = new Unison(buffersize / 4 + 1, 2.0f, samplerate_f); - bandwidth->setSize(50); - bandwidth->setBaseFrequency(1.0f); - } - settime(Ptime); - cleanup(); -} - -void Reverb::setroomsize(unsigned char _Proomsize) -{ - Proomsize = _Proomsize; - if(!Proomsize) - this->Proomsize = 64; //this is because the older versions consider roomsize=0 - roomsize = (this->Proomsize - 64.0f) / 64.0f; - if(roomsize > 0.0f) - roomsize *= 2.0f; - roomsize = powf(10.0f, roomsize); - rs = sqrtf(roomsize); - settype(Ptype); -} - -void Reverb::setbandwidth(unsigned char _Pbandwidth) -{ - Pbandwidth = _Pbandwidth; - float v = Pbandwidth / 127.0f; - if(bandwidth) - bandwidth->setBandwidth(powf(v, 2.0f) * 200.0f); -} - -void Reverb::setpreset(unsigned char npreset) -{ - const int PRESET_SIZE = 13; - const int NUM_PRESETS = 13; - unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { - //Cathedral1 - {80, 64, 63, 24, 0, 0, 0, 85, 5, 83, 1, 64, 20}, - //Cathedral2 - {80, 64, 69, 35, 0, 0, 0, 127, 0, 71, 0, 64, 20}, - //Cathedral3 - {80, 64, 69, 24, 0, 0, 0, 127, 75, 78, 1, 85, 20}, - //Hall1 - {90, 64, 51, 10, 0, 0, 0, 127, 21, 78, 1, 64, 20}, - //Hall2 - {90, 64, 53, 20, 0, 0, 0, 127, 75, 71, 1, 64, 20}, - //Room1 - {100, 64, 33, 0, 0, 0, 0, 127, 0, 106, 0, 30, 20}, - //Room2 - {100, 64, 21, 26, 0, 0, 0, 62, 0, 77, 1, 45, 20}, - //Basement - {110, 64, 14, 0, 0, 0, 0, 127, 5, 71, 0, 25, 20}, - //Tunnel - {85, 80, 84, 20, 42, 0, 0, 51, 0, 78, 1, 105, 20}, - //Echoed1 - {95, 64, 26, 60, 71, 0, 0, 114, 0, 64, 1, 64, 20}, - //Echoed2 - {90, 64, 40, 88, 71, 0, 0, 114, 0, 88, 1, 64, 20}, - //VeryLong1 - {90, 64, 93, 15, 0, 0, 0, 114, 0, 77, 0, 95, 20}, - //VeryLong2 - {90, 64, 111, 30, 0, 0, 0, 114, 90, 74, 1, 80, 20} - }; - - if(npreset >= NUM_PRESETS) - npreset = NUM_PRESETS - 1; - for(int n = 0; n < PRESET_SIZE; ++n) - changepar(n, presets[npreset][n]); - if(insertion) - changepar(0, presets[npreset][0] / 2); //lower the volume if reverb is insertion effect - Ppreset = npreset; -} - - -void Reverb::changepar(int npar, unsigned char value) -{ - switch(npar) { - case 0: - setvolume(value); - break; - case 1: - setpanning(value); - break; - case 2: - settime(value); - break; - case 3: - setidelay(value); - break; - case 4: - setidelayfb(value); - break; -// case 5: -// setrdelay(value); -// break; -// case 6: -// seterbalance(value); -// break; - case 7: - setlpf(value); - break; - case 8: - sethpf(value); - break; - case 9: - setlohidamp(value); - break; - case 10: - settype(value); - break; - case 11: - setroomsize(value); - break; - case 12: - setbandwidth(value); - break; - } -} - -unsigned char Reverb::getpar(int npar) const -{ - switch(npar) { - case 0: return Pvolume; - case 1: return Ppanning; - case 2: return Ptime; - case 3: return Pidelay; - case 4: return Pidelayfb; - case 7: return Plpf; - case 8: return Phpf; - case 9: return Plohidamp; - case 10: return Ptype; - case 11: return Proomsize; - case 12: return Pbandwidth; - default: return 0; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.h b/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.h deleted file mode 100644 index 5363759b683..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Effects/Reverb.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Reverb.h - Reverberation effect - Copyright (C) 2002-2009 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef REVERB_H -#define REVERB_H - -#include "Effect.h" - -#define REV_COMBS 8 -#define REV_APS 4 - -/**Creates Reverberation Effects*/ -class Reverb:public Effect -{ - public: - Reverb(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize); - ~Reverb(); - void out(const Stereo &smp); - void cleanup(void); - - void setpreset(unsigned char npreset); - void changepar(int npar, unsigned char value); - unsigned char getpar(int npar) const; - - private: - //Parametrii - unsigned char Pvolume; - unsigned char Ptime; //duration - unsigned char Pidelay; //initial delay - unsigned char Pidelayfb; //initial feedback - unsigned char Plpf; - unsigned char Phpf; - unsigned char Plohidamp; //Low/HighFrequency Damping - unsigned char Ptype; //reverb type - unsigned char Proomsize; //room size - unsigned char Pbandwidth; //bandwidth - - //parameter control - void setvolume(unsigned char _Pvolume); - void settime(unsigned char _Ptime); - void setlohidamp(unsigned char _Plohidamp); - void setidelay(unsigned char _Pidelay); - void setidelayfb(unsigned char _Pidelayfb); - void sethpf(unsigned char _Phpf); - void setlpf(unsigned char _Plpf); - void settype(unsigned char _Ptype); - void setroomsize(unsigned char _Proomsize); - void setbandwidth(unsigned char _Pbandwidth); - void processmono(int ch, float *output, float *inputbuf); - - - //Parameters - int lohidamptype; //0=disable, 1=highdamp (lowpass), 2=lowdamp (highpass) - int idelaylen; - int idelayk; - float lohifb; - float idelayfb; - float roomsize; - float rs; //rs is used to "normalise" the volume according to the roomsize - int comblen[REV_COMBS * 2]; - int aplen[REV_APS * 2]; - class Unison * bandwidth; - - //Internal Variables - float *comb[REV_COMBS * 2]; - int combk[REV_COMBS * 2]; - float combfb[REV_COMBS * 2]; //feedback-ul fiecarui filtru "comb" - float lpcomb[REV_COMBS * 2]; //pentru Filtrul LowPass - float *ap[REV_APS * 2]; - int apk[REV_APS * 2]; - float *idelay; - class AnalogFilter * lpf, *hpf; //filters -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.cpp deleted file mode 100644 index a1f9f5d6b40..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.cpp +++ /dev/null @@ -1,473 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.cpp - Instrument Bank - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2010-2010 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Bank.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Config.h" -#include "Util.h" -#include "Part.h" - -#define INSTRUMENT_EXTENSION ".xiz" - -//if this file exists into a directory, this make the directory to be considered as a bank, even if it not contains a instrument file -#define FORCE_BANK_DIR_FILE ".bankdir" - -using namespace std; - -Bank::Bank() - :defaultinsname(" ") -{ - clearbank(); - bankfiletitle = dirname; - loadbank(config.cfg.currentBankDir); -} - -Bank::~Bank() -{ - clearbank(); -} - -/* - * Get the name of an instrument from the bank - */ -string Bank::getname(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return defaultinsname; - return ins[ninstrument].name; -} - -/* - * Get the numbered name of an instrument from the bank - */ -string Bank::getnamenumbered(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return defaultinsname; - - return stringFrom(ninstrument + 1) + ". " + getname(ninstrument); -} - -/* - * Changes the name of an instrument (and the filename) - */ -void Bank::setname(unsigned int ninstrument, const string &newname, int newslot) -{ - if(emptyslot(ninstrument)) - return; - - string newfilename; - char tmpfilename[100 + 1]; - tmpfilename[100] = 0; - - if(newslot >= 0) - snprintf(tmpfilename, 100, "%4d-%s", newslot + 1, newname.c_str()); - else - snprintf(tmpfilename, 100, "%4d-%s", ninstrument + 1, newname.c_str()); - - //add the zeroes at the start of filename - for(int i = 0; i < 4; ++i) - if(tmpfilename[i] == ' ') - tmpfilename[i] = '0'; - - newfilename = dirname + '/' + legalizeFilename(tmpfilename) + ".xiz"; - - rename(ins[ninstrument].filename.c_str(), newfilename.c_str()); - - ins[ninstrument].filename = newfilename; - ins[ninstrument].name = newname; -} - -/* - * Check if there is no instrument on a slot from the bank - */ -bool Bank::emptyslot(unsigned int ninstrument) -{ - if(ninstrument >= BANK_SIZE) - return true; - if(ins[ninstrument].filename.empty()) - return true; - - if(ins[ninstrument].used) - return false; - else - return true; -} - -/* - * Removes the instrument from the bank - */ -void Bank::clearslot(unsigned int ninstrument) -{ - if(emptyslot(ninstrument)) - return; - - remove(ins[ninstrument].filename.c_str()); - deletefrombank(ninstrument); -} - -/* - * Save the instrument to a slot - */ -void Bank::savetoslot(unsigned int ninstrument, Part *part) -{ - clearslot(ninstrument); - - const int maxfilename = 200; - char tmpfilename[maxfilename + 20]; - ZERO(tmpfilename, maxfilename + 20); - - snprintf(tmpfilename, - maxfilename, - "%4d-%s", - ninstrument + 1, - (char *)part->Pname); - - //add the zeroes at the start of filename - for(int i = 0; i < 4; ++i) - if(tmpfilename[i] == ' ') - tmpfilename[i] = '0'; - - string filename = dirname + '/' + legalizeFilename(tmpfilename) + ".xiz"; - - remove(filename.c_str()); - part->saveXML(filename.c_str()); - addtobank(ninstrument, legalizeFilename(tmpfilename) + ".xiz", (char *) part->Pname); -} - -/* - * Loads the instrument from the bank - */ -void Bank::loadfromslot(unsigned int ninstrument, Part *part) -{ - if(emptyslot(ninstrument)) - return; - - part->AllNotesOff(); - part->defaultsinstrument(); - - part->loadXMLinstrument(ins[ninstrument].filename.c_str()); -} - -/* - * Makes current a bank directory - */ -int Bank::loadbank(string bankdirname) -{ - DIR *dir = opendir(bankdirname.c_str()); - clearbank(); - - if(dir == NULL) - return -1; - - dirname = bankdirname; - - bankfiletitle = dirname; - - struct dirent *fn; - - while((fn = readdir(dir))) { - const char *filename = fn->d_name; - - //check for extension - if(strstr(filename, INSTRUMENT_EXTENSION) == NULL) - continue; - - //verify if the name is like this NNNN-name (where N is a digit) - int no = 0; - unsigned int startname = 0; - - for(unsigned int i = 0; i < 4; ++i) { - if(strlen(filename) <= i) - break; - - if((filename[i] >= '0') && (filename[i] <= '9')) { - no = no * 10 + (filename[i] - '0'); - startname++; - } - } - - if((startname + 1) < strlen(filename)) - startname++; //to take out the "-" - - string name = filename; - - //remove the file extension - for(int i = name.size() - 1; i >= 2; i--) - if(name[i] == '.') { - name = name.substr(0, i); - break; - } - - if(no != 0) //the instrument position in the bank is found - addtobank(no - 1, filename, name.substr(startname)); - else - addtobank(-1, filename, name); - } - - closedir(dir); - - if(!dirname.empty()) - config.cfg.currentBankDir = dirname; - - return 0; -} - -/* - * Makes a new bank, put it on a file and makes it current bank - */ -int Bank::newbank(string newbankdirname) -{ - string bankdir; - bankdir = config.cfg.bankRootDirList[0]; - - if(((bankdir[bankdir.size() - 1]) != '/') - && ((bankdir[bankdir.size() - 1]) != '\\')) - bankdir += "/"; - - bankdir += newbankdirname; -#ifdef WIN32 - if(mkdir(bankdir.c_str()) < 0) -#else - if(mkdir(bankdir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) -#endif - return -1; - - const string tmpfilename = bankdir + '/' + FORCE_BANK_DIR_FILE; - - FILE *tmpfile = fopen(tmpfilename.c_str(), "w+"); - fclose(tmpfile); - - return loadbank(bankdir); -} - -/* - * Check if the bank is locked (i.e. the file opened was readonly) - */ -int Bank::locked() -{ - return dirname.empty(); -} - -/* - * Swaps a slot with another - */ -void Bank::swapslot(unsigned int n1, unsigned int n2) -{ - if((n1 == n2) || (locked())) - return; - if(emptyslot(n1) && (emptyslot(n2))) - return; - if(emptyslot(n1)) //change n1 to n2 in order to make - swap(n1, n2); - - if(emptyslot(n2)) { //this is just a movement from slot1 to slot2 - setname(n1, getname(n1), n2); - ins[n2] = ins[n1]; - ins[n1] = ins_t(); - } - else { //if both slots are used - if(ins[n1].name == ins[n2].name) //change the name of the second instrument if the name are equal - ins[n2].name += "2"; - - setname(n1, getname(n1), n2); - setname(n2, getname(n2), n1); - swap(ins[n2], ins[n1]); - } -} - - -bool Bank::bankstruct::operator<(const bankstruct &b) const -{ - return name < b.name; -} - -/* - * Re-scan for directories containing instrument banks - */ - -void Bank::rescanforbanks() -{ - //remove old banks - banks.clear(); - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - if(!config.cfg.bankRootDirList[i].empty()) - scanrootdir(config.cfg.bankRootDirList[i]); - - //sort the banks - sort(banks.begin(), banks.end()); - - //remove duplicate bank names - int dupl = 0; - for(int j = 0; j < (int) banks.size() - 1; ++j) - for(int i = j + 1; i < (int) banks.size(); ++i) { - if(banks[i].name == banks[j].name) { - //add a [1] to the first bankname and [n] to others - banks[i].name = banks[i].name + '[' - + stringFrom(dupl + 2) + ']'; - if(dupl == 0) - banks[j].name += "[1]"; - - dupl++; - } - else - dupl = 0; - } -} - - -// private stuff - -void Bank::scanrootdir(string rootdir) -{ - DIR *dir = opendir(rootdir.c_str()); - if(dir == NULL) - return; - - bankstruct bank; - - const char *separator = "/"; - if(rootdir.size()) { - char tmp = rootdir[rootdir.size() - 1]; - if((tmp == '/') || (tmp == '\\')) - separator = ""; - } - - struct dirent *fn; - while((fn = readdir(dir))) { - const char *dirname = fn->d_name; - if(dirname[0] == '.') - continue; - - bank.dir = rootdir + separator + dirname + '/'; - bank.name = dirname; - //find out if the directory contains at least 1 instrument - bool isbank = false; - - DIR *d = opendir(bank.dir.c_str()); - if(d == NULL) - continue; - - struct dirent *fname; - - while((fname = readdir(d))) { - if((strstr(fname->d_name, INSTRUMENT_EXTENSION) != NULL) - || (strstr(fname->d_name, FORCE_BANK_DIR_FILE) != NULL)) { - isbank = true; - break; //could put a #instrument counter here instead - } - } - - if(isbank) - banks.push_back(bank); - - closedir(d); - } - - closedir(dir); -} - -void Bank::clearbank() -{ - for(int i = 0; i < BANK_SIZE; ++i) - ins[i] = ins_t(); - - bankfiletitle.clear(); - dirname.clear(); -} - -int Bank::addtobank(int pos, string filename, string name) -{ - if((pos >= 0) && (pos < BANK_SIZE)) { - if(ins[pos].used) - pos = -1; //force it to find a new free position - } - else - if(pos >= BANK_SIZE) - pos = -1; - - - if(pos < 0) //find a free position - for(int i = BANK_SIZE - 1; i >= 0; i--) - if(!ins[i].used) { - pos = i; - break; - } - - if(pos < 0) - return -1; //the bank is full - - deletefrombank(pos); - - ins[pos].used = true; - ins[pos].name = name; - ins[pos].filename = dirname + '/' + filename; - - //see if PADsynth is used - if(config.cfg.CheckPADsynth) { - XMLwrapper xml; - xml.loadXMLfile(ins[pos].filename); - - ins[pos].info.PADsynth_used = xml.hasPadSynth(); - } - else - ins[pos].info.PADsynth_used = false; - - return 0; -} - -bool Bank::isPADsynth_used(unsigned int ninstrument) -{ - if(config.cfg.CheckPADsynth == 0) - return 0; - else - return ins[ninstrument].info.PADsynth_used; -} - - -void Bank::deletefrombank(int pos) -{ - if((pos < 0) || (pos >= BANK_SIZE)) - return; - ins[pos] = ins_t(); -} - -Bank::ins_t::ins_t() - :used(false), name(""), filename("") -{ - info.PADsynth_used = false; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.h deleted file mode 100644 index 5a7ed9da255..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.h - Instrument Bank - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef BANK_H -#define BANK_H - -#include -#include - -//entries in a bank -#define BANK_SIZE 160 - -/**The instrument Bank*/ -class Bank -{ - public: - /**Constructor*/ - Bank(); - ~Bank(); - std::string getname(unsigned int ninstrument); - std::string getnamenumbered(unsigned int ninstrument); - void setname(unsigned int ninstrument, - const std::string &newname, - int newslot); //if newslot==-1 then this is ignored, else it will be put on that slot - bool isPADsynth_used(unsigned int ninstrument); - - /**returns true when slot is empty*/ - bool emptyslot(unsigned int ninstrument); - - /**Empties out the selected slot*/ - void clearslot(unsigned int ninstrument); - /**Saves the given Part to slot*/ - void savetoslot(unsigned int ninstrument, class Part * part); - /**Loads the given slot into a Part*/ - void loadfromslot(unsigned int ninstrument, class Part * part); - - /**Swaps Slots*/ - void swapslot(unsigned int n1, unsigned int n2); - - int loadbank(std::string bankdirname); - int newbank(std::string newbankdirname); - - std::string bankfiletitle; //this is shown on the UI of the bank (the title of the window) - int locked(); - - void rescanforbanks(); - - struct bankstruct { - bool operator<(const bankstruct &b) const; - std::string dir; - std::string name; - }; - - std::vector banks; - - private: - - //it adds a filename to the bank - //if pos is -1 it try to find a position - //returns -1 if the bank is full, or 0 if the instrument was added - int addtobank(int pos, std::string filename, std::string name); - - void deletefrombank(int pos); - - void clearbank(); - - std::string defaultinsname; - - struct ins_t { - ins_t(); - bool used; - std::string name; - std::string filename; - struct { - bool PADsynth_used; - } info; - } ins[BANK_SIZE]; - - std::string dirname; - - void scanrootdir(std::string rootdir); //scans a root dir for banks -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/CMakeLists.txt deleted file mode 100644 index eab8ca0528e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -include_directories(${MXML_INCLUDE_DIR}) - -set(zynaddsubfx_misc_SRCS - Misc/Bank.cpp - Misc/Config.cpp - Misc/Dump.cpp - Misc/Master.cpp - Misc/Microtonal.cpp - Misc/Part.cpp - Misc/Util.cpp - Misc/XMLwrapper.cpp - Misc/Recorder.cpp - Misc/WavFile.cpp - Misc/WaveShapeSmps.cpp -) - - - -if(LashEnable) - set(zynaddsubfx_misc_SRCS - ${zynaddsubfx_misc_SRCS} - Misc/LASHClient.cpp - PARENT_SCOPE) -else() - set(zynaddsubfx_misc_SRCS - ${zynaddsubfx_misc_SRCS} - PARENT_SCOPE) -endif() diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.cpp deleted file mode 100644 index d38c88bcae0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.cpp - Configuration file functions - Copyright (C) 2003-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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include -#include - - -#include "Config.h" -#include "XMLwrapper.h" - -using namespace std; - -Config::Config() : - workingDir( NULL ) -{} -void Config::init() -{ - maxstringsize = MAX_STRING_SIZE; //for ui - //defaults - cfg.SampleRate = 44100; - cfg.SoundBufferSize = 256; - cfg.OscilSize = 1024; - cfg.SwapStereo = 0; - - cfg.LinuxOSSWaveOutDev = new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSWaveOutDev, MAX_STRING_SIZE, "/dev/dsp"); - cfg.LinuxOSSSeqInDev = new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSSeqInDev, MAX_STRING_SIZE, "/dev/sequencer"); - - cfg.DumpFile = "zynaddsubfx_dump.txt"; - - cfg.WindowsWaveOutId = 0; - cfg.WindowsMidiInId = 0; - - cfg.BankUIAutoClose = 0; - cfg.DumpNotesToFile = 0; - cfg.DumpAppend = 1; - - cfg.GzipCompression = 3; - - cfg.Interpolation = 0; - cfg.CheckPADsynth = 1; - cfg.IgnoreProgramChange = 0; - - cfg.UserInterfaceMode = 0; - cfg.VirKeybLayout = 1; - winwavemax = 1; - winmidimax = 1; - //try to find out how many input midi devices are there - winmididevices = new winmidionedevice[winmidimax]; - for(int i = 0; i < winmidimax; ++i) { - winmididevices[i].name = new char[MAX_STRING_SIZE]; - for(int j = 0; j < MAX_STRING_SIZE; ++j) - winmididevices[i].name[j] = '\0'; - } - - -//get the midi input devices name - cfg.currentBankDir = "./testbnk"; - - char filename[MAX_STRING_SIZE]; - getConfigFileName(filename, MAX_STRING_SIZE); - readConfig(filename); - - if(cfg.bankRootDirList[0].empty()) { - //banks - cfg.bankRootDirList[0] = "~/banks"; - cfg.bankRootDirList[1] = "./"; - cfg.bankRootDirList[2] = "/usr/share/zynaddsubfx/banks"; - cfg.bankRootDirList[3] = "/usr/local/share/zynaddsubfx/banks"; -#ifdef __APPLE__ - cfg.bankRootDirList[4] = "../Resources/banks"; -#else - cfg.bankRootDirList[4] = "../banks"; -#endif - cfg.bankRootDirList[5] = "banks"; - } - - if(cfg.presetsDirList[0].empty()) { - //presets - cfg.presetsDirList[0] = "./"; -#ifdef __APPLE__ - cfg.presetsDirList[1] = "../Resources/presets"; -#else - cfg.presetsDirList[1] = "../presets"; -#endif - cfg.presetsDirList[2] = "presets"; - cfg.presetsDirList[3] = "/usr/share/zynaddsubfx/presets"; - cfg.presetsDirList[4] = "/usr/local/share/zynaddsubfx/presets"; - } - cfg.LinuxALSAaudioDev = "default"; - cfg.nameTag = ""; -} - -Config::~Config() -{ - delete [] cfg.LinuxOSSWaveOutDev; - delete [] cfg.LinuxOSSSeqInDev; - - for(int i = 0; i < winmidimax; ++i) - delete [] winmididevices[i].name; - delete [] winmididevices; -} - - -void Config::save() -{ - char filename[MAX_STRING_SIZE]; - getConfigFileName(filename, MAX_STRING_SIZE); - saveConfig(filename); -} - -void Config::clearbankrootdirlist() -{ - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - cfg.bankRootDirList[i].clear(); -} - -void Config::clearpresetsdirlist() -{ - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - cfg.presetsDirList[i].clear(); -} - -void Config::readConfig(const char *filename) -{ - XMLwrapper xmlcfg; - if(xmlcfg.loadXMLfile(filename) < 0) - return; - if(xmlcfg.enterbranch("CONFIGURATION")) { - cfg.SampleRate = xmlcfg.getpar("sample_rate", - cfg.SampleRate, - 4000, - 1024000); - cfg.SoundBufferSize = xmlcfg.getpar("sound_buffer_size", - cfg.SoundBufferSize, - 16, - 8192); - cfg.OscilSize = xmlcfg.getpar("oscil_size", - cfg.OscilSize, - MAX_AD_HARMONICS * 2, - 131072); - cfg.SwapStereo = xmlcfg.getpar("swap_stereo", - cfg.SwapStereo, - 0, - 1); - cfg.BankUIAutoClose = xmlcfg.getpar("bank_window_auto_close", - cfg.BankUIAutoClose, - 0, - 1); - - cfg.DumpNotesToFile = xmlcfg.getpar("dump_notes_to_file", - cfg.DumpNotesToFile, - 0, - 1); - cfg.DumpAppend = xmlcfg.getpar("dump_append", - cfg.DumpAppend, - 0, - 1); - cfg.DumpFile = xmlcfg.getparstr("dump_file", ""); - - cfg.GzipCompression = xmlcfg.getpar("gzip_compression", - cfg.GzipCompression, - 0, - 9); - - cfg.currentBankDir = xmlcfg.getparstr("bank_current", ""); - cfg.Interpolation = xmlcfg.getpar("interpolation", - cfg.Interpolation, - 0, - 1); - - cfg.CheckPADsynth = xmlcfg.getpar("check_pad_synth", - cfg.CheckPADsynth, - 0, - 1); - - cfg.IgnoreProgramChange = xmlcfg.getpar("ignore_program_change", - cfg.IgnoreProgramChange, - 0, - 1); - - - cfg.UserInterfaceMode = xmlcfg.getpar("user_interface_mode", - cfg.UserInterfaceMode, - 0, - 2); - cfg.VirKeybLayout = xmlcfg.getpar("virtual_keyboard_layout", - cfg.VirKeybLayout, - 0, - 10); - - //get bankroot dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - if(xmlcfg.enterbranch("BANKROOT", i)) { - cfg.bankRootDirList[i] = xmlcfg.getparstr("bank_root", ""); - xmlcfg.exitbranch(); - } - - //get preset root dirs - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - if(xmlcfg.enterbranch("PRESETSROOT", i)) { - cfg.presetsDirList[i] = xmlcfg.getparstr("presets_root", ""); - xmlcfg.exitbranch(); - } - - //linux stuff - xmlcfg.getparstr("linux_oss_wave_out_dev", - cfg.LinuxOSSWaveOutDev, - MAX_STRING_SIZE); - xmlcfg.getparstr("linux_oss_seq_in_dev", - cfg.LinuxOSSSeqInDev, - MAX_STRING_SIZE); - - //windows stuff - cfg.WindowsWaveOutId = xmlcfg.getpar("windows_wave_out_id", - cfg.WindowsWaveOutId, - 0, - winwavemax); - cfg.WindowsMidiInId = xmlcfg.getpar("windows_midi_in_id", - cfg.WindowsMidiInId, - 0, - winmidimax); - - xmlcfg.exitbranch(); - } - - cfg.OscilSize = (int) powf(2, ceil(logf(cfg.OscilSize - 1.0f) / logf(2.0f))); -} - -void Config::saveConfig(const char *filename) -{ - XMLwrapper *xmlcfg = new XMLwrapper(); - - xmlcfg->beginbranch("CONFIGURATION"); - - xmlcfg->addpar("sample_rate", cfg.SampleRate); - xmlcfg->addpar("sound_buffer_size", cfg.SoundBufferSize); - xmlcfg->addpar("oscil_size", cfg.OscilSize); - xmlcfg->addpar("swap_stereo", cfg.SwapStereo); - xmlcfg->addpar("bank_window_auto_close", cfg.BankUIAutoClose); - - xmlcfg->addpar("dump_notes_to_file", cfg.DumpNotesToFile); - xmlcfg->addpar("dump_append", cfg.DumpAppend); - xmlcfg->addparstr("dump_file", cfg.DumpFile); - - xmlcfg->addpar("gzip_compression", cfg.GzipCompression); - - xmlcfg->addpar("check_pad_synth", cfg.CheckPADsynth); - xmlcfg->addpar("ignore_program_change", cfg.IgnoreProgramChange); - - xmlcfg->addparstr("bank_current", cfg.currentBankDir); - - xmlcfg->addpar("user_interface_mode", cfg.UserInterfaceMode); - xmlcfg->addpar("virtual_keyboard_layout", cfg.VirKeybLayout); - - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - if(!cfg.bankRootDirList[i].empty()) { - xmlcfg->beginbranch("BANKROOT", i); - xmlcfg->addparstr("bank_root", cfg.bankRootDirList[i]); - xmlcfg->endbranch(); - } - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) - if(!cfg.presetsDirList[i].empty()) { - xmlcfg->beginbranch("PRESETSROOT", i); - xmlcfg->addparstr("presets_root", cfg.presetsDirList[i]); - xmlcfg->endbranch(); - } - - xmlcfg->addpar("interpolation", cfg.Interpolation); - - //linux stuff - xmlcfg->addparstr("linux_oss_wave_out_dev", cfg.LinuxOSSWaveOutDev); - xmlcfg->addparstr("linux_oss_seq_in_dev", cfg.LinuxOSSSeqInDev); - - //windows stuff - xmlcfg->addpar("windows_wave_out_id", cfg.WindowsWaveOutId); - xmlcfg->addpar("windows_midi_in_id", cfg.WindowsMidiInId); - - xmlcfg->endbranch(); - - int tmp = cfg.GzipCompression; - cfg.GzipCompression = 0; - xmlcfg->saveXMLfile(filename); - cfg.GzipCompression = tmp; - - delete (xmlcfg); -} - -void Config::getConfigFileName(char *name, int namesize) -{ - name[0] = 0; - if( workingDir != NULL ) - { - snprintf(name, namesize, "%s%s", workingDir, ".zynaddsubfxXML.cfg"); - } - else - { - snprintf(name, namesize, "%s%s", getenv("HOME"), "/.zynaddsubfxXML.cfg"); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.h deleted file mode 100644 index 1c875d87a3d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Config.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.h - Configuration file functions - Copyright (C) 2003-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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef CONFIG_H -#define CONFIG_H -#include "../globals.h" -#include -#define MAX_STRING_SIZE 4000 -#define MAX_BANK_ROOT_DIRS 100 - -/**Configuration file functions*/ -class Config -{ - public: - /** Constructor*/ - Config(); - /** Destructor*/ - ~Config(); - struct { - char *LinuxOSSWaveOutDev, *LinuxOSSSeqInDev; - int SampleRate, SoundBufferSize, OscilSize, SwapStereo; - int WindowsWaveOutId, WindowsMidiInId; - int BankUIAutoClose; - int DumpNotesToFile, DumpAppend; - int GzipCompression; - int Interpolation; - std::string DumpFile; - std::string bankRootDirList[MAX_BANK_ROOT_DIRS], currentBankDir; - std::string presetsDirList[MAX_BANK_ROOT_DIRS]; - int CheckPADsynth; - int IgnoreProgramChange; - int UserInterfaceMode; - int VirKeybLayout; - std::string LinuxALSAaudioDev; - std::string nameTag; - } cfg; - int winwavemax, winmidimax; //number of wave/midi devices on Windows - int maxstringsize; - - char * workingDir; - - struct winmidionedevice { - char *name; - }; - winmidionedevice *winmididevices; - - void clearbankrootdirlist(); - void clearpresetsdirlist(); - void init(); - void save(); - - private: - void readConfig(const char *filename); - void saveConfig(const char *filename); - void getConfigFileName(char *name, int namesize); -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Control.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Control.h deleted file mode 100644 index a605a66b4ae..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Control.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Control.h - Defines a variable that can be controled from a frontend - - Copyright (C) 2009 Harald Hvaal - Author: Harald Hvaal - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _CONTROL_H_ -#define _CONTROL_H_ - -#include - -class Control -{ - public: - /** - * The parent is the logical owner of this control. Parent should only - * be null for the root node. - * The id is a string uniquely identifying this control within the - * context of the parent control. No spaces or dots are allowed in this - * id. - * Children id's are denoted by ., so that one - * can refer to any control in the hierarchy by separating them with - * dots. Example: Main.AddSynth.FrequencyLFO.Amplitude - */ - Control(Control *parent, string id); - - /** - * Will recursively get the XML representation for all the subcontrols. - * Used for saving to file and copy-pasting settings - */ - string getXMLRepresentation(); - - /** - * Set the value of this (and possibly subcomponents as well) based on - * a xml description. - */ - void restoreFromXML(string xml); - - /** - * Register a controluser. This will cause this user to be notified - * whenever the contents of the control changes. - */ - void registerControlUser(ControlUser *user); - - /** - * This should return a string representation of the controls internal - * value - */ - virtual string getStringRepresentation() = 0; -}; - -class FloatControl:public Control -{ - public: - /** - * Set the value of this control. If the ControlUser variable is set, - * then this user will not be updated with the new value. This is to - * avoid setting a value being set back to the source that set it - * (which would be redundant, or possibly causing infinite setValue - * loops). - * NOTE: this function is thread-safe (using a mutex internally) - */ - void setValue(float value, ControlUser *user = NULL); - - /** - * Reimplemented from Control - */ - virtual string getStringRepresentation(); - - float value(); -}; - -class ControlUser -{ - public: - /** - * Pure virtual method, to notify the controluser that the value has - * been changed internally, and needs to be read again. - */ - virtual void controlUpdated(Control *control) = 0; -}; - -#endif /* _CONTROL_H_ */ diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.cpp deleted file mode 100644 index e98074b40bb..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.cpp - It dumps the notes to a text file - - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#include "Util.h" -#include "Dump.h" - -Dump dump; - -Dump::Dump() -{ - file = NULL; - tick = 0; - k = 0; - keyspressed = 0; -} - -Dump::~Dump() -{ - if(file != NULL) { - int duration = tick * synth->buffersize_f / synth->samplerate_f; - fprintf( - file, - "\n# statistics: duration = %d seconds; keyspressed = %d\n\n\n\n", - duration, - keyspressed); - fclose(file); - } -} - -void Dump::startnow() -{ - if(file != NULL) - return; //the file is already open - - if(config.cfg.DumpNotesToFile != 0) { - if(config.cfg.DumpAppend != 0) - file = fopen(config.cfg.DumpFile.c_str(), "a"); - else - file = fopen(config.cfg.DumpFile.c_str(), "w"); - if(file == NULL) - return; - if(config.cfg.DumpAppend != 0) - fprintf(file, "%s", "#************************************\n"); - - time_t tm = time(NULL); - - fprintf(file, "#date/time = %s\n", ctime(&tm)); - fprintf(file, "#1 tick = %g milliseconds\n", - synth->buffersize_f * 1000.0f / synth->samplerate_f); - fprintf(file, "SAMPLERATE = %d\n", synth->samplerate); - fprintf(file, "TICKSIZE = %d #samples\n", synth->buffersize); - fprintf(file, "\n\nSTART\n"); - } -} - -void Dump::inctick() -{ - tick++; -} - - -void Dump::dumpnote(char chan, char note, char vel) -{ - if(file == NULL) - return; - if(note == 0) - return; - if(vel == 0) - fprintf(file, "n %d -> %d %d \n", tick, chan, note); //note off - else - fprintf(file, "N %d -> %d %d %d \n", tick, chan, note, vel); //note on - - if(vel != 0) - keyspressed++; -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} - -void Dump::dumpcontroller(char chan, unsigned int type, int par) -{ - if(file == NULL) - return; - switch(type) { - case C_pitchwheel: - fprintf(file, "P %d -> %d %d\n", tick, chan, par); - break; - default: - fprintf(file, "C %d -> %d %d %d\n", tick, chan, type, par); - break; - } -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.h deleted file mode 100644 index dc543cf09eb..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Dump.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.h - It dumps the notes to a text file - - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef DUMP_H -#define DUMP_H - -#include - -/**Object used to dump the notes into a text file - * \todo see if this object should have knowledge about the file - * that it will write to - * \todo upgrade from stdio to iostream*/ -class Dump -{ - public: - /**Constructor*/ - Dump(); - /**Destructor - * Closes the dumpfile*/ - ~Dump(); - /**Open dumpfile and prepare it for dumps - * \todo see if this fits better in the constructor*/ - void startnow(); - /**Tick the timestamp*/ - void inctick(); - /**Dump Note to dumpfile - * @param chan The channel of the note - * @param note The note - * @param vel The velocity of the note*/ - void dumpnote(char chan, char note, char vel); - /** Dump the Controller - * @param chan The channel of the Controller - * @param type The type - * @param par The value of the controller - * \todo figure out what type is exactly meaning*/ - void dumpcontroller(char chan, unsigned int type, int par); - - private: - FILE *file; - int tick; - int k; //This appears to be a constant used to flush the file - //periodically when JACK is used - int keyspressed; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.cpp deleted file mode 100644 index 57979a32918..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LASHClient.cpp - LASH support - Copyright (C) 2006-2009 Lars Luthman - Author: Lars Luthman - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include - -#include "LASHClient.h" - - -LASHClient::LASHClient(int *argc, char ***argv) -{ - client = lash_init(lash_extract_args(argc, argv), "ZynAddSubFX", - LASH_Config_File, LASH_PROTOCOL(2, 0)); -} - - -void LASHClient::setalsaid(int id) -{ - if(lash_enabled(client)) - if(id != -1) - lash_alsa_client_id(client, id); -} - - -void LASHClient::setjackname(const char *name) -{ - if(lash_enabled(client)) - if(name != NULL) { - lash_jack_client_name(client, name); - - lash_event_t *event = lash_event_new_with_type(LASH_Client_Name); - lash_event_set_string(event, name); - lash_send_event(client, event); - } -} - - -LASHClient::Event LASHClient::checkevents(std::string &filename) -{ - if(!lash_enabled(client)) - return NoEvent; - - Event received = NoEvent; - lash_event_t *event; - while((event = lash_get_event(client))) { - // save - if(lash_event_get_type(event) == LASH_Save_File) { - std::cerr << "LASH event: LASH_Save_File" << std::endl; - filename = std::string(lash_event_get_string(event)) - + "/master.xmz"; - received = Save; - break; - } - // restore - else - if(lash_event_get_type(event) == LASH_Restore_File) { - std::cerr << "LASH event: LASH_Restore_File" << std::endl; - filename = std::string(lash_event_get_string(event)) - + "/master.xmz"; - received = Restore; - break; - } - // quit - else - if(lash_event_get_type(event) == LASH_Quit) { - std::cerr << "LASH event: LASH_Quit" << std::endl; - received = Quit; - break; - } - - lash_event_destroy(event); - } - return received; -} - - -void LASHClient::confirmevent(Event event) -{ - if(event == Save) - lash_send_event(client, lash_event_new_with_type(LASH_Save_File)); - else - if(event == Restore) - lash_send_event(client, lash_event_new_with_type(LASH_Restore_File)); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.h deleted file mode 100644 index 1f3a4946747..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/LASHClient.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LASHClient.h - LASH support - Copyright (C) 2006-2009 Lars Luthman - Author: Lars Luthman - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef LASHClient_h -#define LASHClient_h - -#include -#include -#include - - -/** This class wraps up some functions for initialising and polling - * the LASH daemon.*/ -class LASHClient -{ - public: - /**Enum to represent the LASH events that are currently handled*/ - enum Event { - Save, - Restore, - Quit, - NoEvent - }; - - /** Constructor - * @param argc number of arguments - * @param argv the text arguments*/ - LASHClient(int *argc, char ***argv); - - /**set the ALSA id - * @param id new ALSA id*/ - void setalsaid(int id); - /**Set the JACK name - * @param name the new name*/ - void setjackname(const char *name); - Event checkevents(std::string &filename); - void confirmevent(Event event); - - private: - - lash_client_t *client; -}; - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.cpp deleted file mode 100644 index c4b8947b8fa..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.cpp +++ /dev/null @@ -1,808 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.cpp - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Master.h" - -#include "Part.h" - -#include "../Params/LFOParams.h" -#include "../Effects/EffectMgr.h" -#include "../DSP/FFTwrapper.h" - -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; - -vuData::vuData(void) - :outpeakl(0.0f), outpeakr(0.0f), maxoutpeakl(0.0f), maxoutpeakr(0.0f), - rmspeakl(0.0f), rmspeakr(0.0f), clipped(0) -{} - -static Master* masterInstance = NULL; - -Master::Master() -{ - swaplr = 0; - off = 0; - smps = 0; - bufl = new float[synth->buffersize]; - bufr = new float[synth->buffersize]; - - pthread_mutex_init(&mutex, NULL); - pthread_mutex_init(&vumutex, NULL); - fft = new FFTwrapper(synth->oscilsize); - - shutup = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - vuoutpeakpart[npart] = 1e-9; - fakepeakpart[npart] = 0; - } - - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - part[npart] = new Part(µtonal, fft, &mutex); - - //Insertion Effects init - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - insefx[nefx] = new EffectMgr(1, &mutex); - - //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) - sysefx[nefx] = new EffectMgr(0, &mutex); - - - defaults(); -} - -void Master::defaults() -{ - volume = 1.0f; - setPvolume(80); - setPkeyshift(64); - - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - part[npart]->defaults(); - part[npart]->Prcvchn = npart % NUM_MIDI_CHANNELS; - } - - partonoff(0, 1); //enable the first part - - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - insefx[nefx]->defaults(); - Pinsparts[nefx] = -1; - } - - //System Effects init - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - sysefx[nefx]->defaults(); - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - setPsysefxvol(npart, nefx, 0); - - for(int nefxto = 0; nefxto < NUM_SYS_EFX; ++nefxto) - setPsysefxsend(nefx, nefxto, 0); - } - - microtonal.defaults(); - ShutUp(); -} - -bool Master::mutexLock(lockset request) -{ - switch(request) { - case MUTEX_TRYLOCK: - return !pthread_mutex_trylock(&mutex); - case MUTEX_LOCK: - return !pthread_mutex_lock(&mutex); - case MUTEX_UNLOCK: - return !pthread_mutex_unlock(&mutex); - } - return false; -} - -Master &Master::getInstance() -{ - if (!masterInstance) - masterInstance = new Master; - - return *masterInstance; -} - -void Master::deleteInstance() -{ - if (masterInstance) - { - delete masterInstance; - masterInstance = NULL; - } -} - -/* - * Note On Messages (velocity=0 for NoteOff) - */ -void Master::noteOn(char chan, char note, char velocity) -{ - if(velocity) { - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - if(chan == part[npart]->Prcvchn) { - fakepeakpart[npart] = velocity * 2; - if(part[npart]->Penabled) - part[npart]->NoteOn(note, velocity, keyshift); - } - } - else - this->noteOff(chan, note); - HDDRecorder.triggernow(); -} - -/* - * Note Off Messages - */ -void Master::noteOff(char chan, char note) -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - if((chan == part[npart]->Prcvchn) && part[npart]->Penabled) - part[npart]->NoteOff(note); -} - -/* - * Pressure Messages (velocity=0 for NoteOff) - */ -void Master::polyphonicAftertouch(char chan, char note, char velocity) -{ - if(velocity) { - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - if(chan == part[npart]->Prcvchn) - if(part[npart]->Penabled) - part[npart]->PolyphonicAftertouch(note, velocity, keyshift); - - } - else - this->noteOff(chan, note); -} - -/* - * Controllers - */ -void Master::setController(char chan, int type, int par) -{ - if((type == C_dataentryhi) || (type == C_dataentrylo) - || (type == C_nrpnhi) || (type == C_nrpnlo)) { //Process RPN and NRPN by the Master (ignore the chan) - ctl.setparameternumber(type, par); - - int parhi = -1, parlo = -1, valhi = -1, vallo = -1; - if(ctl.getnrpn(&parhi, &parlo, &valhi, &vallo) == 0) //this is NRPN - //fprintf(stderr,"rcv. NRPN: %d %d %d %d\n",parhi,parlo,valhi,vallo); - switch(parhi) { - case 0x04: //System Effects - if(parlo < NUM_SYS_EFX) - sysefx[parlo]->seteffectpar_nolock(valhi, vallo); - ; - break; - case 0x08: //Insertion Effects - if(parlo < NUM_INS_EFX) - insefx[parlo]->seteffectpar_nolock(valhi, vallo); - ; - break; - } - ; - } - else - if(type == C_bankselectmsb) { // Change current bank - if(((unsigned int)par < bank.banks.size()) - && (bank.banks[par].dir != bank.bankfiletitle)) - bank.loadbank(bank.banks[par].dir); - } - else { //other controllers - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) //Send the controller to all part assigned to the channel - if((chan == part[npart]->Prcvchn) && (part[npart]->Penabled != 0)) - part[npart]->SetController(type, par); - ; - - if(type == C_allsoundsoff) { //cleanup insertion/system FX - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) - sysefx[nefx]->cleanup(); - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - insefx[nefx]->cleanup(); - } - } -} - -void Master::setProgram(char chan, unsigned int pgm) -{ - if(config.cfg.IgnoreProgramChange) - return; - - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - if(chan == part[npart]->Prcvchn) { - bank.loadfromslot(pgm, part[npart]); - - //Hack to get pad note parameters to update - //this is not real time safe and makes assumptions about the calling - //convention of this function... - pthread_mutex_unlock(&mutex); - part[npart]->applyparameters(); - pthread_mutex_lock(&mutex); - } -} - -void Master::vuUpdate(const float *outl, const float *outr) -{ - //Peak computation (for vumeters) - vu.outpeakl = 1e-12; - vu.outpeakr = 1e-12; - for(int i = 0; i < synth->buffersize; ++i) { - if(fabs(outl[i]) > vu.outpeakl) - vu.outpeakl = fabs(outl[i]); - if(fabs(outr[i]) > vu.outpeakr) - vu.outpeakr = fabs(outr[i]); - } - if((vu.outpeakl > 1.0f) || (vu.outpeakr > 1.0f)) - vu.clipped = 1; - if(vu.maxoutpeakl < vu.outpeakl) - vu.maxoutpeakl = vu.outpeakl; - if(vu.maxoutpeakr < vu.outpeakr) - vu.maxoutpeakr = vu.outpeakr; - - //RMS Peak computation (for vumeters) - vu.rmspeakl = 1e-12; - vu.rmspeakr = 1e-12; - for(int i = 0; i < synth->buffersize; ++i) { - vu.rmspeakl += outl[i] * outl[i]; - vu.rmspeakr += outr[i] * outr[i]; - } - vu.rmspeakl = sqrt(vu.rmspeakl / synth->buffersize_f); - vu.rmspeakr = sqrt(vu.rmspeakr / synth->buffersize_f); - - //Part Peak computation (for Part vumeters or fake part vumeters) - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - vuoutpeakpart[npart] = 1.0e-12f; - if(part[npart]->Penabled != 0) { - float *outl = part[npart]->partoutl, - *outr = part[npart]->partoutr; - for(int i = 0; i < synth->buffersize; ++i) { - float tmp = fabs(outl[i] + outr[i]); - if(tmp > vuoutpeakpart[npart]) - vuoutpeakpart[npart] = tmp; - } - vuoutpeakpart[npart] *= volume; - } - else - if(fakepeakpart[npart] > 1) - fakepeakpart[npart]--; - } -} - -/* - * Enable/Disable a part - */ -void Master::partonoff(int npart, int what) -{ - if(npart >= NUM_MIDI_PARTS) - return; - if(what == 0) { //disable part - fakepeakpart[npart] = 0; - part[npart]->Penabled = 0; - part[npart]->cleanup(); - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - if(Pinsparts[nefx] == npart) - insefx[nefx]->cleanup(); - ; - } - } - else { //enabled - part[npart]->Penabled = 1; - fakepeakpart[npart] = 0; - } -} - -/* - * Master audio out (the final sound) - */ -void Master::AudioOut(float *outl, float *outr) -{ - //Swaps the Left channel with Right Channel - if(swaplr) - swap(outl, outr); - - //clean up the output samples (should not be needed?) - memset(outl, 0, synth->bufferbytes); - memset(outr, 0, synth->bufferbytes); - - //Compute part samples and store them part[npart]->partoutl,partoutr - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - if(part[npart]->Penabled != 0 && !pthread_mutex_trylock(&part[npart]->load_mutex)) { - part[npart]->ComputePartSmps(); - pthread_mutex_unlock(&part[npart]->load_mutex); - } - } - - //Insertion effects - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - if(Pinsparts[nefx] >= 0) { - int efxpart = Pinsparts[nefx]; - if(part[efxpart]->Penabled) - insefx[nefx]->out(part[efxpart]->partoutl, - part[efxpart]->partoutr); - } - - - //Apply the part volumes and pannings (after insertion effects) - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - if(part[npart]->Penabled == 0) - continue; - - Stereo newvol(part[npart]->volume), - oldvol(part[npart]->oldvolumel, - part[npart]->oldvolumer); - - float pan = part[npart]->panning; - if(pan < 0.5f) - newvol.l *= pan * 2.0f; - else - newvol.r *= (1.0f - pan) * 2.0f; - - //the volume or the panning has changed and needs interpolation - if(ABOVE_AMPLITUDE_THRESHOLD(oldvol.l, newvol.l) - || ABOVE_AMPLITUDE_THRESHOLD(oldvol.r, newvol.r)) { - for(int i = 0; i < synth->buffersize; ++i) { - Stereo vol(INTERPOLATE_AMPLITUDE(oldvol.l, newvol.l, - i, synth->buffersize), - INTERPOLATE_AMPLITUDE(oldvol.r, newvol.r, - i, synth->buffersize)); - part[npart]->partoutl[i] *= vol.l; - part[npart]->partoutr[i] *= vol.r; - } - part[npart]->oldvolumel = newvol.l; - part[npart]->oldvolumer = newvol.r; - } - else - for(int i = 0; i < synth->buffersize; ++i) { //the volume did not changed - part[npart]->partoutl[i] *= newvol.l; - part[npart]->partoutr[i] *= newvol.r; - } - } - - - //System effects - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - if(sysefx[nefx]->geteffect() == 0) - continue; //the effect is disabled - - float tmpmixl[synth->buffersize]; - float tmpmixr[synth->buffersize]; - //Clean up the samples used by the system effects - memset(tmpmixl, 0, synth->bufferbytes); - memset(tmpmixr, 0, synth->bufferbytes); - - //Mix the channels according to the part settings about System Effect - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - //skip if the part has no output to effect - if(Psysefxvol[nefx][npart] == 0) - continue; - - //skip if the part is disabled - if(part[npart]->Penabled == 0) - continue; - - //the output volume of each part to system effect - const float vol = sysefxvol[nefx][npart]; - for(int i = 0; i < synth->buffersize; ++i) { - tmpmixl[i] += part[npart]->partoutl[i] * vol; - tmpmixr[i] += part[npart]->partoutr[i] * vol; - } - } - - // system effect send to next ones - for(int nefxfrom = 0; nefxfrom < nefx; ++nefxfrom) - if(Psysefxsend[nefxfrom][nefx] != 0) { - const float vol = sysefxsend[nefxfrom][nefx]; - for(int i = 0; i < synth->buffersize; ++i) { - tmpmixl[i] += sysefx[nefxfrom]->efxoutl[i] * vol; - tmpmixr[i] += sysefx[nefxfrom]->efxoutr[i] * vol; - } - } - - sysefx[nefx]->out(tmpmixl, tmpmixr); - - //Add the System Effect to sound output - const float outvol = sysefx[nefx]->sysefxgetvolume(); - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] += tmpmixl[i] * outvol; - outr[i] += tmpmixr[i] * outvol; - } - } - - //Mix all parts - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - if(part[npart]->Penabled) //only mix active parts - for(int i = 0; i < synth->buffersize; ++i) { //the volume did not changed - outl[i] += part[npart]->partoutl[i]; - outr[i] += part[npart]->partoutr[i]; - } - - //Insertion effects for Master Out - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - if(Pinsparts[nefx] == -2) - insefx[nefx]->out(outl, outr); - - - //Master Volume - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] *= volume; - outr[i] *= volume; - } - - if(!pthread_mutex_trylock(&vumutex)) { - vuUpdate(outl, outr); - pthread_mutex_unlock(&vumutex); - } - - //Shutup if it is asked (with fade-out) - if(shutup) { - for(int i = 0; i < synth->buffersize; ++i) { - float tmp = (synth->buffersize_f - i) / synth->buffersize_f; - outl[i] *= tmp; - outr[i] *= tmp; - } - ShutUp(); - } - - //update the LFO's time - LFOParams::time++; - - dump.inctick(); -} - -//TODO review the respective code from yoshimi for this -//If memory serves correctly, libsamplerate was used -void Master::GetAudioOutSamples(size_t nsamples, - unsigned samplerate, - float *outl, - float *outr) -{ - off_t out_off = 0; - - //Fail when resampling rather than doing a poor job - if(synth->samplerate != samplerate) { - printf("darn it: %d vs %d\n", synth->samplerate, samplerate); - return; - } - - while(nsamples) { - //use all available samples - if(nsamples >= smps) { - memcpy(outl + out_off, bufl + off, sizeof(float) * smps); - memcpy(outr + out_off, bufr + off, sizeof(float) * smps); - nsamples -= smps; - - //generate samples - AudioOut(bufl, bufr); - off = 0; - out_off += smps; - smps = synth->buffersize; - } - else { //use some samples - memcpy(outl + out_off, bufl + off, sizeof(float) * nsamples); - memcpy(outr + out_off, bufr + off, sizeof(float) * nsamples); - smps -= nsamples; - off += nsamples; - nsamples = 0; - } - } -} - -Master::~Master() -{ - delete []bufl; - delete []bufr; - - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - delete part[npart]; - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - delete insefx[nefx]; - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) - delete sysefx[nefx]; - - delete fft; - - pthread_mutex_destroy(&mutex); - pthread_mutex_destroy(&vumutex); -} - - -/* - * Parameter control - */ -void Master::setPvolume(char Pvolume_) -{ - Pvolume = Pvolume_; - volume = dB2rap((Pvolume - 96.0f) / 96.0f * 40.0f); -} - -void Master::setPkeyshift(char Pkeyshift_) -{ - Pkeyshift = Pkeyshift_; - keyshift = (int)Pkeyshift - 64; -} - - -void Master::setPsysefxvol(int Ppart, int Pefx, char Pvol) -{ - Psysefxvol[Pefx][Ppart] = Pvol; - sysefxvol[Pefx][Ppart] = powf(0.1f, (1.0f - Pvol / 96.0f) * 2.0f); -} - -void Master::setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol) -{ - Psysefxsend[Pefxfrom][Pefxto] = Pvol; - sysefxsend[Pefxfrom][Pefxto] = powf(0.1f, (1.0f - Pvol / 96.0f) * 2.0f); -} - - -/* - * Panic! (Clean up all parts and effects) - */ -void Master::ShutUp() -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - part[npart]->cleanup(); - fakepeakpart[npart] = 0; - } - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) - insefx[nefx]->cleanup(); - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) - sysefx[nefx]->cleanup(); - vuresetpeaks(); - shutup = 0; -} - - -/* - * Reset peaks and clear the "cliped" flag (for VU-meter) - */ -void Master::vuresetpeaks() -{ - pthread_mutex_lock(&vumutex); - vu.outpeakl = 1e-9; - vu.outpeakr = 1e-9; - vu.maxoutpeakl = 1e-9; - vu.maxoutpeakr = 1e-9; - vu.clipped = 0; - pthread_mutex_unlock(&vumutex); -} - -vuData Master::getVuData() -{ - vuData tmp; - pthread_mutex_lock(&vumutex); - tmp = vu; - pthread_mutex_unlock(&vumutex); - return tmp; -} - -void Master::applyparameters(bool lockmutex) -{ - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) - part[npart]->applyparameters(lockmutex); -} - -void Master::add2XML(XMLwrapper *xml) -{ - xml->addpar("volume", Pvolume); - xml->addpar("key_shift", Pkeyshift); - xml->addparbool("nrpn_receive", ctl.NRPN.receive); - - xml->beginbranch("MICROTONAL"); - microtonal.add2XML(xml); - xml->endbranch(); - - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - xml->beginbranch("PART", npart); - part[npart]->add2XML(xml); - xml->endbranch(); - } - - xml->beginbranch("SYSTEM_EFFECTS"); - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - xml->beginbranch("SYSTEM_EFFECT", nefx); - xml->beginbranch("EFFECT"); - sysefx[nefx]->add2XML(xml); - xml->endbranch(); - - for(int pefx = 0; pefx < NUM_MIDI_PARTS; ++pefx) { - xml->beginbranch("VOLUME", pefx); - xml->addpar("vol", Psysefxvol[nefx][pefx]); - xml->endbranch(); - } - - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { - xml->beginbranch("SENDTO", tonefx); - xml->addpar("send_vol", Psysefxsend[nefx][tonefx]); - xml->endbranch(); - } - - - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("INSERTION_EFFECTS"); - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - xml->beginbranch("INSERTION_EFFECT", nefx); - xml->addpar("part", Pinsparts[nefx]); - - xml->beginbranch("EFFECT"); - insefx[nefx]->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - } - - xml->endbranch(); -} - - -int Master::getalldata(char **data) -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MASTER"); - - pthread_mutex_lock(&mutex); - add2XML(xml); - pthread_mutex_unlock(&mutex); - - xml->endbranch(); - - *data = xml->getXMLdata(); - delete (xml); - return strlen(*data) + 1; -} - -void Master::putalldata(char *data, int /*size*/) -{ - XMLwrapper *xml = new XMLwrapper(); - if(!xml->putXMLdata(data)) { - delete (xml); - return; - } - - if(xml->enterbranch("MASTER") == 0) - return; - - pthread_mutex_lock(&mutex); - getfromXML(xml); - pthread_mutex_unlock(&mutex); - - xml->exitbranch(); - - delete (xml); -} - -int Master::saveXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MASTER"); - add2XML(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - - - -int Master::loadXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("MASTER") == 0) - return -10; - getfromXML(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} - -void Master::getfromXML(XMLwrapper *xml) -{ - setPvolume(xml->getpar127("volume", Pvolume)); - setPkeyshift(xml->getpar127("key_shift", Pkeyshift)); - ctl.NRPN.receive = xml->getparbool("nrpn_receive", ctl.NRPN.receive); - - - part[0]->Penabled = 0; - for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - if(xml->enterbranch("PART", npart) == 0) - continue; - part[npart]->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("MICROTONAL")) { - microtonal.getfromXML(xml); - xml->exitbranch(); - } - - sysefx[0]->changeeffect(0); - if(xml->enterbranch("SYSTEM_EFFECTS")) { - for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - if(xml->enterbranch("SYSTEM_EFFECT", nefx) == 0) - continue; - if(xml->enterbranch("EFFECT")) { - sysefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - - for(int partefx = 0; partefx < NUM_MIDI_PARTS; ++partefx) { - if(xml->enterbranch("VOLUME", partefx) == 0) - continue; - setPsysefxvol(partefx, nefx, - xml->getpar127("vol", Psysefxvol[partefx][nefx])); - xml->exitbranch(); - } - - for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { - if(xml->enterbranch("SENDTO", tonefx) == 0) - continue; - setPsysefxsend(nefx, tonefx, - xml->getpar127("send_vol", - Psysefxsend[nefx][tonefx])); - xml->exitbranch(); - } - xml->exitbranch(); - } - xml->exitbranch(); - } - - - if(xml->enterbranch("INSERTION_EFFECTS")) { - for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - if(xml->enterbranch("INSERTION_EFFECT", nefx) == 0) - continue; - Pinsparts[nefx] = xml->getpar("part", - Pinsparts[nefx], - -2, - NUM_MIDI_PARTS); - if(xml->enterbranch("EFFECT")) { - insefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.h deleted file mode 100644 index 2238d759320..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Master.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.h - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MASTER_H -#define MASTER_H -#include - -#include "../globals.h" -#include "Microtonal.h" - -#include "Bank.h" -#include "Recorder.h" -#include "Dump.h" -#include "XMLwrapper.h" - -#include "../Params/Controller.h" - -typedef enum { - MUTEX_TRYLOCK, MUTEX_LOCK, MUTEX_UNLOCK -} lockset; - -extern Dump dump; - -struct vuData { - vuData(void); - float outpeakl, outpeakr, maxoutpeakl, maxoutpeakr, - rmspeakl, rmspeakr; - int clipped; -}; - - -/** It sends Midi Messages to Parts, receives samples from parts, - * process them with system/insertion effects and mix them */ -class Master -{ - public: - /** Constructor TODO make private*/ - Master(); - /** Destructor*/ - ~Master(); - - static Master &getInstance(); - static void deleteInstance(); - - /**Saves all settings to a XML file - * @return 0 for ok or <0 if there is an error*/ - int saveXML(const char *filename); - - /**This adds the parameters to the XML data*/ - void add2XML(XMLwrapper *xml); - - void defaults(); - - - /**loads all settings from a XML file - * @return 0 for ok or -1 if there is an error*/ - int loadXML(const char *filename); - void applyparameters(bool lockmutex = true); - - void getfromXML(XMLwrapper *xml); - - /**get all data to a newly allocated array (used for VST) - * @return the datasize*/ - int getalldata(char **data); - /**put all data from the *data array to zynaddsubfx parameters (used for VST)*/ - void putalldata(char *data, int size); - - //Mutex control - /**Control the Master's mutex state. - * @param lockset either trylock, lock, or unlock. - * @return true when successful false otherwise.*/ - bool mutexLock(lockset request); - - //Midi IN - void noteOn(char chan, char note, char velocity); - void noteOff(char chan, char note); - void polyphonicAftertouch(char chan, char note, char velocity); - void setController(char chan, int type, int par); - void setProgram(char chan, unsigned int pgm); - //void NRPN... - - - void ShutUp(); - int shutup; - - void vuUpdate(const float *outl, const float *outr); - - /**Audio Output*/ - void AudioOut(float *outl, float *outr); - /**Audio Output (for callback mode). This allows the program to be controled by an external program*/ - void GetAudioOutSamples(size_t nsamples, - unsigned samplerate, - float *outl, - float *outr); - - - void partonoff(int npart, int what); - - /**parts \todo see if this can be made to be dynamic*/ - class Part * part[NUM_MIDI_PARTS]; - - //parameters - - unsigned char Pvolume; - unsigned char Pkeyshift; - unsigned char Psysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - unsigned char Psysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - - //parameters control - void setPvolume(char Pvolume_); - void setPkeyshift(char Pkeyshift_); - void setPsysefxvol(int Ppart, int Pefx, char Pvol); - void setPsysefxsend(int Pefxfrom, int Pefxto, char Pvol); - - //effects - class EffectMgr * sysefx[NUM_SYS_EFX]; //system - class EffectMgr * insefx[NUM_INS_EFX]; //insertion -// void swapcopyeffects(int what,int type,int neff1,int neff2); - - //HDD recorder - Recorder HDDRecorder; - - //part that's apply the insertion effect; -1 to disable - short int Pinsparts[NUM_INS_EFX]; - - - //peaks for VU-meter - void vuresetpeaks(); - //get VU-meter data - vuData getVuData(); - - //peaks for part VU-meters - /**\todo synchronize this with a mutex*/ - float vuoutpeakpart[NUM_MIDI_PARTS]; - unsigned char fakepeakpart[NUM_MIDI_PARTS]; //this is used to compute the "peak" when the part is disabled - - Controller ctl; - bool swaplr; //if L and R are swapped - - //other objects - Microtonal microtonal; - Bank bank; - - class FFTwrapper * fft; - pthread_mutex_t mutex; - pthread_mutex_t vumutex; - - - private: - vuData vu; - float volume; - float sysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - float sysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - int keyshift; - - //information relevent to generating plugin audio samples - float *bufl; - float *bufr; - off_t off; - size_t smps; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.cpp deleted file mode 100644 index fc0e015e178..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.cpp +++ /dev/null @@ -1,694 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.cpp - Tuning settings and microtonal capabilities - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "Microtonal.h" - -#define MAX_LINE_SIZE 80 - -Microtonal::Microtonal() -{ - Pname = new unsigned char[MICROTONAL_MAX_NAME_LEN]; - Pcomment = new unsigned char[MICROTONAL_MAX_NAME_LEN]; - defaults(); -} - -void Microtonal::defaults() -{ - Pinvertupdown = 0; - Pinvertupdowncenter = 60; - octavesize = 12; - Penabled = 0; - PAnote = 69; - PAfreq = 440.0f; - Pscaleshift = 64; - - Pfirstkey = 0; - Plastkey = 127; - Pmiddlenote = 60; - Pmapsize = 12; - Pmappingenabled = 0; - - for(int i = 0; i < 128; ++i) - Pmapping[i] = i; - - for(int i = 0; i < MAX_OCTAVE_SIZE; ++i) { - octave[i].tuning = tmpoctave[i].tuning = powf( - 2, - (i % octavesize - + 1) / 12.0f); - octave[i].type = tmpoctave[i].type = 1; - octave[i].x1 = tmpoctave[i].x1 = (i % octavesize + 1) * 100; - octave[i].x2 = tmpoctave[i].x2 = 0; - } - octave[11].type = 2; - octave[11].x1 = 2; - octave[11].x2 = 1; - for(int i = 0; i < MICROTONAL_MAX_NAME_LEN; ++i) { - Pname[i] = '\0'; - Pcomment[i] = '\0'; - } - snprintf((char *) Pname, MICROTONAL_MAX_NAME_LEN, "12tET"); - snprintf((char *) Pcomment, - MICROTONAL_MAX_NAME_LEN, - "Equal Temperament 12 notes per octave"); - Pglobalfinedetune = 64; -} - -Microtonal::~Microtonal() -{ - delete [] Pname; - delete [] Pcomment; -} - -/* - * Get the size of the octave - */ -unsigned char Microtonal::getoctavesize() const -{ - if(Penabled != 0) - return octavesize; - else - return 12; -} - -/* - * Get the frequency according the note number - */ -float Microtonal::getnotefreq(int note, int keyshift) const -{ - // in this function will appears many times things like this: - // var=(a+b*100)%b - // I had written this way because if I use var=a%b gives unwanted results when a<0 - // This is the same with divisions. - - if((Pinvertupdown != 0) && ((Pmappingenabled == 0) || (Penabled == 0))) - note = (int) Pinvertupdowncenter * 2 - note; - - //compute global fine detune - float globalfinedetunerap = powf(2.0f, - (Pglobalfinedetune - 64.0f) / 1200.0f); //-64.0f .. 63.0f cents - - if(Penabled == 0) - return powf(2.0f, - (note - PAnote - + keyshift) / 12.0f) * PAfreq * globalfinedetunerap; //12tET - - int scaleshift = - ((int)Pscaleshift - 64 + (int) octavesize * 100) % octavesize; - - //compute the keyshift - float rap_keyshift = 1.0f; - if(keyshift != 0) { - int kskey = (keyshift + (int)octavesize * 100) % octavesize; - int ksoct = (keyshift + (int)octavesize * 100) / octavesize - 100; - rap_keyshift = (kskey == 0) ? (1.0f) : (octave[kskey - 1].tuning); - rap_keyshift *= powf(octave[octavesize - 1].tuning, ksoct); - } - - //if the mapping is enabled - if(Pmappingenabled != 0) { - if((note < Pfirstkey) || (note > Plastkey)) - return -1.0f; - //Compute how many mapped keys are from middle note to reference note - //and find out the proportion between the freq. of middle note and "A" note - int tmp = PAnote - Pmiddlenote, minus = 0; - if(tmp < 0) { - tmp = -tmp; - minus = 1; - } - int deltanote = 0; - for(int i = 0; i < tmp; ++i) - if(Pmapping[i % Pmapsize] >= 0) - deltanote++; - float rap_anote_middlenote = - (deltanote == - 0) ? (1.0f) : (octave[(deltanote - 1) % octavesize].tuning); - if(deltanote != 0) - rap_anote_middlenote *= - powf(octave[octavesize - 1].tuning, - (deltanote - 1) / octavesize); - if(minus != 0) - rap_anote_middlenote = 1.0f / rap_anote_middlenote; - - //Convert from note (midi) to degree (note from the tunning) - int degoct = - (note - (int)Pmiddlenote + (int) Pmapsize - * 200) / (int)Pmapsize - 200; - int degkey = (note - Pmiddlenote + (int)Pmapsize * 100) % Pmapsize; - degkey = Pmapping[degkey]; - if(degkey < 0) - return -1.0f; //this key is not mapped - - //invert the keyboard upside-down if it is asked for - //TODO: do the right way by using Pinvertupdowncenter - if(Pinvertupdown != 0) { - degkey = octavesize - degkey - 1; - degoct = -degoct; - } - //compute the frequency of the note - degkey = degkey + scaleshift; - degoct += degkey / octavesize; - degkey %= octavesize; - - float freq = (degkey == 0) ? (1.0f) : octave[degkey - 1].tuning; - freq *= powf(octave[octavesize - 1].tuning, degoct); - freq *= PAfreq / rap_anote_middlenote; - freq *= globalfinedetunerap; - if(scaleshift != 0) - freq /= octave[scaleshift - 1].tuning; - return freq * rap_keyshift; - } - else { //if the mapping is disabled - int nt = note - PAnote + scaleshift; - int ntkey = (nt + (int)octavesize * 100) % octavesize; - int ntoct = (nt - ntkey) / octavesize; - - float oct = octave[octavesize - 1].tuning; - float freq = - octave[(ntkey + octavesize - 1) % octavesize].tuning * powf(oct, - ntoct) - * PAfreq; - if(ntkey == 0) - freq /= oct; - if(scaleshift != 0) - freq /= octave[scaleshift - 1].tuning; -// fprintf(stderr,"note=%d freq=%.3f cents=%d\n",note,freq,(int)floor(logf(freq/PAfreq)/logf(2.0f)*1200.0f+0.5f)); - freq *= globalfinedetunerap; - return freq * rap_keyshift; - } -} - -bool Microtonal::operator==(const Microtonal µ) const -{ - return !(*this != micro); -} - -bool Microtonal::operator!=(const Microtonal µ) const -{ - //A simple macro to test equality MiCRotonal EQuals (not the perfect - //approach, but good enough) -#define MCREQ(x) if(x != micro.x) \ - return true - - //for floats -#define FMCREQ(x) if(!((x < micro.x + 0.0001f) && (x > micro.x - 0.0001f))) \ - return true - - MCREQ(Pinvertupdown); - MCREQ(Pinvertupdowncenter); - MCREQ(octavesize); - MCREQ(Penabled); - MCREQ(PAnote); - FMCREQ(PAfreq); - MCREQ(Pscaleshift); - - MCREQ(Pfirstkey); - MCREQ(Plastkey); - MCREQ(Pmiddlenote); - MCREQ(Pmapsize); - MCREQ(Pmappingenabled); - - for(int i = 0; i < 128; ++i) - MCREQ(Pmapping[i]); - - for(int i = 0; i < octavesize; ++i) { - FMCREQ(octave[i].tuning); - MCREQ(octave[i].type); - MCREQ(octave[i].x1); - MCREQ(octave[i].x2); - } - if(strcmp((const char *)this->Pname, (const char *)micro.Pname)) - return true; - if(strcmp((const char *)this->Pcomment, (const char *)micro.Pcomment)) - return true; - MCREQ(Pglobalfinedetune); - return false; - - //undefine macros, as they are no longer needed -#undef MCREQ -#undef FMCREQ -} - - -/* - * Convert a line to tunings; returns -1 if it ok - */ -int Microtonal::linetotunings(unsigned int nline, const char *line) -{ - int x1 = -1, x2 = -1, type = -1; - float x = -1.0f, tmp, tuning = 1.0f; - if(strstr(line, "/") == NULL) { - if(strstr(line, ".") == NULL) { // M case (M=M/1) - sscanf(line, "%d", &x1); - x2 = 1; - type = 2; //division - } - else { // float number case - sscanf(line, "%f", &x); - if(x < 0.000001f) - return 1; - type = 1; //float type(cents) - } - } - else { // M/N case - sscanf(line, "%d/%d", &x1, &x2); - if((x1 < 0) || (x2 < 0)) - return 1; - if(x2 == 0) - x2 = 1; - type = 2; //division - } - - if(x1 <= 0) - x1 = 1; //not allow zero frequency sounds (consider 0 as 1) - - //convert to float if the number are too big - if((type == 2) - && ((x1 > (128 * 128 * 128 - 1)) || (x2 > (128 * 128 * 128 - 1)))) { - type = 1; - x = ((float) x1) / x2; - } - switch(type) { - case 1: - x1 = (int) floor(x); - tmp = fmod(x, 1.0f); - x2 = (int) (floor(tmp * 1e6)); - tuning = powf(2.0f, x / 1200.0f); - break; - case 2: - x = ((float)x1) / x2; - tuning = x; - break; - } - - tmpoctave[nline].tuning = tuning; - tmpoctave[nline].type = type; - tmpoctave[nline].x1 = x1; - tmpoctave[nline].x2 = x2; - - return -1; //ok -} - -/* - * Convert the text to tunnings - */ -int Microtonal::texttotunings(const char *text) -{ - unsigned int i, k = 0, nl = 0; - char *lin; - lin = new char[MAX_LINE_SIZE + 1]; - while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; ++i) { - lin[i] = text[k++]; - if(lin[i] < 0x20) - break; - } - lin[i] = '\0'; - if(strlen(lin) == 0) - continue; - int err = linetotunings(nl, lin); - if(err != -1) { - delete [] lin; - return nl; //Parse error - } - nl++; - } - delete [] lin; - if(nl > MAX_OCTAVE_SIZE) - nl = MAX_OCTAVE_SIZE; - if(nl == 0) - return -2; //the input is empty - octavesize = nl; - for(i = 0; i < octavesize; ++i) { - octave[i].tuning = tmpoctave[i].tuning; - octave[i].type = tmpoctave[i].type; - octave[i].x1 = tmpoctave[i].x1; - octave[i].x2 = tmpoctave[i].x2; - } - return -1; //ok -} - -/* - * Convert the text to mapping - */ -void Microtonal::texttomapping(const char *text) -{ - unsigned int i, k = 0; - char *lin; - lin = new char[MAX_LINE_SIZE + 1]; - for(i = 0; i < 128; ++i) - Pmapping[i] = -1; - int tx = 0; - while(k < strlen(text)) { - for(i = 0; i < MAX_LINE_SIZE; ++i) { - lin[i] = text[k++]; - if(lin[i] < 0x20) - break; - } - lin[i] = '\0'; - if(strlen(lin) == 0) - continue; - - int tmp = 0; - if(sscanf(lin, "%d", &tmp) == 0) - tmp = -1; - if(tmp < -1) - tmp = -1; - Pmapping[tx] = tmp; - - if((tx++) > 127) - break; - } - delete [] lin; - - if(tx == 0) - tx = 1; - Pmapsize = tx; -} - -/* - * Convert tunning to text line - */ -void Microtonal::tuningtoline(int n, char *line, int maxn) -{ - if((n > octavesize) || (n > MAX_OCTAVE_SIZE)) { - line[0] = '\0'; - return; - } - if(octave[n].type == 1) - snprintf(line, maxn, "%d.%06d", octave[n].x1, octave[n].x2); - if(octave[n].type == 2) - snprintf(line, maxn, "%d/%d", octave[n].x1, octave[n].x2); -} - - -int Microtonal::loadline(FILE *file, char *line) -{ - do { - if(fgets(line, 500, file) == 0) - return 1; - } while(line[0] == '!'); - return 0; -} -/* - * Loads the tunnings from a scl file - */ -int Microtonal::loadscl(const char *filename) -{ - FILE *file = fopen(filename, "r"); - char tmp[500]; - fseek(file, 0, SEEK_SET); - //loads the short description - if(loadline(file, &tmp[0]) != 0) - return 2; - for(int i = 0; i < 500; ++i) - if(tmp[i] < 32) - tmp[i] = 0; - snprintf((char *) Pname, MICROTONAL_MAX_NAME_LEN, "%s", tmp); - snprintf((char *) Pcomment, MICROTONAL_MAX_NAME_LEN, "%s", tmp); - //loads the number of the notes - if(loadline(file, &tmp[0]) != 0) - return 2; - int nnotes = MAX_OCTAVE_SIZE; - sscanf(&tmp[0], "%d", &nnotes); - if(nnotes > MAX_OCTAVE_SIZE) - return 2; - //load the tunnings - for(int nline = 0; nline < nnotes; ++nline) { - if(loadline(file, &tmp[0]) != 0) - return 2; - linetotunings(nline, &tmp[0]); - } - fclose(file); - - octavesize = nnotes; - for(int i = 0; i < octavesize; ++i) { - octave[i].tuning = tmpoctave[i].tuning; - octave[i].type = tmpoctave[i].type; - octave[i].x1 = tmpoctave[i].x1; - octave[i].x2 = tmpoctave[i].x2; - } - - return 0; -} - -/* - * Loads the mapping from a kbm file - */ -int Microtonal::loadkbm(const char *filename) -{ - FILE *file = fopen(filename, "r"); - int x; - char tmp[500]; - - fseek(file, 0, SEEK_SET); - //loads the mapsize - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pmapsize = x; - //loads first MIDI note to retune - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pfirstkey = x; - //loads last MIDI note to retune - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Plastkey = x; - //loads last the middle note where scale fro scale degree=0 - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - Pmiddlenote = x; - //loads the reference note - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - return 2; - if(x < 1) - x = 0; - if(x > 127) - x = 127; //just in case... - PAnote = x; - //loads the reference freq. - if(loadline(file, &tmp[0]) != 0) - return 2; - float tmpPAfreq = 440.0f; - if(sscanf(&tmp[0], "%f", &tmpPAfreq) == 0) - return 2; - PAfreq = tmpPAfreq; - - //the scale degree(which is the octave) is not loaded, it is obtained by the tunnings with getoctavesize() method - if(loadline(file, &tmp[0]) != 0) - return 2; - - //load the mappings - if(Pmapsize != 0) { - for(int nline = 0; nline < Pmapsize; ++nline) { - if(loadline(file, &tmp[0]) != 0) - return 2; - if(sscanf(&tmp[0], "%d", &x) == 0) - x = -1; - Pmapping[nline] = x; - } - Pmappingenabled = 1; - } - else { - Pmappingenabled = 0; - Pmapping[0] = 0; - Pmapsize = 1; - } - fclose(file); - - return 0; -} - - - -void Microtonal::add2XML(XMLwrapper *xml) const -{ - xml->addparstr("name", (char *) Pname); - xml->addparstr("comment", (char *) Pcomment); - - xml->addparbool("invert_up_down", Pinvertupdown); - xml->addpar("invert_up_down_center", Pinvertupdowncenter); - - xml->addparbool("enabled", Penabled); - xml->addpar("global_fine_detune", Pglobalfinedetune); - - xml->addpar("a_note", PAnote); - xml->addparreal("a_freq", PAfreq); - - if((Penabled == 0) && (xml->minimal)) - return; - - xml->beginbranch("SCALE"); - xml->addpar("scale_shift", Pscaleshift); - xml->addpar("first_key", Pfirstkey); - xml->addpar("last_key", Plastkey); - xml->addpar("middle_note", Pmiddlenote); - - xml->beginbranch("OCTAVE"); - xml->addpar("octave_size", octavesize); - for(int i = 0; i < octavesize; ++i) { - xml->beginbranch("DEGREE", i); - if(octave[i].type == 1) - xml->addparreal("cents", octave[i].tuning); - ; - if(octave[i].type == 2) { - xml->addpar("numerator", octave[i].x1); - xml->addpar("denominator", octave[i].x2); - } - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("KEYBOARD_MAPPING"); - xml->addpar("map_size", Pmapsize); - xml->addpar("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; ++i) { - xml->beginbranch("KEYMAP", i); - xml->addpar("degree", Pmapping[i]); - xml->endbranch(); - } - - xml->endbranch(); - xml->endbranch(); -} - -void Microtonal::getfromXML(XMLwrapper *xml) -{ - xml->getparstr("name", (char *) Pname, MICROTONAL_MAX_NAME_LEN); - xml->getparstr("comment", (char *) Pcomment, MICROTONAL_MAX_NAME_LEN); - - Pinvertupdown = xml->getparbool("invert_up_down", Pinvertupdown); - Pinvertupdowncenter = xml->getpar127("invert_up_down_center", - Pinvertupdowncenter); - - Penabled = xml->getparbool("enabled", Penabled); - Pglobalfinedetune = xml->getpar127("global_fine_detune", Pglobalfinedetune); - - PAnote = xml->getpar127("a_note", PAnote); - PAfreq = xml->getparreal("a_freq", PAfreq, 1.0f, 10000.0f); - - if(xml->enterbranch("SCALE")) { - Pscaleshift = xml->getpar127("scale_shift", Pscaleshift); - Pfirstkey = xml->getpar127("first_key", Pfirstkey); - Plastkey = xml->getpar127("last_key", Plastkey); - Pmiddlenote = xml->getpar127("middle_note", Pmiddlenote); - - if(xml->enterbranch("OCTAVE")) { - octavesize = xml->getpar127("octave_size", octavesize); - for(int i = 0; i < octavesize; ++i) { - if(xml->enterbranch("DEGREE", i) == 0) - continue; - octave[i].x2 = 0; - octave[i].tuning = xml->getparreal("cents", octave[i].tuning); - octave[i].x1 = xml->getpar127("numerator", octave[i].x1); - octave[i].x2 = xml->getpar127("denominator", octave[i].x2); - - if(octave[i].x2 != 0) - octave[i].type = 2; - else { - octave[i].type = 1; - //populate fields for display - float x = logf(octave[i].tuning) / LOG_2 * 1200.0f; - octave[i].x1 = (int) floor(x); - octave[i].x2 = (int) (floor(fmodf(x, 1.0f) * 1e6)); - } - - - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("KEYBOARD_MAPPING")) { - Pmapsize = xml->getpar127("map_size", Pmapsize); - Pmappingenabled = xml->getpar127("mapping_enabled", Pmappingenabled); - for(int i = 0; i < Pmapsize; ++i) { - if(xml->enterbranch("KEYMAP", i) == 0) - continue; - Pmapping[i] = xml->getpar127("degree", Pmapping[i]); - xml->exitbranch(); - } - xml->exitbranch(); - } - xml->exitbranch(); - } -} - - - -int Microtonal::saveXML(const char *filename) const -{ - XMLwrapper *xml = new XMLwrapper(); - - xml->beginbranch("MICROTONAL"); - add2XML(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - -int Microtonal::loadXML(const char *filename) -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("MICROTONAL") == 0) - return -10; - getfromXML(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.h deleted file mode 100644 index 638a1590fb3..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Microtonal.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.h - Tuning settings and microtonal capabilities - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MICROTONAL_H -#define MICROTONAL_H - -#include "../globals.h" -#include "XMLwrapper.h" - -#define MAX_OCTAVE_SIZE 128 -#define MICROTONAL_MAX_NAME_LEN 120 - -#include - - -/**Tuning settings and microtonal capabilities*/ -class Microtonal -{ - public: - /**Constructor*/ - Microtonal(); - /**Destructor*/ - ~Microtonal(); - void defaults(); - /**Calculates the frequency for a given note - */ - float getnotefreq(int note, int keyshift) const; - - - //Parameters - /**if the keys are inversed (the pitch is lower to keys from the right direction)*/ - unsigned char Pinvertupdown; - - /**the central key of the inversion*/ - unsigned char Pinvertupdowncenter; - - /**0 for 12 key temperate scale, 1 for microtonal*/ - unsigned char Penabled; - - /**the note of "A" key*/ - unsigned char PAnote; - - /**the frequency of the "A" note*/ - float PAfreq; - - /**if the scale is "tuned" to a note, you can tune to other note*/ - unsigned char Pscaleshift; - - //first and last key (to retune) - unsigned char Pfirstkey; - unsigned char Plastkey; - - /**The middle note where scale degree 0 is mapped to*/ - unsigned char Pmiddlenote; - - /**Map size*/ - unsigned char Pmapsize; - - /**Mapping ON/OFF*/ - unsigned char Pmappingenabled; - /**Mapping (keys)*/ - short int Pmapping[128]; - - /**Fine detune to be applied to all notes*/ - unsigned char Pglobalfinedetune; - - // Functions - /** Return the current octave size*/ - unsigned char getoctavesize() const; - /**Convert tunning to string*/ - void tuningtoline(int n, char *line, int maxn); - /**load the tunnings from a .scl file*/ - int loadscl(const char *filename); - /**load the mapping from .kbm file*/ - int loadkbm(const char *filename); - /**Load text into the internal tunings - * - *\todo better description*/ - int texttotunings(const char *text); - /**Load text into the internal mappings - * - *\todo better description*/ - void texttomapping(const char *text); - - /**Name of Microtonal tuning*/ - unsigned char *Pname; - /**Comment about the tuning*/ - unsigned char *Pcomment; - - void add2XML(XMLwrapper *xml) const; - void getfromXML(XMLwrapper *xml); - int saveXML(const char *filename) const; - int loadXML(const char *filename); - - //simple operators primarily for debug - bool operator==(const Microtonal µ) const; - bool operator!=(const Microtonal µ) const; - - private: - int linetotunings(unsigned int nline, const char *line); - int loadline(FILE *file, char *line); //loads a line from the text file, while ignoring the lines beggining with "!" - unsigned char octavesize; - struct { - unsigned char type; //1 for cents or 2 for division - - // the real tuning (eg. +1.05946f for one halftone) - // or 2.0f for one octave - float tuning; - - //the real tunning is x1/x2 - unsigned int x1, x2; - } octave[MAX_OCTAVE_SIZE], tmpoctave[MAX_OCTAVE_SIZE]; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.cpp deleted file mode 100644 index 184a0e23897..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.cpp +++ /dev/null @@ -1,1339 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Part.cpp - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Part.h" -#include "Microtonal.h" -#include "Util.h" -#include "XMLwrapper.h" -#include "../Effects/EffectMgr.h" -#include "../Params/ADnoteParameters.h" -#include "../Params/SUBnoteParameters.h" -#include "../Params/PADnoteParameters.h" -#include "../Synth/ADnote.h" -#include "../Synth/SUBnote.h" -#include "../Synth/PADnote.h" -#include "../DSP/FFTwrapper.h" -#include -#include -#include - -Part::Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_) -{ - microtonal = microtonal_; - fft = fft_; - mutex = mutex_; - pthread_mutex_init(&load_mutex, NULL); - partoutl = new float [synth->buffersize]; - partoutr = new float [synth->buffersize]; - - for(int n = 0; n < NUM_KIT_ITEMS; ++n) { - kit[n].Pname = new unsigned char [PART_MAX_NAME_LEN]; - kit[n].adpars = NULL; - kit[n].subpars = NULL; - kit[n].padpars = NULL; - } - - kit[0].adpars = new ADnoteParameters(fft); - kit[0].subpars = new SUBnoteParameters(); - kit[0].padpars = new PADnoteParameters(fft, mutex); - - //Part's Insertion Effects init - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - partefx[nefx] = new EffectMgr(1, mutex); - Pefxbypass[nefx] = false; - } - - for(int n = 0; n < NUM_PART_EFX + 1; ++n) { - partfxinputl[n] = new float [synth->buffersize]; - partfxinputr[n] = new float [synth->buffersize]; - } - - killallnotes = 0; - oldfreq = -1.0f; - - for(int i = 0; i < POLIPHONY; ++i) { - partnote[i].status = KEY_OFF; - partnote[i].note = -1; - partnote[i].itemsplaying = 0; - for(int j = 0; j < NUM_KIT_ITEMS; ++j) { - partnote[i].kititem[j].adnote = NULL; - partnote[i].kititem[j].subnote = NULL; - partnote[i].kititem[j].padnote = NULL; - } - partnote[i].time = 0; - } - cleanup(); - - Pname = new unsigned char [PART_MAX_NAME_LEN]; - - oldvolumel = oldvolumer = 0.5f; - lastnote = -1; - lastpos = 0; // lastpos will store previously used NoteOn(...)'s pos. - lastlegatomodevalid = false; // To store previous legatomodevalid value. - - defaults(); -} - -void Part::defaults() -{ - Penabled = 0; - Pminkey = 0; - Pmaxkey = 127; - Pnoteon = 1; - Ppolymode = 1; - Plegatomode = 0; - setPvolume(96); - Pkeyshift = 64; - Prcvchn = 0; - setPpanning(64); - Pvelsns = 64; - Pveloffs = 64; - Pkeylimit = 15; - defaultsinstrument(); - ctl.defaults(); -} - -void Part::defaultsinstrument() -{ - ZERO(Pname, PART_MAX_NAME_LEN); - - info.Ptype = 0; - ZERO(info.Pauthor, MAX_INFO_TEXT_SIZE + 1); - ZERO(info.Pcomments, MAX_INFO_TEXT_SIZE + 1); - - Pkitmode = 0; - Pdrummode = 0; - - for(int n = 0; n < NUM_KIT_ITEMS; ++n) { - kit[n].Penabled = 0; - kit[n].Pmuted = 0; - kit[n].Pminkey = 0; - kit[n].Pmaxkey = 127; - kit[n].Padenabled = 0; - kit[n].Psubenabled = 0; - kit[n].Ppadenabled = 0; - ZERO(kit[n].Pname, PART_MAX_NAME_LEN); - kit[n].Psendtoparteffect = 0; - if(n != 0) - setkititemstatus(n, 0); - } - kit[0].Penabled = 1; - kit[0].Padenabled = 1; - kit[0].adpars->defaults(); - kit[0].subpars->defaults(); - kit[0].padpars->defaults(); - - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - partefx[nefx]->defaults(); - Pefxroute[nefx] = 0; //route to next effect - } -} - - - -/* - * Cleanup the part - */ -void Part::cleanup(bool final_) -{ - for(int k = 0; k < POLIPHONY; ++k) - KillNotePos(k); - for(int i = 0; i < synth->buffersize; ++i) { - partoutl[i] = final_ ? 0.0f : denormalkillbuf[i]; - partoutr[i] = final_ ? 0.0f : denormalkillbuf[i]; - } - ctl.resetall(); - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) - partefx[nefx]->cleanup(); - for(int n = 0; n < NUM_PART_EFX + 1; ++n) - for(int i = 0; i < synth->buffersize; ++i) { - partfxinputl[n][i] = final_ ? 0.0f : denormalkillbuf[i]; - partfxinputr[n][i] = final_ ? 0.0f : denormalkillbuf[i]; - } -} - -Part::~Part() -{ - cleanup(true); - for(int n = 0; n < NUM_KIT_ITEMS; ++n) { - if(kit[n].adpars != NULL) - delete (kit[n].adpars); - if(kit[n].subpars != NULL) - delete (kit[n].subpars); - if(kit[n].padpars != NULL) - delete (kit[n].padpars); - kit[n].adpars = NULL; - kit[n].subpars = NULL; - kit[n].padpars = NULL; - delete [] kit[n].Pname; - } - - delete [] Pname; - delete [] partoutl; - delete [] partoutr; - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) - delete (partefx[nefx]); - for(int n = 0; n < NUM_PART_EFX + 1; ++n) { - delete [] partfxinputl[n]; - delete [] partfxinputr[n]; - } -} - -/* - * Note On Messages - */ -void Part::NoteOn(unsigned char note, - unsigned char velocity, - int masterkeyshift) -{ - int i, pos; - - // Legato and MonoMem used vars: - int posb = POLIPHONY - 1; // Just a dummy initial value. - bool legatomodevalid = false; //true when legato mode is determined applicable. - bool doinglegato = false; // true when we determined we do a legato note. - bool ismonofirstnote = false; /*(In Mono/Legato) true when we determined - no other notes are held down or sustained.*/ - int lastnotecopy = lastnote; //Useful after lastnote has been changed. - - if(Pnoteon == 0) - return; - if((note < Pminkey) || (note > Pmaxkey)) - return; - - // MonoMem stuff: - if(Ppolymode == 0) { // If Poly is off - monomemnotes.push_back(note); // Add note to the list. - monomem[note].velocity = velocity; // Store this note's velocity. - monomem[note].mkeyshift = masterkeyshift; /* Store masterkeyshift too, - I'm not sure why though... */ - if((partnote[lastpos].status != KEY_PLAYING) - && (partnote[lastpos].status != KEY_RELASED_AND_SUSTAINED)) - ismonofirstnote = true; // No other keys are held or sustained. - } - else - // Poly mode is On so just make sure the list is empty. - if(not monomemnotes.empty()) - monomemnotes.clear(); - - lastnote = note; - - pos = -1; - for(i = 0; i < POLIPHONY; ++i) - if(partnote[i].status == KEY_OFF) { - pos = i; - break; - } - - if((Plegatomode != 0) && (Pdrummode == 0)) { - if(Ppolymode != 0) { - fprintf( - stderr, - "ZynAddSubFX WARNING: Poly and Legato modes are both On, that should not happen ! ... Disabling Legato mode ! - (Part.cpp::NoteOn(..))\n"); - Plegatomode = 0; - } - else { - // Legato mode is on and applicable. - legatomodevalid = true; - if((not ismonofirstnote) && (lastlegatomodevalid)) { - // At least one other key is held or sustained, and the - // previous note was played while in valid legato mode. - doinglegato = true; // So we'll do a legato note. - pos = lastpos; // A legato note uses same pos as previous.. - posb = lastposb; // .. same goes for posb. - } - else { - // Legato mode is valid, but this is only a first note. - for(i = 0; i < POLIPHONY; ++i) - if((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - RelaseNotePos(i); - - // Set posb - posb = (pos + 1) % POLIPHONY; //We really want it (if the following fails) - for(i = 0; i < POLIPHONY; ++i) - if((partnote[i].status == KEY_OFF) && (pos != i)) { - posb = i; - break; - } - } - lastposb = posb; // Keep a trace of used posb - } - } - else // Legato mode is either off or non-applicable. - if(Ppolymode == 0) { //if the mode is 'mono' turn off all other notes - for(i = 0; i < POLIPHONY; ++i) - if(partnote[i].status == KEY_PLAYING) - RelaseNotePos(i); - RelaseSustainedKeys(); - } - lastlegatomodevalid = legatomodevalid; - - if(pos == -1) - //test - fprintf(stderr, - "%s", - "NOTES TOO MANY (> POLIPHONY) - (Part.cpp::NoteOn(..))\n"); - else { - //start the note - partnote[pos].status = KEY_PLAYING; - partnote[pos].note = note; - if(legatomodevalid) { - partnote[posb].status = KEY_PLAYING; - partnote[posb].note = note; - } - - //this computes the velocity sensing of the part - float vel = VelF(velocity / 127.0f, Pvelsns); - - //compute the velocity offset - vel += (Pveloffs - 64.0f) / 64.0f; - if(vel < 0.0f) - vel = 0.0f; - else - if(vel > 1.0f) - vel = 1.0f; - - //compute the keyshift - int partkeyshift = (int)Pkeyshift - 64; - int keyshift = masterkeyshift + partkeyshift; - - //initialise note frequency - float notebasefreq; - if(Pdrummode == 0) { - notebasefreq = microtonal->getnotefreq(note, keyshift); - if(notebasefreq < 0.0f) - return; //the key is no mapped - } - else - notebasefreq = 440.0f * powf(2.0f, (note - 69.0f) / 12.0f); - ; - - //Portamento - if(oldfreq < 1.0f) - oldfreq = notebasefreq; //this is only the first note is played - - // For Mono/Legato: Force Portamento Off on first - // notes. That means it is required that the previous note is - // still held down or sustained for the Portamento to activate - // (that's like Legato). - int portamento = 0; - if((Ppolymode != 0) || (not ismonofirstnote)) - // I added a third argument to the - // ctl.initportamento(...) function to be able - // to tell it if we're doing a legato note. - portamento = ctl.initportamento(oldfreq, notebasefreq, doinglegato); - - if(portamento != 0) - ctl.portamento.noteusing = pos; - oldfreq = notebasefreq; - - lastpos = pos; // Keep a trace of used pos. - - if(doinglegato) { - // Do Legato note - if(Pkitmode == 0) { // "normal mode" legato note - if((kit[0].Padenabled != 0) - && (partnote[pos].kititem[0].adnote != NULL) - && (partnote[posb].kititem[0].adnote != NULL)) { - partnote[pos].kititem[0].adnote->legatonote(notebasefreq, - vel, - portamento, - note, - true); //'true' is to tell it it's being called from here. - partnote[posb].kititem[0].adnote->legatonote(notebasefreq, - vel, - portamento, - note, - true); - } - - if((kit[0].Psubenabled != 0) - && (partnote[pos].kititem[0].subnote != NULL) - && (partnote[posb].kititem[0].subnote != NULL)) { - partnote[pos].kititem[0].subnote->legatonote( - notebasefreq, vel, portamento, note, true); - partnote[posb].kititem[0].subnote->legatonote( - notebasefreq, vel, portamento, note, true); - } - - if((kit[0].Ppadenabled != 0) - && (partnote[pos].kititem[0].padnote != NULL) - && (partnote[posb].kititem[0].padnote != NULL)) { - partnote[pos].kititem[0].padnote->legatonote( - notebasefreq, vel, portamento, note, true); - partnote[posb].kititem[0].padnote->legatonote( - notebasefreq, vel, portamento, note, true); - } - } - else { // "kit mode" legato note - int ci = 0; - for(int item = 0; item < NUM_KIT_ITEMS; ++item) { - if(kit[item].Pmuted != 0) - continue; - if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) - continue; - - if((lastnotecopy < kit[item].Pminkey) - || (lastnotecopy > kit[item].Pmaxkey)) - continue; // We will not perform legato across 2 key regions. - - partnote[pos].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : - NUM_PART_EFX); //if this parameter is 127 for "unprocessed" - partnote[posb].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : - NUM_PART_EFX); - - if((kit[item].Padenabled != 0) && (kit[item].adpars != NULL) - && (partnote[pos].kititem[ci].adnote != NULL) - && (partnote[posb].kititem[ci].adnote != NULL)) { - partnote[pos].kititem[ci].adnote->legatonote( - notebasefreq, vel, portamento, note, true); - partnote[posb].kititem[ci].adnote->legatonote( - notebasefreq, vel, portamento, note, true); - } - if((kit[item].Psubenabled != 0) - && (kit[item].subpars != NULL) - && (partnote[pos].kititem[ci].subnote != NULL) - && (partnote[posb].kititem[ci].subnote != NULL)) { - partnote[pos].kititem[ci].subnote->legatonote( - notebasefreq, vel, portamento, note, true); - partnote[posb].kititem[ci].subnote->legatonote( - notebasefreq, vel, portamento, note, true); - } - if((kit[item].Ppadenabled != 0) - && (kit[item].padpars != NULL) - && (partnote[pos].kititem[ci].padnote != NULL) - && (partnote[posb].kititem[ci].padnote != NULL)) { - partnote[pos].kititem[ci].padnote->legatonote( - notebasefreq, vel, portamento, note, true); - partnote[posb].kititem[ci].padnote->legatonote( - notebasefreq, vel, portamento, note, true); - } - - if((kit[item].adpars != NULL) - || (kit[item].subpars != NULL) - || (kit[item].padpars != NULL)) { - ci++; - if(((kit[item].Padenabled != 0) - || (kit[item].Psubenabled != 0) - || (kit[item].Ppadenabled != 0)) && (Pkitmode == 2)) - break; - } - } - if(ci == 0) { - // No legato were performed at all, so pretend nothing happened: - monomemnotes.pop_back(); // Remove last note from the list. - lastnote = lastnotecopy; // Set lastnote back to previous value. - } - } - return; // Ok, Legato note done, return. - } - - partnote[pos].itemsplaying = 0; - if(legatomodevalid) - partnote[posb].itemsplaying = 0; - - if(Pkitmode == 0) { //init the notes for the "normal mode" - partnote[pos].kititem[0].sendtoparteffect = 0; - if(kit[0].Padenabled != 0) - partnote[pos].kititem[0].adnote = new ADnote(kit[0].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if(kit[0].Psubenabled != 0) - partnote[pos].kititem[0].subnote = new SUBnote(kit[0].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if(kit[0].Ppadenabled != 0) - partnote[pos].kititem[0].padnote = new PADnote(kit[0].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - if((kit[0].Padenabled != 0) || (kit[0].Psubenabled != 0) - || (kit[0].Ppadenabled != 0)) - partnote[pos].itemsplaying++; - - // Spawn another note (but silent) if legatomodevalid==true - if(legatomodevalid) { - partnote[posb].kititem[0].sendtoparteffect = 0; - if(kit[0].Padenabled != 0) - partnote[posb].kititem[0].adnote = new ADnote(kit[0].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); //true for silent. - if(kit[0].Psubenabled != 0) - partnote[posb].kititem[0].subnote = new SUBnote( - kit[0].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if(kit[0].Ppadenabled != 0) - partnote[posb].kititem[0].padnote = new PADnote( - kit[0].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if((kit[0].Padenabled != 0) || (kit[0].Psubenabled != 0) - || (kit[0].Ppadenabled != 0)) - partnote[posb].itemsplaying++; - } - } - else //init the notes for the "kit mode" - for(int item = 0; item < NUM_KIT_ITEMS; ++item) { - if(kit[item].Pmuted != 0) - continue; - if((note < kit[item].Pminkey) || (note > kit[item].Pmaxkey)) - continue; - - int ci = partnote[pos].itemsplaying; //ci=current item - - //if this parameter is 127 for "unprocessed" - partnote[pos].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < NUM_PART_EFX ? - kit[item].Psendtoparteffect : NUM_PART_EFX); - - if((kit[item].adpars != NULL) && ((kit[item].Padenabled) != 0)) - partnote[pos].kititem[ci].adnote = new ADnote( - kit[item].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - if((kit[item].subpars != NULL) && ((kit[item].Psubenabled) != 0)) - partnote[pos].kititem[ci].subnote = new SUBnote( - kit[item].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - if((kit[item].padpars != NULL) && ((kit[item].Ppadenabled) != 0)) - partnote[pos].kititem[ci].padnote = new PADnote( - kit[item].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - false); - - // Spawn another note (but silent) if legatomodevalid==true - if(legatomodevalid) { - partnote[posb].kititem[ci].sendtoparteffect = - (kit[item].Psendtoparteffect < - NUM_PART_EFX ? kit[item].Psendtoparteffect : - NUM_PART_EFX); //if this parameter is 127 for "unprocessed" - - if((kit[item].adpars != NULL) - && ((kit[item].Padenabled) != 0)) - partnote[posb].kititem[ci].adnote = new ADnote( - kit[item].adpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); //true for silent. - if((kit[item].subpars != NULL) - && ((kit[item].Psubenabled) != 0)) - partnote[posb].kititem[ci].subnote = - new SUBnote(kit[item].subpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - if((kit[item].padpars != NULL) - && ((kit[item].Ppadenabled) != 0)) - partnote[posb].kititem[ci].padnote = - new PADnote(kit[item].padpars, - &ctl, - notebasefreq, - vel, - portamento, - note, - true); - - if((kit[item].adpars != NULL) || (kit[item].subpars != NULL)) - partnote[posb].itemsplaying++; - } - - if((kit[item].adpars != NULL) || (kit[item].subpars != NULL)) { - partnote[pos].itemsplaying++; - if(((kit[item].Padenabled != 0) - || (kit[item].Psubenabled != 0) - || (kit[item].Ppadenabled != 0)) - && (Pkitmode == 2)) - break; - } - } - } - - //this only relase the keys if there is maximum number of keys allowed - setkeylimit(Pkeylimit); -} - -/* - * Note Off Messages - */ -void Part::NoteOff(unsigned char note) //relase the key -{ - int i; - - // This note is released, so we remove it from the list. - if(not monomemnotes.empty()) - monomemnotes.remove(note); - - for(i = POLIPHONY - 1; i >= 0; i--) //first note in, is first out if there are same note multiple times - if((partnote[i].status == KEY_PLAYING) && (partnote[i].note == note)) { - if(ctl.sustain.sustain == 0) { //the sustain pedal is not pushed - if((Ppolymode == 0) && (not monomemnotes.empty())) - MonoMemRenote(); // To play most recent still held note. - else - RelaseNotePos(i); - /// break; - } - else //the sustain pedal is pushed - partnote[i].status = KEY_RELASED_AND_SUSTAINED; - } -} - -void Part::PolyphonicAftertouch(unsigned char note, - unsigned char velocity, - int masterkeyshift) -{ - (void) masterkeyshift; - if(!Pnoteon || (note < Pminkey) || (note > Pmaxkey)) - return; - if(Pdrummode) - return; - - // MonoMem stuff: - if(!Ppolymode) // if Poly is off - - monomem[note].velocity = velocity; // Store this note's velocity. - - - for(int i = 0; i < POLIPHONY; ++i) - if((partnote[i].note == note) && (partnote[i].status == KEY_PLAYING)) { - /* update velocity */ - // compute the velocity offset - float vel = - VelF(velocity / 127.0f, Pvelsns) + (Pveloffs - 64.0f) / 64.0f; - vel = (vel < 0.0f) ? 0.0f : vel; - vel = (vel > 1.0f) ? 1.0f : vel; - - if(!Pkitmode) { // "normal mode" - if(kit[0].Padenabled && partnote[i].kititem[0].adnote) - partnote[i].kititem[0].adnote->setVelocity(vel); - if(kit[0].Psubenabled && partnote[i].kititem[0].subnote) - partnote[i].kititem[0].subnote->setVelocity(vel); - if(kit[0].Ppadenabled && partnote[i].kititem[0].padnote) - partnote[i].kititem[0].padnote->setVelocity(vel); - } - else // "kit mode" - for(int item = 0; item < NUM_KIT_ITEMS; ++item) { - if(kit[item].Pmuted) - continue; - if((note < kit[item].Pminkey) - || (note > kit[item].Pmaxkey)) - continue; - - if(kit[item].Padenabled && partnote[i].kititem[item].adnote) - partnote[i].kititem[item].adnote->setVelocity(vel); - if(kit[item].Psubenabled && partnote[i].kititem[item].subnote) - partnote[i].kititem[item].subnote->setVelocity(vel); - if(kit[item].Ppadenabled && partnote[i].kititem[item].padnote) - partnote[i].kititem[item].padnote->setVelocity(vel); - } - } - -} - -/* - * Controllers - */ -void Part::SetController(unsigned int type, int par) -{ - switch(type) { - case C_pitchwheel: - ctl.setpitchwheel(par); - break; - case C_expression: - ctl.setexpression(par); - setPvolume(Pvolume); //update the volume - break; - case C_portamento: - ctl.setportamento(par); - break; - case C_panning: - ctl.setpanning(par); - setPpanning(Ppanning); //update the panning - break; - case C_filtercutoff: - ctl.setfiltercutoff(par); - break; - case C_filterq: - ctl.setfilterq(par); - break; - case C_bandwidth: - ctl.setbandwidth(par); - break; - case C_modwheel: - ctl.setmodwheel(par); - break; - case C_fmamp: - ctl.setfmamp(par); - break; - case C_volume: - ctl.setvolume(par); - if(ctl.volume.receive != 0) - volume = ctl.volume.volume; - else - setPvolume(Pvolume); - break; - case C_sustain: - ctl.setsustain(par); - if(ctl.sustain.sustain == 0) - RelaseSustainedKeys(); - break; - case C_allsoundsoff: - AllNotesOff(); //Panic - break; - case C_resetallcontrollers: - ctl.resetall(); - RelaseSustainedKeys(); - if(ctl.volume.receive != 0) - volume = ctl.volume.volume; - else - setPvolume(Pvolume); - setPvolume(Pvolume); //update the volume - setPpanning(Ppanning); //update the panning - - for(int item = 0; item < NUM_KIT_ITEMS; ++item) { - if(kit[item].adpars == NULL) - continue; - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_center, 1.0f); - - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth, 1.0f); - } - //more update to add here if I add controllers - break; - case C_allnotesoff: - RelaseAllKeys(); - break; - case C_resonance_center: - ctl.setresonancecenter(par); - for(int item = 0; item < NUM_KIT_ITEMS; ++item) { - if(kit[item].adpars == NULL) - continue; - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_center, - ctl.resonancecenter.relcenter); - } - break; - case C_resonance_bandwidth: - ctl.setresonancebw(par); - kit[0].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth, ctl.resonancebandwidth.relbw); - break; - } -} -/* - * Relase the sustained keys - */ - -void Part::RelaseSustainedKeys() -{ - // Let's call MonoMemRenote() on some conditions: - if((Ppolymode == 0) && (not monomemnotes.empty())) - if(monomemnotes.back() != lastnote) // Sustain controller manipulation would cause repeated same note respawn without this check. - MonoMemRenote(); // To play most recent still held note. - - for(int i = 0; i < POLIPHONY; ++i) - if(partnote[i].status == KEY_RELASED_AND_SUSTAINED) - RelaseNotePos(i); -} - -/* - * Relase all keys - */ - -void Part::RelaseAllKeys() -{ - for(int i = 0; i < POLIPHONY; ++i) - if((partnote[i].status != KEY_RELASED) - && (partnote[i].status != KEY_OFF)) //thanks to Frank Neumann - RelaseNotePos(i); -} - -// Call NoteOn(...) with the most recent still held key as new note -// (Made for Mono/Legato). -void Part::MonoMemRenote() -{ - unsigned char mmrtempnote = monomemnotes.back(); // Last list element. - monomemnotes.pop_back(); // We remove it, will be added again in NoteOn(...). - if(Pnoteon == 0) - RelaseNotePos(lastpos); - else - NoteOn(mmrtempnote, monomem[mmrtempnote].velocity, - monomem[mmrtempnote].mkeyshift); -} - -/* - * Release note at position - */ -void Part::RelaseNotePos(int pos) -{ - for(int j = 0; j < NUM_KIT_ITEMS; ++j) { - if(partnote[pos].kititem[j].adnote != NULL) - if(partnote[pos].kititem[j].adnote) - partnote[pos].kititem[j].adnote->relasekey(); - - if(partnote[pos].kititem[j].subnote != NULL) - if(partnote[pos].kititem[j].subnote != NULL) - partnote[pos].kititem[j].subnote->relasekey(); - - if(partnote[pos].kititem[j].padnote != NULL) - if(partnote[pos].kititem[j].padnote) - partnote[pos].kititem[j].padnote->relasekey(); - } - partnote[pos].status = KEY_RELASED; -} - - -/* - * Kill note at position - */ -void Part::KillNotePos(int pos) -{ - partnote[pos].status = KEY_OFF; - partnote[pos].note = -1; - partnote[pos].time = 0; - partnote[pos].itemsplaying = 0; - - for(int j = 0; j < NUM_KIT_ITEMS; ++j) { - if(partnote[pos].kititem[j].adnote != NULL) { - delete (partnote[pos].kititem[j].adnote); - partnote[pos].kititem[j].adnote = NULL; - } - if(partnote[pos].kititem[j].subnote != NULL) { - delete (partnote[pos].kititem[j].subnote); - partnote[pos].kititem[j].subnote = NULL; - } - if(partnote[pos].kititem[j].padnote != NULL) { - delete (partnote[pos].kititem[j].padnote); - partnote[pos].kititem[j].padnote = NULL; - } - } - if(pos == ctl.portamento.noteusing) { - ctl.portamento.noteusing = -1; - ctl.portamento.used = 0; - } -} - - -/* - * Set Part's key limit - */ -void Part::setkeylimit(unsigned char Pkeylimit) -{ - this->Pkeylimit = Pkeylimit; - int keylimit = Pkeylimit; - if(keylimit == 0) - keylimit = POLIPHONY - 5; - - //release old keys if the number of notes>keylimit - if(Ppolymode != 0) { - int notecount = 0; - for(int i = 0; i < POLIPHONY; ++i) - if((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - notecount++; - - int oldestnotepos = -1; - if(notecount > keylimit) //find out the oldest note - for(int i = 0; i < POLIPHONY; ++i) { - int maxtime = 0; - if(((partnote[i].status == KEY_PLAYING) - || (partnote[i].status == KEY_RELASED_AND_SUSTAINED)) - && (partnote[i].time > maxtime)) { - maxtime = partnote[i].time; - oldestnotepos = i; - } - } - if(oldestnotepos != -1) - RelaseNotePos(oldestnotepos); - } -} - - -/* - * Prepare all notes to be turned off - */ -void Part::AllNotesOff() -{ - killallnotes = 1; -} - -void Part::RunNote(unsigned int k) -{ - unsigned noteplay = 0; - for(int item = 0; item < partnote[k].itemsplaying; ++item) { - int sendcurrenttofx = partnote[k].kititem[item].sendtoparteffect; - - for(unsigned type = 0; type < 3; ++type) { - //Select a note - SynthNote **note = NULL; - if(type == 0) - note = &partnote[k].kititem[item].adnote; - else if(type == 1) - note = &partnote[k].kititem[item].subnote; - else if(type == 2) - note = &partnote[k].kititem[item].padnote; - - //Process if it exists - if(!(*note)) - continue; - noteplay++; - - float tmpoutr[synth->buffersize]; - float tmpoutl[synth->buffersize]; - (*note)->noteout(&tmpoutl[0], &tmpoutr[0]); - - if((*note)->finished()) { - delete (*note); - (*note) = NULL; - } - for(int i = 0; i < synth->buffersize; ++i) { //add the note to part(mix) - partfxinputl[sendcurrenttofx][i] += tmpoutl[i]; - partfxinputr[sendcurrenttofx][i] += tmpoutr[i]; - } - } - } - - //Kill note if there is no synth on that note - if(noteplay == 0) - KillNotePos(k); -} - -/* - * Compute Part samples and store them in the partoutl[] and partoutr[] - */ -void Part::ComputePartSmps() -{ - for(unsigned nefx = 0; nefx < NUM_PART_EFX + 1; ++nefx) - for(int i = 0; i < synth->buffersize; ++i) { - partfxinputl[nefx][i] = 0.0f; - partfxinputr[nefx][i] = 0.0f; - } - - for(unsigned k = 0; k < POLIPHONY; ++k) { - if(partnote[k].status == KEY_OFF) - continue; - partnote[k].time++; - //get the sampledata of the note and kill it if it's finished - RunNote(k); - } - - - //Apply part's effects and mix them - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - if(!Pefxbypass[nefx]) { - partefx[nefx]->out(partfxinputl[nefx], partfxinputr[nefx]); - if(Pefxroute[nefx] == 2) - for(int i = 0; i < synth->buffersize; ++i) { - partfxinputl[nefx + 1][i] += partefx[nefx]->efxoutl[i]; - partfxinputr[nefx + 1][i] += partefx[nefx]->efxoutr[i]; - } - } - int routeto = ((Pefxroute[nefx] == 0) ? nefx + 1 : NUM_PART_EFX); - for(int i = 0; i < synth->buffersize; ++i) { - partfxinputl[routeto][i] += partfxinputl[nefx][i]; - partfxinputr[routeto][i] += partfxinputr[nefx][i]; - } - } - for(int i = 0; i < synth->buffersize; ++i) { - partoutl[i] = partfxinputl[NUM_PART_EFX][i]; - partoutr[i] = partfxinputr[NUM_PART_EFX][i]; - } - - //Kill All Notes if killallnotes!=0 - if(killallnotes != 0) { - for(int i = 0; i < synth->buffersize; ++i) { - float tmp = (synth->buffersize_f - i) / synth->buffersize_f; - partoutl[i] *= tmp; - partoutr[i] *= tmp; - } - for(int k = 0; k < POLIPHONY; ++k) - KillNotePos(k); - killallnotes = 0; - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) - partefx[nefx]->cleanup(); - monomemnotes.clear(); - } - ctl.updateportamento(); -} - -/* - * Parameter control - */ -void Part::setPvolume(char Pvolume_) -{ - Pvolume = Pvolume_; - volume = - dB2rap((Pvolume - 96.0f) / 96.0f * 40.0f) * ctl.expression.relvolume; -} - -void Part::setPpanning(char Ppanning_) -{ - Ppanning = Ppanning_; - panning = Ppanning / 127.0f + ctl.panning.pan; - if(panning < 0.0f) - panning = 0.0f; - else - if(panning > 1.0f) - panning = 1.0f; -} - -/* - * Enable or disable a kit item - */ -void Part::setkititemstatus(int kititem, int Penabled_) -{ - if((kititem == 0) || (kititem >= NUM_KIT_ITEMS)) - return; //nonexistent kit item and the first kit item is always enabled - kit[kititem].Penabled = Penabled_; - - bool resetallnotes = false; - if(Penabled_ == 0) { - if(kit[kititem].adpars != NULL) - delete (kit[kititem].adpars); - if(kit[kititem].subpars != NULL) - delete (kit[kititem].subpars); - if(kit[kititem].padpars != NULL) { - delete (kit[kititem].padpars); - resetallnotes = true; - } - kit[kititem].adpars = NULL; - kit[kititem].subpars = NULL; - kit[kititem].padpars = NULL; - kit[kititem].Pname[0] = '\0'; - } - else { - if(kit[kititem].adpars == NULL) - kit[kititem].adpars = new ADnoteParameters(fft); - if(kit[kititem].subpars == NULL) - kit[kititem].subpars = new SUBnoteParameters(); - if(kit[kititem].padpars == NULL) - kit[kititem].padpars = new PADnoteParameters(fft, mutex); - } - - if(resetallnotes) - for(int k = 0; k < POLIPHONY; ++k) - KillNotePos(k); -} - -void Part::add2XMLinstrument(XMLwrapper *xml) -{ - xml->beginbranch("INFO"); - xml->addparstr("name", (char *)Pname); - xml->addparstr("author", (char *)info.Pauthor); - xml->addparstr("comments", (char *)info.Pcomments); - xml->addpar("type", info.Ptype); - xml->endbranch(); - - - xml->beginbranch("INSTRUMENT_KIT"); - xml->addpar("kit_mode", Pkitmode); - xml->addparbool("drum_mode", Pdrummode); - - for(int i = 0; i < NUM_KIT_ITEMS; ++i) { - xml->beginbranch("INSTRUMENT_KIT_ITEM", i); - xml->addparbool("enabled", kit[i].Penabled); - if(kit[i].Penabled != 0) { - xml->addparstr("name", (char *)kit[i].Pname); - - xml->addparbool("muted", kit[i].Pmuted); - xml->addpar("min_key", kit[i].Pminkey); - xml->addpar("max_key", kit[i].Pmaxkey); - - xml->addpar("send_to_instrument_effect", kit[i].Psendtoparteffect); - - xml->addparbool("add_enabled", kit[i].Padenabled); - if((kit[i].Padenabled != 0) && (kit[i].adpars != NULL)) { - xml->beginbranch("ADD_SYNTH_PARAMETERS"); - kit[i].adpars->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("sub_enabled", kit[i].Psubenabled); - if((kit[i].Psubenabled != 0) && (kit[i].subpars != NULL)) { - xml->beginbranch("SUB_SYNTH_PARAMETERS"); - kit[i].subpars->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("pad_enabled", kit[i].Ppadenabled); - if((kit[i].Ppadenabled != 0) && (kit[i].padpars != NULL)) { - xml->beginbranch("PAD_SYNTH_PARAMETERS"); - kit[i].padpars->add2XML(xml); - xml->endbranch(); - } - } - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("INSTRUMENT_EFFECTS"); - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - xml->beginbranch("INSTRUMENT_EFFECT", nefx); - xml->beginbranch("EFFECT"); - partefx[nefx]->add2XML(xml); - xml->endbranch(); - - xml->addpar("route", Pefxroute[nefx]); - partefx[nefx]->setdryonly(Pefxroute[nefx] == 2); - xml->addparbool("bypass", Pefxbypass[nefx]); - xml->endbranch(); - } - xml->endbranch(); -} - -void Part::add2XML(XMLwrapper *xml) -{ - //parameters - xml->addparbool("enabled", Penabled); - if((Penabled == 0) && (xml->minimal)) - return; - - xml->addpar("volume", Pvolume); - xml->addpar("panning", Ppanning); - - xml->addpar("min_key", Pminkey); - xml->addpar("max_key", Pmaxkey); - xml->addpar("key_shift", Pkeyshift); - xml->addpar("rcv_chn", Prcvchn); - - xml->addpar("velocity_sensing", Pvelsns); - xml->addpar("velocity_offset", Pveloffs); - - xml->addparbool("note_on", Pnoteon); - xml->addparbool("poly_mode", Ppolymode); - xml->addpar("legato_mode", Plegatomode); - xml->addpar("key_limit", Pkeylimit); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - xml->beginbranch("CONTROLLER"); - ctl.add2XML(xml); - xml->endbranch(); -} - -int Part::saveXML(const char *filename) -{ - XMLwrapper *xml; - xml = new XMLwrapper(); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - int result = xml->saveXMLfile(filename); - delete (xml); - return result; -} - -int Part::loadXMLinstrument(const char *filename) /*{*/ -{ - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); - return -1; - } - - if(xml->enterbranch("INSTRUMENT") == 0) - return -10; - getfromXMLinstrument(xml); - xml->exitbranch(); - - delete (xml); - return 0; -} /*}*/ - -void Part::applyparameters(bool lockmutex) /*{*/ -{ - for(int n = 0; n < NUM_KIT_ITEMS; ++n) - if((kit[n].padpars != NULL) && (kit[n].Ppadenabled != 0)) - kit[n].padpars->applyparameters(lockmutex); -} /*}*/ - -void Part::getfromXMLinstrument(XMLwrapper *xml) -{ - if(xml->enterbranch("INFO")) { - xml->getparstr("name", (char *)Pname, PART_MAX_NAME_LEN); - xml->getparstr("author", (char *)info.Pauthor, MAX_INFO_TEXT_SIZE); - xml->getparstr("comments", (char *)info.Pcomments, MAX_INFO_TEXT_SIZE); - info.Ptype = xml->getpar("type", info.Ptype, 0, 16); - - xml->exitbranch(); - } - - if(xml->enterbranch("INSTRUMENT_KIT")) { - Pkitmode = xml->getpar127("kit_mode", Pkitmode); - Pdrummode = xml->getparbool("drum_mode", Pdrummode); - - setkititemstatus(0, 0); - for(int i = 0; i < NUM_KIT_ITEMS; ++i) { - if(xml->enterbranch("INSTRUMENT_KIT_ITEM", i) == 0) - continue; - setkititemstatus(i, xml->getparbool("enabled", kit[i].Penabled)); - if(kit[i].Penabled == 0) { - xml->exitbranch(); - continue; - } - - xml->getparstr("name", (char *)kit[i].Pname, PART_MAX_NAME_LEN); - - kit[i].Pmuted = xml->getparbool("muted", kit[i].Pmuted); - kit[i].Pminkey = xml->getpar127("min_key", kit[i].Pminkey); - kit[i].Pmaxkey = xml->getpar127("max_key", kit[i].Pmaxkey); - - kit[i].Psendtoparteffect = xml->getpar127( - "send_to_instrument_effect", - kit[i].Psendtoparteffect); - - kit[i].Padenabled = xml->getparbool("add_enabled", - kit[i].Padenabled); - if(xml->enterbranch("ADD_SYNTH_PARAMETERS")) { - kit[i].adpars->getfromXML(xml); - xml->exitbranch(); - } - - kit[i].Psubenabled = xml->getparbool("sub_enabled", - kit[i].Psubenabled); - if(xml->enterbranch("SUB_SYNTH_PARAMETERS")) { - kit[i].subpars->getfromXML(xml); - xml->exitbranch(); - } - - kit[i].Ppadenabled = xml->getparbool("pad_enabled", - kit[i].Ppadenabled); - if(xml->enterbranch("PAD_SYNTH_PARAMETERS")) { - kit[i].padpars->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - xml->exitbranch(); - } - - - if(xml->enterbranch("INSTRUMENT_EFFECTS")) { - for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - if(xml->enterbranch("INSTRUMENT_EFFECT", nefx) == 0) - continue; - if(xml->enterbranch("EFFECT")) { - partefx[nefx]->getfromXML(xml); - xml->exitbranch(); - } - - Pefxroute[nefx] = xml->getpar("route", - Pefxroute[nefx], - 0, - NUM_PART_EFX); - partefx[nefx]->setdryonly(Pefxroute[nefx] == 2); - Pefxbypass[nefx] = xml->getparbool("bypass", Pefxbypass[nefx]); - xml->exitbranch(); - } - xml->exitbranch(); - } -} - -void Part::getfromXML(XMLwrapper *xml) -{ - Penabled = xml->getparbool("enabled", Penabled); - - setPvolume(xml->getpar127("volume", Pvolume)); - setPpanning(xml->getpar127("panning", Ppanning)); - - Pminkey = xml->getpar127("min_key", Pminkey); - Pmaxkey = xml->getpar127("max_key", Pmaxkey); - Pkeyshift = xml->getpar127("key_shift", Pkeyshift); - Prcvchn = xml->getpar127("rcv_chn", Prcvchn); - - Pvelsns = xml->getpar127("velocity_sensing", Pvelsns); - Pveloffs = xml->getpar127("velocity_offset", Pveloffs); - - Pnoteon = xml->getparbool("note_on", Pnoteon); - Ppolymode = xml->getparbool("poly_mode", Ppolymode); - Plegatomode = xml->getparbool("legato_mode", Plegatomode); //older versions - if(!Plegatomode) - Plegatomode = xml->getpar127("legato_mode", Plegatomode); - Pkeylimit = xml->getpar127("key_limit", Pkeylimit); - - - if(xml->enterbranch("INSTRUMENT")) { - getfromXMLinstrument(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("CONTROLLER")) { - ctl.getfromXML(xml); - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.h deleted file mode 100644 index ed247d30be7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Part.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PART_H -#define PART_H - -#define MAX_INFO_TEXT_SIZE 1000 - -#include "../globals.h" -#include "../Params/Controller.h" -#include "../Misc/Microtonal.h" - -#include -#include // For the monomemnotes list. - -class EffectMgr; -class ADnoteParameters; -class SUBnoteParameters; -class PADnoteParameters; -class SynthNote; -class XMLWrapper; -class FFTwrapper; - -/** Part implementation*/ -class Part -{ - public: - /**Constructor - * @param microtonal_ Pointer to the microtonal object - * @param fft_ Pointer to the FFTwrapper - * @param mutex_ Pointer to the master pthread_mutex_t*/ - Part(Microtonal *microtonal_, FFTwrapper *fft_, pthread_mutex_t *mutex_); - /**Destructor*/ - ~Part(); - - // Midi commands implemented - void NoteOn(unsigned char note, - unsigned char velocity, - int masterkeyshift); - void NoteOff(unsigned char note); - void PolyphonicAftertouch(unsigned char note, - unsigned char velocity, - int masterkeyshift); - void AllNotesOff(); //panic - void SetController(unsigned int type, int par); - void RelaseSustainedKeys(); //this is called when the sustain pedal is relased - void RelaseAllKeys(); //this is called on AllNotesOff controller - - /* The synthesizer part output */ - void ComputePartSmps(); //Part output - - //instrumentonly: 0 - save all, 1 - save only instrumnet, 2 - save only instrument without the name(used in bank) - - - //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(bool lockmutex = true); - - void getfromXML(XMLwrapper *xml); - void getfromXMLinstrument(XMLwrapper *xml); - - void cleanup(bool final = false); - - //the part's kit - struct { - unsigned char Penabled, Pmuted, Pminkey, Pmaxkey; - unsigned char *Pname; - unsigned char Padenabled, Psubenabled, Ppadenabled; - unsigned char Psendtoparteffect; - ADnoteParameters *adpars; - SUBnoteParameters *subpars; - PADnoteParameters *padpars; - } kit[NUM_KIT_ITEMS]; - - - //Part parameters - void setkeylimit(unsigned char Pkeylimit); - void setkititemstatus(int kititem, int Penabled_); - - unsigned char Penabled; /** monomemnotes; // A list to remember held notes. - struct { - unsigned char velocity; - int mkeyshift; // I'm not sure masterkeyshift should be remembered. - } monomem[256]; - /* 256 is to cover all possible note values. - monomem[] is used in conjunction with the list to - store the velocity and masterkeyshift values of a given note (the list only store note values). - For example 'monomem[note].velocity' would be the velocity value of the note 'note'.*/ - - PartNotes partnote[POLIPHONY]; - - float oldfreq; //this is used for portamento - Microtonal *microtonal; - FFTwrapper *fft; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp deleted file mode 100644 index 427797bfda1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp +++ /dev/null @@ -1,550 +0,0 @@ -/* - * QtXmlWrapper.cpp - a QtXml based XML backend for ZynAddSubxFX - * - * Copyright (c) 2009 Tobias Doerffel - * - * This file is part of LMMS - https://lmms.io - * - * 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. - * - * 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -/* File derived from QtXmlWrapper.C: */ -/* - ZynAddSubFX - a software synthesizer - - QtXmlWrapper.C - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "QtXmlWrapper.h" -#include -#include -#include -#include -#include "lmmsconfig.h" -#include "../globals.h" -#include "Util.h" - - -struct XmlData -{ - XmlData() : - m_doc( "ZynAddSubFX-data" ) - { - } - QDomDocument m_doc; - QDomElement m_node; - QDomElement m_info; - - QDomElement addparams( const char *name, unsigned int params, ... ); -} ; - - - -QtXmlWrapper::QtXmlWrapper() : - d( new XmlData ) -{ - version.Major = 2; - version.Minor = 4; - version.Revision = 1; - - minimal = true; - - d->m_node = d->m_doc.createElement( "ZynAddSubFX-data" ); - d->m_node.setAttribute( "version-major", QString::number( version.Major ) ); - d->m_node.setAttribute( "version-minor", QString::number( version.Minor ) ); - d->m_node.setAttribute( "version-revision", QString::number( version.Revision ) ); - d->m_node.setAttribute( "ZynAddSubFX-author", "Nasca Octavian Paul" ); - d->m_doc.appendChild( d->m_node ); - - //make the empty branch that will contain the information parameters - d->m_info = d->addparams("INFORMATION", 0); - - //save zynaddsubfx specifications - beginbranch("BASE_PARAMETERS"); - addpar("max_midi_parts", NUM_MIDI_PARTS); - addpar("max_kit_items_per_instrument", NUM_KIT_ITEMS); - - addpar("max_system_effects", NUM_SYS_EFX); - addpar("max_insertion_effects", NUM_INS_EFX); - addpar("max_instrument_effects", NUM_PART_EFX); - - addpar("max_addsynth_voices", NUM_VOICES); - endbranch(); -} - - - - -QtXmlWrapper::~QtXmlWrapper() -{ - delete d; -} - - - - -void QtXmlWrapper::setPadSynth(bool enabled) -{ - /**@bug this might create multiple nodes when only one is needed*/ - QDomElement oldNode = d->m_node; - d->m_node = d->m_info; - //Info storing - addparbool("PADsynth_used", enabled); - d->m_node = oldNode; -} - -QDomElement findElement( QDomElement root, const QString & tagname, const QString & attrname, - const QString & attrval ) -{ - QDomNodeList list = root.elementsByTagName( tagname ); - for( int i = 0; i < list.size(); ++i ) - { - QDomNode n = list.at( i ); - if( n.isElement() ) - { - QDomElement e = n.toElement(); - if( e.hasAttribute( attrname ) && e.attribute( attrname ) == attrval ) - { - return e; - } - } - } - - return QDomElement(); -} - - - - -bool QtXmlWrapper::hasPadSynth() const -{ - /**Right now this has a copied implementation of setparbool, so this should - * be reworked as XMLwrapper evolves*/ - QDomElement tmp = d->m_doc.elementsByTagName( "INFORMATION" ).at( 0 ).toElement(); - QDomElement parameter = findElement( tmp, "par_bool", "name", "PADsynth_used" ); - if( !parameter.isNull() ) - { - const QString val = parameter.attribute( "value" ).toLower(); - return val[0] == 'y'; - } - return false; -} - - -/* SAVE XML members */ - -int QtXmlWrapper::saveXMLfile(const std::string &filename) const -{ - char *xmldata = getXMLdata(); - if(xmldata == NULL) - return -2; - - int compression = config.cfg.GzipCompression; - int result = dosavefile(filename.c_str(), compression, xmldata); - - delete[] xmldata; - return result; -} - - -char *QtXmlWrapper::getXMLdata() const -{ - QString xml = d->m_doc.toString( 1 ); - return qstrdup( xml.toUtf8().constData() ); -} - - -int QtXmlWrapper::dosavefile(const char *filename, - int compression, - const char *xmldata) const -{ - if(compression == 0) { - FILE *file; - file = fopen(filename, "w"); - if(file == NULL) - return -1; - fputs(xmldata, file); - fclose(file); - } - else { - if(compression > 9) - compression = 9; - if(compression < 1) - compression = 1; - char options[10]; - snprintf(options, 10, "wb%d", compression); - - gzFile gzfile; - gzfile = gzopen(filename, options); - if(gzfile == NULL) - return -1; - gzputs(gzfile, xmldata); - gzclose(gzfile); - } - - return 0; -} - - - -void QtXmlWrapper::addpar(const std::string &name, int val) -{ - d->addparams("par", 2, "name", name.c_str(), "value", stringFrom( - val).c_str()); -} - -void QtXmlWrapper::addparreal(const std::string &name, float val) -{ - d->addparams("par_real", 2, "name", name.c_str(), "value", - stringFrom(val).c_str()); -} - -void QtXmlWrapper::addparbool(const std::string &name, int val) -{ - if(val != 0) - d->addparams("par_bool", 2, "name", name.c_str(), "value", "yes"); - else - d->addparams("par_bool", 2, "name", name.c_str(), "value", "no"); -} - -void QtXmlWrapper::addparstr(const std::string &name, const std::string &val) -{ - QDomElement e = d->m_doc.createElement( "string" ); - e.setAttribute( "name", name.c_str() ); - e.appendChild( d->m_doc.createTextNode( val.c_str() ) ); - d->m_node.appendChild( e ); -} - - -void QtXmlWrapper::beginbranch(const std::string &name) -{ - d->m_node = d->addparams(name.c_str(), 0); -} - -void QtXmlWrapper::beginbranch(const std::string &name, int id) -{ - d->m_node = d->addparams(name.c_str(), 1, "id", stringFrom(id).c_str()); -} - -void QtXmlWrapper::endbranch() -{ - d->m_node = d->m_node.parentNode().toElement(); -} - - - -/* LOAD XML members */ - -int QtXmlWrapper::loadXMLfile(const std::string &filename) -{ - const char *xmldata = doloadfile(filename.c_str()); - if(xmldata == NULL) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): empty data"; - return -1; //the file could not be loaded or uncompressed - } - - QByteArray b( xmldata ); - while( !b.isEmpty() && b[0] != '<' ) - { - // remove first blank line - b.remove( 0, 1 ); - } - - if( !d->m_doc.setContent( b ) ) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): could not set document content"; - delete[] xmldata; - return -2; - } - delete[] xmldata; - - d->m_node = d->m_doc.elementsByTagName( "ZynAddSubFX-data" ).at( 0 ).toElement(); - if( d->m_node.isNull() || !d->m_node.isElement() ) - { - qDebug() << "QtXmlWrapper::loadXMLfile(): missing root node"; - return -3; //the XML doesnt embbed zynaddsubfx data - } - QDomElement root = d->m_node.toElement(); - //fetch version information - version.Major = root.attribute( "version-major").toInt(); - version.Minor = root.attribute( "version-minor").toInt(); - version.Revision = root.attribute( "version-revision").toInt(); - - return 0; -} - - -char *QtXmlWrapper::doloadfile(const std::string &filename) const -{ - char *xmldata = NULL; - gzFile gzfile = gzopen(filename.c_str(), "rb"); - - if(gzfile != NULL) { //The possibly compressed file opened - std::stringstream strBuf; //reading stream - const int bufSize = 500; //fetch size - char fetchBuf[bufSize + 1]; //fetch buffer - int read = 0; //chars read in last fetch - - fetchBuf[bufSize] = 0; //force null termination - - while(bufSize == (read = gzread(gzfile, fetchBuf, bufSize))) - strBuf << fetchBuf; - - fetchBuf[read] = 0; //Truncate last partial read - strBuf << fetchBuf; - - gzclose(gzfile); - - //Place data in output format - std::string tmp = strBuf.str(); - xmldata = new char[tmp.size() + 1]; - strncpy(xmldata, tmp.c_str(), tmp.size() + 1); - } - - return xmldata; -} - -bool QtXmlWrapper::putXMLdata(const char *xmldata) -{ - d->m_doc.setContent( QString::fromUtf8( xmldata ) ); - - d->m_node = d->m_doc.elementsByTagName( "ZynAddSubFX-data" ).at( 0 ).toElement(); - if( d->m_node.isNull() ) - { - return false; - } - - return true; -} - - - -int QtXmlWrapper::enterbranch(const std::string &name) -{ - QDomElement tmp = d->m_node.firstChildElement( name.c_str() ); - if( tmp.isNull() ) - { - return 0; - } - - d->m_node = tmp; - - return 1; -} - -int QtXmlWrapper::enterbranch(const std::string &name, int id) -{ - QDomElement tmp = findElement( d->m_node, name.c_str(), - "id", QString::number( id ) ); - if( tmp.isNull() ) - { - return 0; - } - - d->m_node = tmp; - - return 1; -} - - -void QtXmlWrapper::exitbranch() -{ - d->m_node = d->m_node.parentNode().toElement(); -} - - -int QtXmlWrapper::getbranchid(int min, int max) const -{ - if( !d->m_node.isElement() ) - { - return min; - } - QDomElement tmp = d->m_node.toElement(); - if( !tmp.hasAttribute( "id" ) ) - { - return min; - } - int id = tmp.attribute( "id" ).toInt(); - if((min == 0) && (max == 0)) - return id; - - if(id < min) - id = min; - else - if(id > max) - id = max; - - return id; -} - -int QtXmlWrapper::getpar(const std::string &name, int defaultpar, int min, - int max) const -{ - QDomElement tmp = findElement( d->m_node, "par", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - int val = tmp.attribute( "value" ).toInt(); - if(val < min) - val = min; - else - if(val > max) - val = max; - - return val; -} - -int QtXmlWrapper::getpar127(const std::string &name, int defaultpar) const -{ - return getpar(name, defaultpar, 0, 127); -} - -int QtXmlWrapper::getparbool(const std::string &name, int defaultpar) const -{ - QDomElement tmp = findElement( d->m_node, "par_bool", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - const QString val = tmp.attribute( "value" ).toLower(); - if( val[0] == 'y' ) - { - return 1; - } - return 0; -} - -void QtXmlWrapper::getparstr(const std::string &name, char *par, int maxstrlen) const -{ - ZERO(par, maxstrlen); - QDomNode tmp = findElement( d->m_node, "string", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasChildNodes() ) - { - return; - } - - tmp = tmp.firstChild(); - if( tmp.nodeType() == QDomNode::ElementNode ) - { - snprintf(par, maxstrlen, "%s", tmp.toElement().tagName().toUtf8().constData() ); - return; - } - if( tmp.nodeType() == QDomNode::TextNode ) - { - snprintf(par, maxstrlen, "%s", tmp.toText().data().toUtf8().constData() ); - return; - } -} - -std::string QtXmlWrapper::getparstr(const std::string &name, - const std::string &defaultpar) const -{ - QDomNode tmp = findElement( d->m_node, "string", "name", name.c_str() ); - if( tmp.isNull() || !tmp.hasChildNodes() ) - { - return defaultpar; - } - - tmp = tmp.firstChild(); - if( tmp.nodeType() == QDomNode::ElementNode && !tmp.toElement().tagName().isEmpty() ) - { - return tmp.toElement().tagName().toUtf8().constData(); - } - if( tmp.nodeType() == QDomNode::TextNode && !tmp.toText().data().isEmpty() ) - { - return tmp.toText().data().toUtf8().constData(); - } - - return defaultpar; -} - -float QtXmlWrapper::getparreal(const char *name, float defaultpar) const -{ - QDomElement tmp = findElement( d->m_node, "par_real", "name", name ); - if( tmp.isNull() || !tmp.hasAttribute( "value" ) ) - { - return defaultpar; - } - - return tmp.attribute( "value" ).toFloat(); -} - -float QtXmlWrapper::getparreal(const char *name, - float defaultpar, - float min, - float max) const -{ - float result = getparreal(name, defaultpar); - - if(result < min) - result = min; - else - if(result > max) - result = max; - return result; -} - - -/** Private members **/ - -QDomElement XmlData::addparams(const char *name, unsigned int params, - ...) -{ - /**@todo make this function send out a good error message if something goes - * wrong**/ - QDomElement element = m_doc.createElement( name ); - m_node.appendChild( element ); - - if(params) { - va_list variableList; - va_start(variableList, params); - - const char *ParamName; - const char *ParamValue; - while(params--) { - ParamName = va_arg(variableList, const char *); - ParamValue = va_arg(variableList, const char *); - element.setAttribute( ParamName, ParamValue); - } - } - return element; -} - diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.h deleted file mode 100644 index 34922153050..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * QtXmlWrapper.h - a QtXml based XML backend for ZynAddSubxFX - * - * Copyright (c) 2009 Tobias Doerffel - * - * This file is part of LMMS - https://lmms.io - * - * 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. - * - * 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - -/* File derived from XMLwrapper.h: */ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.h - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef QT_XML_WRAPPER_H -#define QT_XML_WRAPPER_H - -#include "../globals.h" - -#include -#include -#include -#include - -#define QtXmlWrapper XMLwrapper - -struct XmlData; - -class QtXmlWrapper -{ -public: - QtXmlWrapper(); - ~QtXmlWrapper(); - - int saveXMLfile( const std::string & filename ) const; - int loadXMLfile( const std::string & filename ); - - char *getXMLdata() const; - bool putXMLdata( const char *xmldata ); - - void addpar( const std::string & name, int val ); - void addparreal( const std::string & name, float val); - void addparbool( const std::string & name, int val ); - void addparstr( const std::string & name, const std::string & val ); - - void beginbranch( const std::string & name ); - void beginbranch( const std::string & name, int id ); - void endbranch(); - - - int enterbranch( const std::string & name ); - int enterbranch( const std::string & name, int id ); - void exitbranch(); - int getbranchid( int min, int max ) const; - - int getpar( const std::string & name, int defaultpar, int min, int max ) const; - int getpar127( const std::string & name, int defaultpar ) const; - int getparbool( const std::string & name, int defaultpar ) const; - - void getparstr( const std::string & name, char * par, int maxstrlen ) const; - std::string getparstr( const std::string & name, const std::string & defaultpar ) const; - float getparreal( const char * name, float defaultpar ) const; - - float getparreal(const char *name, float defaultpar, float min, float max) const; - - bool minimal; /** -#include "Recorder.h" -#include "WavFile.h" -#include "../Nio/Nio.h" - -Recorder::Recorder() - :status(0), notetrigger(0) -{} - -Recorder::~Recorder() -{ - if(recording() == 1) - stop(); -} - -int Recorder::preparefile(std::string filename_, int overwrite) -{ - if(!overwrite) { - struct stat fileinfo; - int statr; - statr = stat(filename_.c_str(), &fileinfo); - if(statr == 0) //file exists - return 1; - } - - Nio::waveNew(new WavFile(filename_, synth->samplerate, 2)); - - status = 1; //ready - - return 0; -} - -void Recorder::start() -{ - notetrigger = 0; - status = 2; //recording -} - -void Recorder::stop() -{ - Nio::waveStop(); - Nio::waveStart(); - status = 0; -} - -void Recorder::pause() -{ - status = 0; - Nio::waveStop(); -} - -int Recorder::recording() -{ - if((status == 2) && (notetrigger != 0)) - return 1; - else - return 0; -} - -void Recorder::triggernow() -{ - if(status == 2) { - if(notetrigger != 1) - Nio::waveStart(); - notetrigger = 1; - } -} - -//TODO move recorder inside nio system diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Recorder.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Recorder.h deleted file mode 100644 index 0e3f02f1029..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Recorder.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Recorder.h - Records sound to a file - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef RECORDER_H -#define RECORDER_H -#include -#include "../globals.h" - -/**Records sound to a file*/ -class Recorder -{ - public: - - Recorder(); - ~Recorder(); - /**Prepare the given file. - * @returns 1 if the file exists */ - int preparefile(std::string filename_, int overwrite); - void start(); - void stop(); - void pause(); - int recording(); - void triggernow(); - - /** Status: - * 0 - not ready(no file selected), - * 1 - ready - * 2 - recording */ - int status; - - private: - int notetrigger; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.cpp deleted file mode 100644 index ac2f3172706..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Stereo.cpp - Object for storing a pair of objects - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -template -Stereo::Stereo(const T &left, const T &right) - :l(left), r(right) -{} - -template -Stereo::Stereo(const T &val) - :l(val), r(val) -{} - -template -Stereo &Stereo::operator=(const Stereo &nstr) -{ - l = nstr.l; - r = nstr.r; - return *this; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.h deleted file mode 100644 index 516d31870dc..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Stereo.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Stereo.h - Object for storing a pair of objects - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef STEREO_H -#define STEREO_H - -template -struct Stereo { - public: - Stereo(const T &left, const T &right); - - /**Initializes Stereo with left and right set to val - * @param val the value for both channels*/ - Stereo(const T &val); - ~Stereo() {} - - Stereo &operator=(const Stereo &smp); - - //data - T l, r; -}; -#include "Stereo.cpp" -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.cpp deleted file mode 100644 index 9025c622aca..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.cpp - Miscellaneous functions - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Util.h" -#include -#include -#include -#include -#ifndef WIN32 -#include -#endif - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SCHEDULER -#include -#endif - - -prng_t prng_state = 0x1234; - -Config config; -float *denormalkillbuf; - - -/* - * Transform the velocity according the scaling parameter (velocity sensing) - */ -float VelF(float velocity, unsigned char scaling) -{ - float x; - x = powf(VELOCITY_MAX_SCALE, (64.0f - scaling) / 64.0f); - if((scaling == 127) || (velocity > 0.99f)) - return 1.0f; - else - return powf(velocity, x); -} - -/* - * Get the detune in cents - */ -float getdetune(unsigned char type, - unsigned short int coarsedetune, - unsigned short int finedetune) -{ - float det = 0.0f, octdet = 0.0f, cdet = 0.0f, findet = 0.0f; - //Get Octave - int octave = coarsedetune / 1024; - if(octave >= 8) - octave -= 16; - octdet = octave * 1200.0f; - - //Coarse and fine detune - int cdetune = coarsedetune % 1024; - if(cdetune > 512) - cdetune -= 1024; - - int fdetune = finedetune - 8192; - - switch(type) { -// case 1: is used for the default (see below) - case 2: - cdet = fabs(cdetune * 10.0f); - findet = fabs(fdetune / 8192.0f) * 10.0f; - break; - case 3: - cdet = fabs(cdetune * 100); - findet = powf(10, fabs(fdetune / 8192.0f) * 3.0f) / 10.0f - 0.1f; - break; - case 4: - cdet = fabs(cdetune * 701.95500087f); //perfect fifth - findet = - (powf(2, fabs(fdetune / 8192.0f) * 12.0f) - 1.0f) / 4095 * 1200; - break; - //case ...: need to update N_DETUNE_TYPES, if you'll add more - default: - cdet = fabs(cdetune * 50.0f); - findet = fabs(fdetune / 8192.0f) * 35.0f; //almost like "Paul's Sound Designer 2" - break; - } - if(finedetune < 8192) - findet = -findet; - if(cdetune < 0) - cdet = -cdet; - - det = octdet + cdet + findet; - return det; -} - - -bool fileexists(const char *filename) -{ - struct stat tmp; - int result = stat(filename, &tmp); - if(result >= 0) - return true; - - return false; -} - -void set_realtime() -{ -#ifdef HAVE_SCHEDULER - sched_param sc; - sc.sched_priority = 60; - //if you want get "sched_setscheduler undeclared" from compilation, - //you can safely remove the folowing line: - sched_setscheduler(0, SCHED_FIFO, &sc); - //if (err==0) printf("Real-time"); -#endif -} - -void os_sleep(long length) -{ - usleep(length); -} - -std::string legalizeFilename(std::string filename) -{ - for(int i = 0; i < (int) filename.size(); ++i) { - char c = filename[i]; - if(!(isdigit(c) || isalpha(c) || (c == '-') || (c == ' '))) - filename[i] = '_'; - } - return filename; -} - -void invSignal(float *sig, size_t len) -{ - for(size_t i = 0; i < len; ++i) - sig[i] *= -1.0f; -} - -//Some memory pools for short term buffer use -//(avoid the use of new in RT thread(s)) - -struct pool_entry { - bool free; - float *dat; -}; -typedef std::vector pool_t; -typedef pool_t::iterator pool_itr_t; - -pool_t pool; - -float *getTmpBuffer() -{ - for(pool_itr_t itr = pool.begin(); itr != pool.end(); ++itr) - if(itr->free) { //Use Pool - itr->free = false; - return itr->dat; - } - pool_entry p; //Extend Pool - p.free = false; - p.dat = new float[synth->buffersize]; - pool.push_back(p); - - return p.dat; -} - -void returnTmpBuffer(float *buf) -{ - for(pool_itr_t itr = pool.begin(); itr != pool.end(); ++itr) - if(itr->dat == buf) { //Return to Pool - itr->free = true; - return; - } - fprintf(stderr, - "ERROR: invalid buffer returned %s %d\n", - __FILE__, - __LINE__); -} - -void clearTmpBuffers(void) -{ - for(pool_itr_t itr = pool.begin(); itr != pool.end(); ++itr) { -#ifndef WIN32 - if(!itr->free) //Warn about used buffers - warn("Temporary buffer (%p) about to be freed may be in use", - itr->dat); -#endif - delete [] itr->dat; - } - pool.clear(); -} - -float SYNTH_T::numRandom() -{ - return RND; -} - -float interpolate(const float *data, size_t len, float pos) -{ - assert(len > (size_t)pos + 1); - const int l_pos = (int)pos, - r_pos = l_pos + 1; - const float leftness = pos - l_pos; - return data[l_pos] * leftness + data[r_pos] * (1.0f - leftness); -} - -float cinterpolate(const float *data, size_t len, float pos) -{ - const int l_pos = ((int)pos) % len, - r_pos = (l_pos + 1) % len; - const float leftness = pos - l_pos; - return data[l_pos] * leftness + data[r_pos] * (1.0f - leftness); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.h deleted file mode 100644 index 0e67f03676b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/Util.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.h - Miscellaneous functions - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef UTIL_H -#define UTIL_H - -#include -#include -#include -#include "Config.h" -#include "../globals.h" - -//Velocity Sensing function -extern float VelF(float velocity, unsigned char scaling); - -bool fileexists(const char *filename); - -#define N_DETUNE_TYPES 4 //the number of detune types -extern float getdetune(unsigned char type, - unsigned short int coarsedetune, - unsigned short int finedetune); - -/**Try to set current thread to realtime priority program priority - * \todo see if the right pid is being sent - * \todo see if this is having desired effect, if not then look at - * pthread_attr_t*/ -void set_realtime(); - -/**Os independent sleep in microsecond*/ -void os_sleep(long length); - -std::string legalizeFilename(std::string filename); - -extern float *denormalkillbuf; /** -std::string stringFrom(T x) -{ - std::stringstream ss; - ss << x; - return ss.str(); -} - -template -T stringTo(const char *x) -{ - std::string str = x != NULL ? x : "0"; //should work for the basic float/int - std::stringstream ss(str); - T ans; - ss >> ans; - return ans; -} - -template -T limit(T val, T min, T max) -{ - return val < min ? min : (val > max ? max : val); -} - -//Random number generator - -typedef uint32_t prng_t; -extern prng_t prng_state; - -// Portable Pseudo-Random Number Generator -inline prng_t prng_r(prng_t &p) -{ - return p = p * 1103515245 + 12345; -} - -inline prng_t prng(void) -{ - return prng_r(prng_state) & 0x7fffffff; -} - -inline void sprng(prng_t p) -{ - prng_state = p; -} - -/* - * The random generator (0.0f..1.0f) - */ -#ifndef INT32_MAX -# define INT32_MAX (2147483647) -#endif -#define RND (prng() / (INT32_MAX * 1.0f)) - -//Linear Interpolation -float interpolate(const float *data, size_t len, float pos); - -//Linear circular interpolation -float cinterpolate(const float *data, size_t len, float pos); - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.cpp deleted file mode 100644 index 78db9d52ea8..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2006 Nasca Octavian Paul - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include "WavFile.h" -using namespace std; - -WavFile::WavFile(string filename, int samplerate, int channels) - :sampleswritten(0), samplerate(samplerate), channels(channels), - file(fopen(filename.c_str(), "w")) - -{ - if(file) { - cout << "INFO: Making space for wave file header" << endl; - //making space for the header written at destruction - char tmp[44]; - memset(tmp, 0, 44 * sizeof(char)); - fwrite(tmp, 1, 44, file); - } -} - -WavFile::~WavFile() -{ - if(file) { - cout << "INFO: Writing wave file header" << endl; - - unsigned int chunksize; - rewind(file); - - fwrite("RIFF", 4, 1, file); - chunksize = sampleswritten * 4 + 36; - fwrite(&chunksize, 4, 1, file); - - fwrite("WAVEfmt ", 8, 1, file); - chunksize = 16; - fwrite(&chunksize, 4, 1, file); - unsigned short int formattag = 1; //uncompresed wave - fwrite(&formattag, 2, 1, file); - unsigned short int nchannels = channels; //stereo - fwrite(&nchannels, 2, 1, file); - unsigned int samplerate_ = samplerate; //samplerate - fwrite(&samplerate_, 4, 1, file); - unsigned int bytespersec = samplerate * 2 * channels; //bytes/sec - fwrite(&bytespersec, 4, 1, file); - unsigned short int blockalign = 2 * channels; //2 channels * 16 bits/8 - fwrite(&blockalign, 2, 1, file); - unsigned short int bitspersample = 16; - fwrite(&bitspersample, 2, 1, file); - - fwrite("data", 4, 1, file); - chunksize = sampleswritten * blockalign; - fwrite(&chunksize, 4, 1, file); - - fclose(file); - file = NULL; - } -} - -bool WavFile::good() const -{ - return file; -} - -void WavFile::writeStereoSamples(int nsmps, short int *smps) -{ - if(file) { - fwrite(smps, nsmps, 4, file); - sampleswritten += nsmps; - } -} - -void WavFile::writeMonoSamples(int nsmps, short int *smps) -{ - if(file) { - fwrite(smps, nsmps, 2, file); - sampleswritten += nsmps; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.h deleted file mode 100644 index 4b29efa02b0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WavFile.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WavFile.h - Records sound to a file - Copyright (C) 2008 Nasca Octavian Paul - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef WAVFILE_H -#define WAVFILE_H -#include - -class WavFile -{ - public: - WavFile(std::string filename, int samplerate, int channels); - ~WavFile(); - - bool good() const; - - void writeMonoSamples(int nsmps, short int *smps); - void writeStereoSamples(int nsmps, short int *smps); - - private: - int sampleswritten; - int samplerate; - int channels; - FILE *file; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.cpp deleted file mode 100644 index cf281296090..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WaveShapeSmps.cpp - Sample Distortion - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "WaveShapeSmps.h" -#include - -void waveShapeSmps(int n, - float *smps, - unsigned char type, - unsigned char drive) -{ - int i; - float ws = drive / 127.0f; - float tmpv; - - switch(type) { - case 1: - ws = powf(10, ws * ws * 3.0f) - 1.0f + 0.001f; //Arctangent - for(i = 0; i < n; ++i) - smps[i] = atanf(smps[i] * ws) / atanf(ws); - break; - case 2: - ws = ws * ws * 32.0f + 0.0001f; //Asymmetric - if(ws < 1.0f) - tmpv = sinf(ws) + 0.1f; - else - tmpv = 1.1f; - for(i = 0; i < n; ++i) - smps[i] = sinf(smps[i] * (0.1f + ws - ws * smps[i])) / tmpv; - ; - break; - case 3: - ws = ws * ws * ws * 20.0f + 0.0001f; //Pow - for(i = 0; i < n; ++i) { - smps[i] *= ws; - if(fabs(smps[i]) < 1.0f) { - smps[i] = (smps[i] - powf(smps[i], 3.0f)) * 3.0f; - if(ws < 1.0f) - smps[i] /= ws; - } - else - smps[i] = 0.0f; - } - break; - case 4: - ws = ws * ws * ws * 32.0f + 0.0001f; //Sine - if(ws < 1.57f) - tmpv = sinf(ws); - else - tmpv = 1.0f; - for(i = 0; i < n; ++i) - smps[i] = sinf(smps[i] * ws) / tmpv; - break; - case 5: - ws = ws * ws + 0.000001f; //Quantisize - for(i = 0; i < n; ++i) - smps[i] = floor(smps[i] / ws + 0.5f) * ws; - break; - case 6: - ws = ws * ws * ws * 32 + 0.0001f; //Zigzag - if(ws < 1.0f) - tmpv = sinf(ws); - else - tmpv = 1.0f; - for(i = 0; i < n; ++i) - smps[i] = asinf(sinf(smps[i] * ws)) / tmpv; - break; - case 7: - ws = powf(2.0f, -ws * ws * 8.0f); //Limiter - for(i = 0; i < n; ++i) { - float tmp = smps[i]; - if(fabs(tmp) > ws) { - if(tmp >= 0.0f) - smps[i] = 1.0f; - else - smps[i] = -1.0f; - } - else - smps[i] /= ws; - } - break; - case 8: - ws = powf(2.0f, -ws * ws * 8.0f); //Upper Limiter - for(i = 0; i < n; ++i) { - float tmp = smps[i]; - if(tmp > ws) - smps[i] = ws; - smps[i] *= 2.0f; - } - break; - case 9: - ws = powf(2.0f, -ws * ws * 8.0f); //Lower Limiter - for(i = 0; i < n; ++i) { - float tmp = smps[i]; - if(tmp < -ws) - smps[i] = -ws; - smps[i] *= 2.0f; - } - break; - case 10: - ws = (powf(2.0f, ws * 6.0f) - 1.0f) / powf(2.0f, 6.0f); //Inverse Limiter - for(i = 0; i < n; ++i) { - float tmp = smps[i]; - if(fabs(tmp) > ws) { - if(tmp >= 0.0f) - smps[i] = tmp - ws; - else - smps[i] = tmp + ws; - } - else - smps[i] = 0; - } - break; - case 11: - ws = powf(5, ws * ws * 1.0f) - 1.0f; //Clip - for(i = 0; i < n; ++i) - smps[i] = smps[i] - * (ws + 0.5f) * 0.9999f - floor( - 0.5f + smps[i] * (ws + 0.5f) * 0.9999f); - break; - case 12: - ws = ws * ws * ws * 30 + 0.001f; //Asym2 - if(ws < 0.3f) - tmpv = ws; - else - tmpv = 1.0f; - for(i = 0; i < n; ++i) { - float tmp = smps[i] * ws; - if((tmp > -2.0f) && (tmp < 1.0f)) - smps[i] = tmp * (1.0f - tmp) * (tmp + 2.0f) / tmpv; - else - smps[i] = 0.0f; - } - break; - case 13: - ws = ws * ws * ws * 32.0f + 0.0001f; //Pow2 - if(ws < 1.0f) - tmpv = ws * (1 + ws) / 2.0f; - else - tmpv = 1.0f; - for(i = 0; i < n; ++i) { - float tmp = smps[i] * ws; - if((tmp > -1.0f) && (tmp < 1.618034f)) - smps[i] = tmp * (1.0f - tmp) / tmpv; - else - if(tmp > 0.0f) - smps[i] = -1.0f; - else - smps[i] = -2.0f; - } - break; - case 14: - ws = powf(ws, 5.0f) * 80.0f + 0.0001f; //sigmoid - if(ws > 10.0f) - tmpv = 0.5f; - else - tmpv = 0.5f - 1.0f / (expf(ws) + 1.0f); - for(i = 0; i < n; ++i) { - float tmp = smps[i] * ws; - if(tmp < -10.0f) - tmp = -10.0f; - else - if(tmp > 10.0f) - tmp = 10.0f; - tmp = 0.5f - 1.0f / (expf(tmp) + 1.0f); - smps[i] = tmp / tmpv; - } - break; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.h deleted file mode 100644 index 980eb28bc14..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/WaveShapeSmps.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WaveShapeSmps.h - Sample distortions - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef WAVESHAPESMPS_H -#define WAVESHAPESMPS_H - -//Waveshaping(called by Distorsion effect and waveshape from OscilGen) -void waveShapeSmps(int n, - float *smps, - unsigned char type, - unsigned char drive); - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.cpp deleted file mode 100644 index 6148d68de53..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.cpp - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "XMLwrapper.h" -#include -#include -#include -#include -#include -#include -#include - -#include "../globals.h" -#include "Util.h" - -using namespace std; - -int xml_k = 0; -bool verbose = false; - -const char *XMLwrapper_whitespace_callback(mxml_node_t *node, int where) -{ - const char *name = node->value.element.name; - - if((where == MXML_WS_BEFORE_OPEN) && (!strcmp(name, "?xml"))) - return NULL; - if((where == MXML_WS_BEFORE_CLOSE) && (!strcmp(name, "string"))) - return NULL; - - if((where == MXML_WS_BEFORE_OPEN) || (where == MXML_WS_BEFORE_CLOSE)) - /* const char *tmp=node->value.element.name; - if (tmp!=NULL) { - if ((strstr(tmp,"par")!=tmp)&&(strstr(tmp,"string")!=tmp)) { - printf("%s ",tmp); - if (where==MXML_WS_BEFORE_OPEN) xml_k++; - if (where==MXML_WS_BEFORE_CLOSE) xml_k--; - if (xml_k>=STACKSIZE) xml_k=STACKSIZE-1; - if (xml_k<0) xml_k=0; - printf("%d\n",xml_k); - printf("\n"); - }; - - }; - int i=0; - for (i=1;i(mxmlFindElement( - const_cast(node), - const_cast(top), - name, attr, value, descend)); -} - -//temporary const overload of mxmlElementGetAttr -const char *mxmlElementGetAttr(const mxml_node_t *node, const char *name) -{ - return mxmlElementGetAttr(const_cast(node), name); -} - -XMLwrapper::XMLwrapper() -{ - version.Major = 2; - version.Minor = 4; - version.Revision = 4; - - minimal = true; - - node = tree = mxmlNewElement(MXML_NO_PARENT, - "?xml version=\"1.0f\" encoding=\"UTF-8\"?"); - /* for mxml 2.1f (and older) - tree=mxmlNewElement(MXML_NO_PARENT,"?xml"); - mxmlElementSetAttr(tree,"version","1.0f"); - mxmlElementSetAttr(tree,"encoding","UTF-8"); - */ - - mxml_node_t *doctype = mxmlNewElement(tree, "!DOCTYPE"); - mxmlElementSetAttr(doctype, "ZynAddSubFX-data", NULL); - - node = root = addparams("ZynAddSubFX-data", 4, - "version-major", stringFrom( - version.Major).c_str(), - "version-minor", stringFrom( - version.Minor).c_str(), - "version-revision", - stringFrom(version.Revision).c_str(), - "ZynAddSubFX-author", "Nasca Octavian Paul"); - - //make the empty branch that will contain the information parameters - info = addparams("INFORMATION", 0); - - //save zynaddsubfx specifications - beginbranch("BASE_PARAMETERS"); - addpar("max_midi_parts", NUM_MIDI_PARTS); - addpar("max_kit_items_per_instrument", NUM_KIT_ITEMS); - - addpar("max_system_effects", NUM_SYS_EFX); - addpar("max_insertion_effects", NUM_INS_EFX); - addpar("max_instrument_effects", NUM_PART_EFX); - - addpar("max_addsynth_voices", NUM_VOICES); - endbranch(); -} - -XMLwrapper::~XMLwrapper() -{ - if(tree) - mxmlDelete(tree); -} - -void XMLwrapper::setPadSynth(bool enabled) -{ - /**@bug this might create multiple nodes when only one is needed*/ - mxml_node_t *oldnode = node; - node = info; - //Info storing - addparbool("PADsynth_used", enabled); - node = oldnode; -} - -bool XMLwrapper::hasPadSynth() const -{ - /**Right now this has a copied implementation of setparbool, so this should - * be reworked as XMLwrapper evolves*/ - mxml_node_t *tmp = mxmlFindElement(tree, - tree, - "INFORMATION", - NULL, - NULL, - MXML_DESCEND); - - mxml_node_t *parameter = mxmlFindElement(tmp, - tmp, - "par_bool", - "name", - "PADsynth_used", - MXML_DESCEND_FIRST); - if(parameter == NULL) //no information availiable - return false; - - const char *strval = mxmlElementGetAttr(parameter, "value"); - if(strval == NULL) //no information available - return false; - - if((strval[0] == 'Y') || (strval[0] == 'y')) - return true; - else - return false; -} - - -/* SAVE XML members */ - -int XMLwrapper::saveXMLfile(const string &filename) const -{ - char *xmldata = getXMLdata(); - if(xmldata == NULL) - return -2; - - int compression = config.cfg.GzipCompression; - int result = dosavefile(filename.c_str(), compression, xmldata); - - free(xmldata); - return result; -} - -char *XMLwrapper::getXMLdata() const -{ - xml_k = 0; - - char *xmldata = mxmlSaveAllocString(tree, XMLwrapper_whitespace_callback); - - return xmldata; -} - - -int XMLwrapper::dosavefile(const char *filename, - int compression, - const char *xmldata) const -{ - if(compression == 0) { - FILE *file; - file = fopen(filename, "w"); - if(file == NULL) - return -1; - fputs(xmldata, file); - fclose(file); - } - else { - if(compression > 9) - compression = 9; - if(compression < 1) - compression = 1; - char options[10]; - snprintf(options, 10, "wb%d", compression); - - gzFile gzfile; - gzfile = gzopen(filename, options); - if(gzfile == NULL) - return -1; - gzputs(gzfile, xmldata); - gzclose(gzfile); - } - - return 0; -} - - - -void XMLwrapper::addpar(const string &name, int val) -{ - addparams("par", 2, "name", name.c_str(), "value", stringFrom( - val).c_str()); -} - -void XMLwrapper::addparreal(const string &name, float val) -{ - addparams("par_real", 2, "name", name.c_str(), "value", - stringFrom(val).c_str()); -} - -void XMLwrapper::addparbool(const string &name, int val) -{ - if(val != 0) - addparams("par_bool", 2, "name", name.c_str(), "value", "yes"); - else - addparams("par_bool", 2, "name", name.c_str(), "value", "no"); -} - -void XMLwrapper::addparstr(const string &name, const string &val) -{ - mxml_node_t *element = mxmlNewElement(node, "string"); - mxmlElementSetAttr(element, "name", name.c_str()); - mxmlNewText(element, 0, val.c_str()); -} - - -void XMLwrapper::beginbranch(const string &name) -{ - if(verbose) - cout << "beginbranch()" << name << endl; - node = addparams(name.c_str(), 0); -} - -void XMLwrapper::beginbranch(const string &name, int id) -{ - if(verbose) - cout << "beginbranch(" << id << ")" << name << endl; - node = addparams(name.c_str(), 1, "id", stringFrom(id).c_str()); -} - -void XMLwrapper::endbranch() -{ - if(verbose) - cout << "endbranch()" << node << "-" << node->value.element.name - << " To " - << node->parent << "-" << node->parent->value.element.name << endl; - node = node->parent; -} - - -//workaround for memory leak -const char *trimLeadingWhite(const char *c) -{ - while(isspace(*c)) - ++c; - return c; -} - -/* LOAD XML members */ - -int XMLwrapper::loadXMLfile(const string &filename) -{ - if(tree != NULL) - mxmlDelete(tree); - tree = NULL; - - const char *xmldata = doloadfile(filename.c_str()); - if(xmldata == NULL) - return -1; //the file could not be loaded or uncompressed - - root = tree = mxmlLoadString(NULL, trimLeadingWhite( - xmldata), MXML_OPAQUE_CALLBACK); - - delete[] xmldata; - - if(tree == NULL) - return -2; //this is not XML - - node = root = mxmlFindElement(tree, - tree, - "ZynAddSubFX-data", - NULL, - NULL, - MXML_DESCEND); - if(root == NULL) - return -3; //the XML doesnt embbed zynaddsubfx data - - //fetch version information - version.Major = stringTo(mxmlElementGetAttr(root, "version-major")); - version.Minor = stringTo(mxmlElementGetAttr(root, "version-minor")); - version.Revision = - stringTo(mxmlElementGetAttr(root, "version-revision")); - - if(verbose) - cout << "loadXMLfile() version: " << version.Major << '.' - << version.Minor << '.' << version.Revision << endl; - - return 0; -} - - -char *XMLwrapper::doloadfile(const string &filename) const -{ - char *xmldata = NULL; - gzFile gzfile = gzopen(filename.c_str(), "rb"); - - if(gzfile != NULL) { //The possibly compressed file opened - stringstream strBuf; //reading stream - const int bufSize = 500; //fetch size - char fetchBuf[bufSize + 1]; //fetch buffer - int read = 0; //chars read in last fetch - - fetchBuf[bufSize] = 0; //force null termination - - while(bufSize == (read = gzread(gzfile, fetchBuf, bufSize))) - strBuf << fetchBuf; - - fetchBuf[read] = 0; //Truncate last partial read - strBuf << fetchBuf; - - gzclose(gzfile); - - //Place data in output format - string tmp = strBuf.str(); - xmldata = new char[tmp.size() + 1]; - strncpy(xmldata, tmp.c_str(), tmp.size() + 1); - } - - return xmldata; -} - -bool XMLwrapper::putXMLdata(const char *xmldata) -{ - if(tree != NULL) - mxmlDelete(tree); - - tree = NULL; - if(xmldata == NULL) - return false; - - root = tree = mxmlLoadString(NULL, trimLeadingWhite( - xmldata), MXML_OPAQUE_CALLBACK); - if(tree == NULL) - return false; - - node = root = mxmlFindElement(tree, - tree, - "ZynAddSubFX-data", - NULL, - NULL, - MXML_DESCEND); - if(root == NULL) - return false; - - return true; -} - - - -int XMLwrapper::enterbranch(const string &name) -{ - if(verbose) - cout << "enterbranch() " << name << endl; - mxml_node_t *tmp = mxmlFindElement(node, node, - name.c_str(), NULL, NULL, - MXML_DESCEND_FIRST); - if(tmp == NULL) - return 0; - - node = tmp; - return 1; -} - -int XMLwrapper::enterbranch(const string &name, int id) -{ - if(verbose) - cout << "enterbranch(" << id << ") " << name << endl; - mxml_node_t *tmp = mxmlFindElement(node, node, - name.c_str(), "id", stringFrom( - id).c_str(), MXML_DESCEND_FIRST); - if(tmp == NULL) - return 0; - - node = tmp; - return 1; -} - - -void XMLwrapper::exitbranch() -{ - if(verbose) - cout << "exitbranch()" << node << "-" << node->value.element.name - << " To " - << node->parent << "-" << node->parent->value.element.name << endl; - node = node->parent; -} - - -int XMLwrapper::getbranchid(int min, int max) const -{ - int id = stringTo(mxmlElementGetAttr(node, "id")); - if((min == 0) && (max == 0)) - return id; - - if(id < min) - id = min; - else - if(id > max) - id = max; - - return id; -} - -int XMLwrapper::getpar(const string &name, int defaultpar, int min, - int max) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - int val = stringTo(strval); - if(val < min) - val = min; - else - if(val > max) - val = max; - - return val; -} - -int XMLwrapper::getpar127(const string &name, int defaultpar) const -{ - return getpar(name, defaultpar, 0, 127); -} - -int XMLwrapper::getparbool(const string &name, int defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par_bool", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - if((strval[0] == 'Y') || (strval[0] == 'y')) - return 1; - else - return 0; -} - -void XMLwrapper::getparstr(const string &name, char *par, int maxstrlen) const -{ - ZERO(par, maxstrlen); - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "string", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if(tmp == NULL) - return; - if(tmp->child == NULL) - return; - if(tmp->child->type == MXML_OPAQUE) { - snprintf(par, maxstrlen, "%s", tmp->child->value.element.name); - return; - } - if((tmp->child->type == MXML_TEXT) - && (tmp->child->value.text.string != NULL)) { - snprintf(par, maxstrlen, "%s", tmp->child->value.text.string); - return; - } -} - -string XMLwrapper::getparstr(const string &name, - const std::string &defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "string", - "name", - name.c_str(), - MXML_DESCEND_FIRST); - - if((tmp == NULL) || (tmp->child == NULL)) - return defaultpar; - - if((tmp->child->type == MXML_OPAQUE) - && (tmp->child->value.element.name != NULL)) - return tmp->child->value.element.name; - - if((tmp->child->type == MXML_TEXT) - && (tmp->child->value.text.string != NULL)) - return tmp->child->value.text.string; - - return defaultpar; -} - -float XMLwrapper::getparreal(const char *name, float defaultpar) const -{ - const mxml_node_t *tmp = mxmlFindElement(node, - node, - "par_real", - "name", - name, - MXML_DESCEND_FIRST); - if(tmp == NULL) - return defaultpar; - - const char *strval = mxmlElementGetAttr(tmp, "value"); - if(strval == NULL) - return defaultpar; - - return stringTo(strval); -} - -float XMLwrapper::getparreal(const char *name, - float defaultpar, - float min, - float max) const -{ - float result = getparreal(name, defaultpar); - - if(result < min) - result = min; - else - if(result > max) - result = max; - return result; -} - - -/** Private members **/ - -mxml_node_t *XMLwrapper::addparams(const char *name, unsigned int params, - ...) const -{ - /**@todo make this function send out a good error message if something goes - * wrong**/ - mxml_node_t *element = mxmlNewElement(node, name); - - if(params) { - va_list variableList; - va_start(variableList, params); - - const char *ParamName; - const char *ParamValue; - while(params--) { - ParamName = va_arg(variableList, const char *); - ParamValue = va_arg(variableList, const char *); - if(verbose) - cout << "addparams()[" << params << "]=" << name << " " - << ParamName << "=\"" << ParamValue << "\"" << endl; - mxmlElementSetAttr(element, ParamName, ParamValue); - } - } - return element; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.h b/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.h deleted file mode 100644 index d046888b01c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Misc/XMLwrapper.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.h - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Copyright (C) 2009-2009 Mark McCurry - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#if 1 -#include "QtXmlWrapper.h" -#else -#include -#include -#ifndef float -#define float float -#endif - -#ifndef XML_WRAPPER_H -#define XML_WRAPPER_H - -/**Mxml wrapper*/ -class XMLwrapper -{ - public: - /** - * Constructor. - * Will Construct the object and fill in top level branch - * */ - XMLwrapper(); - - /**Destructor*/ - ~XMLwrapper(); - - /** - * Saves the XML to a file. - * @param filename the name of the destination file. - * @returns 0 if ok or -1 if the file cannot be saved. - */ - int saveXMLfile(const std::string &filename) const; - - /** - * Return XML tree as a string. - * Note: The string must be freed with free() to deallocate - * @returns a newly allocated NULL terminated string of the XML data. - */ - char *getXMLdata() const; - - /** - * Add simple parameter. - * @param name The name of the mXML node. - * @param val The string value of the mXml node - */ - void addpar(const std::string &name, int val); - - /** - * Adds a realtype parameter. - * @param name The name of the mXML node. - * @param val The float value of the node. - */ - void addparreal(const std::string &name, float val); - - /** - * Add boolean parameter. - * \todo Fix this reverse boolean logic. - * @param name The name of the mXML node. - * @param val The boolean value of the node (0->"yes";else->"no"). - */ - void addparbool(const std::string &name, int val); - - /** - * Add string parameter. - * @param name The name of the mXML node. - * @param val The string value of the node. - */ - void addparstr(const std::string &name, const std::string &val); - - /** - * Create a new branch. - * @param name Name of new branch - * @see void endbranch() - */ - void beginbranch(const std::string &name); - /** - * Create a new branch. - * @param name Name of new branch - * @param id "id" value of branch - * @see void endbranch() - */ - void beginbranch(const std::string &name, int id); - - /**Closes new branches. - * This must be called to exit each branch created by beginbranch( ). - * @see void beginbranch(const std::string &name) - * @see void beginbranch(const std::string &name, int id) - */ - void endbranch(); - - /** - * Loads file into XMLwrapper. - * @param filename file to be loaded - * @returns 0 if ok or -1 if the file cannot be loaded - */ - int loadXMLfile(const std::string &filename); - - /** - * Loads string into XMLwrapper. - * @param xmldata NULL terminated string of XML data. - * @returns true if successful. - */ - bool putXMLdata(const char *xmldata); - - /** - * Enters the branch. - * @param name Name of branch. - * @returns 1 if is ok, or 0 otherwise. - */ - int enterbranch(const std::string &name); - - /** - * Enter into the branch \c name with id \c id. - * @param name Name of branch. - * @param id Value of branch's "id". - * @returns 1 if is ok, or 0 otherwise. - */ - int enterbranch(const std::string &name, int id); - - /**Exits from a branch*/ - void exitbranch(); - - /**Get the the branch_id and limits it between the min and max. - * if min==max==0, it will not limit it - * if there isn't any id, will return min - * this must be called only imediately after enterbranch() - */ - int getbranchid(int min, int max) const; - - /** - * Returns the integer value stored in node name. - * It returns the integer value between the limits min and max. - * If min==max==0, then the value will not be limited. - * If there is no location named name, then defaultpar will be returned. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - * @param min The minimum return value. - * @param max The maximum return value. - */ - int getpar(const std::string &name, int defaultpar, int min, - int max) const; - - /** - * Returns the integer value stored in the node with range [0,127]. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - int getpar127(const std::string &name, int defaultpar) const; - - /** - * Returns the boolean value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - int getparbool(const std::string &name, int defaultpar) const; - - /** - * Get the string value stored in the node. - * @param name The parameter name. - * @param par Pointer to destination string - * @param maxstrlen Max string length for destination - */ - void getparstr(const std::string &name, char *par, int maxstrlen) const; - - /** - * Get the string value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - std::string getparstr(const std::string &name, - const std::string &defaultpar) const; - - /** - * Returns the real value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - */ - float getparreal(const char *name, float defaultpar) const; - - /** - * Returns the real value stored in the node. - * @param name The parameter name. - * @param defaultpar The default value if the real value is not found. - * @param min The minimum value - * @param max The maximum value - */ - float getparreal(const char *name, - float defaultpar, - float min, - float max) const; - - bool minimal; /** - * - * @param name The name of the xml node - * @param params The number of the attributes - * @param ... const char * pairs that are in the format attribute_name, - * attribute_value - */ - mxml_node_t *addparams(const char *name, unsigned int params, - ...) const; - - /**@todo keep these numbers up to date*/ - struct { - int Major; /**. -*/ - -#include -#include - -using namespace std; - -#include "../Misc/Util.h" -#include "../Misc/Config.h" -#include "InMgr.h" -#include "AlsaEngine.h" - -AlsaEngine::AlsaEngine() - :AudioOut() -{ - audio.buffer = new short[synth->buffersize * 2]; - name = "ALSA"; - audio.handle = NULL; - - midi.handle = NULL; - midi.alsaId = -1; - midi.pThread = 0; -} - -AlsaEngine::~AlsaEngine() -{ - Stop(); - delete[] audio.buffer; -} - -void *AlsaEngine::_AudioThread(void *arg) -{ - return (static_cast(arg))->AudioThread(); -} - -void *AlsaEngine::AudioThread() -{ - set_realtime(); - return processAudio(); -} - -bool AlsaEngine::Start() -{ - return openAudio() && openMidi(); -} - -void AlsaEngine::Stop() -{ - if(getMidiEn()) - setMidiEn(false); - if(getAudioEn()) - setAudioEn(false); - snd_config_update_free_global(); -} - -void AlsaEngine::setMidiEn(bool nval) -{ - if(nval) - openMidi(); - else - stopMidi(); -} - -bool AlsaEngine::getMidiEn() const -{ - return midi.handle; -} - -void AlsaEngine::setAudioEn(bool nval) -{ - if(nval) - openAudio(); - else - stopAudio(); -} - -bool AlsaEngine::getAudioEn() const -{ - return audio.handle; -} - -void *AlsaEngine::_MidiThread(void *arg) -{ - return static_cast(arg)->MidiThread(); -} - - -void *AlsaEngine::MidiThread(void) -{ - snd_seq_event_t *event; - MidiEvent ev; - set_realtime(); - while(snd_seq_event_input(midi.handle, &event) > 0) { - //ensure ev is empty - ev.channel = 0; - ev.num = 0; - ev.value = 0; - ev.type = 0; - - if(!event) - continue; - switch(event->type) { - case SND_SEQ_EVENT_NOTEON: - if(event->data.note.note) { - ev.type = M_NOTE; - ev.channel = event->data.note.channel; - ev.num = event->data.note.note; - ev.value = event->data.note.velocity; - InMgr::getInstance().putEvent(ev); - } - break; - - case SND_SEQ_EVENT_NOTEOFF: - ev.type = M_NOTE; - ev.channel = event->data.note.channel; - ev.num = event->data.note.note; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_KEYPRESS: - ev.type = M_PRESSURE; - ev.channel = event->data.note.channel; - ev.num = event->data.note.note; - ev.value = event->data.note.velocity; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_PITCHBEND: - ev.type = M_CONTROLLER; - ev.channel = event->data.control.channel; - ev.num = C_pitchwheel; - ev.value = event->data.control.value; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_CONTROLLER: - ev.type = M_CONTROLLER; - ev.channel = event->data.control.channel; - ev.num = event->data.control.param; - ev.value = event->data.control.value; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_PGMCHANGE: - ev.type = M_PGMCHANGE; - ev.channel = event->data.control.channel; - ev.num = event->data.control.value; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_RESET: // reset to power-on state - ev.type = M_CONTROLLER; - ev.channel = event->data.control.channel; - ev.num = C_resetallcontrollers; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - - case SND_SEQ_EVENT_PORT_SUBSCRIBED: // ports connected - if(true) - cout << "Info, alsa midi port connected" << endl; - break; - - case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: // ports disconnected - if(true) - cout << "Info, alsa midi port disconnected" << endl; - break; - - case SND_SEQ_EVENT_SYSEX: // system exclusive - case SND_SEQ_EVENT_SENSING: // midi device still there - break; - - default: - if(true) - cout << "Info, other non-handled midi event, type: " - << (int)event->type << endl; - break; - } - snd_seq_free_event(event); - } - return NULL; -} - -bool AlsaEngine::openMidi() -{ - if(getMidiEn()) - return true; - - int alsaport; - midi.handle = NULL; - - if(snd_seq_open(&midi.handle, "default", SND_SEQ_OPEN_INPUT, 0) != 0) - return false; - - snd_seq_set_client_name(midi.handle, "ZynAddSubFX"); - - alsaport = snd_seq_create_simple_port( - midi.handle, - "ZynAddSubFX", - SND_SEQ_PORT_CAP_WRITE - | SND_SEQ_PORT_CAP_SUBS_WRITE, - SND_SEQ_PORT_TYPE_SYNTH); - if(alsaport < 0) - return false; - - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&midi.pThread, &attr, _MidiThread, this); - return true; -} - -void AlsaEngine::stopMidi() -{ - if(!getMidiEn()) - return; - - snd_seq_t *handle = midi.handle; - if((NULL != midi.handle) && midi.pThread) - pthread_cancel(midi.pThread); - midi.handle = NULL; - if(handle) - snd_seq_close(handle); -} - -short *AlsaEngine::interleave(const Stereo &smps) -{ - /**\todo TODO fix repeated allocation*/ - short *shortInterleaved = audio.buffer; - memset(shortInterleaved, 0, bufferSize * 2 * sizeof(short)); - int idx = 0; //possible off by one error here - double scaled; - for(int frame = 0; frame < bufferSize; ++frame) { // with a nod to libsamplerate ... - scaled = smps.l[frame] * (8.0f * 0x10000000); - shortInterleaved[idx++] = (short int)(lrint(scaled) >> 16); - scaled = smps.r[frame] * (8.0f * 0x10000000); - shortInterleaved[idx++] = (short int)(lrint(scaled) >> 16); - } - return shortInterleaved; -} - -bool AlsaEngine::openAudio() -{ - if(getAudioEn()) - return true; - - int rc = 0; - /* Open PCM device for playback. */ - audio.handle = NULL; - rc = snd_pcm_open(&audio.handle, "hw:0", - SND_PCM_STREAM_PLAYBACK, 0); - if(rc < 0) { - fprintf(stderr, - "unable to open pcm device: %s\n", - snd_strerror(rc)); - return false; - } - - /* Allocate a hardware parameters object. */ - snd_pcm_hw_params_alloca(&audio.params); - - /* Fill it in with default values. */ - snd_pcm_hw_params_any(audio.handle, audio.params); - - /* Set the desired hardware parameters. */ - - /* Interleaved mode */ - snd_pcm_hw_params_set_access(audio.handle, audio.params, - SND_PCM_ACCESS_RW_INTERLEAVED); - - /* Signed 16-bit little-endian format */ - snd_pcm_hw_params_set_format(audio.handle, audio.params, - SND_PCM_FORMAT_S16_LE); - - /* Two channels (stereo) */ - snd_pcm_hw_params_set_channels(audio.handle, audio.params, 2); - - audio.sampleRate = synth->samplerate; - snd_pcm_hw_params_set_rate_near(audio.handle, audio.params, - &audio.sampleRate, NULL); - - audio.frames = 512; - snd_pcm_hw_params_set_period_size_near(audio.handle, - audio.params, &audio.frames, NULL); - - audio.periods = 4; - snd_pcm_hw_params_set_periods_near(audio.handle, - audio.params, &audio.periods, NULL); - - /* Write the parameters to the driver */ - rc = snd_pcm_hw_params(audio.handle, audio.params); - if(rc < 0) { - fprintf(stderr, - "unable to set hw parameters: %s\n", - snd_strerror(rc)); - return false; - } - - /* Set buffer size (in frames). The resulting latency is given by */ - /* latency = periodsize * periods / (rate * bytes_per_frame) */ - snd_pcm_hw_params_set_buffer_size(audio.handle, - audio.params, - synth->buffersize); - - //snd_pcm_hw_params_get_period_size(audio.params, &audio.frames, NULL); - //snd_pcm_hw_params_get_period_time(audio.params, &val, NULL); - - - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(&audio.pThread, &attr, _AudioThread, this); - return true; -} - -void AlsaEngine::stopAudio() -{ - if(!getAudioEn()) - return; - - snd_pcm_t *handle = audio.handle; - audio.handle = NULL; - pthread_join(audio.pThread, NULL); - snd_pcm_drain(handle); - if(snd_pcm_close(handle)) - cout << "Error: in snd_pcm_close " << __LINE__ << ' ' << __FILE__ - << endl; -} - -void *AlsaEngine::processAudio() -{ - while(audio.handle) { - audio.buffer = interleave(getNext()); - snd_pcm_t *handle = audio.handle; - int rc = snd_pcm_writei(handle, audio.buffer, synth->buffersize); - if(rc == -EPIPE) { - /* EPIPE means underrun */ - cerr << "underrun occurred" << endl; - snd_pcm_prepare(handle); - } - else - if(rc < 0) - cerr << "error from writei: " << snd_strerror(rc) << endl; - } - return NULL; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AlsaEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AlsaEngine.h deleted file mode 100644 index 3414f45ed3e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AlsaEngine.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - AlsaEngine.h - - Copyright 2009, Alan Calvert - 2010, Mark McCurry - - This file is part of ZynAddSubFX, which 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. - - ZynAddSubFX 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with ZynAddSubFX. If not, see . -*/ - -#ifndef ALSA_ENGINE_H -#define ALSA_ENGINE_H - -#include -#include -#include -#include - -#include "AudioOut.h" -#include "MidiIn.h" -#include "OutMgr.h" -#include "../Misc/Stereo.h" - -class AlsaEngine:public AudioOut, MidiIn -{ - public: - AlsaEngine(); - ~AlsaEngine(); - - bool Start(); - void Stop(); - - void setAudioEn(bool nval); - bool getAudioEn() const; - void setMidiEn(bool nval); - bool getMidiEn() const; - - protected: - void *AudioThread(); - static void *_AudioThread(void *arg); - void *MidiThread(); - static void *_MidiThread(void *arg); - - private: - bool openMidi(); - void stopMidi(); - bool openAudio(); - void stopAudio(); - - short *interleave(const Stereo &smps); - - struct { - std::string device; - snd_seq_t *handle; - int alsaId; - pthread_t pThread; - } midi; - - struct { - snd_pcm_t *handle; - snd_pcm_hw_params_t *params; - unsigned int sampleRate; - snd_pcm_uframes_t frames; - unsigned int periods; - short *buffer; - pthread_t pThread; - } audio; - - void *processAudio(); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.cpp deleted file mode 100644 index 8c4f2d4497c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AudioOut.h - Audio Output superclass - Copyright (C) 2009-2010 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "SafeQueue.h" - -using namespace std; - -#include "OutMgr.h" -#include "../Misc/Master.h" -#include "AudioOut.h" - -AudioOut::AudioOut() - :samplerate(synth->samplerate), bufferSize(synth->buffersize) -{} - -AudioOut::~AudioOut() -{} - -void AudioOut::setSamplerate(int _samplerate) -{ - samplerate = _samplerate; -} - -int AudioOut::getSampleRate() -{ - return samplerate; -} - -void AudioOut::setBufferSize(int _bufferSize) -{ - bufferSize = _bufferSize; -} - -const Stereo AudioOut::getNext() -{ - return OutMgr::getInstance().tick(bufferSize); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.h deleted file mode 100644 index f8e1a97ed5f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/AudioOut.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AudioOut.h - Audio Output superclass - Copyright (C) 2009-2010 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef AUDIO_OUT_H -#define AUDIO_OUT_H - -#include "../Misc/Stereo.h" -#include "../globals.h" -#include "Engine.h" - -class AudioOut:public virtual Engine -{ - public: - AudioOut(); - virtual ~AudioOut(); - - /**Sets the Sample Rate of this Output - * (used for getNext()).*/ - void setSamplerate(int _samplerate); - - /**Sets the Samples required per Out of this driver - * not a realtime opperation */ - int getSampleRate(); - void setBufferSize(int _bufferSize); - - /**Sets the Frame Size for output*/ - void bufferingSize(int nBuffering); - int bufferingSize(); - - virtual void setAudioEn(bool nval) = 0; - virtual bool getAudioEn() const = 0; - - protected: - /**Get the next sample for output. - * (has nsamples sampled at a rate of samplerate)*/ - const Stereo getNext(); - - int samplerate; - int bufferSize; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/CMakeLists.txt deleted file mode 100644 index 9386610b7ab..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -#Defaults: -# - Wave Output (enabled with the record function) -# - Null Output -# - Null Output Running by default -# - Managed with OutMgr -set(zynaddsubfx_nio_SRCS - WavEngine.cpp - NulEngine.cpp - AudioOut.cpp - MidiIn.cpp - OutMgr.cpp - InMgr.cpp - Engine.cpp - EngineMgr.cpp - Nio.cpp - ) - -set(zynaddsubfx_nio_lib ) - -add_definitions(-DOUT_DEFAULT="${DefaultOutput}") -add_definitions(-DIN_DEFAULT="${DefaultInput}") - -if(JackEnable) - include_directories(${JACK_INCLUDE_DIR}) - list(APPEND zynaddsubfx_nio_SRCS JackEngine.cpp) - list(APPEND zynaddsubfx_nio_lib ${JACK_LIBRARIES}) -endif(JackEnable) - -if(PaEnable) - include_directories(${PORTAUDIO_INCLUDE_DIR}) - list(APPEND zynaddsubfx_nio_SRCS PaEngine.cpp) - list(APPEND zynaddsubfx_nio_lib ${PORTAUDIO_LIBRARIES}) -endif(PaEnable) - -if(AlsaEnable) - list(APPEND zynaddsubfx_nio_SRCS AlsaEngine.cpp) - list(APPEND zynaddsubfx_nio_lib ${ASOUND_LIBRARY}) -endif(AlsaEnable) - -if(OssEnable) - list(APPEND zynaddsubfx_nio_SRCS OssEngine.cpp) -endif(OssEnable) - - -add_library(zynaddsubfx_nio STATIC - ${zynaddsubfx_nio_SRCS} - ) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.cpp deleted file mode 100644 index 5e846b70898..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Engine.cpp - Audio Driver base class - Copyright (C) 2009-2010 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include "Engine.h" - -Engine::Engine() -{} - -Engine::~Engine() -{} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.h deleted file mode 100644 index 9de4422c7ab..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Engine.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Engine.h - Audio Driver base class - Copyright (C) 2009-2010 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ENGINE_H -#define ENGINE_H -#include -/**Marker for input/output driver*/ -class Engine -{ - public: - Engine(); - virtual ~Engine(); - - /**Start the Driver with all capabilities - * @return true on success*/ - virtual bool Start() = 0; - /**Completely stop the Driver*/ - virtual void Stop() = 0; - - std::string name; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.cpp deleted file mode 100644 index ee8f7b92454..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include "EngineMgr.h" -#include -#include -#include "Nio.h" -#include "InMgr.h" -#include "OutMgr.h" -#include "AudioOut.h" -#include "MidiIn.h" -#include "NulEngine.h" -#if OSS -#include "OssEngine.h" -#endif -#if ALSA -#include "AlsaEngine.h" -#endif -#if JACK -#include "JackEngine.h" -#endif -#if PORTAUDIO -#include "PaEngine.h" -#endif - -using namespace std; - -EngineMgr &EngineMgr::getInstance() -{ - static EngineMgr instance; - return instance; -} - -EngineMgr::EngineMgr() -{ - Engine *defaultEng = new NulEngine(); - - //conditional compiling mess (but contained) - engines.push_back(defaultEng); -#if OSS - engines.push_back(new OssEngine()); -#endif -#if ALSA - engines.push_back(new AlsaEngine()); -#endif -#if JACK - engines.push_back(new JackEngine()); -#endif -#if PORTAUDIO - engines.push_back(new PaEngine()); -#endif - - defaultOut = dynamic_cast(defaultEng); - - defaultIn = dynamic_cast(defaultEng); - - //Accept command line/compile time options - if(!Nio::defaultSink.empty()) - setOutDefault(Nio::defaultSink); - - if(!Nio::defaultSource.empty()) - setInDefault(Nio::defaultSource); -} - -EngineMgr::~EngineMgr() -{ - for(list::iterator itr = engines.begin(); - itr != engines.end(); ++itr) - delete *itr; -} - -Engine *EngineMgr::getEng(string name) -{ - transform(name.begin(), name.end(), name.begin(), ::toupper); - for(list::iterator itr = engines.begin(); - itr != engines.end(); ++itr) - if((*itr)->name == name) - return *itr; - return NULL; -} - -bool EngineMgr::start() -{ - bool expected = true; - if(!(defaultOut && defaultIn)) { - cerr << "ERROR: It looks like someone broke the Nio Output\n" - << " Attempting to recover by defaulting to the\n" - << " Null Engine." << endl; - defaultOut = dynamic_cast(getEng("NULL")); - defaultIn = dynamic_cast(getEng("NULL")); - } - - OutMgr::getInstance(). currentOut = defaultOut; - InMgr::getInstance(). current = defaultIn; - - //open up the default output(s) - cout << "Starting Audio: " << defaultOut->name << endl; - defaultOut->setAudioEn(true); - if(defaultOut->getAudioEn()) - cout << "Audio Started" << endl; - else { - expected = false; - cerr << "ERROR: The default audio output failed to open!" << endl; - OutMgr::getInstance(). currentOut = - dynamic_cast(getEng("NULL")); - OutMgr::getInstance(). currentOut->setAudioEn(true); - } - - cout << "Starting MIDI: " << defaultIn->name << endl; - defaultIn->setMidiEn(true); - if(defaultIn->getMidiEn()) - cout << "MIDI Started" << endl; - else { //recover - expected = false; - cerr << "ERROR: The default MIDI input failed to open!" << endl; - InMgr::getInstance(). current = dynamic_cast(getEng("NULL")); - InMgr::getInstance(). current->setMidiEn(true); - } - - //Show if expected drivers were booted - return expected; -} - -void EngineMgr::stop() -{ - for(list::iterator itr = engines.begin(); - itr != engines.end(); ++itr) - (*itr)->Stop(); -} - -bool EngineMgr::setInDefault(string name) -{ - MidiIn *chosen; - if((chosen = dynamic_cast(getEng(name)))) { //got the input - defaultIn = chosen; - return true; - } - - //Warn user - cerr << "Error: " << name << " is not a recognized MIDI input source" - << endl; - cerr << " Defaulting to the NULL input source" << endl; - - return false; -} - -bool EngineMgr::setOutDefault(string name) -{ - AudioOut *chosen; - if((chosen = dynamic_cast(getEng(name)))) { //got the output - defaultOut = chosen; - return true; - } - - //Warn user - cerr << "Error: " << name << " is not a recognized audio backend" << endl; - cerr << " Defaulting to the NULL audio backend" << endl; - return false; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.h deleted file mode 100644 index 4d56d299393..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/EngineMgr.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef ENGINE_MGR_H -#define ENGINE_MGR_H - -#include -#include -#include "Engine.h" - - -class MidiIn; -class AudioOut; -class OutMgr; -/**Container/Owner of the long lived Engines*/ -class EngineMgr -{ - public: - static EngineMgr &getInstance(); - ~EngineMgr(); - - /**Gets requested engine - * @param name case unsensitive name of engine - * @return pointer to Engine or NULL - */ - Engine *getEng(std::string name); - - /**Start up defaults*/ - bool start(); - - /**Stop all engines*/ - void stop(); - - std::list engines; - - //return false on failure - bool setInDefault(std::string name); - bool setOutDefault(std::string name); - - //default I/O - AudioOut *defaultOut; - MidiIn *defaultIn; - private: - EngineMgr(); -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.cpp deleted file mode 100644 index 441a6dcdfae..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "InMgr.h" -#include "MidiIn.h" -#include "EngineMgr.h" -#include "../Misc/Master.h" -#include - -using namespace std; - -ostream &operator<<(ostream &out, const MidiEvent &ev) -{ - switch(ev.type) { - case M_NOTE: - out << "MidiNote: note(" << ev.num << ")\n" - << " channel(" << ev.channel << ")\n" - << " velocity(" << ev.value << ")"; - break; - - case M_CONTROLLER: - out << "MidiCtl: controller(" << ev.num << ")\n" - << " channel(" << ev.channel << ")\n" - << " value(" << ev.value << ")"; - break; - - case M_PGMCHANGE: - out << "PgmChange: program(" << ev.num << ")\n" - << " channel(" << ev.channel << ")"; - break; - } - - return out; -} - -MidiEvent::MidiEvent() - :channel(0), type(0), num(0), value(0), time(0) -{} - -InMgr &InMgr::getInstance() -{ - static InMgr instance; - return instance; -} - -InMgr::InMgr() - :queue(100), master(Master::getInstance()) -{ - current = NULL; - work.init(PTHREAD_PROCESS_PRIVATE, 0); -} - -InMgr::~InMgr() -{ - //lets stop the consumer thread -} - -void InMgr::putEvent(MidiEvent ev) -{ - if(queue.push(ev)) //check for error - cerr << "ERROR: Midi Ringbuffer is FULL" << endl; - else - work.post(); -} - -void InMgr::flush(unsigned frameStart, unsigned frameStop) -{ - MidiEvent ev; - while(!work.trywait()) { - queue.peak(ev); - if(ev.time < (int)frameStart || ev.time > (int)frameStop) { - //Back out of transaction - work.post(); - //printf("%d vs [%d..%d]\n",ev.time, frameStart, frameStop); - break; - } - queue.pop(ev); - //cout << ev << endl; - - switch(ev.type) { - case M_NOTE: - dump.dumpnote(ev.channel, ev.num, ev.value); - - if(ev.value) - master.noteOn(ev.channel, ev.num, ev.value); - else - master.noteOff(ev.channel, ev.num); - break; - - case M_CONTROLLER: - dump.dumpcontroller(ev.channel, ev.num, ev.value); - master.setController(ev.channel, ev.num, ev.value); - break; - - case M_PGMCHANGE: - master.setProgram(ev.channel, ev.num); - break; - case M_PRESSURE: - master.polyphonicAftertouch(ev.channel, ev.num, ev.value); - break; - } - } -} - -bool InMgr::empty(void) const -{ - int semvalue = work.getvalue(); - return semvalue <= 0; -} - -bool InMgr::setSource(string name) -{ - MidiIn *src = getIn(name); - - if(!src) - return false; - - if(current) - current->setMidiEn(false); - current = src; - current->setMidiEn(true); - - bool success = current->getMidiEn(); - - //Keep system in a valid state (aka with a running driver) - if(!success) - (current = getIn("NULL"))->setMidiEn(true); - - return success; -} - -string InMgr::getSource() const -{ - if(current) - return current->name; - else - return "ERROR"; -} - -MidiIn *InMgr::getIn(string name) -{ - EngineMgr &eng = EngineMgr::getInstance(); - return dynamic_cast(eng.getEng(name)); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.h deleted file mode 100644 index abaf925cb1e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/InMgr.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef INMGR_H -#define INMGR_H - -#include -#include "ZynSema.h" -#include "SafeQueue.h" - -enum midi_type { - M_NOTE = 1, - M_CONTROLLER = 2, - M_PGMCHANGE = 3, - M_PRESSURE = 4 -}; //type=1 for note, type=2 for controller, type=3 for program change -//type=4 for polyphonic aftertouch - -struct MidiEvent { - MidiEvent(); - int channel; //the midi channel for the event - int type; //type=1 for note, type=2 for controller - int num; //note, controller or program number - int value; //velocity or controller value - int time; //time offset of event (used only in jack->jack case at the moment) -}; - -//super simple class to manage the inputs -class InMgr -{ - public: - static InMgr &getInstance(); - ~InMgr(); - - void putEvent(MidiEvent ev); - - /**Flush the Midi Queue*/ - void flush(unsigned frameStart, unsigned frameStop); - - bool empty() const; - - bool setSource(std::string name); - - std::string getSource() const; - - friend class EngineMgr; - private: - InMgr(); - class MidiIn *getIn(std::string name); - SafeQueue queue; - mutable ZynSema work; - class MidiIn * current; - - /**the link to the rest of zyn*/ - class Master & master; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.cpp deleted file mode 100644 index c3ce0a63b4f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* - JackEngine.cpp - - Copyright 2009, Alan Calvert - - This file is part of yoshimi, which 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. - - yoshimi 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with yoshimi. If not, see . -*/ - -#include - -#include -#include -#include -#include -#include - -#include "Nio.h" -#include "InMgr.h" - -#include "JackEngine.h" - -using namespace std; - -extern char *instance_name; - -JackEngine::JackEngine() - :AudioOut(), jackClient(NULL) -{ - name = "JACK"; - audio.jackSamplerate = 0; - audio.jackNframes = 0; - for(int i = 0; i < 2; ++i) { - audio.ports[i] = NULL; - audio.portBuffs[i] = NULL; - } - midi.inport = NULL; - midi.jack_sync = false; -} - -bool JackEngine::connectServer(string server) -{ - bool autostart_jack = true; - if(jackClient) - return true; - - string clientname = "zynaddsubfx"; - string postfix = Nio::getPostfix(); - if(!postfix.empty()) - clientname += "_" + postfix; - jack_status_t jackstatus; - bool use_server_name = server.size() && server.compare("default") != 0; - jack_options_t jopts = (jack_options_t) - (((!instance_name - && use_server_name) ? JackServerName : - JackNullOption) - | ((autostart_jack) ? JackNullOption : - JackNoStartServer)); - - if(instance_name) - jackClient = jack_client_open(instance_name, jopts, &jackstatus); - else { - if(use_server_name) - jackClient = jack_client_open( - clientname.c_str(), jopts, &jackstatus, - server.c_str()); - else - jackClient = jack_client_open( - clientname.c_str(), jopts, &jackstatus); - } - - - if(NULL != jackClient) - return true; - else - cerr << "Error, failed to open jack client on server: " << server - << " status " << jackstatus << endl; - return false; -} - -bool JackEngine::connectJack() -{ - connectServer(""); - if(NULL != jackClient) { - setBufferSize(jack_get_buffer_size(jackClient)); - int chk; - jack_set_error_function(_errorCallback); - jack_set_info_function(_infoCallback); - if(jack_set_buffer_size_callback(jackClient, _bufferSizeCallback, this)) - cerr << "Error setting the bufferSize callback" << endl; - if((chk = jack_set_xrun_callback(jackClient, _xrunCallback, this))) - cerr << "Error setting jack xrun callback" << endl; - if(jack_set_process_callback(jackClient, _processCallback, this)) { - cerr << "Error, JackEngine failed to set process callback" << endl; - return false; - } - if(jack_activate(jackClient)) { - cerr << "Error, failed to activate jack client" << endl; - return false; - } - - return true; - } - else - cerr << "Error, NULL jackClient through Start()" << endl; - return false; -} - -void JackEngine::disconnectJack() -{ - if(jackClient) { - cout << "Deactivating and closing JACK client" << endl; - - jack_deactivate(jackClient); - jack_client_close(jackClient); - jackClient = NULL; - } -} - -bool JackEngine::Start() -{ - return openMidi() && openAudio(); -} - -void JackEngine::Stop() -{ - stopMidi(); - stopAudio(); -} - -void JackEngine::setMidiEn(bool nval) -{ - if(nval) - openMidi(); - else - stopMidi(); -} - -bool JackEngine::getMidiEn() const -{ - return midi.inport; -} - -void JackEngine::setAudioEn(bool nval) -{ - if(nval) - openAudio(); - else - stopAudio(); -} - -bool JackEngine::getAudioEn() const -{ - return audio.ports[0]; -} - -bool JackEngine::openAudio() -{ - if(getAudioEn()) - return true; - - if(!getMidiEn()) - if(!connectJack()) - return false; - - - const char *portnames[] = { "out_1", "out_2" }; - for(int port = 0; port < 2; ++port) - audio.ports[port] = jack_port_register( - jackClient, - portnames[port], - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput - | JackPortIsTerminal, - 0); - if((NULL != audio.ports[0]) && (NULL != audio.ports[1])) { - audio.jackSamplerate = jack_get_sample_rate(jackClient); - audio.jackNframes = jack_get_buffer_size(jackClient); - samplerate = audio.jackSamplerate; - bufferSize = audio.jackNframes; - - - //Attempt to autoConnect when specified - if(Nio::autoConnect) { - const char **outPorts = jack_get_ports( - jackClient, - NULL, - NULL, - JackPortIsPhysical - | JackPortIsInput); - if(outPorts != NULL) { - //Verify that stereo is available - assert(outPorts[0]); - assert(outPorts[1]); - - //Connect to physical outputs - jack_connect(jackClient, jack_port_name( - audio.ports[0]), outPorts[0]); - jack_connect(jackClient, jack_port_name( - audio.ports[1]), outPorts[1]); - } - else - cerr << "Warning, No outputs to autoconnect to" << endl; - } - midi.jack_sync = true; - return true; - } - else - cerr << "Error, failed to register jack audio ports" << endl; - midi.jack_sync = false; - return false; -} - -void JackEngine::stopAudio() -{ - for(int i = 0; i < 2; ++i) { - jack_port_t *port = audio.ports[i]; - audio.ports[i] = NULL; - if(NULL != port) - jack_port_unregister(jackClient, port); - } - midi.jack_sync = false; - if(!getMidiEn()) - disconnectJack(); -} - -bool JackEngine::openMidi() -{ - if(getMidiEn()) - return true; - if(!getAudioEn()) - if(!connectJack()) - return false; - - midi.inport = jack_port_register(jackClient, "midi_input", - JACK_DEFAULT_MIDI_TYPE, - JackPortIsInput | JackPortIsTerminal, 0); - return midi.inport; -} - -void JackEngine::stopMidi() -{ - jack_port_t *port = midi.inport; - midi.inport = NULL; - if(port) - jack_port_unregister(jackClient, port); - - if(!getAudioEn()) - disconnectJack(); -} - -int JackEngine::clientId() -{ - if(NULL != jackClient) - return (long)jack_client_thread_id(jackClient); - else - return -1; -} - -string JackEngine::clientName() -{ - if(NULL != jackClient) - return string(jack_get_client_name(jackClient)); - else - cerr << "Error, clientName() with null jackClient" << endl; - return string("Oh, yoshimi :-("); -} - -int JackEngine::_processCallback(jack_nframes_t nframes, void *arg) -{ - return static_cast(arg)->processCallback(nframes); -} - -int JackEngine::processCallback(jack_nframes_t nframes) -{ - bool okaudio = true; - - handleMidi(nframes); - if((NULL != audio.ports[0]) && (NULL != audio.ports[1])) - okaudio = processAudio(nframes); - return okaudio ? 0 : -1; -} - -bool JackEngine::processAudio(jack_nframes_t nframes) -{ - for(int port = 0; port < 2; ++port) { - audio.portBuffs[port] = - (jsample_t *)jack_port_get_buffer(audio.ports[port], nframes); - if(NULL == audio.portBuffs[port]) { - cerr << "Error, failed to get jack audio port buffer: " - << port << endl; - return false; - } - } - - Stereo smp = getNext(); - - //Assumes size of smp.l == nframes - memcpy(audio.portBuffs[0], smp.l, bufferSize * sizeof(float)); - memcpy(audio.portBuffs[1], smp.r, bufferSize * sizeof(float)); - return true; -} - -int JackEngine::_xrunCallback(void *) -{ - cerr << "Jack reports xrun" << endl; - return 0; -} - -void JackEngine::_errorCallback(const char *msg) -{ - cerr << "Jack reports error: " << msg << endl; -} - -void JackEngine::_infoCallback(const char *msg) -{ - cerr << "Jack info message: " << msg << endl; -} - -int JackEngine::_bufferSizeCallback(jack_nframes_t nframes, void *arg) -{ - return static_cast(arg)->bufferSizeCallback(nframes); -} - -int JackEngine::bufferSizeCallback(jack_nframes_t nframes) -{ - cerr << "Jack buffer resized" << endl; - setBufferSize(nframes); - return 0; -} - -void JackEngine::handleMidi(unsigned long frames) -{ - if(!midi.inport) - return; - void *midi_buf = jack_port_get_buffer(midi.inport, frames); - jack_midi_event_t jack_midi_event; - jack_nframes_t event_index = 0; - unsigned char *midi_data; - unsigned char type; - - while(jack_midi_event_get(&jack_midi_event, midi_buf, - event_index++) == 0) { - MidiEvent ev; - midi_data = jack_midi_event.buffer; - type = midi_data[0] & 0xF0; - ev.channel = midi_data[0] & 0x0F; - ev.time = midi.jack_sync ? jack_midi_event.time : 0; - - switch(type) { - case 0x80: /* note-off */ - ev.type = M_NOTE; - ev.num = midi_data[1]; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - - case 0x90: /* note-on */ - ev.type = M_NOTE; - ev.num = midi_data[1]; - ev.value = midi_data[2]; - InMgr::getInstance().putEvent(ev); - break; - - case 0xA0: /* pressure, aftertouch */ - ev.type = M_PRESSURE; - ev.num = midi_data[1]; - ev.value = midi_data[2]; - InMgr::getInstance().putEvent(ev); - break; - - case 0xB0: /* controller */ - ev.type = M_CONTROLLER; - ev.num = midi_data[1]; - ev.value = midi_data[2]; - InMgr::getInstance().putEvent(ev); - break; - - case 0xC0: /* program change */ - ev.type = M_PGMCHANGE; - ev.num = midi_data[1]; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - - case 0xE0: /* pitch bend */ - ev.type = M_CONTROLLER; - ev.num = C_pitchwheel; - ev.value = ((midi_data[2] << 7) | midi_data[1]) - 8192; - InMgr::getInstance().putEvent(ev); - break; - - /* XXX TODO: handle MSB/LSB controllers and RPNs and NRPNs */ - } - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.h deleted file mode 100644 index 29f6de0a39b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/JackEngine.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - JackEngine.h - - Copyright 2009, Alan Calvert - - This file is part of yoshimi, which 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. - - yoshimi 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with yoshimi. If not, see . -*/ - -#ifndef JACK_ENGINE_H -#define JACK_ENGINE_H - -#include -#include -#include -#include -#include - -#include "MidiIn.h" -#include "AudioOut.h" - -typedef jack_default_audio_sample_t jsample_t; - -class JackEngine:public AudioOut, MidiIn -{ - public: - JackEngine(); - ~JackEngine() { } - - bool Start(); - void Stop(); - - void setMidiEn(bool nval); - bool getMidiEn() const; - - void setAudioEn(bool nval); - bool getAudioEn() const; - - int getBuffersize() { return audio.jackNframes; } - - std::string clientName(); - int clientId(); - - protected: - - int processCallback(jack_nframes_t nframes); - static int _processCallback(jack_nframes_t nframes, void *arg); - int bufferSizeCallback(jack_nframes_t nframes); - static int _bufferSizeCallback(jack_nframes_t nframes, void *arg); - static void _errorCallback(const char *msg); - static void _infoCallback(const char *msg); - static int _xrunCallback(void *arg); - - private: - bool connectServer(std::string server); - bool connectJack(); - void disconnectJack(); - bool openAudio(); - void stopAudio(); - bool processAudio(jack_nframes_t nframes); - bool openMidi(); - void stopMidi(); - - jack_client_t *jackClient; - struct audio { - unsigned int jackSamplerate; - unsigned int jackNframes; - jack_port_t *ports[2]; - jsample_t *portBuffs[2]; - } audio; - struct midi { - jack_port_t *inport; - bool jack_sync; - } midi; - - void handleMidi(unsigned long frames); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.cpp deleted file mode 100644 index 3635bde2e29..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MidiIn.C - This class is inherited by all the Midi input classes - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "MidiIn.h" -#include "../globals.h" -#include "InMgr.h" - -void MidiIn::midiProcess(unsigned char head, - unsigned char num, - unsigned char value) -{ - MidiEvent ev; - unsigned char chan = head & 0x0f; - switch(head & 0xf0) { - case 0x80: //Note Off - ev.type = M_NOTE; - ev.channel = chan; - ev.num = num; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - case 0x90: //Note On - ev.type = M_NOTE; - ev.channel = chan; - ev.num = num; - ev.value = value; - InMgr::getInstance().putEvent(ev); - break; - case 0xA0: /* pressure, aftertouch */ - ev.type = M_PRESSURE; - ev.channel = chan; - ev.num = num; - ev.value = value; - InMgr::getInstance().putEvent(ev); - break; - case 0xb0: //Controller - ev.type = M_CONTROLLER; - ev.channel = chan; - ev.num = num; - ev.value = value; - InMgr::getInstance().putEvent(ev); - break; - case 0xc0: //Program Change - ev.type = M_PGMCHANGE; - ev.channel = chan; - ev.num = num; - ev.value = 0; - InMgr::getInstance().putEvent(ev); - break; - case 0xe0: //Pitch Wheel - ev.type = M_CONTROLLER; - ev.channel = chan; - ev.num = C_pitchwheel; - ev.value = (num + value * (int) 128) - 8192; - InMgr::getInstance().putEvent(ev); - break; - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.h deleted file mode 100644 index 780a67ff57b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/MidiIn.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MidiIn.h - This class is inherited by all the Midi input classes - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2009-2010 Mark McCurry - Author: Nasca Octavian Paula - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MIDI_IN_H -#define MIDI_IN_H - -#include "Engine.h" - -/**This class is inherited by all the Midi input classes*/ -class MidiIn:public virtual Engine -{ - public: - /**Enables or disables driver based upon value*/ - virtual void setMidiEn(bool nval) = 0; - /**Returns if driver is initialized*/ - virtual bool getMidiEn() const = 0; - static void midiProcess(unsigned char head, - unsigned char num, - unsigned char value); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.cpp deleted file mode 100644 index 0026437a1d1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include "Nio.h" -#include "OutMgr.h" -#include "InMgr.h" -#include "EngineMgr.h" -#include "MidiIn.h" -#include "AudioOut.h" -#include "WavEngine.h" -#include -#include -using std::string; -using std::set; -using std::cerr; -using std::endl; - -InMgr *in = NULL; -OutMgr *out = NULL; -EngineMgr *eng = NULL; -string postfix; - -bool Nio::autoConnect = false; -string Nio::defaultSource = IN_DEFAULT; -string Nio::defaultSink = OUT_DEFAULT; - -void Nio::init(void) -{ - in = &InMgr::getInstance(); //Enable input wrapper - out = &OutMgr::getInstance(); //Initialize the Output Systems - eng = &EngineMgr::getInstance(); //Initialize The Engines -} - -bool Nio::start() -{ - init(); - return eng->start(); -} - -void Nio::stop() -{ - eng->stop(); -} - -void Nio::setDefaultSource(string name) -{ - std::transform(name.begin(), name.end(), name.begin(), ::toupper); - defaultSource = name; -} - -void Nio::setDefaultSink(string name) -{ - std::transform(name.begin(), name.end(), name.begin(), ::toupper); - defaultSink = name; -} - -bool Nio::setSource(string name) -{ - return in->setSource(name); -} - -bool Nio::setSink(string name) -{ - return out->setSink(name); -} - -void Nio::setPostfix(std::string post) -{ - postfix = post; -} - -std::string Nio::getPostfix(void) -{ - return postfix; -} - -set Nio::getSources(void) -{ - set sources; - for(std::list::iterator itr = eng->engines.begin(); - itr != eng->engines.end(); ++itr) - if(dynamic_cast(*itr)) - sources.insert((*itr)->name); - return sources; -} - -set Nio::getSinks(void) -{ - set sinks; - for(std::list::iterator itr = eng->engines.begin(); - itr != eng->engines.end(); ++itr) - if(dynamic_cast(*itr)) - sinks.insert((*itr)->name); - return sinks; -} - -string Nio::getSource() -{ - return in->getSource(); -} - -string Nio::getSink() -{ - return out->getSink(); -} - -#if JACK -#include -void Nio::preferedSampleRate(unsigned &rate) -{ - jack_client_t *client = jack_client_open("temp-client", - JackNoStartServer, 0); - if(client) { - rate = jack_get_sample_rate(client); - jack_client_close(client); - } -} -#else -void Nio::preferedSampleRate(unsigned &) -{} -#endif - -void Nio::waveNew(class WavFile *wave) -{ - out->wave->newFile(wave); -} - -void Nio::waveStart(void) -{ - out->wave->Start(); -} - -void Nio::waveStop(void) -{ - out->wave->Stop(); -} - -void Nio::waveEnd(void) -{ - out->wave->destroyFile(); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.h deleted file mode 100644 index ba050b8ed3f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/Nio.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef NIO_H -#define NIO_H -#include -#include - -class WavFile; - -/**Interface to Nio Subsystem - * - * Should be only externally included header */ -namespace Nio -{ - void init(void); - bool start(void); - void stop(void); - - void setDefaultSource(std::string name); - void setDefaultSink(std::string name); - - bool setSource(std::string name); - bool setSink(std::string name); - - void setPostfix(std::string post); - std::string getPostfix(void); - - std::set getSources(void); - std::set getSinks(void); - - std::string getSource(void); - std::string getSink(void); - - //Get the prefered sample rate from jack (if running) - void preferedSampleRate(unsigned &rate); - - - //Wave writing - void waveNew(class WavFile *wave); - void waveStart(void); - void waveStop(void); - void waveEnd(void); - - extern bool autoConnect; - extern std::string defaultSource; - extern std::string defaultSink; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.cpp deleted file mode 100644 index 633e2ae24c2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.C - Audio output for Open Sound System - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "NulEngine.h" -#include "../globals.h" - -#include -#include - -using namespace std; - -NulEngine::NulEngine() - :AudioOut(), pThread(NULL) -{ - name = "NULL"; - playing_until.tv_sec = 0; - playing_until.tv_usec = 0; -} - -void *NulEngine::_AudioThread(void *arg) -{ - return (static_cast(arg))->AudioThread(); -} - -void *NulEngine::AudioThread() -{ - while(pThread) { - getNext(); - - struct timeval now; - int remaining = 0; - gettimeofday(&now, NULL); - if((playing_until.tv_usec == 0) && (playing_until.tv_sec == 0)) { - playing_until.tv_usec = now.tv_usec; - playing_until.tv_sec = now.tv_sec; - } - else { - remaining = (playing_until.tv_usec - now.tv_usec) - + (playing_until.tv_sec - now.tv_sec) * 1000000; - if(remaining > 10000) //Don't sleep() less than 10ms. - //This will add latency... - usleep(remaining - 10000); - if(remaining < 0) - cerr << "WARNING - too late" << endl; - } - playing_until.tv_usec += synth->buffersize * 1000000 - / synth->samplerate; - if(remaining < 0) - playing_until.tv_usec -= remaining; - playing_until.tv_sec += playing_until.tv_usec / 1000000; - playing_until.tv_usec %= 1000000; - } - return NULL; -} - -NulEngine::~NulEngine() -{} - -bool NulEngine::Start() -{ - setAudioEn(true); - return getAudioEn(); -} - -void NulEngine::Stop() -{ - setAudioEn(false); -} - -void NulEngine::setAudioEn(bool nval) -{ - if(nval) { - if(!getAudioEn()) { - pthread_t *thread = new pthread_t; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pThread = thread; - pthread_create(pThread, &attr, _AudioThread, this); - } - } - else - if(getAudioEn()) { - pthread_t *thread = pThread; - pThread = NULL; - pthread_join(*thread, NULL); - delete thread; - } -} - -bool NulEngine::getAudioEn() const -{ - return pThread; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.h deleted file mode 100644 index 18341809e71..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/NulEngine.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - NulEngine.h - Dummy In/Out driver - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef NUL_ENGINE_H -#define NUL_ENGINE_H - -#include -#include -#include "../globals.h" -#include "AudioOut.h" -#include "MidiIn.h" - -class NulEngine:public AudioOut, MidiIn -{ - public: - NulEngine(); - ~NulEngine(); - - bool Start(); - void Stop(); - - void setAudioEn(bool nval); - bool getAudioEn() const; - - void setMidiEn(bool) {} - bool getMidiEn() const {return true; } - - protected: - void *AudioThread(); - static void *_AudioThread(void *arg); - - private: - struct timeval playing_until; - pthread_t *pThread; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.cpp deleted file mode 100644 index 1c6cdf11c67..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.C - Audio output for Open Sound System - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "OssEngine.h" -#include "../Misc/Util.h" -#include "../globals.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "InMgr.h" - -using namespace std; - -OssEngine::OssEngine() - :AudioOut(), engThread(NULL) -{ - name = "OSS"; - - midi.handle = -1; - audio.handle = -1; - - audio.smps = new short[synth->buffersize * 2]; - memset(audio.smps, 0, synth->bufferbytes); -} - -OssEngine::~OssEngine() -{ - Stop(); - delete [] audio.smps; -} - -bool OssEngine::openAudio() -{ - if(audio.handle != -1) - return true; //already open - - int snd_bitsize = 16; - int snd_fragment = 0x00080009; //fragment size (?); - int snd_stereo = 1; //stereo; - int snd_format = AFMT_S16_LE; - int snd_samplerate = synth->samplerate; - - const char *device = config.cfg.LinuxOSSWaveOutDev; - if(getenv("DSP_DEVICE")) - device = getenv("DSP_DEVICE"); - - audio.handle = open(device, O_WRONLY, 0); - if(audio.handle == -1) { - cerr << "ERROR - I can't open the " - << device << '.' << endl; - return false; - } - ioctl(audio.handle, SNDCTL_DSP_RESET, NULL); - ioctl(audio.handle, SNDCTL_DSP_SETFMT, &snd_format); - ioctl(audio.handle, SNDCTL_DSP_STEREO, &snd_stereo); - ioctl(audio.handle, SNDCTL_DSP_SPEED, &snd_samplerate); - ioctl(audio.handle, SNDCTL_DSP_SAMPLESIZE, &snd_bitsize); - ioctl(audio.handle, SNDCTL_DSP_SETFRAGMENT, &snd_fragment); - - if(!getMidiEn()) { - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - engThread = new pthread_t; - pthread_create(engThread, &attr, _thread, this); - } - - return true; -} - -void OssEngine::stopAudio() -{ - int handle = audio.handle; - if(handle == -1) //already closed - return; - audio.handle = -1; - - if(!getMidiEn() && engThread) - pthread_join(*engThread, NULL); - delete engThread; - engThread = NULL; - - close(handle); -} - -bool OssEngine::Start() -{ - bool good = true; - - if(!openAudio()) { - cerr << "Failed to open OSS audio" << endl; - good = false; - } - - if(!openMidi()) { - cerr << "Failed to open OSS midi" << endl; - good = false; - } - - return good; -} - -void OssEngine::Stop() -{ - stopAudio(); - stopMidi(); -} - -void OssEngine::setMidiEn(bool nval) -{ - if(nval) - openMidi(); - else - stopMidi(); -} - -bool OssEngine::getMidiEn() const -{ - return midi.handle != -1; -} - -void OssEngine::setAudioEn(bool nval) -{ - if(nval) - openAudio(); - else - stopAudio(); -} - -bool OssEngine::getAudioEn() const -{ - return audio.handle != -1; -} - -bool OssEngine::openMidi() -{ - int handle = midi.handle; - if(handle != -1) - return true; //already open - - handle = open(config.cfg.LinuxOSSSeqInDev, O_RDONLY, 0); - - if(-1 == handle) - return false; - midi.handle = handle; - - if(!getAudioEn()) { - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - engThread = new pthread_t; - pthread_create(engThread, &attr, _thread, this); - } - - return true; -} - -void OssEngine::stopMidi() -{ - int handle = midi.handle; - if(handle == -1) //already closed - return; - - midi.handle = -1; - - if(!getAudioEn() && engThread) { - pthread_join(*engThread, NULL); - delete engThread; - engThread = NULL; - } - - close(handle); -} - -void *OssEngine::_thread(void *arg) -{ - return (static_cast(arg))->thread(); -} - -void *OssEngine::thread() -{ - unsigned char tmp[4] = {0, 0, 0, 0}; - set_realtime(); - while(getAudioEn() || getMidiEn()) { - if(getAudioEn()) { - const Stereo smps = getNext(); - - float l, r; - for(int i = 0; i < synth->buffersize; ++i) { - l = smps.l[i]; - r = smps.r[i]; - - if(l < -1.0f) - l = -1.0f; - else - if(l > 1.0f) - l = 1.0f; - if(r < -1.0f) - r = -1.0f; - else - if(r > 1.0f) - r = 1.0f; - - audio.smps[i * 2] = (short int) (l * 32767.0f); - audio.smps[i * 2 + 1] = (short int) (r * 32767.0f); - } - int handle = audio.handle; - if(handle != -1) - write(handle, audio.smps, synth->buffersize * 4); // *2 because is 16 bit, again * 2 because is stereo - else - break; - } - - //Collect up to 30 midi events - for(int k = 0; k < 30 && getMidiEn(); ++k) { - static char escaped; - - memset(tmp, 0, 4); - - if(escaped) { - tmp[0] = escaped; - escaped = 0; - } - else { - getMidi(tmp); - if(!(tmp[0] & 0x80)) - continue; - } - getMidi(tmp + 1); - if(tmp[1] & 0x80) { - escaped = tmp[1]; - tmp[1] = 0; - } - else { - getMidi(tmp + 2); - if(tmp[2] & 0x80) { - escaped = tmp[2]; - tmp[2] = 0; - } - else { - getMidi(tmp + 3); - if(tmp[3] & 0x80) { - escaped = tmp[3]; - tmp[3] = 0; - } - } - } - midiProcess(tmp[0], tmp[1], tmp[2]); - } - } - pthread_exit(NULL); - return NULL; -} - -void OssEngine::getMidi(unsigned char *midiPtr) -{ - read(midi.handle, midiPtr, 1); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.h deleted file mode 100644 index cdccc8120e8..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OssEngine.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.h - Audio output for Open Sound System - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef OSS_ENGINE_H -#define OSS_ENGINE_H - -#include -#include "../globals.h" -#include "AudioOut.h" -#include "MidiIn.h" - -class OssEngine:public AudioOut, MidiIn -{ - public: - OssEngine(); - ~OssEngine(); - - bool Start(); - void Stop(); - - void setAudioEn(bool nval); - bool getAudioEn() const; - - void setMidiEn(bool nval); - bool getMidiEn() const; - - - protected: - void *thread(); - static void *_thread(void *arg); - - private: - pthread_t *engThread; - - //Audio - bool openAudio(); - void stopAudio(); - - struct audio { - int handle; - short int *smps; //Samples to be sent to soundcard - bool en; - } audio; - - //Midi - bool openMidi(); - void stopMidi(); - void getMidi(unsigned char *midiPtr); - - struct midi { - int handle; - bool en; - bool run; - } midi; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.cpp deleted file mode 100644 index 7fbe2417ecd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.cpp +++ /dev/null @@ -1,185 +0,0 @@ -#include "OutMgr.h" -#include -#include -#include -#include "AudioOut.h" -#include "Engine.h" -#include "EngineMgr.h" -#include "InMgr.h" -#include "WavEngine.h" -#include "../Misc/Master.h" -#include "../Misc/Util.h" //for set_realtime() - -using namespace std; - -OutMgr &OutMgr::getInstance() -{ - static OutMgr instance; - return instance; -} - -OutMgr::OutMgr() - :wave(new WavEngine()), - priBuf(new float[4096], - new float[4096]), priBuffCurrent(priBuf), - master(Master::getInstance()) -{ - currentOut = NULL; - stales = 0; - master = Master::getInstance(); - - //init samples - outr = new float[synth->buffersize]; - outl = new float[synth->buffersize]; - memset(outl, 0, synth->bufferbytes); - memset(outr, 0, synth->bufferbytes); -} - -OutMgr::~OutMgr() -{ - delete wave; - delete [] priBuf.l; - delete [] priBuf.r; - delete [] outr; - delete [] outl; -} - -/* Sequence of a tick - * 1) Lets remove old/stale samples - * 2) Apply appliciable midi events - * 3) Lets see if we need to generate samples - * 4) Lets generate some - * 5) Goto 2 if more are needed - * 6) Lets return those samples to the primary and secondary outputs - * 7) Lets wait for another tick - */ -const Stereo OutMgr::tick(unsigned int frameSize) -{ - InMgr &midi = InMgr::getInstance(); - //SysEv->execute(); - removeStaleSmps(); - int i=0; - while(frameSize > storedSmps()) { - if(!midi.empty()) { - pthread_mutex_lock(&(master.mutex)); - midi.flush(i*synth->buffersize, (i+1)*synth->buffersize); - pthread_mutex_unlock(&(master.mutex)); - } - pthread_mutex_lock(&(master.mutex)); - master.AudioOut(outl, outr); - pthread_mutex_unlock(&(master.mutex)); - addSmps(outl, outr); - i++; - } - stales = frameSize; - return priBuf; -} - -AudioOut *OutMgr::getOut(string name) -{ - return dynamic_cast(EngineMgr::getInstance().getEng(name)); -} - -string OutMgr::getDriver() const -{ - return currentOut->name; -} - -bool OutMgr::setSink(string name) -{ - AudioOut *sink = getOut(name); - - if(!sink) - return false; - - if(currentOut) - currentOut->setAudioEn(false); - - currentOut = sink; - currentOut->setAudioEn(true); - - bool success = currentOut->getAudioEn(); - - //Keep system in a valid state (aka with a running driver) - if(!success) - (currentOut = getOut("NULL"))->setAudioEn(true); - - return success; -} - -string OutMgr::getSink() const -{ - if(currentOut) - return currentOut->name; - else { - cerr << "BUG: No current output in OutMgr " << __LINE__ << endl; - return "ERROR"; - } - return "ERROR"; -} - -//perform a cheap linear interpolation for resampling -//This will result in some distortion at frame boundries -//returns number of samples produced -static size_t resample(float *dest, - const float *src, - float s_in, - float s_out, - size_t elms) -{ - size_t out_elms = elms * s_out / s_in; - float r_pos = 0.0f; - for(int i = 0; i < (int)out_elms; ++i, r_pos += s_in / s_out) - dest[i] = interpolate(src, elms, r_pos); - - return out_elms; -} - -void OutMgr::addSmps(float *l, float *r) -{ - //allow wave file to syphon off stream - wave->push(Stereo(l, r), synth->buffersize); - - const int s_out = currentOut->getSampleRate(), - s_sys = synth->samplerate; - - if(s_out != s_sys) { //we need to resample - const size_t steps = resample(priBuffCurrent.l, - l, - s_sys, - s_out, - synth->buffersize); - resample(priBuffCurrent.r, r, s_sys, s_out, synth->buffersize); - - priBuffCurrent.l += steps; - priBuffCurrent.r += steps; - } - else { //just copy the samples - memcpy(priBuffCurrent.l, l, synth->bufferbytes); - memcpy(priBuffCurrent.r, r, synth->bufferbytes); - priBuffCurrent.l += synth->buffersize; - priBuffCurrent.r += synth->buffersize; - } -} - -void OutMgr::removeStaleSmps() -{ - if(!stales) - return; - - const int leftover = storedSmps() - stales; - - assert(leftover > -1); - - //leftover samples [seen at very low latencies] - if(leftover) { - memmove(priBuf.l, priBuffCurrent.l - leftover, leftover * sizeof(float)); - memmove(priBuf.r, priBuffCurrent.r - leftover, leftover * sizeof(float)); - priBuffCurrent.l = priBuf.l + leftover; - priBuffCurrent.r = priBuf.r + leftover; - } - else - priBuffCurrent = priBuf; - - stales = 0; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.h deleted file mode 100644 index bc3a922d5f9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/OutMgr.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef OUTMGR_H -#define OUTMGR_H - -#include "../Misc/Stereo.h" -#include -#include -#include -#include - - -class AudioOut; -class OutMgr -{ - public: - static OutMgr &getInstance(); - ~OutMgr(); - - /**Execute a tick*/ - const Stereo tick(unsigned int frameSize); - - /**Request a new set of samples - * @param n number of requested samples (defaults to 1) - * @return -1 for locking issues 0 for valid request*/ - void requestSamples(unsigned int n = 1); - - /**Gets requested driver - * @param name case unsensitive name of driver - * @return pointer to Audio Out or NULL - */ - AudioOut *getOut(std::string name); - - /**Gets the name of the first running driver - * Deprecated - * @return if no running output, "" is returned - */ - std::string getDriver() const; - - bool setSink(std::string name); - - std::string getSink() const; - - class WavEngine * wave; /** priBuf; //buffer for primary drivers - Stereo priBuffCurrent; //current array accessor - - float *outl; - float *outr; - class Master & master; - - int stales; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.cpp deleted file mode 100644 index d41543b04d9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PaEngine.cpp - Audio output for PortAudio - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "PaEngine.h" -#include - -using namespace std; - -PaEngine::PaEngine() - :stream(NULL) -{ - name = "PA"; -} - - -PaEngine::~PaEngine() -{ - Stop(); -} - -bool PaEngine::Start() -{ - if(getAudioEn()) - return true; - Pa_Initialize(); - - PaStreamParameters outputParameters; - outputParameters.device = Pa_GetDefaultOutputDevice(); - if(outputParameters.device == paNoDevice) { - cerr << "Error: No default output device." << endl; - Pa_Terminate(); - return false; - } - outputParameters.channelCount = 2; /* stereo output */ - outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ - outputParameters.suggestedLatency = - Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; - outputParameters.hostApiSpecificStreamInfo = NULL; - - - Pa_OpenStream(&stream, - NULL, - &outputParameters, - synth->samplerate, - synth->buffersize, - 0, - PAprocess, - (void *) this); - Pa_StartStream(stream); - return true; -} - -void PaEngine::setAudioEn(bool nval) -{ - if(nval) - Start(); - else - Stop(); -} - -bool PaEngine::getAudioEn() const -{ - return stream; -} - -int PaEngine::PAprocess(const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *outTime, - PaStreamCallbackFlags flags, - void *userData) -{ - (void) inputBuffer; - (void) outTime; - (void) flags; - return static_cast(userData)->process((float *) outputBuffer, - framesPerBuffer); -} - -int PaEngine::process(float *out, unsigned long framesPerBuffer) -{ - const Stereo smp = getNext(); - for(unsigned i = 0; i < framesPerBuffer; ++i) { - *out++ = smp.l[i]; - *out++ = smp.r[i]; - } - - return 0; -} - -void PaEngine::Stop() -{ - if(!getAudioEn()) - return; - Pa_StopStream(stream); - Pa_CloseStream(stream); - stream = NULL; - Pa_Terminate(); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.h deleted file mode 100644 index 12fd766a8ec..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/PaEngine.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PAaudiooutput.h - Audio output for PortAudio - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef PA_ENGINE_H -#define PA_ENGINE_H - -#include - -#include "../globals.h" -#include "AudioOut.h" - -class PaEngine:public AudioOut -{ - public: - PaEngine(); - ~PaEngine(); - - bool Start(); - void Stop(); - - void setAudioEn(bool nval); - bool getAudioEn() const; - - protected: - static int PAprocess(const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *outTime, - PaStreamCallbackFlags flags, - void *userData); - int process(float *out, unsigned long framesPerBuffer); - private: - PaStream *stream; -}; - - -void PAfinish(); - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.cpp deleted file mode 100644 index 510e4b20827..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.cpp +++ /dev/null @@ -1,89 +0,0 @@ - -template -SafeQueue::SafeQueue(size_t maxlen) - :writePtr(0), readPtr(0), bufSize(maxlen) -{ - w_space.init(PTHREAD_PROCESS_PRIVATE, maxlen - 1); - r_space.init(PTHREAD_PROCESS_PRIVATE, 0); - buffer = new T[maxlen]; -} - -template -SafeQueue::~SafeQueue() -{ - delete [] buffer; -} - -template -unsigned int SafeQueue::size() const -{ - return rSpace(); -} - -template -unsigned int SafeQueue::rSpace() const -{ - return r_space.getvalue(); -} - -template -unsigned int SafeQueue::wSpace() const -{ - return w_space.getvalue(); -} - -template -int SafeQueue::push(const T &in) -{ - if(!wSpace()) - return -1; - - //ok, there is space to write - size_t w = (writePtr + 1) % bufSize; - buffer[w] = in; - writePtr = w; - - //adjust ranges - w_space.wait(); //guaranteed not to wait - r_space.post(); - return 0; -} - -template -int SafeQueue::peak(T &out) const -{ - if(!rSpace()) - return -1; - - //ok, there is space to read - size_t r = (readPtr + 1) % bufSize; - out = buffer[r]; - - return 0; -} - -template -int SafeQueue::pop(T &out) -{ - if(!rSpace()) - return -1; - - //ok, there is space to read - size_t r = (readPtr + 1) % bufSize; - out = buffer[r]; - readPtr = r; - - //adjust ranges - r_space.wait(); //guaranteed not to wait - w_space.post(); - return 0; -} - -template -void SafeQueue::clear() -{ - //thread unsafe - while(!r_space.trywait()) - w_space.post(); - readPtr = writePtr; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.h deleted file mode 100644 index 9bba53a6047..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/SafeQueue.h +++ /dev/null @@ -1,49 +0,0 @@ - -#ifndef SAFEQUEUE_H -#define SAFEQUEUE_H -#include -#include "ZynSema.h" -#include -#include - -/** - * C++ thread safe lockless queue - * Based off of jack's ringbuffer*/ -template -class SafeQueue -{ - public: - SafeQueue(size_t maxlen); - ~SafeQueue(); - - /**Return read size*/ - unsigned int size() const; - - /**Returns 0 for normal - * Returns -1 on error*/ - int push(const T &in); - int peak(T &out) const; - int pop(T &out); - - //clears reading space - void clear(); - - private: - unsigned int wSpace() const; - unsigned int rSpace() const; - - //write space - mutable ZynSema w_space; - //read space - mutable ZynSema r_space; - - //next writing spot - size_t writePtr; - //next reading spot - size_t readPtr; - const size_t bufSize; - T *buffer; -}; - -#include "SafeQueue.cpp" -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.cpp deleted file mode 100644 index 1c3d66ec861..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2006 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "WavEngine.h" -#include -#include -#include -#include "../Misc/WavFile.h" -#include "../Misc/Util.h" - -using namespace std; - -WavEngine::WavEngine() - :AudioOut(), file(NULL), buffer(synth->samplerate * 4), pThread(NULL) -{ - work.init(PTHREAD_PROCESS_PRIVATE, 0); -} - -WavEngine::~WavEngine() -{ - Stop(); - destroyFile(); -} - -bool WavEngine::openAudio() -{ - return file && file->good(); -} - -bool WavEngine::Start() -{ - if(pThread) - return true; - pThread = new pthread_t; - - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(pThread, &attr, _AudioThread, this); - - return true; -} - -void WavEngine::Stop() -{ - if(!pThread) - return; - - pthread_t *tmp = pThread; - pThread = NULL; - - work.post(); - pthread_join(*tmp, NULL); - delete pThread; -} - -void WavEngine::push(Stereo smps, size_t len) -{ - if(!pThread) - return; - - - //copy the input [overflow when needed] - for(size_t i = 0; i < len; ++i) { - buffer.push(*smps.l++); - buffer.push(*smps.r++); - } - work.post(); -} - -void WavEngine::newFile(WavFile *_file) -{ - //ensure system is clean - destroyFile(); - file = _file; - - //check state - if(!file->good()) - cerr - << "ERROR: WavEngine handed bad file output WavEngine::newFile()" - << endl; -} - -void WavEngine::destroyFile() -{ - if(file) - delete file; - file = NULL; -} - -void *WavEngine::_AudioThread(void *arg) -{ - return (static_cast(arg))->AudioThread(); -} - -void *WavEngine::AudioThread() -{ - short *recordbuf_16bit = new short[2 * synth->buffersize]; - - while(!work.wait() && pThread) { - for(int i = 0; i < synth->buffersize; ++i) { - float left = 0.0f, right = 0.0f; - buffer.pop(left); - buffer.pop(right); - recordbuf_16bit[2 * i] = limit((int)(left * 32767.0f), - -32768, - 32767); - recordbuf_16bit[2 * i + 1] = limit((int)(right * 32767.0f), - -32768, - 32767); - } - file->writeStereoSamples(synth->buffersize, recordbuf_16bit); - } - - delete[] recordbuf_16bit; - - return NULL; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.h deleted file mode 100644 index 73f553c9642..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/WavEngine.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - WavEngine.h - Records sound to a file - Copyright (C) 2008 Nasca Octavian Paul - Author: Nasca Octavian Paul - Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef WAVENGINE_H -#define WAVENGINE_H -#include "AudioOut.h" -#include -#include -#include "ZynSema.h" -#include "SafeQueue.h" - -class WavFile; -class WavEngine:public AudioOut -{ - public: - WavEngine(); - ~WavEngine(); - - bool openAudio(); - bool Start(); - void Stop(); - - void setAudioEn(bool /*nval*/) {} - bool getAudioEn() const {return true; } - - void push(Stereo smps, size_t len); - - void newFile(WavFile *_file); - void destroyFile(); - - protected: - void *AudioThread(); - static void *_AudioThread(void *arg); - - private: - WavFile *file; - ZynSema work; - SafeQueue buffer; - - pthread_t *pThread; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/ZynSema.h b/plugins/zynaddsubfx/zynaddsubfx/src/Nio/ZynSema.h deleted file mode 100644 index c41477e0076..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Nio/ZynSema.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef ZYNSEMA_H -#define ZYNSEMA_H - -#if defined __APPLE__ || defined WIN32 - -#include - -class ZynSema -{ -public: - ZynSema (void) : _count (0) - { - } - - ~ZynSema (void) - { - pthread_mutex_destroy (&_mutex); - pthread_cond_destroy (&_cond); - } - - int init (int, int v) - { - _count = v; - return pthread_mutex_init (&_mutex, 0) || pthread_cond_init (&_cond, 0); - } - - int post (void) - { - pthread_mutex_lock (&_mutex); - if (++_count == 1) pthread_cond_signal (&_cond); - pthread_mutex_unlock (&_mutex); - return 0; - } - - int wait (void) - { - pthread_mutex_lock (&_mutex); - while (_count < 1) pthread_cond_wait (&_cond, &_mutex); - --_count; - pthread_mutex_unlock (&_mutex); - return 0; - } - - int trywait (void) - { - if (pthread_mutex_trylock (&_mutex)) return -1; - if (_count < 1) - { - pthread_mutex_unlock (&_mutex); - return -1; - } - --_count; - pthread_mutex_unlock (&_mutex); - return 0; - } - - int getvalue (void) const - { - return _count; - } - - -private: - int _count; - pthread_mutex_t _mutex; - pthread_cond_t _cond; -}; - -#else // POSIX sempahore - -#include - -class ZynSema -{ -public: - ZynSema (void) - { - } - ~ZynSema (void) - { - sem_destroy (&_sema); - } - int init (int s, int v) - { - return sem_init (&_sema, s, v); - } - int post (void) - { - return sem_post (&_sema); - } - int wait (void) - { - return sem_wait (&_sema); - } - int trywait (void) - { - return sem_trywait (&_sema); - } - int getvalue(void) - { - int v = 0; - sem_getvalue(&_sema, &v); - return v; - } - -private: - sem_t _sema; -}; - -#endif // POSIX semapore - -#endif // ZYNSEMA_H diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.cpp deleted file mode 100644 index b343a486cd2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.cpp +++ /dev/null @@ -1,711 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - DSSIaudiooutput.cpp - Audio functions for DSSI - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -/* - * Inital working DSSI output code contributed by Stephen G. Parry - */ - -//this file contains code used from trivial_synth.c from -//the DSSI (published by Steve Harris under public domain) as a template. - -#include "DSSIaudiooutput.h" -#include "../Misc/Config.h" -#include "../Misc/Bank.h" -#include "../Misc/Util.h" -#include -#include - -using std::string; -using std::vector; - -//Dummy variables and functions for linking purposes -const char *instance_name = 0; -class WavFile; -namespace Nio { - bool start(void){return 1;}; - void stop(void){}; - void waveNew(WavFile *){} - void waveStart(void){} - void waveStop(void){} - void waveEnd(void){} -} - -// -// Static stubs for LADSPA member functions -// -// LADSPA is essentially a C handle based API; This plug-in implementation is -// a C++ OO one so we need stub functions to map from C API calls to C++ object -// method calls. -void DSSIaudiooutput::stub_connectPort(LADSPA_Handle instance, - unsigned long port, - LADSPA_Data *data) -{ - getInstance(instance)->connectPort(port, data); -} - -void DSSIaudiooutput::stub_activate(LADSPA_Handle instance) -{ - getInstance(instance)->activate(); -} - -void DSSIaudiooutput::stub_run(LADSPA_Handle instance, - unsigned long sample_count) -{ - getInstance(instance)->run(sample_count); -} - -void DSSIaudiooutput::stub_deactivate(LADSPA_Handle instance) -{ - getInstance(instance)->deactivate(); -} - - -void DSSIaudiooutput::stub_cleanup(LADSPA_Handle instance) -{ - DSSIaudiooutput *plugin_instance = getInstance(instance); - plugin_instance->cleanup(); - delete plugin_instance; -} - - -const LADSPA_Descriptor *ladspa_descriptor(unsigned long index) -{ - return DSSIaudiooutput::getLadspaDescriptor(index); -} - -// -// Static stubs for DSSI member functions -// -// DSSI is essentially a C handle based API; This plug-in implementation is -// a C++ OO one so we need stub functions to map from C API calls to C++ object -// method calls. -const DSSI_Program_Descriptor *DSSIaudiooutput::stub_getProgram( - LADSPA_Handle instance, - unsigned long index) -{ - return getInstance(instance)->getProgram(index); -} - -void DSSIaudiooutput::stub_selectProgram(LADSPA_Handle instance, - unsigned long bank, - unsigned long program) -{ - getInstance(instance)->selectProgram(bank, program); -} - -int DSSIaudiooutput::stub_getMidiControllerForPort(LADSPA_Handle instance, - unsigned long port) -{ - return getInstance(instance)->getMidiControllerForPort(port); -} - -void DSSIaudiooutput::stub_runSynth(LADSPA_Handle instance, - unsigned long sample_count, - snd_seq_event_t *events, - unsigned long event_count) -{ - getInstance(instance)->runSynth(sample_count, events, event_count); -} - -const DSSI_Descriptor *dssi_descriptor(unsigned long index) -{ - return DSSIaudiooutput::getDssiDescriptor(index); -} - -// -// LADSPA member functions -// - -/** - * Instantiates a plug-in. - * - * This LADSPA member function instantiates a plug-in. - * Note that instance initialisation should generally occur in - * activate() rather than here. - * - * Zyn Implementation - * ------------------ - * This implementation creates a C++ class object and hides its pointer - * in the handle by type casting. - * - * @param descriptor [in] the descriptor for this plug-in - * @param s_rate [in] the sample rate - * @return the plug-in instance handle if successful else NULL - */ -LADSPA_Handle DSSIaudiooutput::instantiate(const LADSPA_Descriptor *descriptor, - unsigned long s_rate) -{ - if(descriptor->UniqueID == dssiDescriptor->LADSPA_Plugin->UniqueID) - return (LADSPA_Handle)(new DSSIaudiooutput(s_rate)); - else - return NULL; -} - -/** - * Connects a port on an instantiated plug-in. - * - * This LADSPA member function connects a port on an instantiated plug-in to a - * memory location at which a block of data for the port will be read/written. - * The data location is expected to be an array of LADSPA_Data for audio ports - * or a single LADSPA_Data value for control ports. Memory issues will be - * managed by the host. The plug-in must read/write the data at these locations - * every time run() or run_adding() is called and the data present at the time - * of this connection call should not be considered meaningful. - * - * Zyn Implementation - * ------------------ - * The buffer pointers are stored as member variables - * - * @param port [in] the port to be connected - * @param data [in] the data buffer to write to / read from - */ -void DSSIaudiooutput::connectPort(unsigned long port, LADSPA_Data *data) -{ - switch(port) { - case 0: - outl = data; - break; - case 1: - outr = data; - break; - } -} - -/** - * Initialises a plug-in instance and activates it for use. - * - * This LADSPA member function initialises a plug-in instance and activates it - * for use. This is separated from instantiate() to aid real-time support and - * so that hosts can reinitialise a plug-in instance by calling deactivate() and - * then activate(). In this case the plug-in instance must reset all state - * information dependent on the history of the plug-in instance except for any - * data locations provided by connect_port() and any gain set by - * set_run_adding_gain(). - * - * Zyn Implementation - * ------------------ - * Currently this does nothing; Care must be taken as to code placed here as - * too much code here seems to cause time-out problems in jack-dssi-host. -*/ -void DSSIaudiooutput::activate() -{} - -/** - * Runs an instance of a plug-in for a block. - * - * This LADSPA member function runs an instance of a plug-in for a block. - * Note that if an activate() function exists then it must be called before - * run() or run_adding(). If deactivate() is called for a plug-in instance then - * the plug-in instance may not be reused until activate() has been called again. - * - * Zyn Implementation - * ------------------ - * This is a LADSPA function that does not process any MIDI events; it is hence - * implemented by simply calling runSynth() with an empty event list. - * - * @param sample_count [in] the block size (in samples) for which the plug-in instance may run - */ -void DSSIaudiooutput::run(unsigned long sample_count) -{ - runSynth(sample_count, NULL, (unsigned long)0); -} - -/** - * Counterpart to activate(). - * - * This LADSPA member function is the counterpart to activate() (see above). - * Deactivation is not similar to pausing as the plug-in instance will be - * reinitialised when activate() is called to reuse it. - * - * Zyn Implementation - * ------------------ - * Currently this function does nothing. - */ -void DSSIaudiooutput::deactivate() -{} - -/** - * Deletes a plug-in instance that is no longer required. - * - * LADSPA member function; once an instance of a plug-in has been finished with - * it can be deleted using this function. The instance handle ceases to be - * valid after this call. - * - * If activate() was called for a plug-in instance then a corresponding call to - * deactivate() must be made before cleanup() is called. - * - * Zyn Implementation - * ------------------ - * Currently cleanup is deferred to the destructor that is invoked after cleanup() - */ -void DSSIaudiooutput::cleanup() -{} - -/** - * Initial entry point for the LADSPA plug-in library. - * - * This LADSPA function is the initial entry point for the plug-in library. - * The LADSPA host looks for this entry point in each shared library object it - * finds and then calls the function to enumerate the plug-ins within the - * library. - * - * Zyn Implementation - * ------------------ - * As the Zyn plug-in is a DSSI plug-in, the LADSPA descriptor is embedded inside - * the DSSI descriptor, which is created by DSSIaudiooutput::initDssiDescriptor() - * statically when the library is loaded. This function then merely returns a pointer - * to that embedded descriptor. - * - * @param index [in] the index number of the plug-in within the library. - * @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL - */ -const LADSPA_Descriptor *DSSIaudiooutput::getLadspaDescriptor( - unsigned long index) -{ - if((index > 0) || (dssiDescriptor == NULL)) - return NULL; - else - return dssiDescriptor->LADSPA_Plugin; -} - -// -// DSSI member functions -// - -/** - * Provides a description of a program available on this synth. - * - * This DSSI member function pointer provides a description of a program (named - * preset sound) available on this synth. - * - * Zyn Implementation - * ------------------ - * The instruments in all Zyn's bank directories, as shown by the `instrument - * -> show instrument bank` command, are enumerated to the host by this - * function, allowing access to all those instruments. - * The first time an instrument is requested, the bank it is in and any - * unmapped ones preceding that are mapped; all the instruments names and - * filenames from those banks are stored in the programMap member variable for - * later use. This is done on demand in this way, rather than up front in one - * go because loading all the instrument names in one go can lead to timeouts - * and zombies. - * - * @param index [in] index into the plug-in's list of - * programs, not a program number as represented by the Program - * field of the DSSI_Program_Descriptor. (This distinction is - * needed to support synths that use non-contiguous program or - * bank numbers.) - * @return a DSSI_Program_Descriptor pointer that is - * guaranteed to be valid only until the next call to get_program, - * deactivate, or configure, on the same plug-in instance, or NULL if index is out of range. - */ -const DSSI_Program_Descriptor *DSSIaudiooutput::getProgram(unsigned long index) -{ - static DSSI_Program_Descriptor retVal; - - /* Make sure we have the list of banks loaded */ - initBanks(); - - /* Make sure that the bank containing the instrument has been mapped */ - while(index >= programMap.size() && mapNextBank()) - /* DO NOTHING MORE */; - - if(index >= programMap.size()) - /* No more instruments */ - return NULL; - else { - /* OK, return the instrument */ - retVal.Name = programMap[index].name.c_str(); - retVal.Program = programMap[index].program; - retVal.Bank = programMap[index].bank; - return &retVal; - } -} - -/** - * Selects a new program for this synth. - * - * This DSSI member function selects a new program for this synth. The program - * change will take effect immediately at the start of the next run_synth() - * call. An invalid bank / instrument combination is ignored. - * - * Zyn Implementation - * ------------------ - * the banks and instruments are as shown in the `instrument -> show instrument - * bank` command in Zyn. The bank no is a 1-based index into the list of banks - * Zyn loads and shows in the drop down and the program number is the - * instrument within that bank. - * - * @param bank [in] the bank number to select - * @param program [in] the program number within the bank to select - */ -void DSSIaudiooutput::selectProgram(unsigned long bank, unsigned long program) -{ - initBanks(); -// cerr << "selectProgram(" << (bank & 0x7F) << ':' << ((bank >> 7) & 0x7F) << "," << program << ")" << '\n'; - if((bank < master->bank.banks.size()) && (program < BANK_SIZE)) { - const std::string bankdir = master->bank.banks[bank].dir; - if(!bankdir.empty()) { - pthread_mutex_lock(&master->mutex); - - /* We have to turn off the CheckPADsynth functionality, else - * the program change takes way too long and we get timeouts - * and hence zombies (!) */ - int save = config.cfg.CheckPADsynth; - config.cfg.CheckPADsynth = 0; - - /* Load the bank... */ - master->bank.loadbank(bankdir); - - /* restore the CheckPADsynth flag */ - config.cfg.CheckPADsynth = save; - - /* Now load the instrument... */ - master->bank.loadfromslot((unsigned int)program, master->part[0]); - - pthread_mutex_unlock(&master->mutex); - } - } -} - -/** - * Returns the MIDI controller number or NRPN for a input control port - * - * This DSSI member function returns the MIDI controller number or NRPN that - * should be mapped to the given input control port. If the given port should - * not have any MIDI controller mapped to it, the function will return DSSI_NONE. - * The behaviour of this function is undefined if the given port - * number does not correspond to an input control port. - * - * Zyn Implementation - * ------------------ - * Currently Zyn does not define any controller ports, but may do in the future. - * - * @param port [in] the input controller port - * @return the CC and NRPN values shifted and ORed together. - */ -int DSSIaudiooutput::getMidiControllerForPort(unsigned long /*port*/) -{ - return DSSI_NONE; -} - -/** - * Runs the synth for a block. - * - * This DSSI member function runs the synth for a block. This is identical in - * function to the LADSPA run() function, except that it also supplies events - * to the synth. - * - * Zyn Implementation - * ------------------ - * Zyn implements synthesis in Master::GetAudioOutSamples; runSynth calls this - * function in chunks delimited by the sample_count and the frame indexes in - * the events block, calling the appropriate NoteOn, NoteOff and SetController - * members of Master to process the events supplied between each chunk. - * - * @param sample_count [in] the block size (in samples) for which the synth - * instance may run. - * @param events [in] The Events pointer points to a block of ALSA - * sequencer events, used to communicate MIDI and related events to the synth. - * Each event must be timestamped relative to the start of the block, - * (mis)using the ALSA "tick time" field as a frame count. The host is - * responsible for ensuring that events with differing timestamps are already - * ordered by time. Must not include NOTE (only NOTE_ON / NOTE_OFF), LSB or MSB - * events. - * @param event_count [in] the number of entries in the `events` block - */ -void DSSIaudiooutput::runSynth(unsigned long sample_count, - snd_seq_event_t *events, - unsigned long event_count) -{ - unsigned long from_frame = 0; - unsigned long event_index = 0; - unsigned long next_event_frame = 0; - unsigned long to_frame = 0; - pthread_mutex_lock(&master->mutex); - - do { - /* Find the time of the next event, if any */ - if((events == NULL) || (event_index >= event_count)) - next_event_frame = ULONG_MAX; - else - next_event_frame = events[event_index].time.tick; - - /* find the end of the sub-sample to be processed this time round... */ - /* if the next event falls within the desired sample interval... */ - if((next_event_frame < sample_count) && (next_event_frame >= to_frame)) - /* set the end to be at that event */ - to_frame = next_event_frame; - else - /* ...else go for the whole remaining sample */ - to_frame = sample_count; - if(from_frame < to_frame) { - // call master to fill from `from_frame` to `to_frame`: - master->GetAudioOutSamples(to_frame - from_frame, - (int)sampleRate, - &(outl[from_frame]), - &(outr[from_frame])); - // next sub-sample please... - from_frame = to_frame; - } - - // Now process any event(s) at the current timing point - while(events != NULL && event_index < event_count - && events[event_index].time.tick == to_frame) { - if(events[event_index].type == SND_SEQ_EVENT_NOTEON) - master->noteOn(events[event_index].data.note.channel, - events[event_index].data.note.note, - events[event_index].data.note.velocity); - else - if(events[event_index].type == SND_SEQ_EVENT_NOTEOFF) - master->noteOff(events[event_index].data.note.channel, - events[event_index].data.note.note); - else - if(events[event_index].type == SND_SEQ_EVENT_CONTROLLER) - master->setController(events[event_index].data.control.channel, - events[event_index].data.control.param, - events[event_index].data.control.value); - else {} - event_index++; - } - - // Keep going until we have the desired total length of sample... - } while(to_frame < sample_count); - - pthread_mutex_unlock(&master->mutex); -} - -/** - * Initial entry point for the DSSI plug-in library. - * - * This DSSI function is the initial entry point for the plug-in library. - * The DSSI host looks for this entry point in each shared library object it - * finds and then calls the function to enumerate the plug-ins within the - * library. - * - * Zyn Implementation - * ------------------ - * The descriptor is created statically by DSSIaudiooutput::initDssiDescriptor() - * when the plug-in library is loaded. This function merely returns a pointer to - * that descriptor. - * - * @param index [in] the index number of the plug-in within the library. - * @return if index is in range, a pointer to the plug-in descriptor is returned, else NULL - */ -const DSSI_Descriptor *DSSIaudiooutput::getDssiDescriptor(unsigned long index) -{ - if((index > 0) || (dssiDescriptor == NULL)) - return NULL; - else - return dssiDescriptor; -} - -// -// Internal member functions -// - -// Initialise the DSSI descriptor, statically: -DSSI_Descriptor *DSSIaudiooutput::dssiDescriptor = - DSSIaudiooutput::initDssiDescriptor(); - -/** - * Initializes the DSSI (and LADSPA) descriptor, returning it is an object. - */ -DSSI_Descriptor *DSSIaudiooutput::initDssiDescriptor() -{ - DSSI_Descriptor *newDssiDescriptor = new DSSI_Descriptor; - - LADSPA_PortDescriptor *newPortDescriptors; - const char **newPortNames; - LADSPA_PortRangeHint *newPortRangeHints; - - if(newDssiDescriptor) { - LADSPA_Descriptor *newLadspaDescriptor = new LADSPA_Descriptor; - if(newLadspaDescriptor) { - newLadspaDescriptor->UniqueID = 100; - newLadspaDescriptor->Label = "ZASF"; - newLadspaDescriptor->Properties = 0; - newLadspaDescriptor->Name = "ZynAddSubFX"; - newLadspaDescriptor->Maker = - "Nasca Octavian Paul "; - newLadspaDescriptor->Copyright = "GNU General Public License v.2"; - newLadspaDescriptor->PortCount = 2; - - newPortNames = new const char *[newLadspaDescriptor->PortCount]; - newPortNames[0] = "Output L"; - newPortNames[1] = "Output R"; - newLadspaDescriptor->PortNames = newPortNames; - - newPortDescriptors = - new LADSPA_PortDescriptor[newLadspaDescriptor->PortCount]; - newPortDescriptors[0] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO; - newPortDescriptors[1] = LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO; - newLadspaDescriptor->PortDescriptors = newPortDescriptors; - - newPortRangeHints = - new LADSPA_PortRangeHint[newLadspaDescriptor->PortCount]; - newPortRangeHints[0].HintDescriptor = 0; - newPortRangeHints[1].HintDescriptor = 0; - newLadspaDescriptor->PortRangeHints = newPortRangeHints; - - newLadspaDescriptor->activate = stub_activate; - newLadspaDescriptor->cleanup = stub_cleanup; - newLadspaDescriptor->connect_port = stub_connectPort; - newLadspaDescriptor->deactivate = stub_deactivate; - newLadspaDescriptor->instantiate = instantiate; - newLadspaDescriptor->run = stub_run; - newLadspaDescriptor->run_adding = NULL; - newLadspaDescriptor->set_run_adding_gain = NULL; - } - newDssiDescriptor->LADSPA_Plugin = newLadspaDescriptor; - newDssiDescriptor->DSSI_API_Version = 1; - newDssiDescriptor->configure = NULL; - newDssiDescriptor->get_program = stub_getProgram; - newDssiDescriptor->get_midi_controller_for_port = - stub_getMidiControllerForPort; - newDssiDescriptor->select_program = stub_selectProgram; - newDssiDescriptor->run_synth = stub_runSynth; - newDssiDescriptor->run_synth_adding = NULL; - newDssiDescriptor->run_multiple_synths = NULL; - newDssiDescriptor->run_multiple_synths_adding = NULL; - } - - dssiDescriptor = newDssiDescriptor; - - return dssiDescriptor; -} - -/** - * Converts a LADSPA / DSSI handle into a DSSIaudiooutput instance. - * - * @param instance [in] - * @return the instance - */ -DSSIaudiooutput *DSSIaudiooutput::getInstance(LADSPA_Handle instance) -{ - return (DSSIaudiooutput *)(instance); -} - -SYNTH_T *synth; - -/** - * The private sole constructor for the DSSIaudiooutput class. - * - * Only ever called via instantiate(). - * @param sampleRate [in] the sample rate to be used by the synth. - * @return - */ -DSSIaudiooutput::DSSIaudiooutput(unsigned long sampleRate) -{ - synth = new SYNTH_T; - synth->samplerate = sampleRate; - - this->sampleRate = sampleRate; - this->banksInited = false; - - config.init(); - - sprng(time(NULL)); - denormalkillbuf = new float [synth->buffersize]; - for(int i = 0; i < synth->buffersize; i++) - denormalkillbuf[i] = (RND - 0.5f) * 1e-16; - - synth->alias(); - this->master = new Master(); -} - -/** - * The destructor for the DSSIaudiooutput class - * @return - */ -DSSIaudiooutput::~DSSIaudiooutput() -{} - -/** - * Ensures the list of bank (directories) has been initialised. - */ -void DSSIaudiooutput::initBanks(void) -{ - if(!banksInited) { - pthread_mutex_lock(&master->mutex); - master->bank.rescanforbanks(); - banksInited = true; - pthread_mutex_unlock(&master->mutex); - } -} - -/** - * constructor for the internally used ProgramDescriptor class - * - * @param _bank [in] bank number - * @param _program [in] program number - * @param _name [in] instrument / sample name - * @return - */ -DSSIaudiooutput::ProgramDescriptor::ProgramDescriptor(unsigned long _bank, - unsigned long _program, - char *_name) - :bank(_bank), program(_program), name(_name) -{} - -/** - * The map of programs available; held as a single shared statically allocated object. - */ -vector DSSIaudiooutput::programMap = - vector(); - -/** - * Index controlling the map of banks - */ -long DSSIaudiooutput::bankNoToMap = 1; - -/** - * Queries and maps the next available bank of instruments. - * - * If the program index requested to getProgram() lies beyond the banks mapped to date, - * this member function is called to map the next one. - * @return true if a new bank has been found and mapped, else false. - */ -bool DSSIaudiooutput::mapNextBank() -{ - pthread_mutex_lock(&master->mutex); - Bank &bank = master->bank; - bool retval; - if((bankNoToMap >= (int)bank.banks.size()) - || bank.banks[bankNoToMap].dir.empty()) - retval = false; - else { - bank.loadbank(bank.banks[bankNoToMap].dir); - for(unsigned long instrument = 0; instrument < BANK_SIZE; - ++instrument) { - string insName = bank.getname(instrument); - if(!insName.empty() && (insName[0] != '\0') && (insName[0] != ' ')) - programMap.push_back(ProgramDescriptor(bankNoToMap, instrument, - const_cast( - insName.c_str()))); - } - bankNoToMap++; - retval = true; - } - pthread_mutex_unlock(&master->mutex); - return retval; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.h b/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.h deleted file mode 100644 index f7eaaf35947..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Output/DSSIaudiooutput.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - VSTaudiooutput.h - Audio output for VST - Copyright (C) 2002 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef VST_AUDIO_OUTPUT_H -#define VST_AUDIO_OUTPUT_H - -#include - -#include "../globals.h" -#include "../Misc/Master.h" - -#include -#include -#include - -class DSSIaudiooutput -{ - public: - // - // Static stubs for LADSPA member functions - // - static void stub_connectPort(LADSPA_Handle instance, - unsigned long port, - LADSPA_Data *data); - static void stub_activate(LADSPA_Handle instance); - static void stub_run(LADSPA_Handle instance, unsigned long sample_count); - static void stub_deactivate(LADSPA_Handle Instance); - static void stub_cleanup(LADSPA_Handle instance); - - // - // Static stubs for DSSI member functions - // - static const DSSI_Program_Descriptor *stub_getProgram( - LADSPA_Handle instance, - unsigned long Index); - static void stub_selectProgram(LADSPA_Handle instance, - unsigned long bank, - unsigned long program); - static int stub_getMidiControllerForPort(LADSPA_Handle instance, - unsigned long port); - static void stub_runSynth(LADSPA_Handle instance, - unsigned long sample_count, - snd_seq_event_t *events, - unsigned long event_count); - - /* - * LADSPA member functions - */ - static LADSPA_Handle instantiate(const LADSPA_Descriptor *descriptor, - unsigned long s_rate); - void connectPort(unsigned long port, LADSPA_Data *data); - void activate(); - void run(unsigned long sample_count); - void deactivate(); - void cleanup(); - static const LADSPA_Descriptor *getLadspaDescriptor(unsigned long index); - - /* - * DSSI member functions - */ - const DSSI_Program_Descriptor *getProgram(unsigned long Index); - void selectProgram(unsigned long bank, unsigned long program); - int getMidiControllerForPort(unsigned long port); - void runSynth(unsigned long sample_count, - snd_seq_event_t *events, - unsigned long event_count); - static const DSSI_Descriptor *getDssiDescriptor(unsigned long index); - - struct ProgramDescriptor { - unsigned long bank; - unsigned long program; - std::string name; - ProgramDescriptor(unsigned long _bank, - unsigned long _program, - char *_name); - }; - - private: - - DSSIaudiooutput(unsigned long sampleRate); - ~DSSIaudiooutput(); - static DSSI_Descriptor *initDssiDescriptor(); - static DSSIaudiooutput *getInstance(LADSPA_Handle instance); - void initBanks(); - bool mapNextBank(); - - LADSPA_Data *outl; - LADSPA_Data *outr; - long sampleRate; - Master *master; - static DSSI_Descriptor *dssiDescriptor; - static std::string bankDirNames[]; - static - std::vector programMap; - - /** - * Flag controlling the list of bank directories - */ - bool banksInited; - - static - long bankNoToMap; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.cpp deleted file mode 100644 index 02564dbbf53..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.cpp +++ /dev/null @@ -1,796 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnoteParameters.cpp - Parameters for ADnote (ADsynth) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include - -#include "ADnoteParameters.h" -#include "EnvelopeParams.h" -#include "LFOParams.h" -#include "../Misc/XMLwrapper.h" -#include "../DSP/FFTwrapper.h" -#include "../Synth/OscilGen.h" -#include "../Synth/Resonance.h" -#include "FilterParams.h" - -int ADnote_unison_sizes[] = -{1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 25, 30, 40, 50, 0}; - -ADnoteParameters::ADnoteParameters(FFTwrapper *fft_) - :PresetsArray() -{ - setpresettype("Padsynth"); - fft = fft_; - - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) - EnableVoice(nvoice); - - defaults(); -} - -ADnoteGlobalParam::ADnoteGlobalParam() -{ - FreqEnvelope = new EnvelopeParams(0, 0); - FreqEnvelope->ASRinit(64, 50, 64, 60); - FreqLfo = new LFOParams(70, 0, 64, 0, 0, 0, 0, 0); - - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - AmpLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 1); - - GlobalFilter = new FilterParams(2, 94, 40); - FilterEnvelope = new EnvelopeParams(0, 1); - FilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - FilterLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 2); - Reson = new Resonance(); -} - -void ADnoteParameters::defaults() -{ - //Default Parameters - GlobalPar.defaults(); - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) - defaults(nvoice); - - VoicePar[0].Enabled = 1; -} - -void ADnoteGlobalParam::defaults() -{ - /* Frequency Global Parameters */ - PStereo = 1; //stereo - PDetune = 8192; //zero - PCoarseDetune = 0; - PDetuneType = 1; - FreqEnvelope->defaults(); - FreqLfo->defaults(); - PBandwidth = 64; - - /* Amplitude Global Parameters */ - PVolume = 90; - PPanning = 64; //center - PAmpVelocityScaleFunction = 64; - AmpEnvelope->defaults(); - AmpLfo->defaults(); - PPunchStrength = 0; - PPunchTime = 60; - PPunchStretch = 64; - PPunchVelocitySensing = 72; - Hrandgrouping = 0; - - /* Filter Global Parameters*/ - PFilterVelocityScale = 64; - PFilterVelocityScaleFunction = 64; - GlobalFilter->defaults(); - FilterEnvelope->defaults(); - FilterLfo->defaults(); - Reson->defaults(); -} - -/* - * Defaults a voice - */ -void ADnoteParameters::defaults(int n) -{ - VoicePar[n].defaults(); -} - -void ADnoteVoiceParam::defaults() -{ - Enabled = 0; - - Unison_size = 1; - Unison_frequency_spread = 60; - Unison_stereo_spread = 64; - Unison_vibratto = 64; - Unison_vibratto_speed = 64; - Unison_invert_phase = 0; - Unison_phase_randomness = 127; - - Type = 0; - Pfixedfreq = 0; - PfixedfreqET = 0; - Presonance = 1; - Pfilterbypass = 0; - Pextoscil = -1; - PextFMoscil = -1; - Poscilphase = 64; - PFMoscilphase = 64; - PDelay = 0; - PVolume = 100; - PVolumeminus = 0; - PPanning = 64; //center - PDetune = 8192; //8192=0 - PCoarseDetune = 0; - PDetuneType = 0; - PFreqLfoEnabled = 0; - PFreqEnvelopeEnabled = 0; - PAmpEnvelopeEnabled = 0; - PAmpLfoEnabled = 0; - PAmpVelocityScaleFunction = 127; - PFilterEnabled = 0; - PFilterEnvelopeEnabled = 0; - PFilterLfoEnabled = 0; - PFMEnabled = 0; - - //I use the internal oscillator (-1) - PFMVoice = -1; - - PFMVolume = 90; - PFMVolumeDamp = 64; - PFMDetune = 8192; - PFMCoarseDetune = 0; - PFMDetuneType = 0; - PFMFreqEnvelopeEnabled = 0; - PFMAmpEnvelopeEnabled = 0; - PFMVelocityScaleFunction = 64; - - OscilSmp->defaults(); - FMSmp->defaults(); - - AmpEnvelope->defaults(); - AmpLfo->defaults(); - - FreqEnvelope->defaults(); - FreqLfo->defaults(); - - VoiceFilter->defaults(); - FilterEnvelope->defaults(); - FilterLfo->defaults(); - - FMFreqEnvelope->defaults(); - FMAmpEnvelope->defaults(); -} - - - -/* - * Init the voice parameters - */ -void ADnoteParameters::EnableVoice(int nvoice) -{ - VoicePar[nvoice].enable(fft, GlobalPar.Reson); -} - -void ADnoteVoiceParam::enable(FFTwrapper *fft, Resonance *Reson) -{ - OscilSmp = new OscilGen(fft, Reson); - FMSmp = new OscilGen(fft, NULL); - - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 100, 127, 100); - AmpLfo = new LFOParams(90, 32, 64, 0, 0, 30, 0, 1); - - FreqEnvelope = new EnvelopeParams(0, 0); - FreqEnvelope->ASRinit(30, 40, 64, 60); - FreqLfo = new LFOParams(50, 40, 0, 0, 0, 0, 0, 0); - - VoiceFilter = new FilterParams(2, 50, 60); - FilterEnvelope = new EnvelopeParams(0, 0); - FilterEnvelope->ADSRinit_filter(90, 70, 40, 70, 10, 40); - FilterLfo = new LFOParams(50, 20, 64, 0, 0, 0, 0, 2); - - FMFreqEnvelope = new EnvelopeParams(0, 0); - FMFreqEnvelope->ASRinit(20, 90, 40, 80); - FMAmpEnvelope = new EnvelopeParams(64, 1); - FMAmpEnvelope->ADSRinit(80, 90, 127, 100); -} - -/* - * Get the Multiplier of the fine detunes of the voices - */ -float ADnoteParameters::getBandwidthDetuneMultiplier() -{ - float bw = (GlobalPar.PBandwidth - 64.0f) / 64.0f; - bw = powf(2.0f, bw * powf(fabs(bw), 0.2f) * 5.0f); - - return bw; -} - -/* - * Get the unison spread in cents for a voice - */ - -float ADnoteParameters::getUnisonFrequencySpreadCents(int nvoice) { - float unison_spread = VoicePar[nvoice].Unison_frequency_spread / 127.0f; - unison_spread = powf(unison_spread * 2.0f, 2.0f) * 50.0f; //cents - return unison_spread; -} - -/* - * Kill the voice - */ -void ADnoteParameters::KillVoice(int nvoice) -{ - VoicePar[nvoice].kill(); -} - -void ADnoteVoiceParam::kill() -{ - delete OscilSmp; - delete FMSmp; - - delete AmpEnvelope; - delete AmpLfo; - - delete FreqEnvelope; - delete FreqLfo; - - delete VoiceFilter; - delete FilterEnvelope; - delete FilterLfo; - - delete FMFreqEnvelope; - delete FMAmpEnvelope; -} - - -ADnoteGlobalParam::~ADnoteGlobalParam() -{ - delete FreqEnvelope; - delete FreqLfo; - delete AmpEnvelope; - delete AmpLfo; - delete GlobalFilter; - delete FilterEnvelope; - delete FilterLfo; - delete Reson; -} - -ADnoteParameters::~ADnoteParameters() -{ - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) - KillVoice(nvoice); -} - -int ADnoteParameters::get_unison_size_index(int nvoice) { - int index = 0; - if(nvoice >= NUM_VOICES) - return 0; - int unison = VoicePar[nvoice].Unison_size; - - while(1) { - if(ADnote_unison_sizes[index] >= unison) - return index; - - if(ADnote_unison_sizes[index] == 0) - return index - 1; - - index++; - } - return 0; -} - -void ADnoteParameters::set_unison_size_index(int nvoice, int index) { - int unison = 1; - for(int i = 0; i <= index; ++i) { - unison = ADnote_unison_sizes[i]; - if(unison == 0) { - unison = ADnote_unison_sizes[i - 1]; - break; - } - } - - VoicePar[nvoice].Unison_size = unison; -} - - - -void ADnoteParameters::add2XMLsection(XMLwrapper *xml, int n) -{ - int nvoice = n; - if(nvoice >= NUM_VOICES) - return; - - int oscilused = 0, fmoscilused = 0; //if the oscil or fmoscil are used by another voice - - for(int i = 0; i < NUM_VOICES; ++i) { - if(VoicePar[i].Pextoscil == nvoice) - oscilused = 1; - if(VoicePar[i].PextFMoscil == nvoice) - fmoscilused = 1; - } - - xml->addparbool("enabled", VoicePar[nvoice].Enabled); - if(((VoicePar[nvoice].Enabled == 0) && (oscilused == 0) - && (fmoscilused == 0)) && (xml->minimal)) - return; - - VoicePar[nvoice].add2XML(xml, fmoscilused); -} - -void ADnoteVoiceParam::add2XML(XMLwrapper *xml, bool fmoscilused) -{ - xml->addpar("type", Type); - - xml->addpar("unison_size", Unison_size); - xml->addpar("unison_frequency_spread", - Unison_frequency_spread); - xml->addpar("unison_stereo_spread", Unison_stereo_spread); - xml->addpar("unison_vibratto", Unison_vibratto); - xml->addpar("unison_vibratto_speed", Unison_vibratto_speed); - xml->addpar("unison_invert_phase", Unison_invert_phase); - xml->addpar("unison_phase_randomness", Unison_phase_randomness); - - xml->addpar("delay", PDelay); - xml->addparbool("resonance", Presonance); - - xml->addpar("ext_oscil", Pextoscil); - xml->addpar("ext_fm_oscil", PextFMoscil); - - xml->addpar("oscil_phase", Poscilphase); - xml->addpar("oscil_fm_phase", PFMoscilphase); - - xml->addparbool("filter_enabled", PFilterEnabled); - xml->addparbool("filter_bypass", Pfilterbypass); - - xml->addpar("fm_enabled", PFMEnabled); - - xml->beginbranch("OSCIL"); - OscilSmp->add2XML(xml); - xml->endbranch(); - - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("panning", PPanning); - xml->addpar("volume", PVolume); - xml->addparbool("volume_minus", PVolumeminus); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - - xml->addparbool("amp_envelope_enabled", - PAmpEnvelopeEnabled); - if((PAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->addparbool("amp_lfo_enabled", PAmpLfoEnabled); - if((PAmpLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_LFO"); - AmpLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); - - xml->addparbool("freq_envelope_enabled", - PFreqEnvelopeEnabled); - if((PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->addparbool("freq_lfo_enabled", PFreqLfoEnabled); - if((PFreqLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_LFO"); - FreqLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - - if((PFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_PARAMETERS"); - xml->beginbranch("FILTER"); - VoiceFilter->add2XML(xml); - xml->endbranch(); - - xml->addparbool("filter_envelope_enabled", - PFilterEnvelopeEnabled); - if((PFilterEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_ENVELOPE"); - FilterEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("filter_lfo_enabled", - PFilterLfoEnabled); - if((PFilterLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_LFO"); - FilterLfo->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - } - - if((PFMEnabled != 0) || (fmoscilused != 0) - || (!xml->minimal)) { - xml->beginbranch("FM_PARAMETERS"); - xml->addpar("input_voice", PFMVoice); - - xml->addpar("volume", PFMVolume); - xml->addpar("volume_damp", PFMVolumeDamp); - xml->addpar("velocity_sensing", - PFMVelocityScaleFunction); - - xml->addparbool("amp_envelope_enabled", - PFMAmpEnvelopeEnabled); - if((PFMAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); - FMAmpEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->beginbranch("MODULATOR"); - xml->addpar("detune", PFMDetune); - xml->addpar("coarse_detune", PFMCoarseDetune); - xml->addpar("detune_type", PFMDetuneType); - - xml->addparbool("freq_envelope_enabled", - PFMFreqEnvelopeEnabled); - if((PFMFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - FMFreqEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->beginbranch("OSCIL"); - FMSmp->add2XML(xml); - xml->endbranch(); - - xml->endbranch(); - xml->endbranch(); - } -} - -void ADnoteGlobalParam::add2XML(XMLwrapper *xml) -{ - xml->addparbool("stereo", PStereo); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addpar("punch_strength", PPunchStrength); - xml->addpar("punch_time", PPunchTime); - xml->addpar("punch_stretch", PPunchStretch); - xml->addpar("punch_velocity_sensing", PPunchVelocitySensing); - xml->addpar("harmonic_randomness_grouping", Hrandgrouping); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_LFO"); - AmpLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("detune", PDetune); - - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); - - xml->addpar("bandwidth", PBandwidth); - - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_LFO"); - FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); - - xml->beginbranch("FILTER"); - GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_ENVELOPE"); - FilterEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_LFO"); - FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("RESONANCE"); - Reson->add2XML(xml); - xml->endbranch(); -} - -void ADnoteParameters::add2XML(XMLwrapper *xml) -{ - GlobalPar.add2XML(xml); - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - xml->beginbranch("VOICE", nvoice); - add2XMLsection(xml, nvoice); - xml->endbranch(); - } -} - - -void ADnoteGlobalParam::getfromXML(XMLwrapper *xml) -{ - PStereo = xml->getparbool("stereo", PStereo); - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - - PPunchStrength = xml->getpar127("punch_strength", PPunchStrength); - PPunchTime = xml->getpar127("punch_time", PPunchTime); - PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch); - PPunchVelocitySensing = xml->getpar127("punch_velocity_sensing", - PPunchVelocitySensing); - Hrandgrouping = xml->getpar127("harmonic_randomness_grouping", - Hrandgrouping); - - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_LFO")) { - AmpLfo->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - PBandwidth = xml->getpar127("bandwidth", PBandwidth); - - xml->enterbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FREQUENCY_LFO"); - FreqLfo->getfromXML(xml); - xml->exitbranch(); - - xml->exitbranch(); - } - - - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", - PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - PFilterVelocityScaleFunction); - - xml->enterbranch("FILTER"); - GlobalFilter->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_ENVELOPE"); - FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_LFO"); - FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } - - if(xml->enterbranch("RESONANCE")) { - Reson->getfromXML(xml); - xml->exitbranch(); - } -} - -void ADnoteParameters::getfromXML(XMLwrapper *xml) -{ - GlobalPar.getfromXML(xml); - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - VoicePar[nvoice].Enabled = 0; - if(xml->enterbranch("VOICE", nvoice) == 0) - continue; - getfromXMLsection(xml, nvoice); - xml->exitbranch(); - } -} - -void ADnoteParameters::getfromXMLsection(XMLwrapper *xml, int n) -{ - int nvoice = n; - if(nvoice >= NUM_VOICES) - return; - - VoicePar[nvoice].getfromXML(xml, nvoice); -} - - -void ADnoteVoiceParam::getfromXML(XMLwrapper *xml, unsigned nvoice) -{ - Enabled = xml->getparbool("enabled", 0); - Unison_size = xml->getpar127("unison_size", Unison_size); - Unison_frequency_spread = xml->getpar127("unison_frequency_spread", - Unison_frequency_spread); - Unison_stereo_spread = xml->getpar127("unison_stereo_spread", - Unison_stereo_spread); - Unison_vibratto = xml->getpar127("unison_vibratto", Unison_vibratto); - Unison_vibratto_speed = xml->getpar127("unison_vibratto_speed", - Unison_vibratto_speed); - Unison_invert_phase = xml->getpar127("unison_invert_phase", - Unison_invert_phase); - Unison_phase_randomness = xml->getpar127("unison_phase_randomness", - Unison_phase_randomness); - - Type = xml->getpar127("type", Type); - PDelay = xml->getpar127("delay", PDelay); - Presonance = xml->getparbool("resonance", Presonance); - - Pextoscil = xml->getpar("ext_oscil", -1, -1, nvoice - 1); - PextFMoscil = xml->getpar("ext_fm_oscil", -1, -1, nvoice - 1); - - Poscilphase = xml->getpar127("oscil_phase", Poscilphase); - PFMoscilphase = xml->getpar127("oscil_fm_phase", PFMoscilphase); - PFilterEnabled = xml->getparbool("filter_enabled", PFilterEnabled); - Pfilterbypass = xml->getparbool("filter_bypass", Pfilterbypass); - PFMEnabled = xml->getpar127("fm_enabled", PFMEnabled); - - if(xml->enterbranch("OSCIL")) { - OscilSmp->getfromXML(xml); - xml->exitbranch(); - } - - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PPanning = xml->getpar127("panning", PPanning); - PVolume = xml->getpar127("volume", PVolume); - PVolumeminus = xml->getparbool("volume_minus", PVolumeminus); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - - PAmpEnvelopeEnabled = xml->getparbool("amp_envelope_enabled", - PAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - PAmpLfoEnabled = xml->getparbool("amp_lfo_enabled", PAmpLfoEnabled); - if(xml->enterbranch("AMPLITUDE_LFO")) { - AmpLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getparbool("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - PFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", - PFreqEnvelopeEnabled); - - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - PFreqLfoEnabled = xml->getparbool("freq_lfo_enabled", PFreqLfoEnabled); - - if(xml->enterbranch("FREQUENCY_LFO")) { - FreqLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - if(xml->enterbranch("FILTER")) { - VoiceFilter->getfromXML(xml); - xml->exitbranch(); - } - - PFilterEnvelopeEnabled = xml->getparbool("filter_envelope_enabled", - PFilterEnvelopeEnabled); - if(xml->enterbranch("FILTER_ENVELOPE")) { - FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - PFilterLfoEnabled = xml->getparbool("filter_lfo_enabled", - PFilterLfoEnabled); - if(xml->enterbranch("FILTER_LFO")) { - FilterLfo->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FM_PARAMETERS")) { - PFMVoice = xml->getpar("input_voice", PFMVoice, -1, nvoice - 1); - PFMVolume = xml->getpar127("volume", PFMVolume); - PFMVolumeDamp = xml->getpar127("volume_damp", PFMVolumeDamp); - PFMVelocityScaleFunction = xml->getpar127("velocity_sensing", - PFMVelocityScaleFunction); - - PFMAmpEnvelopeEnabled = xml->getparbool("amp_envelope_enabled", - PFMAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - FMAmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("MODULATOR")) { - PFMDetune = xml->getpar("detune", PFMDetune, 0, 16383); - PFMCoarseDetune = xml->getpar("coarse_detune", - PFMCoarseDetune, - 0, - 16383); - PFMDetuneType = xml->getpar127("detune_type", PFMDetuneType); - - PFMFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", - PFMFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - FMFreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("OSCIL")) { - FMSmp->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.h deleted file mode 100644 index a95e1d1bdff..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/ADnoteParameters.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnoteParameters.h - Parameters for ADnote (ADsynth) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef AD_NOTE_PARAMETERS_H -#define AD_NOTE_PARAMETERS_H - - -#include "../globals.h" -#include "../Misc/Util.h" -#include "PresetsArray.h" - -class EnvelopeParams; -class LFOParams; -class FilterParams; -class Resonance; -class OscilGen; -class FFTwrapper; - -enum FMTYPE { - NONE, MORPH, RING_MOD, PHASE_MOD, FREQ_MOD, PITCH_MOD -}; -extern int ADnote_unison_sizes[]; - -/*****************************************************************/ -/* GLOBAL PARAMETERS */ -/*****************************************************************/ - -struct ADnoteGlobalParam { - ADnoteGlobalParam(); - ~ADnoteGlobalParam(); - void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - /* The instrument type - MONO/STEREO - If the mode is MONO, the panning of voices are not used - Stereo=1, Mono=0. */ - - unsigned char PStereo; - - - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - unsigned short int PDetune; //fine detune - unsigned short int PCoarseDetune; //coarse detune+octave - unsigned char PDetuneType; //detune type - - unsigned char PBandwidth; //how much the relative fine detunes of the voices are changed - - EnvelopeParams *FreqEnvelope; //Frequency Envelope - - LFOParams *FreqLfo; //Frequency LFO - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - - /* Panning - 0 - random - 1 - left - 64 - center - 127 - right */ - unsigned char PPanning; - - unsigned char PVolume; - - unsigned char PAmpVelocityScaleFunction; - - EnvelopeParams *AmpEnvelope; - - LFOParams *AmpLfo; - - unsigned char PPunchStrength, PPunchTime, PPunchStretch, - PPunchVelocitySensing; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - FilterParams *GlobalFilter; - - // filter velocity sensing - unsigned char PFilterVelocityScale; - - // filter velocity sensing - unsigned char PFilterVelocityScaleFunction; - - EnvelopeParams *FilterEnvelope; - - LFOParams *FilterLfo; - - // RESONANCE - Resonance *Reson; - - //how the randomness is applied to the harmonics on more voices using the same oscillator - unsigned char Hrandgrouping; -}; - - - -/***********************************************************/ -/* VOICE PARAMETERS */ -/***********************************************************/ -struct ADnoteVoiceParam { - void getfromXML(XMLwrapper *xml, unsigned nvoice); - void add2XML(XMLwrapper *xml, bool fmoscilused); - void defaults(); - void enable(FFTwrapper *fft, Resonance *Reson); - void kill(); - /** If the voice is enabled */ - unsigned char Enabled; - - /** How many subvoices are used in this voice */ - unsigned char Unison_size; - - /** How subvoices are spread */ - unsigned char Unison_frequency_spread; - - /** How much phase randomization */ - unsigned char Unison_phase_randomness; - - /** Stereo spread of the subvoices*/ - unsigned char Unison_stereo_spread; - - /** Vibratto of the subvoices (which makes the unison more "natural")*/ - unsigned char Unison_vibratto; - - /** Medium speed of the vibratto of the subvoices*/ - unsigned char Unison_vibratto_speed; - - /** Unison invert phase */ - unsigned char Unison_invert_phase; //0=none,1=random,2=50%,3=33%,4=25% - - /** Type of the voice (0=Sound,1=Noise)*/ - unsigned char Type; - - /** Voice Delay */ - unsigned char PDelay; - - /** If the resonance is enabled for this voice */ - unsigned char Presonance; - - // What external oscil should I use, -1 for internal OscilSmp&FMSmp - short int Pextoscil, PextFMoscil; - // it is not allowed that the externoscil,externFMoscil => current voice - - // oscillator phases - unsigned char Poscilphase, PFMoscilphase; - - // filter bypass - unsigned char Pfilterbypass; - - /** Voice oscillator */ - OscilGen *OscilSmp; - - /********************************** - * FREQUENCY PARAMETERS * - **********************************/ - - /** If the base frequency is fixed to 440 Hz*/ - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - - /** Fine detune */ - unsigned short int PDetune; - - /** Coarse detune + octave */ - unsigned short int PCoarseDetune; - - /** Detune type */ - unsigned char PDetuneType; - - /* Frequency Envelope */ - unsigned char PFreqEnvelopeEnabled; - EnvelopeParams *FreqEnvelope; - - /* Frequency LFO */ - unsigned char PFreqLfoEnabled; - LFOParams *FreqLfo; - - - /*************************** - * AMPLITUDE PARAMETERS * - ***************************/ - - /* Panning 0 - random - 1 - left - 64 - center - 127 - right - The Panning is ignored if the instrument is mono */ - unsigned char PPanning; - - /* Voice Volume */ - unsigned char PVolume; - - /* If the Volume negative */ - unsigned char PVolumeminus; - - /* Velocity sensing */ - unsigned char PAmpVelocityScaleFunction; - - /* Amplitude Envelope */ - unsigned char PAmpEnvelopeEnabled; - EnvelopeParams *AmpEnvelope; - - /* Amplitude LFO */ - unsigned char PAmpLfoEnabled; - LFOParams *AmpLfo; - - - - /************************* - * FILTER PARAMETERS * - *************************/ - - /* Voice Filter */ - unsigned char PFilterEnabled; - FilterParams *VoiceFilter; - - /* Filter Envelope */ - unsigned char PFilterEnvelopeEnabled; - EnvelopeParams *FilterEnvelope; - - /* LFO Envelope */ - unsigned char PFilterLfoEnabled; - LFOParams *FilterLfo; - - /**************************** - * MODULLATOR PARAMETERS * - ****************************/ - - /* Modullator Parameters (0=off,1=Morph,2=RM,3=PM,4=FM.. */ - unsigned char PFMEnabled; - - /* Voice that I use as modullator instead of FMSmp. - It is -1 if I use FMSmp(default). - It maynot be equal or bigger than current voice */ - short int PFMVoice; - - /* Modullator oscillator */ - OscilGen *FMSmp; - - /* Modullator Volume */ - unsigned char PFMVolume; - - /* Modullator damping at higher frequencies */ - unsigned char PFMVolumeDamp; - - /* Modullator Velocity Sensing */ - unsigned char PFMVelocityScaleFunction; - - /* Fine Detune of the Modullator*/ - unsigned short int PFMDetune; - - /* Coarse Detune of the Modullator */ - unsigned short int PFMCoarseDetune; - - /* The detune type */ - unsigned char PFMDetuneType; - - /* Frequency Envelope of the Modullator */ - unsigned char PFMFreqEnvelopeEnabled; - EnvelopeParams *FMFreqEnvelope; - - /* Frequency Envelope of the Modullator */ - unsigned char PFMAmpEnvelopeEnabled; - EnvelopeParams *FMAmpEnvelope; -}; - -class ADnoteParameters:public PresetsArray -{ - public: - ADnoteParameters(FFTwrapper *fft_); - ~ADnoteParameters(); - - ADnoteGlobalParam GlobalPar; - ADnoteVoiceParam VoicePar[NUM_VOICES]; - - void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - - float getBandwidthDetuneMultiplier(); - float getUnisonFrequencySpreadCents(int nvoice); - int get_unison_size_index(int nvoice); - void set_unison_size_index(int nvoice, int index); - private: - void defaults(int n); //n is the nvoice - - void EnableVoice(int nvoice); - void KillVoice(int nvoice); - FFTwrapper *fft; - - void add2XMLsection(XMLwrapper *xml, int n); - void getfromXMLsection(XMLwrapper *xml, int n); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Params/CMakeLists.txt deleted file mode 100644 index d5758affa1f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(zynaddsubfx_params_SRCS - Params/ADnoteParameters.cpp - Params/Controller.cpp - Params/EnvelopeParams.cpp - Params/FilterParams.cpp - Params/LFOParams.cpp - Params/PADnoteParameters.cpp - Params/Presets.cpp - Params/PresetsArray.cpp - Params/PresetsStore.cpp - Params/SUBnoteParameters.cpp - PARENT_SCOPE -) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.cpp deleted file mode 100644 index 5d126545059..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Controller.cpp - (Midi) Controllers 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Controller.h" -#include -#include - -Controller::Controller() -{ - defaults(); - resetall(); -} - -Controller::~Controller() -{} - -void Controller::defaults() -{ - setpitchwheelbendrange(100); //1 halftones - expression.receive = 1; - panning.depth = 64; - filtercutoff.depth = 64; - filterq.depth = 64; - bandwidth.depth = 64; - bandwidth.exponential = 0; - modwheel.depth = 80; - modwheel.exponential = 0; - fmamp.receive = 1; - volume.receive = 1; - sustain.receive = 1; - NRPN.receive = 1; - - portamento.portamento = 0; - portamento.used = 0; - portamento.proportional = 0; - portamento.propRate = 80; - portamento.propDepth = 90; - portamento.receive = 1; - portamento.time = 64; - portamento.updowntimestretch = 64; - portamento.pitchthresh = 3; - portamento.pitchthreshtype = 1; - portamento.noteusing = -1; - resonancecenter.depth = 64; - resonancebandwidth.depth = 64; - - initportamento(440.0f, 440.0f, false); // Now has a third argument - setportamento(0); -} - -void Controller::resetall() -{ - setpitchwheel(0); //center - setexpression(127); - setpanning(64); - setfiltercutoff(64); - setfilterq(64); - setbandwidth(64); - setmodwheel(64); - setfmamp(127); - setvolume(127); - setsustain(0); - setresonancecenter(64); - setresonancebw(64); - - //reset the NRPN - NRPN.parhi = -1; - NRPN.parlo = -1; - NRPN.valhi = -1; - NRPN.vallo = -1; -} - -void Controller::setpitchwheel(int value) -{ - pitchwheel.data = value; - float cents = value / 8192.0f; - cents *= pitchwheel.bendrange; - pitchwheel.relfreq = powf(2, cents / 1200.0f); - //fprintf(stderr,"%ld %ld -> %.3f\n",pitchwheel.bendrange,pitchwheel.data,pitchwheel.relfreq);fflush(stderr); -} - -void Controller::setpitchwheelbendrange(unsigned short int value) -{ - pitchwheel.bendrange = value; -} - -void Controller::setexpression(int value) -{ - expression.data = value; - if(expression.receive != 0) - expression.relvolume = value / 127.0f; - else - expression.relvolume = 1.0f; -} - -void Controller::setpanning(int value) -{ - panning.data = value; - panning.pan = (value / 128.0f - 0.5f) * (panning.depth / 64.0f); -} - -void Controller::setfiltercutoff(int value) -{ - filtercutoff.data = value; - filtercutoff.relfreq = - (value - 64.0f) * filtercutoff.depth / 4096.0f * 3.321928f; //3.3219f..=ln2(10) -} - -void Controller::setfilterq(int value) -{ - filterq.data = value; - filterq.relq = powf(30.0f, (value - 64.0f) / 64.0f * (filterq.depth / 64.0f)); -} - -void Controller::setbandwidth(int value) -{ - bandwidth.data = value; - if(bandwidth.exponential == 0) { - float tmp = powf(25.0f, powf(bandwidth.depth / 127.0f, 1.5f)) - 1.0f; - if((value < 64) && (bandwidth.depth >= 64)) - tmp = 1.0f; - bandwidth.relbw = (value / 64.0f - 1.0f) * tmp + 1.0f; - if(bandwidth.relbw < 0.01f) - bandwidth.relbw = 0.01f; - } - else - bandwidth.relbw = - powf(25.0f, (value - 64.0f) / 64.0f * (bandwidth.depth / 64.0f)); - ; -} - -void Controller::setmodwheel(int value) -{ - modwheel.data = value; - if(modwheel.exponential == 0) { - float tmp = - powf(25.0f, powf(modwheel.depth / 127.0f, 1.5f) * 2.0f) / 25.0f; - if((value < 64) && (modwheel.depth >= 64)) - tmp = 1.0f; - modwheel.relmod = (value / 64.0f - 1.0f) * tmp + 1.0f; - if(modwheel.relmod < 0.0f) - modwheel.relmod = 0.0f; - } - else - modwheel.relmod = - powf(25.0f, (value - 64.0f) / 64.0f * (modwheel.depth / 80.0f)); -} - -void Controller::setfmamp(int value) -{ - fmamp.data = value; - fmamp.relamp = value / 127.0f; - if(fmamp.receive != 0) - fmamp.relamp = value / 127.0f; - else - fmamp.relamp = 1.0f; -} - -void Controller::setvolume(int value) -{ - volume.data = value; - if(volume.receive != 0) - volume.volume = powf(0.1f, (127 - value) / 127.0f * 2.0f); - else - volume.volume = 1.0f; -} - -void Controller::setsustain(int value) -{ - sustain.data = value; - if(sustain.receive != 0) - sustain.sustain = ((value < 64) ? 0 : 1); - else - sustain.sustain = 0; -} - -void Controller::setportamento(int value) -{ - portamento.data = value; - if(portamento.receive != 0) - portamento.portamento = ((value < 64) ? 0 : 1); -} - -int Controller::initportamento(float oldfreq, - float newfreq, - bool legatoflag) -{ - portamento.x = 0.0f; - - if(legatoflag) { // Legato in progress - if(portamento.portamento == 0) - return 0; - } - else // No legato, do the original if...return - if((portamento.used != 0) || (portamento.portamento == 0)) - return 0; - ; - - float portamentotime = powf(100.0f, portamento.time / 127.0f) / 50.0f; //portamento time in seconds - - if(portamento.proportional) { - //If there is a min(float,float) and a max(float,float) then they - //could be used here - //Linear functors could also make this nicer - if(oldfreq > newfreq) //2 is the center of propRate - portamentotime *= - powf(oldfreq / newfreq - / (portamento.propRate / 127.0f * 3 + .05), - (portamento.propDepth / 127.0f * 1.6f + .2)); - else //1 is the center of propDepth - portamentotime *= - powf(newfreq / oldfreq - / (portamento.propRate / 127.0f * 3 + .05), - (portamento.propDepth / 127.0f * 1.6f + .2)); - } - - if((portamento.updowntimestretch >= 64) && (newfreq < oldfreq)) { - if(portamento.updowntimestretch == 127) - return 0; - portamentotime *= powf(0.1f, - (portamento.updowntimestretch - 64) / 63.0f); - } - if((portamento.updowntimestretch < 64) && (newfreq > oldfreq)) { - if(portamento.updowntimestretch == 0) - return 0; - portamentotime *= powf(0.1f, - (64.0f - portamento.updowntimestretch) / 64.0f); - } - - //printf("%f->%f : Time %f\n",oldfreq,newfreq,portamentotime); - - portamento.dx = synth->buffersize_f / (portamentotime * synth->samplerate_f); - portamento.origfreqrap = oldfreq / newfreq; - - float tmprap = ((portamento.origfreqrap > 1.0f) ? - (portamento.origfreqrap) : - (1.0f / portamento.origfreqrap)); - - float thresholdrap = powf(2.0f, portamento.pitchthresh / 12.0f); - if((portamento.pitchthreshtype == 0) && (tmprap - 0.00001f > thresholdrap)) - return 0; - if((portamento.pitchthreshtype == 1) && (tmprap + 0.00001f < thresholdrap)) - return 0; - - portamento.used = 1; - portamento.freqrap = portamento.origfreqrap; - return 1; -} - -void Controller::updateportamento() -{ - if(portamento.used == 0) - return; - - portamento.x += portamento.dx; - if(portamento.x > 1.0f) { - portamento.x = 1.0f; - portamento.used = 0; - } - portamento.freqrap = - (1.0f - portamento.x) * portamento.origfreqrap + portamento.x; -} - - -void Controller::setresonancecenter(int value) -{ - resonancecenter.data = value; - resonancecenter.relcenter = - powf(3.0f, (value - 64.0f) / 64.0f * (resonancecenter.depth / 64.0f)); -} -void Controller::setresonancebw(int value) -{ - resonancebandwidth.data = value; - resonancebandwidth.relbw = - powf(1.5f, (value - 64.0f) / 64.0f * (resonancebandwidth.depth / 127.0f)); -} - - -//Returns 0 if there is NRPN or 1 if there is not -int Controller::getnrpn(int *parhi, int *parlo, int *valhi, int *vallo) -{ - if(NRPN.receive == 0) - return 1; - if((NRPN.parhi < 0) || (NRPN.parlo < 0) || (NRPN.valhi < 0) - || (NRPN.vallo < 0)) - return 1; - - *parhi = NRPN.parhi; - *parlo = NRPN.parlo; - *valhi = NRPN.valhi; - *vallo = NRPN.vallo; - return 0; -} - - -void Controller::setparameternumber(unsigned int type, int value) -{ - switch(type) { - case C_nrpnhi: - NRPN.parhi = value; - NRPN.valhi = -1; - NRPN.vallo = -1; //clear the values - break; - case C_nrpnlo: - NRPN.parlo = value; - NRPN.valhi = -1; - NRPN.vallo = -1; //clear the values - break; - case C_dataentryhi: - if((NRPN.parhi >= 0) && (NRPN.parlo >= 0)) - NRPN.valhi = value; - break; - case C_dataentrylo: - if((NRPN.parhi >= 0) && (NRPN.parlo >= 0)) - NRPN.vallo = value; - break; - } -} - - - -void Controller::add2XML(XMLwrapper *xml) -{ - xml->addpar("pitchwheel_bendrange", pitchwheel.bendrange); - - xml->addparbool("expression_receive", expression.receive); - xml->addpar("panning_depth", panning.depth); - xml->addpar("filter_cutoff_depth", filtercutoff.depth); - xml->addpar("filter_q_depth", filterq.depth); - xml->addpar("bandwidth_depth", bandwidth.depth); - xml->addpar("mod_wheel_depth", modwheel.depth); - xml->addparbool("mod_wheel_exponential", modwheel.exponential); - xml->addparbool("fm_amp_receive", fmamp.receive); - xml->addparbool("volume_receive", volume.receive); - xml->addparbool("sustain_receive", sustain.receive); - - xml->addparbool("portamento_receive", portamento.receive); - xml->addpar("portamento_time", portamento.time); - xml->addpar("portamento_pitchthresh", portamento.pitchthresh); - xml->addpar("portamento_pitchthreshtype", portamento.pitchthreshtype); - xml->addpar("portamento_portamento", portamento.portamento); - xml->addpar("portamento_updowntimestretch", portamento.updowntimestretch); - xml->addpar("portamento_proportional", portamento.proportional); - xml->addpar("portamento_proprate", portamento.propRate); - xml->addpar("portamento_propdepth", portamento.propDepth); - - xml->addpar("resonance_center_depth", resonancecenter.depth); - xml->addpar("resonance_bandwidth_depth", resonancebandwidth.depth); -} - -void Controller::getfromXML(XMLwrapper *xml) -{ - pitchwheel.bendrange = xml->getpar("pitchwheel_bendrange", - pitchwheel.bendrange, - -6400, - 6400); - - expression.receive = xml->getparbool("expression_receive", - expression.receive); - panning.depth = xml->getpar127("panning_depth", panning.depth); - filtercutoff.depth = xml->getpar127("filter_cutoff_depth", - filtercutoff.depth); - filterq.depth = xml->getpar127("filter_q_depth", filterq.depth); - bandwidth.depth = xml->getpar127("bandwidth_depth", bandwidth.depth); - modwheel.depth = xml->getpar127("mod_wheel_depth", modwheel.depth); - modwheel.exponential = xml->getparbool("mod_wheel_exponential", - modwheel.exponential); - fmamp.receive = xml->getparbool("fm_amp_receive", - fmamp.receive); - volume.receive = xml->getparbool("volume_receive", - volume.receive); - sustain.receive = xml->getparbool("sustain_receive", - sustain.receive); - - portamento.receive = xml->getparbool("portamento_receive", - portamento.receive); - portamento.time = xml->getpar127("portamento_time", - portamento.time); - portamento.pitchthresh = xml->getpar127("portamento_pitchthresh", - portamento.pitchthresh); - portamento.pitchthreshtype = xml->getpar127("portamento_pitchthreshtype", - portamento.pitchthreshtype); - portamento.portamento = xml->getpar127("portamento_portamento", - portamento.portamento); - portamento.updowntimestretch = xml->getpar127( - "portamento_updowntimestretch", - portamento.updowntimestretch); - portamento.proportional = xml->getpar127("portamento_proportional", - portamento.proportional); - portamento.propRate = xml->getpar127("portamento_proprate", - portamento.propRate); - portamento.propDepth = xml->getpar127("portamento_propdepth", - portamento.propDepth); - - - resonancecenter.depth = xml->getpar127("resonance_center_depth", - resonancecenter.depth); - resonancebandwidth.depth = xml->getpar127("resonance_bandwidth_depth", - resonancebandwidth.depth); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.h deleted file mode 100644 index 22483eaaa3b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Controller.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Controller.h - (Midi) Controllers 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#ifndef CONTROLLER_H -#define CONTROLLER_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" - -/**(Midi) Controllers implementation*/ -class Controller -{ - public: - Controller(); - ~Controller(); - void resetall(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - //Controllers functions - void setpitchwheel(int value); - void setpitchwheelbendrange(unsigned short int value); - void setexpression(int value); - void setpanning(int value); - void setfiltercutoff(int value); - void setfilterq(int value); - void setbandwidth(int value); - void setmodwheel(int value); - void setfmamp(int value); - void setvolume(int value); - void setsustain(int value); - /**Enable or disable portamento - * @param value 0-127 MIDI value (greater than 64 enables)*/ - void setportamento(int value); - void setresonancecenter(int value); - void setresonancebw(int value); - - - void setparameternumber(unsigned int type, int value); //used for RPN and NRPN's - int getnrpn(int *parhi, int *parlo, int *valhi, int *vallo); - - /** - * Initialize a portamento - * - * @param oldfreq Starting frequency of the portamento (Hz) - * @param newfreq Ending frequency of the portamento (Hz) - * @param legatoflag true when legato is in progress, false otherwise - * @returns 1 if properly initialized, 0 otherwise*/ - int initportamento(float oldfreq, float newfreq, bool legatoflag); - /**Update portamento's freqrap to next value based upon dx*/ - void updateportamento(); - - // Controllers values - struct { //Pitch Wheel - int data; - short int bendrange; //bendrange is in cents - float relfreq; //the relative frequency (default is 1.0f) - } pitchwheel; - - struct { //Expression - int data; - float relvolume; - unsigned char receive; - } expression; - - struct { //Panning - int data; - float pan; - unsigned char depth; - } panning; - - - struct { //Filter cutoff - int data; - float relfreq; - unsigned char depth; - } filtercutoff; - - struct { //Filter Q - int data; - float relq; - unsigned char depth; - } filterq; - - struct { //Bandwidth - int data; - float relbw; - unsigned char depth; - unsigned char exponential; - } bandwidth; - - struct { //Modulation Wheel - int data; - float relmod; - unsigned char depth; - unsigned char exponential; - } modwheel; - - struct { //FM amplitude - int data; - float relamp; - unsigned char receive; - } fmamp; - - struct { //Volume - int data; - float volume; - unsigned char receive; - } volume; - - struct { //Sustain - int data, sustain; - unsigned char receive; - } sustain; - - struct { /** - -#include -#include -#include "EnvelopeParams.h" - -EnvelopeParams::EnvelopeParams(unsigned char Penvstretch_, - unsigned char Pforcedrelease_):Presets() -{ - int i; - - PA_dt = 10; - PD_dt = 10; - PR_dt = 10; - PA_val = 64; - PD_val = 64; - PS_val = 64; - PR_val = 64; - - for(i = 0; i < MAX_ENVELOPE_POINTS; ++i) { - Penvdt[i] = 32; - Penvval[i] = 64; - } - Penvdt[0] = 0; //no used - Penvsustain = 1; - Penvpoints = 1; - Envmode = 1; - Penvstretch = Penvstretch_; - Pforcedrelease = Pforcedrelease_; - Pfreemode = 1; - Plinearenvelope = 0; - - store2defaults(); -} - -EnvelopeParams::~EnvelopeParams() -{} - -float EnvelopeParams::getdt(char i) -{ - float result = (powf(2.0f, Penvdt[(int)i] / 127.0f * 12.0f) - 1.0f) * 10.0f; //miliseconds - return result; -} - - -/* - * ADSR/ASR... initialisations - */ -void EnvelopeParams::ADSRinit(char A_dt, char D_dt, char S_val, char R_dt) -{ - setpresettype("Penvamplitude"); - Envmode = 1; - PA_dt = A_dt; - PD_dt = D_dt; - PS_val = S_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt) -{ - setpresettype("Penvamplitude"); - Envmode = 2; - PA_dt = A_dt; - PD_dt = D_dt; - PS_val = S_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ASRinit(char A_val, char A_dt, char R_val, char R_dt) -{ - setpresettype("Penvfrequency"); - Envmode = 3; - PA_val = A_val; - PA_dt = A_dt; - PR_val = R_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - - store2defaults(); -} - -void EnvelopeParams::ADSRinit_filter(char A_val, - char A_dt, - char D_val, - char D_dt, - char R_dt, - char R_val) -{ - setpresettype("Penvfilter"); - Envmode = 4; - PA_val = A_val; - PA_dt = A_dt; - PD_val = D_val; - PD_dt = D_dt; - PR_dt = R_dt; - PR_val = R_val; - Pfreemode = 0; - converttofree(); - store2defaults(); -} - -void EnvelopeParams::ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt) -{ - setpresettype("Penvbandwidth"); - Envmode = 5; - PA_val = A_val; - PA_dt = A_dt; - PR_val = R_val; - PR_dt = R_dt; - Pfreemode = 0; - converttofree(); - store2defaults(); -} - -/* - * Convert the Envelope to freemode - */ -void EnvelopeParams::converttofree() -{ - switch(Envmode) { - case 1: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = 0; - Penvdt[1] = PA_dt; - Penvval[1] = 127; - Penvdt[2] = PD_dt; - Penvval[2] = PS_val; - Penvdt[3] = PR_dt; - Penvval[3] = 0; - break; - case 2: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = 0; - Penvdt[1] = PA_dt; - Penvval[1] = 127; - Penvdt[2] = PD_dt; - Penvval[2] = PS_val; - Penvdt[3] = PR_dt; - Penvval[3] = 0; - break; - case 3: - Penvpoints = 3; - Penvsustain = 1; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = 64; - Penvdt[2] = PR_dt; - Penvval[2] = PR_val; - break; - case 4: - Penvpoints = 4; - Penvsustain = 2; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = PD_val; - Penvdt[2] = PD_dt; - Penvval[2] = 64; - Penvdt[3] = PR_dt; - Penvval[3] = PR_val; - break; - case 5: - Penvpoints = 3; - Penvsustain = 1; - Penvval[0] = PA_val; - Penvdt[1] = PA_dt; - Penvval[1] = 64; - Penvdt[2] = PR_dt; - Penvval[2] = PR_val; - break; - } -} - - - - -void EnvelopeParams::add2XML(XMLwrapper *xml) -{ - xml->addparbool("free_mode", Pfreemode); - xml->addpar("env_points", Penvpoints); - xml->addpar("env_sustain", Penvsustain); - xml->addpar("env_stretch", Penvstretch); - xml->addparbool("forced_release", Pforcedrelease); - xml->addparbool("linear_envelope", Plinearenvelope); - xml->addpar("A_dt", PA_dt); - xml->addpar("D_dt", PD_dt); - xml->addpar("R_dt", PR_dt); - xml->addpar("A_val", PA_val); - xml->addpar("D_val", PD_val); - xml->addpar("S_val", PS_val); - xml->addpar("R_val", PR_val); - - if((Pfreemode != 0) || (!xml->minimal)) - for(int i = 0; i < Penvpoints; ++i) { - xml->beginbranch("POINT", i); - if(i != 0) - xml->addpar("dt", Penvdt[i]); - xml->addpar("val", Penvval[i]); - xml->endbranch(); - } -} - - - -void EnvelopeParams::getfromXML(XMLwrapper *xml) -{ - Pfreemode = xml->getparbool("free_mode", Pfreemode); - Penvpoints = xml->getpar127("env_points", Penvpoints); - Penvsustain = xml->getpar127("env_sustain", Penvsustain); - Penvstretch = xml->getpar127("env_stretch", Penvstretch); - Pforcedrelease = xml->getparbool("forced_release", Pforcedrelease); - Plinearenvelope = xml->getparbool("linear_envelope", Plinearenvelope); - - PA_dt = xml->getpar127("A_dt", PA_dt); - PD_dt = xml->getpar127("D_dt", PD_dt); - PR_dt = xml->getpar127("R_dt", PR_dt); - PA_val = xml->getpar127("A_val", PA_val); - PD_val = xml->getpar127("D_val", PD_val); - PS_val = xml->getpar127("S_val", PS_val); - PR_val = xml->getpar127("R_val", PR_val); - - for(int i = 0; i < Penvpoints; ++i) { - if(xml->enterbranch("POINT", i) == 0) - continue; - if(i != 0) - Penvdt[i] = xml->getpar127("dt", Penvdt[i]); - Penvval[i] = xml->getpar127("val", Penvval[i]); - xml->exitbranch(); - } - - if(!Pfreemode) - converttofree(); -} - - -void EnvelopeParams::defaults() -{ - Penvstretch = Denvstretch; - Pforcedrelease = Dforcedrelease; - Plinearenvelope = Dlinearenvelope; - PA_dt = DA_dt; - PD_dt = DD_dt; - PR_dt = DR_dt; - PA_val = DA_val; - PD_val = DD_val; - PS_val = DS_val; - PR_val = DR_val; - Pfreemode = 0; - converttofree(); -} - -void EnvelopeParams::store2defaults() -{ - Denvstretch = Penvstretch; - Dforcedrelease = Pforcedrelease; - Dlinearenvelope = Plinearenvelope; - DA_dt = PA_dt; - DD_dt = PD_dt; - DR_dt = PR_dt; - DA_val = PA_val; - DD_val = PD_val; - DS_val = PS_val; - DR_val = PR_val; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/EnvelopeParams.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/EnvelopeParams.h deleted file mode 100644 index 0b3e99c9604..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/EnvelopeParams.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EnvelopeParams.h - Parameters for Envelope - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ENVELOPE_PARAMS_H -#define ENVELOPE_PARAMS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "Presets.h" - -#define MAX_ENVELOPE_POINTS 40 -#define MIN_ENVELOPE_DB -400 - -class EnvelopeParams:public Presets -{ - public: - EnvelopeParams(unsigned char Penvstretch_, - unsigned char Pforcedrelease_); - ~EnvelopeParams(); - void ADSRinit(char A_dt, char D_dt, char S_val, char R_dt); - void ADSRinit_dB(char A_dt, char D_dt, char S_val, char R_dt); - void ASRinit(char A_val, char A_dt, char R_val, char R_dt); - void ADSRinit_filter(char A_val, - char A_dt, - char D_val, - char D_dt, - char R_dt, - char R_val); - void ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt); - void converttofree(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - float getdt(char i); - - /* MIDI Parameters */ - unsigned char Pfreemode; //1 daca este in modul free sau 0 daca este in mod ADSR,ASR,... - unsigned char Penvpoints; - unsigned char Penvsustain; //127 pentru dezactivat - unsigned char Penvdt[MAX_ENVELOPE_POINTS]; - unsigned char Penvval[MAX_ENVELOPE_POINTS]; - unsigned char Penvstretch; //64=normal stretch (piano-like), 0=no stretch - unsigned char Pforcedrelease; //0 - OFF, 1 - ON - unsigned char Plinearenvelope; //if the amplitude envelope is linear - - unsigned char PA_dt, PD_dt, PR_dt, - PA_val, PD_val, PS_val, PR_val; - - - - int Envmode; // 1 for ADSR parameters (linear amplitude) - // 2 for ADSR_dB parameters (dB amplitude) - // 3 for ASR parameters (frequency LFO) - // 4 for ADSR_filter parameters (filter parameters) - // 5 for ASR_bw parameters (bandwidth parameters) - - private: - void store2defaults(); - - /* Default parameters */ - unsigned char Denvstretch; - unsigned char Dforcedrelease; - unsigned char Dlinearenvelope; - unsigned char DA_dt, DD_dt, DR_dt, - DA_val, DD_val, DS_val, DR_val; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.cpp deleted file mode 100644 index 81309d6c748..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FilterParams.cpp - Parameters for filter - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "FilterParams.h" -#include "../Misc/Util.h" -#include -#include -#include - -FilterParams::FilterParams(unsigned char Ptype_, - unsigned char Pfreq_, - unsigned char Pq_) - :PresetsArray() -{ - setpresettype("Pfilter"); - Dtype = Ptype_; - Dfreq = Pfreq_; - Dq = Pq_; - - changed = false; - defaults(); -} - -FilterParams::~FilterParams() -{} - - -void FilterParams::defaults() -{ - Ptype = Dtype; - Pfreq = Dfreq; - Pq = Dq; - - Pstages = 0; - Pfreqtrack = 64; - Pgain = 64; - Pcategory = 0; - - Pnumformants = 3; - Pformantslowness = 64; - for(int j = 0; j < FF_MAX_VOWELS; ++j) - defaults(j); - ; - - Psequencesize = 3; - for(int i = 0; i < FF_MAX_SEQUENCE; ++i) - Psequence[i].nvowel = i % FF_MAX_VOWELS; - - Psequencestretch = 40; - Psequencereversed = 0; - Pcenterfreq = 64; //1 kHz - Poctavesfreq = 64; - Pvowelclearness = 64; -} - -void FilterParams::defaults(int n) -{ - int j = n; - for(int i = 0; i < FF_MAX_FORMANTS; ++i) { - Pvowels[j].formants[i].freq = (int)(RND * 127.0f); //some random freqs - Pvowels[j].formants[i].q = 64; - Pvowels[j].formants[i].amp = 127; - } -} - - -/* - * Get the parameters from other FilterParams - */ - -void FilterParams::getfromFilterParams(FilterParams *pars) -{ - defaults(); - - if(pars == NULL) - return; - - Ptype = pars->Ptype; - Pfreq = pars->Pfreq; - Pq = pars->Pq; - - Pstages = pars->Pstages; - Pfreqtrack = pars->Pfreqtrack; - Pgain = pars->Pgain; - Pcategory = pars->Pcategory; - - Pnumformants = pars->Pnumformants; - Pformantslowness = pars->Pformantslowness; - for(int j = 0; j < FF_MAX_VOWELS; ++j) - for(int i = 0; i < FF_MAX_FORMANTS; ++i) { - Pvowels[j].formants[i].freq = pars->Pvowels[j].formants[i].freq; - Pvowels[j].formants[i].q = pars->Pvowels[j].formants[i].q; - Pvowels[j].formants[i].amp = pars->Pvowels[j].formants[i].amp; - } - - Psequencesize = pars->Psequencesize; - for(int i = 0; i < FF_MAX_SEQUENCE; ++i) - Psequence[i].nvowel = pars->Psequence[i].nvowel; - - Psequencestretch = pars->Psequencestretch; - Psequencereversed = pars->Psequencereversed; - Pcenterfreq = pars->Pcenterfreq; - Poctavesfreq = pars->Poctavesfreq; - Pvowelclearness = pars->Pvowelclearness; -} - - -/* - * Parameter control - */ -float FilterParams::getfreq() -{ - return (Pfreq / 64.0f - 1.0f) * 5.0f; -} - -float FilterParams::getq() -{ - return expf(powf((float) Pq / 127.0f, 2) * logf(1000.0f)) - 0.9f; -} -float FilterParams::getfreqtracking(float notefreq) -{ - return logf(notefreq / 440.0f) * (Pfreqtrack - 64.0f) / (64.0f * LOG_2); -} - -float FilterParams::getgain() -{ - return (Pgain / 64.0f - 1.0f) * 30.0f; //-30..30dB -} - -/* - * Get the center frequency of the formant's graph - */ -float FilterParams::getcenterfreq() -{ - return 10000.0f * powf(10, -(1.0f - Pcenterfreq / 127.0f) * 2.0f); -} - -/* - * Get the number of octave that the formant functions applies to - */ -float FilterParams::getoctavesfreq() -{ - return 0.25f + 10.0f * Poctavesfreq / 127.0f; -} - -/* - * Get the frequency from x, where x is [0..1] - */ -float FilterParams::getfreqx(float x) -{ - if(x > 1.0f) - x = 1.0f; - float octf = powf(2.0f, getoctavesfreq()); - return getcenterfreq() / sqrt(octf) * powf(octf, x); -} - -/* - * Get the x coordinate from frequency (used by the UI) - */ -float FilterParams::getfreqpos(float freq) -{ - return (logf(freq) - logf(getfreqx(0.0f))) / logf(2.0f) / getoctavesfreq(); -} - - -/* - * Get the freq. response of the formant filter - */ -void FilterParams::formantfilterH(int nvowel, int nfreqs, float *freqs) -{ - float c[3], d[3]; - float filter_freq, filter_q, filter_amp; - float omega, sn, cs, alpha; - - for(int i = 0; i < nfreqs; ++i) - freqs[i] = 0.0f; - - //for each formant... - for(int nformant = 0; nformant < Pnumformants; ++nformant) { - //compute formant parameters(frequency,amplitude,etc.) - filter_freq = getformantfreq(Pvowels[nvowel].formants[nformant].freq); - filter_q = getformantq(Pvowels[nvowel].formants[nformant].q) * getq(); - if(Pstages > 0) - filter_q = - (filter_q > - 1.0f ? powf(filter_q, 1.0f / (Pstages + 1)) : filter_q); - - filter_amp = getformantamp(Pvowels[nvowel].formants[nformant].amp); - - - if(filter_freq <= (synth->samplerate / 2 - 100.0f)) { - omega = 2 * PI * filter_freq / synth->samplerate_f; - sn = sinf(omega); - cs = cosf(omega); - alpha = sn / (2 * filter_q); - float tmp = 1 + alpha; - c[0] = alpha / tmp *sqrt(filter_q + 1); - c[1] = 0; - c[2] = -alpha / tmp *sqrt(filter_q + 1); - d[1] = -2 * cs / tmp * (-1); - d[2] = (1 - alpha) / tmp * (-1); - } - else - continue; - - - for(int i = 0; i < nfreqs; ++i) { - float freq = getfreqx(i / (float) nfreqs); - if(freq > synth->samplerate / 2) { - for(int tmp = i; tmp < nfreqs; ++tmp) - freqs[tmp] = 0.0f; - break; - } - float fr = freq / synth->samplerate * PI * 2.0f; - float x = c[0], y = 0.0f; - for(int n = 1; n < 3; ++n) { - x += cosf(n * fr) * c[n]; - y -= sinf(n * fr) * c[n]; - } - float h = x * x + y * y; - x = 1.0f; - y = 0.0f; - for(int n = 1; n < 3; ++n) { - x -= cosf(n * fr) * d[n]; - y += sinf(n * fr) * d[n]; - } - h = h / (x * x + y * y); - - freqs[i] += powf(h, (Pstages + 1.0f) / 2.0f) * filter_amp; - } - } - for(int i = 0; i < nfreqs; ++i) { - if(freqs[i] > 0.000000001f) - freqs[i] = rap2dB(freqs[i]) + getgain(); - else - freqs[i] = -90.0f; - } -} - -/* - * Transforms a parameter to the real value - */ -float FilterParams::getformantfreq(unsigned char freq) -{ - float result = getfreqx(freq / 127.0f); - return result; -} - -float FilterParams::getformantamp(unsigned char amp) -{ - float result = powf(0.1f, (1.0f - amp / 127.0f) * 4.0f); - return result; -} - -float FilterParams::getformantq(unsigned char q) -{ - //temp - float result = powf(25.0f, (q - 32.0f) / 64.0f); - return result; -} - - - -void FilterParams::add2XMLsection(XMLwrapper *xml, int n) -{ - int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { - xml->beginbranch("FORMANT", nformant); - xml->addpar("freq", Pvowels[nvowel].formants[nformant].freq); - xml->addpar("amp", Pvowels[nvowel].formants[nformant].amp); - xml->addpar("q", Pvowels[nvowel].formants[nformant].q); - xml->endbranch(); - } -} - -void FilterParams::add2XML(XMLwrapper *xml) -{ - //filter parameters - xml->addpar("category", Pcategory); - xml->addpar("type", Ptype); - xml->addpar("freq", Pfreq); - xml->addpar("q", Pq); - xml->addpar("stages", Pstages); - xml->addpar("freq_track", Pfreqtrack); - xml->addpar("gain", Pgain); - - //formant filter parameters - if((Pcategory == 1) || (!xml->minimal)) { - xml->beginbranch("FORMANT_FILTER"); - xml->addpar("num_formants", Pnumformants); - xml->addpar("formant_slowness", Pformantslowness); - xml->addpar("vowel_clearness", Pvowelclearness); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { - xml->beginbranch("VOWEL", nvowel); - add2XMLsection(xml, nvowel); - xml->endbranch(); - } - xml->addpar("sequence_size", Psequencesize); - xml->addpar("sequence_stretch", Psequencestretch); - xml->addparbool("sequence_reversed", Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { - xml->beginbranch("SEQUENCE_POS", nseq); - xml->addpar("vowel_id", Psequence[nseq].nvowel); - xml->endbranch(); - } - xml->endbranch(); - } -} - - -void FilterParams::getfromXMLsection(XMLwrapper *xml, int n) -{ - int nvowel = n; - for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { - if(xml->enterbranch("FORMANT", nformant) == 0) - continue; - Pvowels[nvowel].formants[nformant].freq = xml->getpar127( - "freq", - Pvowels[nvowel - ].formants[nformant].freq); - Pvowels[nvowel].formants[nformant].amp = xml->getpar127( - "amp", - Pvowels[nvowel - ].formants[nformant].amp); - Pvowels[nvowel].formants[nformant].q = - xml->getpar127("q", Pvowels[nvowel].formants[nformant].q); - xml->exitbranch(); - } -} - -void FilterParams::getfromXML(XMLwrapper *xml) -{ - //filter parameters - Pcategory = xml->getpar127("category", Pcategory); - Ptype = xml->getpar127("type", Ptype); - Pfreq = xml->getpar127("freq", Pfreq); - Pq = xml->getpar127("q", Pq); - Pstages = xml->getpar127("stages", Pstages); - Pfreqtrack = xml->getpar127("freq_track", Pfreqtrack); - Pgain = xml->getpar127("gain", Pgain); - - //formant filter parameters - if(xml->enterbranch("FORMANT_FILTER")) { - Pnumformants = xml->getpar127("num_formants", Pnumformants); - Pformantslowness = xml->getpar127("formant_slowness", Pformantslowness); - Pvowelclearness = xml->getpar127("vowel_clearness", Pvowelclearness); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - - for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { - if(xml->enterbranch("VOWEL", nvowel) == 0) - continue; - getfromXMLsection(xml, nvowel); - xml->exitbranch(); - } - Psequencesize = xml->getpar127("sequence_size", Psequencesize); - Psequencestretch = xml->getpar127("sequence_stretch", Psequencestretch); - Psequencereversed = xml->getparbool("sequence_reversed", - Psequencereversed); - for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { - if(xml->enterbranch("SEQUENCE_POS", nseq) == 0) - continue; - Psequence[nseq].nvowel = xml->getpar("vowel_id", - Psequence[nseq].nvowel, - 0, - FF_MAX_VOWELS - 1); - xml->exitbranch(); - } - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.h deleted file mode 100644 index 22a1a94f8b9..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/FilterParams.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - FilterParams.h - Parameters for filter - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef FILTER_PARAMS_H -#define FILTER_PARAMS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "PresetsArray.h" - -class FilterParams:public PresetsArray -{ - public: - FilterParams(unsigned char Ptype_, - unsigned char Pfreq, - unsigned char Pq_); - ~FilterParams(); - - void add2XML(XMLwrapper *xml); - void add2XMLsection(XMLwrapper *xml, int n); - void defaults(); - void getfromXML(XMLwrapper *xml); - void getfromXMLsection(XMLwrapper *xml, int n); - - - void getfromFilterParams(FilterParams *pars); - - float getfreq(); - float getq(); - float getfreqtracking(float notefreq); - float getgain(); - - unsigned char Pcategory; //Filter category (Analog/Formant/StVar) - unsigned char Ptype; // Filter type (for analog lpf,hpf,bpf..) - unsigned char Pfreq; // Frequency (64-central frequency) - unsigned char Pq; // Q parameters (resonance or bandwidth) - unsigned char Pstages; //filter stages+1 - unsigned char Pfreqtrack; //how the filter frequency is changing according the note frequency - unsigned char Pgain; //filter's output gain - - //Formant filter parameters - unsigned char Pnumformants; //how many formants are used - unsigned char Pformantslowness; //how slow varies the formants - unsigned char Pvowelclearness; //how vowels are kept clean (how much try to avoid "mixed" vowels) - unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves - - struct { - struct { - unsigned char freq, amp, q; //frequency,amplitude,Q - } formants[FF_MAX_FORMANTS]; - } Pvowels[FF_MAX_VOWELS]; - - - unsigned char Psequencesize; //how many vowels are in the sequence - unsigned char Psequencestretch; //how the sequence is stretched (how the input from filter envelopes/LFOs/etc. is "stretched") - unsigned char Psequencereversed; //if the input from filter envelopes/LFOs/etc. is reversed(negated) - struct { - unsigned char nvowel; //the vowel from the position - } Psequence[FF_MAX_SEQUENCE]; - - float getcenterfreq(); - float getoctavesfreq(); - float getfreqpos(float freq); - float getfreqx(float x); - - void formantfilterH(int nvowel, int nfreqs, float *freqs); //used by UI - - float getformantfreq(unsigned char freq); - float getformantamp(unsigned char amp); - float getformantq(unsigned char q); - - bool changed; - - private: - void defaults(int n); - - //stored default parameters - unsigned char Dtype; - unsigned char Dfreq; - unsigned char Dq; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.cpp deleted file mode 100644 index 72f2269da54..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFOParams.cpp - Parameters for LFO - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "../globals.h" -#include "LFOParams.h" - -int LFOParams::time; - -LFOParams::LFOParams(char Pfreq_, - char Pintensity_, - char Pstartphase_, - char PLFOtype_, - char Prandomness_, - char Pdelay_, - char Pcontinous_, - char fel_):Presets() -{ - switch(fel_) { - case 0: - setpresettype("Plfofrequency"); - break; - case 1: - setpresettype("Plfoamplitude"); - break; - case 2: - setpresettype("Plfofilter"); - break; - } - Dfreq = Pfreq_; - Dintensity = Pintensity_; - Dstartphase = Pstartphase_; - DLFOtype = PLFOtype_; - Drandomness = Prandomness_; - Ddelay = Pdelay_; - Dcontinous = Pcontinous_; - fel = fel_; - time = 0; - - defaults(); -} - -LFOParams::~LFOParams() -{} - -void LFOParams::defaults() -{ - Pfreq = Dfreq / 127.0f; - Pintensity = Dintensity; - Pstartphase = Dstartphase; - PLFOtype = DLFOtype; - Prandomness = Drandomness; - Pdelay = Ddelay; - Pcontinous = Dcontinous; - Pfreqrand = 0; - Pstretch = 64; -} - - -void LFOParams::add2XML(XMLwrapper *xml) -{ - xml->addparreal("freq", Pfreq); - xml->addpar("intensity", Pintensity); - xml->addpar("start_phase", Pstartphase); - xml->addpar("lfo_type", PLFOtype); - xml->addpar("randomness_amplitude", Prandomness); - xml->addpar("randomness_frequency", Pfreqrand); - xml->addpar("delay", Pdelay); - xml->addpar("stretch", Pstretch); - xml->addparbool("continous", Pcontinous); -} - -void LFOParams::getfromXML(XMLwrapper *xml) -{ - Pfreq = xml->getparreal("freq", Pfreq, 0.0f, 1.0f); - Pintensity = xml->getpar127("intensity", Pintensity); - Pstartphase = xml->getpar127("start_phase", Pstartphase); - PLFOtype = xml->getpar127("lfo_type", PLFOtype); - Prandomness = xml->getpar127("randomness_amplitude", Prandomness); - Pfreqrand = xml->getpar127("randomness_frequency", Pfreqrand); - Pdelay = xml->getpar127("delay", Pdelay); - Pstretch = xml->getpar127("stretch", Pstretch); - Pcontinous = xml->getparbool("continous", Pcontinous); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.h deleted file mode 100644 index 6ca30719316..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/LFOParams.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFOParams.h - Parameters for LFO - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef LFO_PARAMS_H -#define LFO_PARAMS_H - -#include "../Misc/XMLwrapper.h" -#include "Presets.h" - -class LFOParams:public Presets -{ - public: - LFOParams(char Pfreq_, - char Pintensity_, - char Pstartphase_, - char PLFOtype_, - char Prandomness_, - char Pdelay_, - char Pcontinous, - char fel_); - ~LFOParams(); - - void add2XML(XMLwrapper *xml); - void defaults(); - /**Loads the LFO from the xml*/ - void getfromXML(XMLwrapper *xml); - - /* MIDI Parameters*/ - float Pfreq; /** -#include "PADnoteParameters.h" -#include "../Misc/WavFile.h" - -PADnoteParameters::PADnoteParameters(FFTwrapper *fft_, - pthread_mutex_t *mutex_):Presets() -{ - setpresettype("Ppadsynth"); - - fft = fft_; - mutex = mutex_; - - resonance = new Resonance(); - oscilgen = new OscilGen(fft_, resonance); - oscilgen->ADvsPAD = true; - - FreqEnvelope = new EnvelopeParams(0, 0); - FreqEnvelope->ASRinit(64, 50, 64, 60); - FreqLfo = new LFOParams(70, 0, 64, 0, 0, 0, 0, 0); - - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - AmpLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 1); - - GlobalFilter = new FilterParams(2, 94, 40); - FilterEnvelope = new EnvelopeParams(0, 1); - FilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - FilterLfo = new LFOParams(80, 0, 64, 0, 0, 0, 0, 2); - - for(int i = 0; i < PAD_MAX_SAMPLES; ++i) - sample[i].smp = NULL; - newsample.smp = NULL; - - defaults(); -} - -PADnoteParameters::~PADnoteParameters() -{ - deletesamples(); - delete (oscilgen); - delete (resonance); - - delete (FreqEnvelope); - delete (FreqLfo); - delete (AmpEnvelope); - delete (AmpLfo); - delete (GlobalFilter); - delete (FilterEnvelope); - delete (FilterLfo); -} - -void PADnoteParameters::defaults() -{ - Pmode = 0; - Php.base.type = 0; - Php.base.par1 = 80; - Php.freqmult = 0; - Php.modulator.par1 = 0; - Php.modulator.freq = 30; - Php.width = 127; - Php.amp.type = 0; - Php.amp.mode = 0; - Php.amp.par1 = 80; - Php.amp.par2 = 64; - Php.autoscale = true; - Php.onehalf = 0; - - setPbandwidth(500); - Pbwscale = 0; - - resonance->defaults(); - oscilgen->defaults(); - - Phrpos.type = 0; - Phrpos.par1 = 64; - Phrpos.par2 = 64; - Phrpos.par3 = 0; - - Pquality.samplesize = 3; - Pquality.basenote = 4; - Pquality.oct = 3; - Pquality.smpoct = 2; - - PStereo = 1; //stereo - /* Frequency Global Parameters */ - Pfixedfreq = 0; - PfixedfreqET = 0; - PDetune = 8192; //zero - PCoarseDetune = 0; - PDetuneType = 1; - FreqEnvelope->defaults(); - FreqLfo->defaults(); - - /* Amplitude Global Parameters */ - PVolume = 90; - PPanning = 64; //center - PAmpVelocityScaleFunction = 64; - AmpEnvelope->defaults(); - AmpLfo->defaults(); - PPunchStrength = 0; - PPunchTime = 60; - PPunchStretch = 64; - PPunchVelocitySensing = 72; - - /* Filter Global Parameters*/ - PFilterVelocityScale = 64; - PFilterVelocityScaleFunction = 64; - GlobalFilter->defaults(); - FilterEnvelope->defaults(); - FilterLfo->defaults(); - - deletesamples(); -} - -void PADnoteParameters::deletesample(int n) -{ - if((n < 0) || (n >= PAD_MAX_SAMPLES)) - return; - if(sample[n].smp != NULL) { - delete[] sample[n].smp; - sample[n].smp = NULL; - } - sample[n].size = 0; - sample[n].basefreq = 440.0f; -} - -void PADnoteParameters::deletesamples() -{ - for(int i = 0; i < PAD_MAX_SAMPLES; ++i) - deletesample(i); -} - -/* - * Get the harmonic profile (i.e. the frequency distributio of a single harmonic) - */ -float PADnoteParameters::getprofile(float *smp, int size) -{ - for(int i = 0; i < size; ++i) - smp[i] = 0.0f; - const int supersample = 16; - float basepar = powf(2.0f, (1.0f - Php.base.par1 / 127.0f) * 12.0f); - float freqmult = floor(powf(2.0f, - Php.freqmult / 127.0f - * 5.0f) + 0.000001f); - - float modfreq = floor(powf(2.0f, - Php.modulator.freq / 127.0f - * 5.0f) + 0.000001f); - float modpar1 = powf(Php.modulator.par1 / 127.0f, 4.0f) * 5.0f / sqrt( - modfreq); - float amppar1 = - powf(2.0f, powf(Php.amp.par1 / 127.0f, 2.0f) * 10.0f) - 0.999f; - float amppar2 = (1.0f - Php.amp.par2 / 127.0f) * 0.998f + 0.001f; - float width = powf(150.0f / (Php.width + 22.0f), 2.0f); - - for(int i = 0; i < size * supersample; ++i) { - bool makezero = false; - float x = i * 1.0f / (size * (float) supersample); - - float origx = x; - - //do the sizing (width) - x = (x - 0.5f) * width + 0.5f; - if(x < 0.0f) { - x = 0.0f; - makezero = true; - } - else - if(x > 1.0f) { - x = 1.0f; - makezero = true; - } - - //compute the full profile or one half - switch(Php.onehalf) { - case 1: - x = x * 0.5f + 0.5f; - break; - case 2: - x = x * 0.5f; - break; - } - - float x_before_freq_mult = x; - - //do the frequency multiplier - x *= freqmult; - - //do the modulation of the profile - x += sinf(x_before_freq_mult * 3.1415926f * modfreq) * modpar1; - x = fmod(x + 1000.0f, 1.0f) * 2.0f - 1.0f; - - - //this is the base function of the profile - float f; - switch(Php.base.type) { - case 1: - f = expf(-(x * x) * basepar); - if(f < 0.4f) - f = 0.0f; - else - f = 1.0f; - break; - case 2: - f = expf(-(fabs(x)) * sqrt(basepar)); - break; - default: - f = expf(-(x * x) * basepar); - break; - } - if(makezero) - f = 0.0f; - - float amp = 1.0f; - origx = origx * 2.0f - 1.0f; - - //compute the amplitude multiplier - switch(Php.amp.type) { - case 1: - amp = expf(-(origx * origx) * 10.0f * amppar1); - break; - case 2: - amp = 0.5f - * (1.0f - + cosf(3.1415926f * origx * sqrt(amppar1 * 4.0f + 1.0f))); - break; - case 3: - amp = 1.0f - / (powf(origx * (amppar1 * 2.0f + 0.8f), 14.0f) + 1.0f); - break; - } - - //apply the amplitude multiplier - float finalsmp = f; - if(Php.amp.type != 0) - switch(Php.amp.mode) { - case 0: - finalsmp = amp * (1.0f - amppar2) + finalsmp * amppar2; - break; - case 1: - finalsmp *= amp * (1.0f - amppar2) + amppar2; - break; - case 2: - finalsmp = finalsmp - / (amp + powf(amppar2, 4.0f) * 20.0f + 0.0001f); - break; - case 3: - finalsmp = amp - / (finalsmp - + powf(amppar2, 4.0f) * 20.0f + 0.0001f); - break; - } - ; - - smp[i / supersample] += finalsmp / supersample; - } - - //normalize the profile (make the max. to be equal to 1.0f) - float max = 0.0f; - for(int i = 0; i < size; ++i) { - if(smp[i] < 0.0f) - smp[i] = 0.0f; - if(smp[i] > max) - max = smp[i]; - } - if(max < 0.00001f) - max = 1.0f; - for(int i = 0; i < size; ++i) - smp[i] /= max; - - if(!Php.autoscale) - return 0.5f; - - //compute the estimated perceived bandwidth - float sum = 0.0f; - int i; - for(i = 0; i < size / 2 - 2; ++i) { - sum += smp[i] * smp[i] + smp[size - i - 1] * smp[size - i - 1]; - if(sum >= 4.0f) - break; - } - - float result = 1.0f - 2.0f * i / (float) size; - return result; -} - -/* - * Compute the real bandwidth in cents and returns it - * Also, sets the bandwidth parameter - */ -float PADnoteParameters::setPbandwidth(int Pbandwidth) -{ - this->Pbandwidth = Pbandwidth; - float result = powf(Pbandwidth / 1000.0f, 1.1f); - result = powf(10.0f, result * 4.0f) * 0.25f; - return result; -} - -/* - * Get the harmonic(overtone) position - */ -float PADnoteParameters::getNhr(int n) -{ - float result = 1.0f; - float par1 = powf(10.0f, -(1.0f - Phrpos.par1 / 255.0f) * 3.0f); - float par2 = Phrpos.par2 / 255.0f; - - float n0 = n - 1.0f; - float tmp = 0.0f; - int thresh = 0; - switch(Phrpos.type) { - case 1: - thresh = (int)(par2 * par2 * 100.0f) + 1; - if(n < thresh) - result = n; - else - result = 1.0f + n0 + (n0 - thresh + 1.0f) * par1 * 8.0f; - break; - case 2: - thresh = (int)(par2 * par2 * 100.0f) + 1; - if(n < thresh) - result = n; - else - result = 1.0f + n0 - (n0 - thresh + 1.0f) * par1 * 0.90f; - break; - case 3: - tmp = par1 * 100.0f + 1.0f; - result = powf(n0 / tmp, 1.0f - par2 * 0.8f) * tmp + 1.0f; - break; - case 4: - result = n0 - * (1.0f - - par1) - + powf(n0 * 0.1f, par2 * 3.0f - + 1.0f) * par1 * 10.0f + 1.0f; - break; - case 5: - result = n0 - + sinf(n0 * par2 * par2 * PI - * 0.999f) * sqrt(par1) * 2.0f + 1.0f; - break; - case 6: - tmp = powf(par2 * 2.0f, 2.0f) + 0.1f; - result = n0 * powf(1.0f + par1 * powf(n0 * 0.8f, tmp), tmp) + 1.0f; - break; - case 7: - result = (n + Phrpos.par1 / 255.0f) / (Phrpos.par1 / 255.0f + 1); - break; - default: - result = n; - break; - } - - float par3 = Phrpos.par3 / 255.0f; - - float iresult = floor(result + 0.5f); - float dresult = result - iresult; - - result = iresult + (1.0f - par3) * dresult; - - return result; -} - -/* - * Generates the long spectrum for Bandwidth mode (only amplitudes are generated; phases will be random) - */ -void PADnoteParameters::generatespectrum_bandwidthMode(float *spectrum, - int size, - float basefreq, - float *profile, - int profilesize, - float bwadjust) -{ - for(int i = 0; i < size; ++i) - spectrum[i] = 0.0f; - - float harmonics[synth->oscilsize / 2]; - for(int i = 0; i < synth->oscilsize / 2; ++i) - harmonics[i] = 0.0f; - //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) - oscilgen->get(harmonics, basefreq, false); - - //normalize - float max = 0.0f; - for(int i = 0; i < synth->oscilsize / 2; ++i) - if(harmonics[i] > max) - max = harmonics[i]; - if(max < 0.000001f) - max = 1; - for(int i = 0; i < synth->oscilsize / 2; ++i) - harmonics[i] /= max; - - for(int nh = 1; nh < synth->oscilsize / 2; ++nh) { //for each harmonic - float realfreq = getNhr(nh) * basefreq; - if(realfreq > synth->samplerate_f * 0.49999f) - break; - if(realfreq < 20.0f) - break; - if(harmonics[nh - 1] < 1e-4) - continue; - - //compute the bandwidth of each harmonic - float bandwidthcents = setPbandwidth(Pbandwidth); - float bw = - (powf(2.0f, bandwidthcents / 1200.0f) - 1.0f) * basefreq / bwadjust; - float power = 1.0f; - switch(Pbwscale) { - case 0: - power = 1.0f; - break; - case 1: - power = 0.0f; - break; - case 2: - power = 0.25f; - break; - case 3: - power = 0.5f; - break; - case 4: - power = 0.75f; - break; - case 5: - power = 1.5f; - break; - case 6: - power = 2.0f; - break; - case 7: - power = -0.5f; - break; - } - bw = bw * powf(realfreq / basefreq, power); - int ibw = (int)((bw / (synth->samplerate_f * 0.5f) * size)) + 1; - - float amp = harmonics[nh - 1]; - if(resonance->Penabled) - amp *= resonance->getfreqresponse(realfreq); - - if(ibw > profilesize) { //if the bandwidth is larger than the profilesize - float rap = sqrt((float)profilesize / (float)ibw); - int cfreq = - (int) (realfreq - / (synth->samplerate_f * 0.5f) * size) - ibw / 2; - for(int i = 0; i < ibw; ++i) { - int src = (int)(i * rap * rap); - int spfreq = i + cfreq; - if(spfreq < 0) - continue; - if(spfreq >= size) - break; - spectrum[spfreq] += amp * profile[src] * rap; - } - } - else { //if the bandwidth is smaller than the profilesize - float rap = sqrt((float)ibw / (float)profilesize); - float ibasefreq = realfreq / (synth->samplerate_f * 0.5f) * size; - for(int i = 0; i < profilesize; ++i) { - float idfreq = i / (float)profilesize - 0.5f; - idfreq *= ibw; - int spfreq = (int) (idfreq + ibasefreq); - float fspfreq = fmodf((float)idfreq + ibasefreq, 1.0f); - if(spfreq <= 0) - continue; - if(spfreq >= size - 1) - break; - spectrum[spfreq] += amp * profile[i] * rap - * (1.0f - fspfreq); - spectrum[spfreq + 1] += amp * profile[i] * rap * fspfreq; - } - } - } -} - -/* - * Generates the long spectrum for non-Bandwidth modes (only amplitudes are generated; phases will be random) - */ -void PADnoteParameters::generatespectrum_otherModes(float *spectrum, - int size, - float basefreq) -{ - for(int i = 0; i < size; ++i) - spectrum[i] = 0.0f; - - float harmonics[synth->oscilsize / 2]; - for(int i = 0; i < synth->oscilsize / 2; ++i) - harmonics[i] = 0.0f; - //get the harmonic structure from the oscillator (I am using the frequency amplitudes, only) - oscilgen->get(harmonics, basefreq, false); - - //normalize - float max = 0.0f; - for(int i = 0; i < synth->oscilsize / 2; ++i) - if(harmonics[i] > max) - max = harmonics[i]; - if(max < 0.000001f) - max = 1; - for(int i = 0; i < synth->oscilsize / 2; ++i) - harmonics[i] /= max; - - for(int nh = 1; nh < synth->oscilsize / 2; ++nh) { //for each harmonic - float realfreq = getNhr(nh) * basefreq; - - ///sa fac aici interpolarea si sa am grija daca frecv descresc - - if(realfreq > synth->samplerate_f * 0.49999f) - break; - if(realfreq < 20.0f) - break; -// if (harmonics[nh-1]<1e-4) continue; - - - float amp = harmonics[nh - 1]; - if(resonance->Penabled) - amp *= resonance->getfreqresponse(realfreq); - int cfreq = (int) (realfreq / (synth->samplerate_f * 0.5f) * size); - - spectrum[cfreq] = amp + 1e-9; - } - - if(Pmode != 1) { - int old = 0; - for(int k = 1; k < size; ++k) - if((spectrum[k] > 1e-10) || (k == (size - 1))) { - int delta = k - old; - float val1 = spectrum[old]; - float val2 = spectrum[k]; - float idelta = 1.0f / delta; - for(int i = 0; i < delta; ++i) { - float x = idelta * i; - spectrum[old + i] = val1 * (1.0f - x) + val2 * x; - } - old = k; - } - } -} - -/* - * Applies the parameters (i.e. computes all the samples, based on parameters); - */ -void PADnoteParameters::applyparameters(bool lockmutex) -{ - const int samplesize = (((int) 1) << (Pquality.samplesize + 14)); - int spectrumsize = samplesize / 2; - float *spectrum = new float[spectrumsize]; - int profilesize = 512; - float profile[profilesize]; - - - float bwadjust = getprofile(profile, profilesize); -// for (int i=0;ifreqs2smps(fftfreqs, newsample.smp); //that's all; here is the only ifft for the whole sample; no windows are used ;-) - - - //normalize(rms) - float rms = 0.0f; - for(int i = 0; i < samplesize; ++i) - rms += newsample.smp[i] * newsample.smp[i]; - rms = sqrt(rms); - if(rms < 0.000001f) - rms = 1.0f; - rms *= sqrt(262144.0f / samplesize); - for(int i = 0; i < samplesize; ++i) - newsample.smp[i] *= 1.0f / rms * 50.0f; - - //prepare extra samples used by the linear or cubic interpolation - for(int i = 0; i < extra_samples; ++i) - newsample.smp[i + samplesize] = newsample.smp[i]; - - //replace the current sample with the new computed sample - if(lockmutex) { - pthread_mutex_lock(mutex); - deletesample(nsample); - sample[nsample].smp = newsample.smp; - sample[nsample].size = samplesize; - sample[nsample].basefreq = basefreq * basefreqadjust; - pthread_mutex_unlock(mutex); - } - else { - deletesample(nsample); - sample[nsample].smp = newsample.smp; - sample[nsample].size = samplesize; - sample[nsample].basefreq = basefreq * basefreqadjust; - } - newsample.smp = NULL; - } - delete (fft); - delete[] fftfreqs; - delete[] spectrum; - - //delete the additional samples that might exists and are not useful - if(lockmutex) { - pthread_mutex_lock(mutex); - for(int i = samplemax; i < PAD_MAX_SAMPLES; ++i) - deletesample(i); - pthread_mutex_unlock(mutex); - } - else - for(int i = samplemax; i < PAD_MAX_SAMPLES; ++i) - deletesample(i); - ; -} - -void PADnoteParameters::export2wav(std::string basefilename) -{ - applyparameters(true); - basefilename += "_PADsynth_"; - for(int k = 0; k < PAD_MAX_SAMPLES; ++k) { - if(sample[k].smp == NULL) - continue; - char tmpstr[20]; - snprintf(tmpstr, 20, "_%02d", k + 1); - std::string filename = basefilename + std::string(tmpstr) + ".wav"; - WavFile wav(filename, synth->samplerate, 1); - if(wav.good()) { - int nsmps = sample[k].size; - short int *smps = new short int[nsmps]; - for(int i = 0; i < nsmps; ++i) - smps[i] = (short int)(sample[k].smp[i] * 32767.0f); - wav.writeMonoSamples(nsmps, smps); - } - } -} - -void PADnoteParameters::add2XML(XMLwrapper *xml) -{ - xml->setPadSynth(true); - - xml->addparbool("stereo", PStereo); - xml->addpar("mode", Pmode); - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->beginbranch("HARMONIC_PROFILE"); - xml->addpar("base_type", Php.base.type); - xml->addpar("base_par1", Php.base.par1); - xml->addpar("frequency_multiplier", Php.freqmult); - xml->addpar("modulator_par1", Php.modulator.par1); - xml->addpar("modulator_frequency", Php.modulator.freq); - xml->addpar("width", Php.width); - xml->addpar("amplitude_multiplier_type", Php.amp.type); - xml->addpar("amplitude_multiplier_mode", Php.amp.mode); - xml->addpar("amplitude_multiplier_par1", Php.amp.par1); - xml->addpar("amplitude_multiplier_par2", Php.amp.par2); - xml->addparbool("autoscale", Php.autoscale); - xml->addpar("one_half", Php.onehalf); - xml->endbranch(); - - xml->beginbranch("OSCIL"); - oscilgen->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("RESONANCE"); - resonance->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("HARMONIC_POSITION"); - xml->addpar("type", Phrpos.type); - xml->addpar("parameter1", Phrpos.par1); - xml->addpar("parameter2", Phrpos.par2); - xml->addpar("parameter3", Phrpos.par3); - xml->endbranch(); - - xml->beginbranch("SAMPLE_QUALITY"); - xml->addpar("samplesize", Pquality.samplesize); - xml->addpar("basenote", Pquality.basenote); - xml->addpar("octaves", Pquality.oct); - xml->addpar("samples_per_octave", Pquality.smpoct); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addpar("punch_strength", PPunchStrength); - xml->addpar("punch_time", PPunchTime); - xml->addpar("punch_stretch", PPunchStretch); - xml->addpar("punch_velocity_sensing", PPunchVelocitySensing); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_LFO"); - AmpLfo->add2XML(xml); - xml->endbranch(); - - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); - - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_LFO"); - FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); - - xml->beginbranch("FILTER"); - GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_ENVELOPE"); - FilterEnvelope->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("FILTER_LFO"); - FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); -} - -void PADnoteParameters::getfromXML(XMLwrapper *xml) -{ - PStereo = xml->getparbool("stereo", PStereo); - Pmode = xml->getpar127("mode", 0); - Pbandwidth = xml->getpar("bandwidth", Pbandwidth, 0, 1000); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); - - if(xml->enterbranch("HARMONIC_PROFILE")) { - Php.base.type = xml->getpar127("base_type", Php.base.type); - Php.base.par1 = xml->getpar127("base_par1", Php.base.par1); - Php.freqmult = xml->getpar127("frequency_multiplier", - Php.freqmult); - Php.modulator.par1 = xml->getpar127("modulator_par1", - Php.modulator.par1); - Php.modulator.freq = xml->getpar127("modulator_frequency", - Php.modulator.freq); - Php.width = xml->getpar127("width", Php.width); - Php.amp.type = xml->getpar127("amplitude_multiplier_type", - Php.amp.type); - Php.amp.mode = xml->getpar127("amplitude_multiplier_mode", - Php.amp.mode); - Php.amp.par1 = xml->getpar127("amplitude_multiplier_par1", - Php.amp.par1); - Php.amp.par2 = xml->getpar127("amplitude_multiplier_par2", - Php.amp.par2); - Php.autoscale = xml->getparbool("autoscale", Php.autoscale); - Php.onehalf = xml->getpar127("one_half", Php.onehalf); - xml->exitbranch(); - } - - if(xml->enterbranch("OSCIL")) { - oscilgen->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("RESONANCE")) { - resonance->getfromXML(xml); - xml->exitbranch(); - } - - if(xml->enterbranch("HARMONIC_POSITION")) { - Phrpos.type = xml->getpar127("type", Phrpos.type); - Phrpos.par1 = xml->getpar("parameter1", Phrpos.par1, 0, 255); - Phrpos.par2 = xml->getpar("parameter2", Phrpos.par2, 0, 255); - Phrpos.par3 = xml->getpar("parameter3", Phrpos.par3, 0, 255); - xml->exitbranch(); - } - - if(xml->enterbranch("SAMPLE_QUALITY")) { - Pquality.samplesize = xml->getpar127("samplesize", Pquality.samplesize); - Pquality.basenote = xml->getpar127("basenote", Pquality.basenote); - Pquality.oct = xml->getpar127("octaves", Pquality.oct); - Pquality.smpoct = xml->getpar127("samples_per_octave", - Pquality.smpoct); - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - PPunchStrength = xml->getpar127("punch_strength", PPunchStrength); - PPunchTime = xml->getpar127("punch_time", PPunchTime); - PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch); - PPunchVelocitySensing = xml->getpar127("punch_velocity_sensing", - PPunchVelocitySensing); - - xml->enterbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("AMPLITUDE_LFO"); - AmpLfo->getfromXML(xml); - xml->exitbranch(); - - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getpar127("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - - xml->enterbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FREQUENCY_LFO"); - FreqLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", - PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( - "velocity_sensing", - PFilterVelocityScaleFunction); - - xml->enterbranch("FILTER"); - GlobalFilter->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_ENVELOPE"); - FilterEnvelope->getfromXML(xml); - xml->exitbranch(); - - xml->enterbranch("FILTER_LFO"); - FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PADnoteParameters.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/PADnoteParameters.h deleted file mode 100644 index b3283216ae5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PADnoteParameters.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PADnoteParameters.h - Parameters for PADnote (PADsynth) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PAD_NOTE_PARAMETERS_H -#define PAD_NOTE_PARAMETERS_H - -#include "../Misc/XMLwrapper.h" -#include "../DSP/FFTwrapper.h" -#include "../globals.h" -#include "../Synth/OscilGen.h" -#include "../Synth/Resonance.h" -#include "../Misc/Util.h" - -#include "EnvelopeParams.h" -#include "LFOParams.h" -#include "FilterParams.h" -#include "Presets.h" -#include -#include - -class PADnoteParameters:public Presets -{ - public: - PADnoteParameters(FFTwrapper *fft_, pthread_mutex_t *mutex_); - ~PADnoteParameters(); - - void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - - //returns a value between 0.0f-1.0f that represents the estimation perceived bandwidth - float getprofile(float *smp, int size); - - //parameters - - //the mode: 0 - bandwidth, 1 - discrete (bandwidth=0), 2 - continous - //the harmonic profile is used only on mode 0 - unsigned char Pmode; - - //Harmonic profile (the frequency distribution of a single harmonic) - struct { - struct { //base function - unsigned char type; - unsigned char par1; - } base; - unsigned char freqmult; //frequency multiplier of the distribution - struct { //the modulator of the distribution - unsigned char par1; - unsigned char freq; - } modulator; - - unsigned char width; //the width of the resulting function after the modulation - struct { //the amplitude multiplier of the harmonic profile - unsigned char mode; - unsigned char type; - unsigned char par1; - unsigned char par2; - } amp; - bool autoscale; //if the scale of the harmonic profile is computed automaticaly - unsigned char onehalf; //what part of the base function is used to make the distribution - } Php; - - - unsigned int Pbandwidth; //the values are from 0 to 1000 - unsigned char Pbwscale; //how the bandwidth is increased according to the harmonic's frequency - - struct { //where are positioned the harmonics (on integer multimplier or different places) - unsigned char type; - unsigned char par1, par2, par3; //0..255 - } Phrpos; - - struct { //quality of the samples (how many samples, the length of them,etc.) - unsigned char samplesize; - unsigned char basenote, oct, smpoct; - } Pquality; - - //frequency parameters - //If the base frequency is fixed to 440 Hz - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - unsigned short int PDetune; //fine detune - unsigned short int PCoarseDetune; //coarse detune+octave - unsigned char PDetuneType; //detune type - - EnvelopeParams *FreqEnvelope; //Frequency Envelope - LFOParams *FreqLfo; //Frequency LFO - - //Amplitude parameters - unsigned char PStereo; - /* Panning - 0 - random - 1 - left - 64 - center - 127 - right */ - unsigned char PPanning; - - unsigned char PVolume; - - unsigned char PAmpVelocityScaleFunction; - - EnvelopeParams *AmpEnvelope; - - LFOParams *AmpLfo; - - unsigned char PPunchStrength, PPunchTime, PPunchStretch, - PPunchVelocitySensing; - - //Filter Parameters - FilterParams *GlobalFilter; - - // filter velocity sensing - unsigned char PFilterVelocityScale; - - // filter velocity sensing - unsigned char PFilterVelocityScaleFunction; - - EnvelopeParams *FilterEnvelope; - LFOParams *FilterLfo; - - - - - float setPbandwidth(int Pbandwidth); //returns the BandWidth in cents - float getNhr(int n); //gets the n-th overtone position relatively to N harmonic - - void applyparameters(bool lockmutex); - void export2wav(std::string basefilename); - - OscilGen *oscilgen; - Resonance *resonance; - - struct { - int size; - float basefreq; - float *smp; - } sample[PAD_MAX_SAMPLES], newsample; - - private: - void generatespectrum_bandwidthMode(float *spectrum, - int size, - float basefreq, - float *profile, - int profilesize, - float bwadjust); - void generatespectrum_otherModes(float *spectrum, - int size, - float basefreq); - void deletesamples(); - void deletesample(int n); - - FFTwrapper *fft; - pthread_mutex_t *mutex; -}; - - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.cpp deleted file mode 100644 index d96fc536e00..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Presets.cpp - Presets and Clipboard management - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Presets.h" -#include - - -Presets::Presets() -{ - type[0] = 0; -} - -Presets::~Presets() -{} - -void Presets::setpresettype(const char *type) -{ - strcpy(this->type, type); -} - -void Presets::copy(const char *name) -{ - XMLwrapper *xml = new XMLwrapper(); - - //used only for the clipboard - if(name == NULL) - xml->minimal = false; - - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - //strcat(type, "n"); - if(name == NULL) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - - xml->beginbranch(type); - add2XML(xml); - xml->endbranch(); - - if(name == NULL) - presetsstore.copyclipboard(xml, type); - else - presetsstore.copypreset(xml, type, name); - - delete (xml); -} - -void Presets::paste(int npreset) -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - //strcat(type, "n"); - - if(npreset == 0) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - - XMLwrapper *xml = new XMLwrapper(); - if(npreset == 0) { - if(!checkclipboardtype()) { - delete (xml); - return; - } - if(!presetsstore.pasteclipboard(xml)) { - delete (xml); - return; - } - } - else - if(!presetsstore.pastepreset(xml, npreset)) { - delete (xml); - return; - } - - if(xml->enterbranch(type) == 0) - return; - - defaults(); - getfromXML(xml); - - xml->exitbranch(); - - delete (xml); -} - -bool Presets::checkclipboardtype() -{ - return presetsstore.checkclipboardtype(type); -} - -void Presets::rescanforpresets() -{ - presetsstore.rescanforpresets(type); -} - - -void Presets::deletepreset(int npreset) -{ - presetsstore.deletepreset(npreset); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.h deleted file mode 100644 index a64d25e74db..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/Presets.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Presets.h - Presets and Clipboard management - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PRESETS_H -#define PRESETS_H - -#include "../Misc/XMLwrapper.h" - -#include "PresetsStore.h" - -/**Presets and Clipboard management*/ -class Presets -{ - friend class PresetsArray; - public: - Presets(); - virtual ~Presets(); - - virtual void copy(const char *name); /** - - -PresetsArray::PresetsArray() -{ - type[0] = 0; - nelement = -1; -} - -PresetsArray::~PresetsArray() -{} - -void PresetsArray::setpresettype(const char *type) -{ - strcpy(this->type, type); -} - -void PresetsArray::copy(const char *name) -{ - XMLwrapper *xml = new XMLwrapper(); - - //used only for the clipboard - if(name == NULL) - xml->minimal = false; - - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - if(name == NULL) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - ; - - xml->beginbranch(type); - if(nelement == -1) - add2XML(xml); - else - add2XMLsection(xml, nelement); - xml->endbranch(); - - if(name == NULL) - presetsstore.copyclipboard(xml, type); - else - presetsstore.copypreset(xml, type, name); - - delete (xml); - nelement = -1; -} - -void PresetsArray::paste(int npreset) -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - if(npreset == 0) - if(strstr(type, "Plfo") != NULL) - strcpy(type, "Plfo"); - ; - - XMLwrapper *xml = new XMLwrapper(); - if(npreset == 0) { - if(!checkclipboardtype()) { - nelement = -1; - delete (xml); - return; - } - if(!presetsstore.pasteclipboard(xml)) { - delete (xml); - nelement = -1; - return; - } - } - else - if(!presetsstore.pastepreset(xml, npreset)) { - delete (xml); - nelement = -1; - return; - } - - if(xml->enterbranch(type) == 0) { - nelement = -1; - return; - } - if(nelement == -1) { - defaults(); - getfromXML(xml); - } - else { - defaults(nelement); - getfromXMLsection(xml, nelement); - } - xml->exitbranch(); - - delete (xml); - nelement = -1; -} - -bool PresetsArray::checkclipboardtype() -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - - return presetsstore.checkclipboardtype(type); -} - -void PresetsArray::rescanforpresets() -{ - char type[MAX_PRESETTYPE_SIZE]; - strcpy(type, this->type); - if(nelement != -1) - strcat(type, "n"); - - presetsstore.rescanforpresets(type); -} - -void PresetsArray::setelement(int n) -{ - nelement = n; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsArray.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsArray.h deleted file mode 100644 index 724dc0b58f1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsArray.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PresetsArray.h - PresetsArray and Clipboard management - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PRESETSARRAY_H -#define PRESETSARRAY_H - -#include "../Misc/XMLwrapper.h" - -#include "Presets.h" - -/**PresetsArray and Clipboard management*/ -class PresetsArray:public Presets -{ - public: - PresetsArray(); - virtual ~PresetsArray(); - - void copy(const char *name); /** -#include -#include -#include -#include -#include -#include - -#include "PresetsStore.h" -#include "../Misc/Util.h" - -using namespace std; - -PresetsStore presetsstore; - -PresetsStore::PresetsStore() -{ - clipboard.data = NULL; - clipboard.type[0] = 0; -} - -PresetsStore::~PresetsStore() -{ - if(clipboard.data != NULL) - free(clipboard.data); - clearpresets(); -} - -//Clipboard management - -void PresetsStore::copyclipboard(XMLwrapper *xml, char *type) -{ - strcpy(clipboard.type, type); - if(clipboard.data != NULL) - free(clipboard.data); - clipboard.data = xml->getXMLdata(); -} - -bool PresetsStore::pasteclipboard(XMLwrapper *xml) -{ - if(clipboard.data != NULL) - xml->putXMLdata(clipboard.data); - else - return false; - return true; -} - -bool PresetsStore::checkclipboardtype(const char *type) -{ - //makes LFO's compatible - if((strstr(type, - "Plfo") != NULL) && (strstr(clipboard.type, "Plfo") != NULL)) - return true; - return strcmp(type, clipboard.type) == 0; -} - -//Presets management -void PresetsStore::clearpresets() -{ - presets.clear(); -} - -//a helper function that compares 2 presets[] -bool PresetsStore::presetstruct::operator<(const presetstruct &b) const -{ - return name < b.name; -} - - -void PresetsStore::rescanforpresets(const string &type) -{ - //std::cout << "Scanning For Presets" << std::endl; - //std::cout << "Of Type: " << type << std::endl; - - clearpresets(); - string ftype = "." + type.substr(1) + ".xpz"; - - for(int i = 0; i < MAX_BANK_ROOT_DIRS; ++i) { - if(config.cfg.presetsDirList[i].empty()) - continue; - - //open directory - string dirname = config.cfg.presetsDirList[i]; - DIR *dir = opendir(dirname.c_str()); - if(dir == NULL) - continue; - struct dirent *fn; - - //check all files in directory - while((fn = readdir(dir))) { - string filename = fn->d_name; - if(filename.find(ftype) == string::npos) - continue; - - //ensure proper path is formed - char tmpc = dirname[dirname.size() - 1]; - const char *tmps; - if((tmpc == '/') || (tmpc == '\\')) - tmps = ""; - else - tmps = "/"; - - string location = "" + dirname + tmps + filename; - - //trim file type off of name - string name = filename.substr(0, filename.find(ftype)); - - //put on list - presets.push_back(presetstruct(location, name)); - } - - closedir(dir); - } - - //sort the presets - sort(presets.begin(), presets.end()); -} - - -void PresetsStore::copypreset(XMLwrapper *xml, char *type, string name) -{ - if(config.cfg.presetsDirList[0].empty()) - return; - - //make the filenames legal - name = legalizeFilename(name); - - //make path legal - const string dirname = config.cfg.presetsDirList[0]; - char tmpc = dirname[dirname.size() - 1]; - const char *tmps; - if((tmpc == '/') || (tmpc == '\\')) - tmps = ""; - else - tmps = "/"; - - string filename("" + dirname + tmps + name + "." + &type[1] + ".xpz"); - - xml->saveXMLfile(filename); -} - -bool PresetsStore::pastepreset(XMLwrapper *xml, unsigned int npreset) -{ - npreset--; - if(npreset >= presets.size()) - return false; - string filename = presets[npreset].file; - if(filename.empty()) - return false; - bool result = (xml->loadXMLfile(filename) >= 0); - return result; -} - -void PresetsStore::deletepreset(unsigned int npreset) -{ - npreset--; - if(npreset >= presets.size()) - return; - string filename = presets[npreset].file; - if(filename.empty()) - return; - remove(filename.c_str()); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsStore.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsStore.h deleted file mode 100644 index a2f48fd2170..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/PresetsStore.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PresetsStore.cpp - Presets and Clipboard store - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PRESETSTORE_H -#define PRESETSTORE_H - -#include -#include -#include "../Misc/XMLwrapper.h" -#include "../Misc/Config.h" - -#define MAX_PRESETTYPE_SIZE 30 - -class PresetsStore -{ - public: - PresetsStore(); - ~PresetsStore(); - - //Clipboard stuff - void copyclipboard(XMLwrapper *xml, char *type); - bool pasteclipboard(XMLwrapper *xml); - bool checkclipboardtype(const char *type); - - //presets stuff - void copypreset(XMLwrapper *xml, char *type, std::string name); - bool pastepreset(XMLwrapper *xml, unsigned int npreset); - void deletepreset(unsigned int npreset); - - struct presetstruct { - presetstruct(std::string _file, std::string _name) - :file(_file), name(_name) {} - bool operator<(const presetstruct &b) const; - std::string file; - std::string name; - }; - std::vector presets; - - void rescanforpresets(const std::string &type); - - private: - struct { - char *data; - char type[MAX_PRESETTYPE_SIZE]; - } clipboard; - - void clearpresets(); -}; - -extern PresetsStore presetsstore; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.cpp deleted file mode 100644 index 7e303742bf7..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnoteParameters.cpp - Parameters for SUBnote (SUBsynth) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "../globals.h" -#include "SUBnoteParameters.h" -#include -#include - -SUBnoteParameters::SUBnoteParameters():Presets() -{ - setpresettype("Psubsynth"); - AmpEnvelope = new EnvelopeParams(64, 1); - AmpEnvelope->ADSRinit_dB(0, 40, 127, 25); - FreqEnvelope = new EnvelopeParams(64, 0); - FreqEnvelope->ASRinit(30, 50, 64, 60); - BandWidthEnvelope = new EnvelopeParams(64, 0); - BandWidthEnvelope->ASRinit_bw(100, 70, 64, 60); - - GlobalFilter = new FilterParams(2, 80, 40); - GlobalFilterEnvelope = new EnvelopeParams(0, 1); - GlobalFilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64); - - defaults(); -} - - -void SUBnoteParameters::defaults() -{ - PVolume = 96; - PPanning = 64; - PAmpVelocityScaleFunction = 90; - - Pfixedfreq = 0; - PfixedfreqET = 0; - Pnumstages = 2; - Pbandwidth = 40; - Phmagtype = 0; - Pbwscale = 64; - Pstereo = 1; - Pstart = 1; - - PDetune = 8192; - PCoarseDetune = 0; - PDetuneType = 1; - PFreqEnvelopeEnabled = 0; - PBandWidthEnvelopeEnabled = 0; - - POvertoneSpread.type = 0; - POvertoneSpread.par1 = 0; - POvertoneSpread.par2 = 0; - POvertoneSpread.par3 = 0; - updateFrequencyMultipliers(); - - for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { - Phmag[n] = 0; - Phrelbw[n] = 64; - } - Phmag[0] = 127; - - PGlobalFilterEnabled = 0; - PGlobalFilterVelocityScale = 64; - PGlobalFilterVelocityScaleFunction = 64; - - AmpEnvelope->defaults(); - FreqEnvelope->defaults(); - BandWidthEnvelope->defaults(); - GlobalFilter->defaults(); - GlobalFilterEnvelope->defaults(); -} - - - -SUBnoteParameters::~SUBnoteParameters() -{ - delete (AmpEnvelope); - delete (FreqEnvelope); - delete (BandWidthEnvelope); - delete (GlobalFilter); - delete (GlobalFilterEnvelope); -} - - - - -void SUBnoteParameters::add2XML(XMLwrapper *xml) -{ - xml->addpar("num_stages", Pnumstages); - xml->addpar("harmonic_mag_type", Phmagtype); - xml->addpar("start", Pstart); - - xml->beginbranch("HARMONICS"); - for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { - if((Phmag[i] == 0) && (xml->minimal)) - continue; - xml->beginbranch("HARMONIC", i); - xml->addpar("mag", Phmag[i]); - xml->addpar("relbw", Phrelbw[i]); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addparbool("stereo", Pstereo); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->beginbranch("AMPLITUDE_ENVELOPE"); - AmpEnvelope->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("overtone_spread_type", POvertoneSpread.type); - xml->addpar("overtone_spread_par1", POvertoneSpread.par1); - xml->addpar("overtone_spread_par2", POvertoneSpread.par2); - xml->addpar("overtone_spread_par3", POvertoneSpread.par3); - xml->addpar("detune_type", PDetuneType); - - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if((PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); - FreqEnvelope->add2XML(xml); - xml->endbranch(); - } - - xml->addparbool("band_width_envelope_enabled", PBandWidthEnvelopeEnabled); - if((PBandWidthEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("BANDWIDTH_ENVELOPE"); - BandWidthEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); - - xml->beginbranch("FILTER_PARAMETERS"); - xml->addparbool("enabled", PGlobalFilterEnabled); - if((PGlobalFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER"); - GlobalFilter->add2XML(xml); - xml->endbranch(); - - xml->addpar("filter_velocity_sensing", - PGlobalFilterVelocityScaleFunction); - xml->addpar("filter_velocity_sensing_amplitude", - PGlobalFilterVelocityScale); - - xml->beginbranch("FILTER_ENVELOPE"); - GlobalFilterEnvelope->add2XML(xml); - xml->endbranch(); - } - xml->endbranch(); -} - - - -void SUBnoteParameters::updateFrequencyMultipliers(void) { - float par1 = POvertoneSpread.par1 / 255.0f; - float par1pow = powf(10.0f, - -(1.0f - POvertoneSpread.par1 / 255.0f) * 3.0f); - float par2 = POvertoneSpread.par2 / 255.0f; - float par3 = 1.0f - POvertoneSpread.par3 / 255.0f; - float result; - float tmp = 0.0f; - int thresh = 0; - - for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { - float n1 = n + 1.0f; - switch(POvertoneSpread.type) { - case 1: - thresh = (int)(100.0f * par2 * par2) + 1; - if (n1 < thresh) - result = n1; - else - result = n1 + 8.0f * (n1 - thresh) * par1pow; - break; - case 2: - thresh = (int)(100.0f * par2 * par2) + 1; - if (n1 < thresh) - result = n1; - else - result = n1 + 0.9f * (thresh - n1) * par1pow; - break; - case 3: - tmp = par1pow * 100.0f + 1.0f; - result = powf(n / tmp, 1.0f - 0.8f * par2) * tmp + 1.0f; - break; - case 4: - result = n * (1.0f - par1pow) + - powf(0.1f * n, 3.0f * par2 + 1.0f) * - 10.0f * par1pow + 1.0f; - break; - - case 5: - result = n1 + 2.0f * sinf(n * par2 * par2 * PI * 0.999f) * - sqrt(par1pow); - break; - case 6: - tmp = powf(2.0f * par2, 2.0f) + 0.1f; - result = n * powf(par1 * powf(0.8f * n, tmp) + 1.0f, tmp) + - 1.0f; - break; - - case 7: - result = (n1 + par1) / (par1 + 1); - break; - default: - result = n1; - } - float iresult = floor(result + 0.5f); - POvertoneFreqMult[n] = iresult + par3 * (result - iresult); - } -} - -void SUBnoteParameters::getfromXML(XMLwrapper *xml) -{ - Pnumstages = xml->getpar127("num_stages", Pnumstages); - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); - Pstart = xml->getpar127("start", Pstart); - - if(xml->enterbranch("HARMONICS")) { - Phmag[0] = 0; - for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { - if(xml->enterbranch("HARMONIC", i) == 0) - continue; - Phmag[i] = xml->getpar127("mag", Phmag[i]); - Phrelbw[i] = xml->getpar127("relbw", Phrelbw[i]); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - Pstereo = xml->getparbool("stereo", Pstereo); - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", - PAmpVelocityScaleFunction); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { - AmpEnvelope->getfromXML(xml); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getparbool("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - POvertoneSpread.type = - xml->getpar127("overtone_spread_type", POvertoneSpread.type); - POvertoneSpread.par1 = - xml->getpar("overtone_spread_par1", POvertoneSpread.par1, 0, 255); - POvertoneSpread.par2 = - xml->getpar("overtone_spread_par2", POvertoneSpread.par2, 0, 255); - POvertoneSpread.par3 = - xml->getpar("overtone_spread_par3", POvertoneSpread.par3, 0, 255); - updateFrequencyMultipliers(); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - - Pbandwidth = xml->getpar127("bandwidth", Pbandwidth); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); - - PFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", - PFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { - FreqEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - PBandWidthEnvelopeEnabled = xml->getparbool( - "band_width_envelope_enabled", - PBandWidthEnvelopeEnabled); - if(xml->enterbranch("BANDWIDTH_ENVELOPE")) { - BandWidthEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } - - if(xml->enterbranch("FILTER_PARAMETERS")) { - PGlobalFilterEnabled = xml->getparbool("enabled", PGlobalFilterEnabled); - if(xml->enterbranch("FILTER")) { - GlobalFilter->getfromXML(xml); - xml->exitbranch(); - } - - PGlobalFilterVelocityScaleFunction = xml->getpar127( - "filter_velocity_sensing", - PGlobalFilterVelocityScaleFunction); - PGlobalFilterVelocityScale = xml->getpar127( - "filter_velocity_sensing_amplitude", - PGlobalFilterVelocityScale); - - if(xml->enterbranch("FILTER_ENVELOPE")) { - GlobalFilterEnvelope->getfromXML(xml); - xml->exitbranch(); - } - - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.h b/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.h deleted file mode 100644 index adbfca3ec5a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Params/SUBnoteParameters.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnoteParameters.h - Parameters for SUBnote (SUBsynth) - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SUB_NOTE_PARAMETERS_H -#define SUB_NOTE_PARAMETERS_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "EnvelopeParams.h" -#include "FilterParams.h" -#include "Presets.h" - -class SUBnoteParameters:public Presets -{ - public: - SUBnoteParameters(); - ~SUBnoteParameters(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - void updateFrequencyMultipliers(void); - - //Parameters - //AMPLITUDE PARAMETRERS - unsigned char Pstereo; //0 for mono,1 for stereo - unsigned char PVolume; - unsigned char PPanning; - unsigned char PAmpVelocityScaleFunction; - EnvelopeParams *AmpEnvelope; - - //Frequency Parameters - unsigned short int PDetune; - unsigned short int PCoarseDetune; - unsigned char PDetuneType; - unsigned char PFreqEnvelopeEnabled; - EnvelopeParams *FreqEnvelope; - unsigned char PBandWidthEnvelopeEnabled; - EnvelopeParams *BandWidthEnvelope; - - //Filter Parameters (Global) - unsigned char PGlobalFilterEnabled; - FilterParams *GlobalFilter; - unsigned char PGlobalFilterVelocityScale; - unsigned char PGlobalFilterVelocityScaleFunction; - EnvelopeParams *GlobalFilterEnvelope; - - - //Other Parameters - - //If the base frequency is fixed to 440 Hz - unsigned char Pfixedfreq; - - /* Equal temperate (this is used only if the Pfixedfreq is enabled) - If this parameter is 0, the frequency is fixed (to 440 Hz); - if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ - unsigned char PfixedfreqET; - - // Overtone spread parameters - struct { - unsigned char type; - unsigned char par1; - unsigned char par2; - unsigned char par3; - } POvertoneSpread; - float POvertoneFreqMult[MAX_SUB_HARMONICS]; - - //how many times the filters are applied - unsigned char Pnumstages; - - //bandwidth - unsigned char Pbandwidth; - - //How the magnitudes are computed (0=linear,1=-60dB,2=-60dB) - unsigned char Phmagtype; - - //Magnitudes - unsigned char Phmag[MAX_SUB_HARMONICS]; - - //Relative BandWidth ("64"=1.0f) - unsigned char Phrelbw[MAX_SUB_HARMONICS]; - - //how much the bandwidth is increased according to lower/higher frequency; 64-default - unsigned char Pbwscale; - - //how the harmonics start("0"=0,"1"=random,"2"=1) - unsigned char Pstart; - - - private: -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.cpp deleted file mode 100644 index 6c702390088..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.cpp +++ /dev/null @@ -1,1822 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnote.cpp - The "additive" synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include - -#include "../globals.h" -#include "../Misc/Util.h" -#include "../DSP/Filter.h" -#include "OscilGen.h" -#include "ADnote.h" - - -ADnote::ADnote(ADnoteParameters *pars, - Controller *ctl_, - float freq, - float velocity, - int portamento_, - int midinote_, - bool besilent) - :SynthNote(freq, velocity, portamento_, midinote_, besilent) -{ - tmpwavel = new float [synth->buffersize]; - tmpwaver = new float [synth->buffersize]; - bypassl = new float [synth->buffersize]; - bypassr = new float [synth->buffersize]; - - partparams = pars; - ctl = ctl_; - portamento = portamento_; - midinote = midinote_; - NoteEnabled = ON; - basefreq = freq; - if(velocity > 1.0f) - velocity = 1.0f; - this->velocity = velocity; - time = 0.0f; - stereo = pars->GlobalPar.PStereo; - - NoteGlobalPar.Detune = getdetune(pars->GlobalPar.PDetuneType, - pars->GlobalPar.PCoarseDetune, - pars->GlobalPar.PDetune); - bandwidthDetuneMultiplier = pars->getBandwidthDetuneMultiplier(); - - if(pars->GlobalPar.PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->GlobalPar.PPanning / 128.0f; - - - NoteGlobalPar.FilterCenterPitch = pars->GlobalPar.GlobalFilter->getfreq() //center freq - + pars->GlobalPar.PFilterVelocityScale - / 127.0f * 6.0f //velocity sensing - * (VelF(velocity, - pars->GlobalPar. - PFilterVelocityScaleFunction) - 1); - - if(pars->GlobalPar.PPunchStrength != 0) { - NoteGlobalPar.Punch.Enabled = 1; - NoteGlobalPar.Punch.t = 1.0f; //start from 1.0f and to 0.0f - NoteGlobalPar.Punch.initialvalue = - ((powf(10, 1.5f * pars->GlobalPar.PPunchStrength / 127.0f) - 1.0f) - * VelF(velocity, - pars->GlobalPar.PPunchVelocitySensing)); - float time = - powf(10, 3.0f * pars->GlobalPar.PPunchTime / 127.0f) / 10000.0f; //0.1f .. 100 ms - float stretch = powf(440.0f / freq, - pars->GlobalPar.PPunchStretch / 64.0f); - NoteGlobalPar.Punch.dt = 1.0f / (time * synth->samplerate_f * stretch); - } - else - NoteGlobalPar.Punch.Enabled = 0; - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - pars->VoicePar[nvoice].OscilSmp->newrandseed(prng()); - NoteVoicePar[nvoice].OscilSmp = NULL; - NoteVoicePar[nvoice].FMSmp = NULL; - NoteVoicePar[nvoice].VoiceOut = NULL; - - NoteVoicePar[nvoice].FMVoice = -1; - unison_size[nvoice] = 1; - - if(pars->VoicePar[nvoice].Enabled == 0) { - NoteVoicePar[nvoice].Enabled = OFF; - continue; //the voice is disabled - } - - unison_stereo_spread[nvoice] = - pars->VoicePar[nvoice].Unison_stereo_spread / 127.0f; - int unison = pars->VoicePar[nvoice].Unison_size; - if(unison < 1) - unison = 1; - - //compute unison - unison_size[nvoice] = unison; - - unison_base_freq_rap[nvoice] = new float[unison]; - unison_freq_rap[nvoice] = new float[unison]; - unison_invert_phase[nvoice] = new bool[unison]; - float unison_spread = pars->getUnisonFrequencySpreadCents( - nvoice); - float unison_real_spread = powf(2.0f, (unison_spread * 0.5f) / 1200.0f); - float unison_vibratto_a = pars->VoicePar[nvoice].Unison_vibratto - / 127.0f; //0.0f .. 1.0f - - - switch(unison) { - case 1: - unison_base_freq_rap[nvoice][0] = 1.0f; //if the unison is not used, always make the only subvoice to have the default note - break; - case 2: { //unison for 2 subvoices - unison_base_freq_rap[nvoice][0] = 1.0f / unison_real_spread; - unison_base_freq_rap[nvoice][1] = unison_real_spread; - }; - break; - default: { //unison for more than 2 subvoices - float unison_values[unison]; - float min = -1e-6, max = 1e-6; - for(int k = 0; k < unison; ++k) { - float step = (k / (float) (unison - 1)) * 2.0f - 1.0f; //this makes the unison spread more uniform - float val = step + (RND * 2.0f - 1.0f) / (unison - 1); - unison_values[k] = val; - if (min > val) { - min = val; - } - if (max < val) { - max = val; - } - } - float diff = max - min; - for(int k = 0; k < unison; ++k) { - unison_values[k] = - (unison_values[k] - (max + min) * 0.5f) / diff; //the lowest value will be -1 and the highest will be 1 - unison_base_freq_rap[nvoice][k] = - powf(2.0f, (unison_spread * unison_values[k]) / 1200); - } - }; - } - - //unison vibrattos - if(unison > 1) - for(int k = 0; k < unison; ++k) //reduce the frequency difference for larger vibrattos - unison_base_freq_rap[nvoice][k] = 1.0f - + (unison_base_freq_rap[ - nvoice][k] - 1.0f) - * (1.0f - unison_vibratto_a); - unison_vibratto[nvoice].step = new float[unison]; - unison_vibratto[nvoice].position = new float[unison]; - unison_vibratto[nvoice].amplitude = - (unison_real_spread - 1.0f) * unison_vibratto_a; - - float increments_per_second = synth->samplerate_f / synth->buffersize_f; - float vibratto_base_period = 0.25f - * powf( - 2.0f, - (1.0f - - pars->VoicePar[nvoice]. - Unison_vibratto_speed - / 127.0f) * 4.0f); - for(int k = 0; k < unison; ++k) { - unison_vibratto[nvoice].position[k] = RND * 1.8f - 0.9f; - //make period to vary randomly from 50% to 200% vibratto base period - float vibratto_period = vibratto_base_period - * powf(2.0f, RND * 2.0f - 1.0f); - - float m = 4.0f / (vibratto_period * increments_per_second); - if(RND < 0.5f) - m = -m; - unison_vibratto[nvoice].step[k] = m; - } - - if(unison == 1) { //no vibratto for a single voice - unison_vibratto[nvoice].step[0] = 0.0f; - unison_vibratto[nvoice].position[0] = 0.0f; - unison_vibratto[nvoice].amplitude = 0.0f; - } - - //phase invert for unison - unison_invert_phase[nvoice][0] = false; - if(unison != 1) { - int inv = pars->VoicePar[nvoice].Unison_invert_phase; - switch(inv) { - case 0: for(int k = 0; k < unison; ++k) - unison_invert_phase[nvoice][k] = false; - break; - case 1: for(int k = 0; k < unison; ++k) - unison_invert_phase[nvoice][k] = (RND > 0.5f); - break; - default: for(int k = 0; k < unison; ++k) - unison_invert_phase[nvoice][k] = - (k % inv == 0) ? true : false; - break; - } - } - - - oscfreqhi[nvoice] = new int[unison]; - oscfreqlo[nvoice] = new float[unison]; - oscfreqhiFM[nvoice] = new unsigned int[unison]; - oscfreqloFM[nvoice] = new float[unison]; - oscposhi[nvoice] = new int[unison]; - oscposlo[nvoice] = new float[unison]; - oscposhiFM[nvoice] = new unsigned int[unison]; - oscposloFM[nvoice] = new float[unison]; - - NoteVoicePar[nvoice].Enabled = ON; - NoteVoicePar[nvoice].fixedfreq = pars->VoicePar[nvoice].Pfixedfreq; - NoteVoicePar[nvoice].fixedfreqET = pars->VoicePar[nvoice].PfixedfreqET; - - //use the Globalpars.detunetype if the detunetype is 0 - if(pars->VoicePar[nvoice].PDetuneType != 0) { - NoteVoicePar[nvoice].Detune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - else { - NoteVoicePar[nvoice].Detune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->GlobalPar.PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - if(pars->VoicePar[nvoice].PFMDetuneType != 0) - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->VoicePar[nvoice].PFMDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - else - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice]. - PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - - - - for(int k = 0; k < unison; ++k) { - oscposhi[nvoice][k] = 0; - oscposlo[nvoice][k] = 0.0f; - oscposhiFM[nvoice][k] = 0; - oscposloFM[nvoice][k] = 0.0f; - } - - //the extra points contains the first point - NoteVoicePar[nvoice].OscilSmp = - new float[synth->oscilsize + OSCIL_SMP_EXTRA_SAMPLES]; - - //Get the voice's oscil or external's voice oscil - int vc = nvoice; - if(pars->VoicePar[nvoice].Pextoscil != -1) - vc = pars->VoicePar[nvoice].Pextoscil; - if(!pars->GlobalPar.Hrandgrouping) - pars->VoicePar[vc].OscilSmp->newrandseed(prng()); - int oscposhi_start = - pars->VoicePar[vc].OscilSmp->get(NoteVoicePar[nvoice].OscilSmp, - getvoicebasefreq(nvoice), - pars->VoicePar[nvoice].Presonance); - - //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) - NoteVoicePar[nvoice].OscilSmp[synth->oscilsize - + i] = - NoteVoicePar[nvoice].OscilSmp[i]; - - oscposhi_start += - (int)((pars->VoicePar[nvoice].Poscilphase - - 64.0f) / 128.0f * synth->oscilsize + synth->oscilsize * 4); - oscposhi_start %= synth->oscilsize; - - for(int k = 0; k < unison; ++k) { - oscposhi[nvoice][k] = oscposhi_start; - //put random starting point for other subvoices - oscposhi_start = - (int)(RND * pars->VoicePar[nvoice].Unison_phase_randomness / - 127.0f * (synth->oscilsize - 1)); - } - - NoteVoicePar[nvoice].FreqLfo = NULL; - NoteVoicePar[nvoice].FreqEnvelope = NULL; - - NoteVoicePar[nvoice].AmpLfo = NULL; - NoteVoicePar[nvoice].AmpEnvelope = NULL; - - NoteVoicePar[nvoice].VoiceFilterL = NULL; - NoteVoicePar[nvoice].VoiceFilterR = NULL; - NoteVoicePar[nvoice].FilterEnvelope = NULL; - NoteVoicePar[nvoice].FilterLfo = NULL; - - NoteVoicePar[nvoice].FilterCenterPitch = - pars->VoicePar[nvoice].VoiceFilter->getfreq(); - NoteVoicePar[nvoice].filterbypass = - pars->VoicePar[nvoice].Pfilterbypass; - - switch(pars->VoicePar[nvoice].PFMEnabled) { - case 1: - NoteVoicePar[nvoice].FMEnabled = MORPH; - break; - case 2: - NoteVoicePar[nvoice].FMEnabled = RING_MOD; - break; - case 3: - NoteVoicePar[nvoice].FMEnabled = PHASE_MOD; - break; - case 4: - NoteVoicePar[nvoice].FMEnabled = FREQ_MOD; - break; - case 5: - NoteVoicePar[nvoice].FMEnabled = PITCH_MOD; - break; - default: - NoteVoicePar[nvoice].FMEnabled = NONE; - } - - NoteVoicePar[nvoice].FMVoice = pars->VoicePar[nvoice].PFMVoice; - NoteVoicePar[nvoice].FMFreqEnvelope = NULL; - NoteVoicePar[nvoice].FMAmpEnvelope = NULL; - - //Compute the Voice's modulator volume (incl. damping) - float fmvoldamp = powf(440.0f / getvoicebasefreq( - nvoice), - pars->VoicePar[nvoice].PFMVolumeDamp / 64.0f - - 1.0f); - switch(NoteVoicePar[nvoice].FMEnabled) { - case PHASE_MOD: - fmvoldamp = - powf(440.0f / getvoicebasefreq( - nvoice), pars->VoicePar[nvoice].PFMVolumeDamp - / 64.0f); - NoteVoicePar[nvoice].FMVolume = - (expf(pars->VoicePar[nvoice].PFMVolume / 127.0f - * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; - break; - case FREQ_MOD: - NoteVoicePar[nvoice].FMVolume = - (expf(pars->VoicePar[nvoice].PFMVolume / 127.0f - * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; - break; - // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars->VoicePar[nvoice].PFMVolume/127.0f*8.0f)*fmvoldamp;//??????????? - // break; - default: - if(fmvoldamp > 1.0f) - fmvoldamp = 1.0f; - NoteVoicePar[nvoice].FMVolume = - pars->VoicePar[nvoice].PFMVolume - / 127.0f * fmvoldamp; - } - - //Voice's modulator velocity sensing - NoteVoicePar[nvoice].FMVolume *= - VelF(velocity, - partparams->VoicePar[nvoice].PFMVelocityScaleFunction); - - FMoldsmp[nvoice] = new float [unison]; - for(int k = 0; k < unison; ++k) - FMoldsmp[nvoice][k] = 0.0f; //this is for FM (integration) - - firsttick[nvoice] = 1; - NoteVoicePar[nvoice].DelayTicks = - (int)((expf(pars->VoicePar[nvoice].PDelay / 127.0f - * logf(50.0f)) - - 1.0f) / synth->buffersize_f / 10.0f * synth->samplerate_f); - } - - max_unison = 1; - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) - if(unison_size[nvoice] > max_unison) - max_unison = unison_size[nvoice]; - - - tmpwave_unison = new float *[max_unison]; - for(int k = 0; k < max_unison; ++k) { - tmpwave_unison[k] = new float[synth->buffersize]; - memset(tmpwave_unison[k], 0, synth->bufferbytes); - } - - initparameters(); -} - -// ADlegatonote: This function is (mostly) a copy of ADnote(...) and -// initparameters() stuck together with some lines removed so that it -// only alter the already playing note (to perform legato). It is -// possible I left stuff that is not required for this. -void ADnote::legatonote(float freq, float velocity, int portamento_, - int midinote_, bool externcall) -{ - ADnoteParameters *pars = partparams; - - // Manage legato stuff - if(legato.update(freq, velocity, portamento_, midinote_, externcall)) - return; - - portamento = portamento_; - midinote = midinote_; - basefreq = freq; - - if(velocity > 1.0f) - velocity = 1.0f; - this->velocity = velocity; - - NoteGlobalPar.Detune = getdetune(pars->GlobalPar.PDetuneType, - pars->GlobalPar.PCoarseDetune, - pars->GlobalPar.PDetune); - bandwidthDetuneMultiplier = pars->getBandwidthDetuneMultiplier(); - - if(pars->GlobalPar.PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->GlobalPar.PPanning / 128.0f; - - //center freq - NoteGlobalPar.FilterCenterPitch = pars->GlobalPar.GlobalFilter->getfreq() - + pars->GlobalPar.PFilterVelocityScale - / 127.0f * 6.0f //velocity sensing - * (VelF(velocity, - pars->GlobalPar. - PFilterVelocityScaleFunction) - 1); - - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - if(NoteVoicePar[nvoice].Enabled == OFF) - continue; //(gf) Stay the same as first note in legato. - - NoteVoicePar[nvoice].fixedfreq = pars->VoicePar[nvoice].Pfixedfreq; - NoteVoicePar[nvoice].fixedfreqET = pars->VoicePar[nvoice].PfixedfreqET; - - //use the Globalpars.detunetype if the detunetype is 0 - if(pars->VoicePar[nvoice].PDetuneType != 0) { - NoteVoicePar[nvoice].Detune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - pars->VoicePar[nvoice].PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->VoicePar[nvoice].PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - else { - NoteVoicePar[nvoice].Detune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice].PCoarseDetune, - 8192); //coarse detune - NoteVoicePar[nvoice].FineDetune = getdetune( - pars->GlobalPar.PDetuneType, - 0, - pars->VoicePar[nvoice].PDetune); //fine detune - } - if(pars->VoicePar[nvoice].PFMDetuneType != 0) - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->VoicePar[nvoice].PFMDetuneType, - pars->VoicePar[nvoice].PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - else - NoteVoicePar[nvoice].FMDetune = getdetune( - pars->GlobalPar.PDetuneType, - pars->VoicePar[nvoice].PFMCoarseDetune, - pars->VoicePar[nvoice].PFMDetune); - - - //Get the voice's oscil or external's voice oscil - int vc = nvoice; - if(pars->VoicePar[nvoice].Pextoscil != -1) - vc = pars->VoicePar[nvoice].Pextoscil; - if(!pars->GlobalPar.Hrandgrouping) - pars->VoicePar[vc].OscilSmp->newrandseed(prng()); - - pars->VoicePar[vc].OscilSmp->get(NoteVoicePar[nvoice].OscilSmp, - getvoicebasefreq(nvoice), - pars->VoicePar[nvoice].Presonance); //(gf)Modif of the above line. - - //I store the first elments to the last position for speedups - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) - NoteVoicePar[nvoice].OscilSmp[synth->oscilsize - + i] = - NoteVoicePar[nvoice].OscilSmp[i]; - - - NoteVoicePar[nvoice].FilterCenterPitch = - pars->VoicePar[nvoice].VoiceFilter->getfreq(); - NoteVoicePar[nvoice].filterbypass = - pars->VoicePar[nvoice].Pfilterbypass; - - - NoteVoicePar[nvoice].FMVoice = pars->VoicePar[nvoice].PFMVoice; - - //Compute the Voice's modulator volume (incl. damping) - float fmvoldamp = powf(440.0f / getvoicebasefreq(nvoice), - pars->VoicePar[nvoice].PFMVolumeDamp / 64.0f - - 1.0f); - - switch(NoteVoicePar[nvoice].FMEnabled) { - case PHASE_MOD: - fmvoldamp = - powf(440.0f / getvoicebasefreq( - nvoice), pars->VoicePar[nvoice].PFMVolumeDamp - / 64.0f); - NoteVoicePar[nvoice].FMVolume = - (expf(pars->VoicePar[nvoice].PFMVolume / 127.0f - * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; - break; - case FREQ_MOD: - NoteVoicePar[nvoice].FMVolume = - (expf(pars->VoicePar[nvoice].PFMVolume / 127.0f - * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; - break; - // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars->VoicePar[nvoice].PFMVolume/127.0f*8.0f)*fmvoldamp;//??????????? - // break; - default: - if(fmvoldamp > 1.0f) - fmvoldamp = 1.0f; - NoteVoicePar[nvoice].FMVolume = - pars->VoicePar[nvoice].PFMVolume - / 127.0f * fmvoldamp; - } - - //Voice's modulator velocity sensing - NoteVoicePar[nvoice].FMVolume *= - VelF(velocity, - partparams->VoicePar[nvoice].PFMVelocityScaleFunction); - - NoteVoicePar[nvoice].DelayTicks = - (int)((expf(pars->VoicePar[nvoice].PDelay / 127.0f - * logf(50.0f)) - - 1.0f) / synth->buffersize_f / 10.0f * synth->samplerate_f); - } - - /// initparameters(); - - /////////////// - // Altered content of initparameters(): - - int tmp[NUM_VOICES]; - - NoteGlobalPar.Volume = 4.0f - * powf(0.1f, 3.0f - * (1.0f - partparams->GlobalPar.PVolume - / 96.0f)) //-60 dB .. 0 dB - * VelF( - velocity, - partparams->GlobalPar. - PAmpVelocityScaleFunction); //velocity sensing - - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - NoteGlobalPar.FilterQ = partparams->GlobalPar.GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = - partparams->GlobalPar.GlobalFilter->getfreqtracking(basefreq); - - // Forbids the Modulation Voice to be greater or equal than voice - for(int i = 0; i < NUM_VOICES; ++i) - if(NoteVoicePar[i].FMVoice >= i) - NoteVoicePar[i].FMVoice = -1; - - // Voice Parameter init - for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - if(NoteVoicePar[nvoice].Enabled == 0) - continue; - - NoteVoicePar[nvoice].noisetype = partparams->VoicePar[nvoice].Type; - /* Voice Amplitude Parameters Init */ - NoteVoicePar[nvoice].Volume = - powf(0.1f, 3.0f - * (1.0f - partparams->VoicePar[nvoice].PVolume / 127.0f)) // -60 dB .. 0 dB - * VelF(velocity, - partparams->VoicePar[nvoice].PAmpVelocityScaleFunction); //velocity - - if(partparams->VoicePar[nvoice].PVolumeminus != 0) - NoteVoicePar[nvoice].Volume = -NoteVoicePar[nvoice].Volume; - - if(partparams->VoicePar[nvoice].PPanning == 0) - NoteVoicePar[nvoice].Panning = RND; // random panning - else - NoteVoicePar[nvoice].Panning = - partparams->VoicePar[nvoice].PPanning / 128.0f; - - newamplitude[nvoice] = 1.0f; - if((partparams->VoicePar[nvoice].PAmpEnvelopeEnabled != 0) - && (NoteVoicePar[nvoice].AmpEnvelope != NULL)) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); - - - if((partparams->VoicePar[nvoice].PAmpLfoEnabled != 0) - && (NoteVoicePar[nvoice].AmpLfo != NULL)) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpLfo->amplfoout(); - - - - NoteVoicePar[nvoice].FilterFreqTracking = - partparams->VoicePar[nvoice].VoiceFilter->getfreqtracking(basefreq); - - /* Voice Modulation Parameters Init */ - if((NoteVoicePar[nvoice].FMEnabled != NONE) - && (NoteVoicePar[nvoice].FMVoice < 0)) { - partparams->VoicePar[nvoice].FMSmp->newrandseed(prng()); - - //Perform Anti-aliasing only on MORPH or RING MODULATION - - int vc = nvoice; - if(partparams->VoicePar[nvoice].PextFMoscil != -1) - vc = partparams->VoicePar[nvoice].PextFMoscil; - - if(!partparams->GlobalPar.Hrandgrouping) - partparams->VoicePar[vc].FMSmp->newrandseed(prng()); - - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) - NoteVoicePar[nvoice].FMSmp[synth->oscilsize + i] = - NoteVoicePar[nvoice].FMSmp[i]; - } - - FMnewamplitude[nvoice] = NoteVoicePar[nvoice].FMVolume - * ctl->fmamp.relamp; - - if((partparams->VoicePar[nvoice].PFMAmpEnvelopeEnabled != 0) - && (NoteVoicePar[nvoice].FMAmpEnvelope != NULL)) - FMnewamplitude[nvoice] *= - NoteVoicePar[nvoice].FMAmpEnvelope->envout_dB(); - } - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - for(unsigned i = nvoice + 1; i < NUM_VOICES; ++i) - tmp[i] = 0; - for(unsigned i = nvoice + 1; i < NUM_VOICES; ++i) - if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) - tmp[i] = 1; - } -} - - -/* - * Kill a voice of ADnote - */ -void ADnote::KillVoice(int nvoice) -{ - delete [] oscfreqhi[nvoice]; - delete [] oscfreqlo[nvoice]; - delete [] oscfreqhiFM[nvoice]; - delete [] oscfreqloFM[nvoice]; - delete [] oscposhi[nvoice]; - delete [] oscposlo[nvoice]; - delete [] oscposhiFM[nvoice]; - delete [] oscposloFM[nvoice]; - - delete [] unison_base_freq_rap[nvoice]; - delete [] unison_freq_rap[nvoice]; - delete [] unison_invert_phase[nvoice]; - delete [] FMoldsmp[nvoice]; - delete [] unison_vibratto[nvoice].step; - delete [] unison_vibratto[nvoice].position; - - NoteVoicePar[nvoice].kill(); -} - -/* - * Kill the note - */ -void ADnote::KillNote() -{ - for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - if(NoteVoicePar[nvoice].Enabled == ON) - KillVoice(nvoice); - - if(NoteVoicePar[nvoice].VoiceOut) - delete[] NoteVoicePar[nvoice].VoiceOut; - NoteVoicePar[nvoice].VoiceOut = NULL; - } - - NoteGlobalPar.kill(); - - NoteEnabled = OFF; -} - -ADnote::~ADnote() -{ - if(NoteEnabled == ON) - KillNote(); - delete [] tmpwavel; - delete [] tmpwaver; - delete [] bypassl; - delete [] bypassr; - for(int k = 0; k < max_unison; ++k) - delete[] tmpwave_unison[k]; - delete[] tmpwave_unison; -} - - -/* - * Init the parameters - */ -void ADnote::initparameters() -{ - int tmp[NUM_VOICES]; - - // Global Parameters - NoteGlobalPar.initparameters(partparams->GlobalPar, basefreq, velocity, - stereo); - - NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - // Forbids the Modulation Voice to be greater or equal than voice - for(int i = 0; i < NUM_VOICES; ++i) - if(NoteVoicePar[i].FMVoice >= i) - NoteVoicePar[i].FMVoice = -1; - - // Voice Parameter init - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - Voice &vce = NoteVoicePar[nvoice]; - ADnoteVoiceParam ¶m = partparams->VoicePar[nvoice]; - - if(vce.Enabled == 0) - continue; - - vce.noisetype = param.Type; - /* Voice Amplitude Parameters Init */ - vce.Volume = powf(0.1f, 3.0f * (1.0f - param.PVolume / 127.0f)) // -60dB..0dB - * VelF(velocity, param.PAmpVelocityScaleFunction); - - if(param.PVolumeminus) - vce.Volume = -vce.Volume; - - if(param.PPanning == 0) - vce.Panning = RND; // random panning - else - vce.Panning = param.PPanning / 128.0f; - - newamplitude[nvoice] = 1.0f; - if(param.PAmpEnvelopeEnabled) { - vce.AmpEnvelope = new Envelope(param.AmpEnvelope, basefreq); - vce.AmpEnvelope->envout_dB(); //discard the first envelope sample - newamplitude[nvoice] *= vce.AmpEnvelope->envout_dB(); - } - - if(param.PAmpLfoEnabled) { - vce.AmpLfo = new LFO(param.AmpLfo, basefreq); - newamplitude[nvoice] *= vce.AmpLfo->amplfoout(); - } - - /* Voice Frequency Parameters Init */ - if(param.PFreqEnvelopeEnabled != 0) - vce.FreqEnvelope = new Envelope(param.FreqEnvelope, basefreq); - - if(param.PFreqLfoEnabled != 0) - vce.FreqLfo = new LFO(param.FreqLfo, basefreq); - - /* Voice Filter Parameters Init */ - if(param.PFilterEnabled != 0) { - vce.VoiceFilterL = Filter::generate(param.VoiceFilter); - vce.VoiceFilterR = Filter::generate(param.VoiceFilter); - } - - if(param.PFilterEnvelopeEnabled != 0) - vce.FilterEnvelope = new Envelope(param.FilterEnvelope, basefreq); - - if(param.PFilterLfoEnabled != 0) - vce.FilterLfo = new LFO(param.FilterLfo, basefreq); - - vce.FilterFreqTracking = - param.VoiceFilter->getfreqtracking(basefreq); - - /* Voice Modulation Parameters Init */ - if((vce.FMEnabled != NONE) && (vce.FMVoice < 0)) { - param.FMSmp->newrandseed(prng()); - vce.FMSmp = new float[synth->oscilsize + OSCIL_SMP_EXTRA_SAMPLES]; - - //Perform Anti-aliasing only on MORPH or RING MODULATION - - int vc = nvoice; - if(param.PextFMoscil != -1) - vc = param.PextFMoscil; - - float tmp = 1.0f; - if((partparams->VoicePar[vc].FMSmp->Padaptiveharmonics != 0) - || (vce.FMEnabled == MORPH) - || (vce.FMEnabled == RING_MOD)) - tmp = getFMvoicebasefreq(nvoice); - - if(!partparams->GlobalPar.Hrandgrouping) - partparams->VoicePar[vc].FMSmp->newrandseed(prng()); - - for(int k = 0; k < unison_size[nvoice]; ++k) - oscposhiFM[nvoice][k] = (oscposhi[nvoice][k] - + partparams->VoicePar[vc].FMSmp->get( - vce.FMSmp, tmp)) - % synth->oscilsize; - - for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) - vce.FMSmp[synth->oscilsize + i] = vce.FMSmp[i]; - int oscposhiFM_add = - (int)((param.PFMoscilphase - - 64.0f) / 128.0f * synth->oscilsize - + synth->oscilsize * 4); - for(int k = 0; k < unison_size[nvoice]; ++k) { - oscposhiFM[nvoice][k] += oscposhiFM_add; - oscposhiFM[nvoice][k] %= synth->oscilsize; - } - } - - if(param.PFMFreqEnvelopeEnabled != 0) - vce.FMFreqEnvelope = new Envelope(param.FMFreqEnvelope, basefreq); - - FMnewamplitude[nvoice] = vce.FMVolume * ctl->fmamp.relamp; - - if(param.PFMAmpEnvelopeEnabled != 0) { - vce.FMAmpEnvelope = new Envelope(param.FMAmpEnvelope, - basefreq); - FMnewamplitude[nvoice] *= vce.FMAmpEnvelope->envout_dB(); - } - } - - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - for(int i = nvoice + 1; i < NUM_VOICES; ++i) - tmp[i] = 0; - for(int i = nvoice + 1; i < NUM_VOICES; ++i) - if((NoteVoicePar[i].FMVoice == nvoice) && (tmp[i] == 0)) { - NoteVoicePar[nvoice].VoiceOut = new float[synth->buffersize]; - tmp[i] = 1; - } - - if(NoteVoicePar[nvoice].VoiceOut) - memset(NoteVoicePar[nvoice].VoiceOut, 0, synth->bufferbytes); - } -} - - -/* - * Computes the relative frequency of each unison voice and it's vibratto - * This must be called before setfreq* functions - */ -void ADnote::compute_unison_freq_rap(int nvoice) { - if(unison_size[nvoice] == 1) { //no unison - unison_freq_rap[nvoice][0] = 1.0f; - return; - } - float relbw = ctl->bandwidth.relbw * bandwidthDetuneMultiplier; - for(int k = 0; k < unison_size[nvoice]; ++k) { - float pos = unison_vibratto[nvoice].position[k]; - float step = unison_vibratto[nvoice].step[k]; - pos += step; - if(pos <= -1.0f) { - pos = -1.0f; - step = -step; - } - if(pos >= 1.0f) { - pos = 1.0f; - step = -step; - } - float vibratto_val = (pos - 0.333333333f * pos * pos * pos) * 1.5f; //make the vibratto lfo smoother - unison_freq_rap[nvoice][k] = 1.0f - + ((unison_base_freq_rap[nvoice][k] - - 1.0f) + vibratto_val - * unison_vibratto[nvoice].amplitude) - * relbw; - - unison_vibratto[nvoice].position[k] = pos; - step = unison_vibratto[nvoice].step[k] = step; - } -} - - -/* - * Computes the frequency of an oscillator - */ -void ADnote::setfreq(int nvoice, float in_freq) -{ - for(int k = 0; k < unison_size[nvoice]; ++k) { - float freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; - float speed = freq * synth->oscilsize_f / synth->samplerate_f; - if(speed > synth->oscilsize_f) - speed = synth->oscilsize_f; - - F2I(speed, oscfreqhi[nvoice][k]); - oscfreqlo[nvoice][k] = speed - floor(speed); - } -} - -/* - * Computes the frequency of an modullator oscillator - */ -void ADnote::setfreqFM(int nvoice, float in_freq) -{ - for(int k = 0; k < unison_size[nvoice]; ++k) { - float freq = fabs(in_freq) * unison_freq_rap[nvoice][k]; - float speed = freq * synth->oscilsize_f / synth->samplerate_f; - if(speed > synth->samplerate_f) - speed = synth->samplerate_f; - - F2I(speed, oscfreqhiFM[nvoice][k]); - oscfreqloFM[nvoice][k] = speed - floor(speed); - } -} - -/* - * Get Voice base frequency - */ -float ADnote::getvoicebasefreq(int nvoice) const -{ - float detune = NoteVoicePar[nvoice].Detune / 100.0f - + NoteVoicePar[nvoice].FineDetune / 100.0f - * ctl->bandwidth.relbw * bandwidthDetuneMultiplier - + NoteGlobalPar.Detune / 100.0f; - - if(NoteVoicePar[nvoice].fixedfreq == 0) - return this->basefreq * powf(2, detune / 12.0f); - else { //the fixed freq is enabled - float fixedfreq = 440.0f; - int fixedfreqET = NoteVoicePar[nvoice].fixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - float tmp = - (midinote - - 69.0f) / 12.0f - * (powf(2.0f, (fixedfreqET - 1) / 63.0f) - 1.0f); - if(fixedfreqET <= 64) - fixedfreq *= powf(2.0f, tmp); - else - fixedfreq *= powf(3.0f, tmp); - } - return fixedfreq * powf(2.0f, detune / 12.0f); - } -} - -/* - * Get Voice's Modullator base frequency - */ -float ADnote::getFMvoicebasefreq(int nvoice) const -{ - float detune = NoteVoicePar[nvoice].FMDetune / 100.0f; - return getvoicebasefreq(nvoice) * powf(2, detune / 12.0f); -} - -/* - * Computes all the parameters for each tick - */ -void ADnote::computecurrentparameters() -{ - int nvoice; - float voicefreq, voicepitch, filterpitch, filterfreq, FMfreq, - FMrelativepitch, globalpitch, globalfilterpitch; - globalpitch = 0.01f * (NoteGlobalPar.FreqEnvelope->envout() - + NoteGlobalPar.FreqLfo->lfoout() - * ctl->modwheel.relmod); - globaloldamplitude = globalnewamplitude; - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - globalfilterpitch = NoteGlobalPar.FilterEnvelope->envout() - + NoteGlobalPar.FilterLfo->lfoout() - + NoteGlobalPar.FilterCenterPitch; - - float tmpfilterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + NoteGlobalPar.FilterFreqTracking; - - tmpfilterfreq = Filter::getrealfreq(tmpfilterfreq); - - float globalfilterq = NoteGlobalPar.FilterQ * ctl->filterq.relq; - NoteGlobalPar.GlobalFilterL->setfreq_and_q(tmpfilterfreq, globalfilterq); - if(stereo != 0) - NoteGlobalPar.GlobalFilterR->setfreq_and_q(tmpfilterfreq, globalfilterq); - - //compute the portamento, if it is used by this note - float portamentofreqrap = 1.0f; - if(portamento != 0) { //this voice use portamento - portamentofreqrap = ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - } - - //compute parameters for all voices - for(nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - if(NoteVoicePar[nvoice].Enabled != ON) - continue; - NoteVoicePar[nvoice].DelayTicks -= 1; - if(NoteVoicePar[nvoice].DelayTicks > 0) - continue; - - compute_unison_freq_rap(nvoice); - - /*******************/ - /* Voice Amplitude */ - /*******************/ - oldamplitude[nvoice] = newamplitude[nvoice]; - newamplitude[nvoice] = 1.0f; - - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpEnvelope->envout_dB(); - - if(NoteVoicePar[nvoice].AmpLfo != NULL) - newamplitude[nvoice] *= NoteVoicePar[nvoice].AmpLfo->amplfoout(); - - /****************/ - /* Voice Filter */ - /****************/ - if(NoteVoicePar[nvoice].VoiceFilterL != NULL) { - filterpitch = NoteVoicePar[nvoice].FilterCenterPitch; - - if(NoteVoicePar[nvoice].FilterEnvelope != NULL) - filterpitch += NoteVoicePar[nvoice].FilterEnvelope->envout(); - - if(NoteVoicePar[nvoice].FilterLfo != NULL) - filterpitch += NoteVoicePar[nvoice].FilterLfo->lfoout(); - - filterfreq = filterpitch + NoteVoicePar[nvoice].FilterFreqTracking; - filterfreq = Filter::getrealfreq(filterfreq); - - NoteVoicePar[nvoice].VoiceFilterL->setfreq(filterfreq); - if(stereo && NoteVoicePar[nvoice].VoiceFilterR) - NoteVoicePar[nvoice].VoiceFilterR->setfreq(filterfreq); - } - - if(NoteVoicePar[nvoice].noisetype == 0) { //compute only if the voice isn't noise - /*******************/ - /* Voice Frequency */ - /*******************/ - voicepitch = 0.0f; - if(NoteVoicePar[nvoice].FreqLfo != NULL) - voicepitch += NoteVoicePar[nvoice].FreqLfo->lfoout() / 100.0f - * ctl->bandwidth.relbw; - - if(NoteVoicePar[nvoice].FreqEnvelope != NULL) - voicepitch += NoteVoicePar[nvoice].FreqEnvelope->envout() - / 100.0f; - voicefreq = getvoicebasefreq(nvoice) - * powf(2, (voicepitch + globalpitch) / 12.0f); //Hz frequency - voicefreq *= ctl->pitchwheel.relfreq; //change the frequency by the controller - setfreq(nvoice, voicefreq * portamentofreqrap); - - /***************/ - /* Modulator */ - /***************/ - if(NoteVoicePar[nvoice].FMEnabled != NONE) { - FMrelativepitch = NoteVoicePar[nvoice].FMDetune / 100.0f; - if(NoteVoicePar[nvoice].FMFreqEnvelope != NULL) - FMrelativepitch += - NoteVoicePar[nvoice].FMFreqEnvelope->envout() / 100; - FMfreq = - powf(2.0f, FMrelativepitch - / 12.0f) * voicefreq * portamentofreqrap; - setfreqFM(nvoice, FMfreq); - - FMoldamplitude[nvoice] = FMnewamplitude[nvoice]; - FMnewamplitude[nvoice] = NoteVoicePar[nvoice].FMVolume - * ctl->fmamp.relamp; - if(NoteVoicePar[nvoice].FMAmpEnvelope != NULL) - FMnewamplitude[nvoice] *= - NoteVoicePar[nvoice].FMAmpEnvelope->envout_dB(); - } - } - } - time += synth->buffersize_f / synth->samplerate_f; -} - - -/* - * Fadein in a way that removes clicks but keep sound "punchy" - */ -inline void ADnote::fadein(float *smps) const -{ - int zerocrossings = 0; - for(int i = 1; i < synth->buffersize; ++i) - if((smps[i - 1] < 0.0f) && (smps[i] > 0.0f)) - zerocrossings++; //this is only the possitive crossings - - float tmp = (synth->buffersize_f - 1.0f) / (zerocrossings + 1) / 3.0f; - if(tmp < 8.0f) - tmp = 8.0f; - - int n; - F2I(tmp, n); //how many samples is the fade-in - if(n > synth->buffersize) - n = synth->buffersize; - for(int i = 0; i < n; ++i) { //fade-in - float tmp = 0.5f - cosf((float)i / (float) n * PI) * 0.5f; - smps[i] *= tmp; - } -} - -/* - * Computes the Oscillator (Without Modulation) - LinearInterpolation - */ - -/* As the code here is a bit odd due to optimization, here is what happens - * First the current possition and frequency are retrieved from the running - * state. These are broken up into high and low portions to indicate how many - * samples are skipped in one step and how many fractional samples are skipped. - * Outside of this method the fractional samples are just handled with floating - * point code, but that's a bit slower than it needs to be. In this code the low - * portions are known to exist between 0.0 and 1.0 and it is known that they are - * stored in single precision floating point IEEE numbers. This implies that - * a maximum of 24 bits are significant. The below code does your standard - * linear interpolation that you'll see throughout this codebase, but by - * sticking to integers for tracking the overflow of the low portion, around 15% - * of the execution time was shaved off in the ADnote test. - */ -inline void ADnote::ComputeVoiceOscillator_LinearInterpolation(int nvoice) -{ - for(int k = 0; k < unison_size[nvoice]; ++k) { - int poshi = oscposhi[nvoice][k]; - int poslo = oscposlo[nvoice][k] * (1<<24); - int freqhi = oscfreqhi[nvoice][k]; - int freqlo = oscfreqlo[nvoice][k] * (1<<24); - float *smps = NoteVoicePar[nvoice].OscilSmp; - float *tw = tmpwave_unison[k]; - assert(oscfreqlo[nvoice][k] < 1.0f); - for(int i = 0; i < synth->buffersize; ++i) { - tw[i] = (smps[poshi] * ((1<<24) - poslo) + smps[poshi + 1] * poslo)/(1.0f*(1<<24)); - poslo += freqlo; - poshi += freqhi + (poslo>>24); - poslo &= 0xffffff; - poshi &= synth->oscilsize - 1; - } - oscposhi[nvoice][k] = poshi; - oscposlo[nvoice][k] = poslo/(1.0f*(1<<24)); - } -} - - - -/* - * Computes the Oscillator (Without Modulation) - CubicInterpolation - * - The differences from the Linear are to little to deserve to be used. This is because I am using a large synth->oscilsize (>512) -inline void ADnote::ComputeVoiceOscillator_CubicInterpolation(int nvoice){ - int i,poshi; - float poslo; - - poshi=oscposhi[nvoice]; - poslo=oscposlo[nvoice]; - float *smps=NoteVoicePar[nvoice].OscilSmp; - float xm1,x0,x1,x2,a,b,c; - for (i=0;ibuffersize;i++){ - xm1=smps[poshi]; - x0=smps[poshi+1]; - x1=smps[poshi+2]; - x2=smps[poshi+3]; - a=(3.0f * (x0-x1) - xm1 + x2) / 2.0f; - b = 2.0f*x1 + xm1 - (5.0f*x0 + x2) / 2.0f; - c = (x1 - xm1) / 2.0f; - tmpwave[i]=(((a * poslo) + b) * poslo + c) * poslo + x0; - printf("a\n"); - //tmpwave[i]=smps[poshi]*(1.0f-poslo)+smps[poshi+1]*poslo; - poslo+=oscfreqlo[nvoice]; - if (poslo>=1.0f) { - poslo-=1.0f; - poshi++; - }; - poshi+=oscfreqhi[nvoice]; - poshi&=synth->oscilsize-1; - }; - oscposhi[nvoice]=poshi; - oscposlo[nvoice]=poslo; -}; -*/ -/* - * Computes the Oscillator (Morphing) - */ -inline void ADnote::ComputeVoiceOscillatorMorph(int nvoice) -{ - int i; - float amp; - ComputeVoiceOscillator_LinearInterpolation(nvoice); - if(FMnewamplitude[nvoice] > 1.0f) - FMnewamplitude[nvoice] = 1.0f; - if(FMoldamplitude[nvoice] > 1.0f) - FMoldamplitude[nvoice] = 1.0f; - - if(NoteVoicePar[nvoice].FMVoice >= 0) { - //if I use VoiceOut[] as modullator - int FMVoice = NoteVoicePar[nvoice].FMVoice; - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(i = 0; i < synth->buffersize; ++i) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - synth->buffersize); - tw[i] = tw[i] - * (1.0f - - amp) + amp * NoteVoicePar[FMVoice].VoiceOut[i]; - } - } - } - else - for(int k = 0; k < unison_size[nvoice]; ++k) { - int poshiFM = oscposhiFM[nvoice][k]; - float posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - float freqloFM = oscfreqloFM[nvoice][k]; - float *tw = tmpwave_unison[k]; - - for(i = 0; i < synth->buffersize; ++i) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - synth->buffersize); - tw[i] = tw[i] * (1.0f - amp) + amp - * (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1 - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM + 1] * posloFM); - posloFM += freqloFM; - if(posloFM >= 1.0f) { - posloFM -= 1.0f; - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= synth->oscilsize - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } -} - -/* - * Computes the Oscillator (Ring Modulation) - */ -inline void ADnote::ComputeVoiceOscillatorRingModulation(int nvoice) -{ - int i; - float amp; - ComputeVoiceOscillator_LinearInterpolation(nvoice); - if(FMnewamplitude[nvoice] > 1.0f) - FMnewamplitude[nvoice] = 1.0f; - if(FMoldamplitude[nvoice] > 1.0f) - FMoldamplitude[nvoice] = 1.0f; - if(NoteVoicePar[nvoice].FMVoice >= 0) - // if I use VoiceOut[] as modullator - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(i = 0; i < synth->buffersize; ++i) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - synth->buffersize); - int FMVoice = NoteVoicePar[nvoice].FMVoice; - tw[i] *= (1.0f - amp) + amp * NoteVoicePar[FMVoice].VoiceOut[i]; - } - } - else - for(int k = 0; k < unison_size[nvoice]; ++k) { - int poshiFM = oscposhiFM[nvoice][k]; - float posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - float freqloFM = oscfreqloFM[nvoice][k]; - float *tw = tmpwave_unison[k]; - - for(i = 0; i < synth->buffersize; ++i) { - amp = INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - synth->buffersize); - tw[i] *= (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1.0f - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM - + 1] * posloFM) * amp - + (1.0f - amp); - posloFM += freqloFM; - if(posloFM >= 1.0f) { - posloFM -= 1.0f; - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= synth->oscilsize - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } -} - - - -/* - * Computes the Oscillator (Phase Modulation or Frequency Modulation) - */ -inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, - int FMmode) -{ - int carposhi = 0; - int i, FMmodfreqhi = 0; - float FMmodfreqlo = 0, carposlo = 0; - - if(NoteVoicePar[nvoice].FMVoice >= 0) - //if I use VoiceOut[] as modulator - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - memcpy(tw, NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut, - synth->bufferbytes); - } - else - //Compute the modulator and store it in tmpwave_unison[][] - for(int k = 0; k < unison_size[nvoice]; ++k) { - int poshiFM = oscposhiFM[nvoice][k]; - float posloFM = oscposloFM[nvoice][k]; - int freqhiFM = oscfreqhiFM[nvoice][k]; - float freqloFM = oscfreqloFM[nvoice][k]; - float *tw = tmpwave_unison[k]; - - for(i = 0; i < synth->buffersize; ++i) { - tw[i] = - (NoteVoicePar[nvoice].FMSmp[poshiFM] * (1.0f - posloFM) - + NoteVoicePar[nvoice].FMSmp[poshiFM + 1] * posloFM); - posloFM += freqloFM; - if(posloFM >= 1.0f) { - posloFM = fmod(posloFM, 1.0f); - poshiFM++; - } - poshiFM += freqhiFM; - poshiFM &= synth->oscilsize - 1; - } - oscposhiFM[nvoice][k] = poshiFM; - oscposloFM[nvoice][k] = posloFM; - } - // Amplitude interpolation - if(ABOVE_AMPLITUDE_THRESHOLD(FMoldamplitude[nvoice], - FMnewamplitude[nvoice])) - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(i = 0; i < synth->buffersize; ++i) - tw[i] *= INTERPOLATE_AMPLITUDE(FMoldamplitude[nvoice], - FMnewamplitude[nvoice], - i, - synth->buffersize); - } - else - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(i = 0; i < synth->buffersize; ++i) - tw[i] *= FMnewamplitude[nvoice]; - } - - - //normalize: makes all sample-rates, oscil_sizes to produce same sound - if(FMmode != 0) { //Frequency modulation - float normalize = synth->oscilsize_f / 262144.0f * 44100.0f - / synth->samplerate_f; - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - float fmold = FMoldsmp[nvoice][k]; - for(i = 0; i < synth->buffersize; ++i) { - fmold = fmod(fmold + tw[i] * normalize, synth->oscilsize); - tw[i] = fmold; - } - FMoldsmp[nvoice][k] = fmold; - } - } - else { //Phase modulation - float normalize = synth->oscilsize_f / 262144.0f; - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(i = 0; i < synth->buffersize; ++i) - tw[i] *= normalize; - } - } - - //do the modulation - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - int poshi = oscposhi[nvoice][k]; - float poslo = oscposlo[nvoice][k]; - int freqhi = oscfreqhi[nvoice][k]; - float freqlo = oscfreqlo[nvoice][k]; - - for(i = 0; i < synth->buffersize; ++i) { - F2I(tw[i], FMmodfreqhi); - FMmodfreqlo = fmod(tw[i] + 0.0000000001f, 1.0f); - if(FMmodfreqhi < 0) - FMmodfreqlo++; - - //carrier - carposhi = poshi + FMmodfreqhi; - carposlo = poslo + FMmodfreqlo; - - if(carposlo >= 1.0f) { - carposhi++; - carposlo = fmod(carposlo, 1.0f); - } - carposhi &= (synth->oscilsize - 1); - - tw[i] = NoteVoicePar[nvoice].OscilSmp[carposhi] - * (1.0f - carposlo) - + NoteVoicePar[nvoice].OscilSmp[carposhi - + 1] * carposlo; - - poslo += freqlo; - if(poslo >= 1.0f) { - poslo = fmod(poslo, 1.0f); - poshi++; - } - - poshi += freqhi; - poshi &= synth->oscilsize - 1; - } - oscposhi[nvoice][k] = poshi; - oscposlo[nvoice][k] = poslo; - } -} - - -/*Calculeaza Oscilatorul cu PITCH MODULATION*/ -inline void ADnote::ComputeVoiceOscillatorPitchModulation(int /*nvoice*/) -{ -//TODO -} - -/* - * Computes the Noise - */ -inline void ADnote::ComputeVoiceNoise(int nvoice) -{ - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - for(int i = 0; i < synth->buffersize; ++i) - tw[i] = RND * 2.0f - 1.0f; - } -} - - - -/* - * Compute the ADnote samples - * Returns 0 if the note is finished - */ -int ADnote::noteout(float *outl, float *outr) -{ - memcpy(outl, denormalkillbuf, synth->bufferbytes); - memcpy(outr, denormalkillbuf, synth->bufferbytes); - - if(NoteEnabled == OFF) - return 0; - - memset(bypassl, 0, synth->bufferbytes); - memset(bypassr, 0, synth->bufferbytes); - computecurrentparameters(); - - for(unsigned nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - if((NoteVoicePar[nvoice].Enabled != ON) - || (NoteVoicePar[nvoice].DelayTicks > 0)) - continue; - if(NoteVoicePar[nvoice].noisetype == 0) //voice mode=sound - switch(NoteVoicePar[nvoice].FMEnabled) { - case MORPH: - ComputeVoiceOscillatorMorph(nvoice); - break; - case RING_MOD: - ComputeVoiceOscillatorRingModulation(nvoice); - break; - case PHASE_MOD: - ComputeVoiceOscillatorFrequencyModulation(nvoice, 0); - break; - case FREQ_MOD: - ComputeVoiceOscillatorFrequencyModulation(nvoice, 1); - break; - //case PITCH_MOD:ComputeVoiceOscillatorPitchModulation(nvoice);break; - default: - ComputeVoiceOscillator_LinearInterpolation(nvoice); - //if (config.cfg.Interpolation) ComputeVoiceOscillator_CubicInterpolation(nvoice); - } - else - ComputeVoiceNoise(nvoice); - // Voice Processing - - - //mix subvoices into voice - memset(tmpwavel, 0, synth->bufferbytes); - if(stereo) - memset(tmpwaver, 0, synth->bufferbytes); - for(int k = 0; k < unison_size[nvoice]; ++k) { - float *tw = tmpwave_unison[k]; - if(stereo) { - float stereo_pos = 0; - if(unison_size[nvoice] > 1) - stereo_pos = k - / (float)(unison_size[nvoice] - - 1) * 2.0f - 1.0f; - float stereo_spread = unison_stereo_spread[nvoice] * 2.0f; //between 0 and 2.0f - if(stereo_spread > 1.0f) { - float stereo_pos_1 = (stereo_pos >= 0.0f) ? 1.0f : -1.0f; - stereo_pos = - (2.0f - - stereo_spread) * stereo_pos - + (stereo_spread - 1.0f) * stereo_pos_1; - } - else - stereo_pos *= stereo_spread; - - if(unison_size[nvoice] == 1) - stereo_pos = 0.0f; - float panning = (stereo_pos + 1.0f) * 0.5f; - - - float lvol = (1.0f - panning) * 2.0f; - if(lvol > 1.0f) - lvol = 1.0f; - - float rvol = panning * 2.0f; - if(rvol > 1.0f) - rvol = 1.0f; - - if(unison_invert_phase[nvoice][k]) { - lvol = -lvol; - rvol = -rvol; - } - - for(int i = 0; i < synth->buffersize; ++i) - tmpwavel[i] += tw[i] * lvol; - for(int i = 0; i < synth->buffersize; ++i) - tmpwaver[i] += tw[i] * rvol; - } - else - for(int i = 0; i < synth->buffersize; ++i) - tmpwavel[i] += tw[i]; - } - - - float unison_amplitude = 1.0f / sqrt(unison_size[nvoice]); //reduce the amplitude for large unison sizes - // Amplitude - float oldam = oldamplitude[nvoice] * unison_amplitude; - float newam = newamplitude[nvoice] * unison_amplitude; - - if(ABOVE_AMPLITUDE_THRESHOLD(oldam, newam)) { - int rest = synth->buffersize; - //test if the amplitude if raising and the difference is high - if((newam > oldam) && ((newam - oldam) > 0.25f)) { - rest = 10; - if(rest > synth->buffersize) - rest = synth->buffersize; - for(int i = 0; i < synth->buffersize - rest; ++i) - tmpwavel[i] *= oldam; - if(stereo) - for(int i = 0; i < synth->buffersize - rest; ++i) - tmpwaver[i] *= oldam; - } - // Amplitude interpolation - for(int i = 0; i < rest; ++i) { - float amp = INTERPOLATE_AMPLITUDE(oldam, newam, i, rest); - tmpwavel[i + (synth->buffersize - rest)] *= amp; - if(stereo) - tmpwaver[i + (synth->buffersize - rest)] *= amp; - } - } - else { - for(int i = 0; i < synth->buffersize; ++i) - tmpwavel[i] *= newam; - if(stereo) - for(int i = 0; i < synth->buffersize; ++i) - tmpwaver[i] *= newam; - } - - // Fade in - if(firsttick[nvoice] != 0) { - fadein(&tmpwavel[0]); - if(stereo) - fadein(&tmpwaver[0]); - firsttick[nvoice] = 0; - } - - - // Filter - if(NoteVoicePar[nvoice].VoiceFilterL != NULL) - NoteVoicePar[nvoice].VoiceFilterL->filterout(&tmpwavel[0]); - if((stereo) && (NoteVoicePar[nvoice].VoiceFilterR != NULL)) - NoteVoicePar[nvoice].VoiceFilterR->filterout(&tmpwaver[0]); - - //check if the amplitude envelope is finished, if yes, the voice will be fadeout - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - if(NoteVoicePar[nvoice].AmpEnvelope->finished() != 0) { - for(int i = 0; i < synth->buffersize; ++i) - tmpwavel[i] *= 1.0f - (float)i / synth->buffersize_f; - if(stereo) - for(int i = 0; i < synth->buffersize; ++i) - tmpwaver[i] *= 1.0f - (float)i / synth->buffersize_f; - } - //the voice is killed later - - - // Put the ADnote samples in VoiceOut (without appling Global volume, because I wish to use this voice as a modullator) - if(NoteVoicePar[nvoice].VoiceOut != NULL) { - if(stereo) - for(int i = 0; i < synth->buffersize; ++i) - NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i] - + tmpwaver[i]; - else //mono - for(int i = 0; i < synth->buffersize; ++i) - NoteVoicePar[nvoice].VoiceOut[i] = tmpwavel[i]; - } - - - // Add the voice that do not bypass the filter to out - if(NoteVoicePar[nvoice].filterbypass == 0) { //no bypass - if(stereo) - for(int i = 0; i < synth->buffersize; ++i) { //stereo - outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume - * NoteVoicePar[nvoice].Panning * 2.0f; - outr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume - * (1.0f - NoteVoicePar[nvoice].Panning) * 2.0f; - } - else - for(int i = 0; i < synth->buffersize; ++i) //mono - outl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; - } - else { //bypass the filter - if(stereo) - for(int i = 0; i < synth->buffersize; ++i) { //stereo - bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume - * NoteVoicePar[nvoice].Panning * 2.0f; - bypassr[i] += tmpwaver[i] * NoteVoicePar[nvoice].Volume - * (1.0f - - NoteVoicePar[nvoice].Panning) * 2.0f; - } - else - for(int i = 0; i < synth->buffersize; ++i) //mono - bypassl[i] += tmpwavel[i] * NoteVoicePar[nvoice].Volume; - } - // chech if there is necesary to proces the voice longer (if the Amplitude envelope isn't finished) - if(NoteVoicePar[nvoice].AmpEnvelope != NULL) - if(NoteVoicePar[nvoice].AmpEnvelope->finished() != 0) - KillVoice(nvoice); - } - - - //Processing Global parameters - NoteGlobalPar.GlobalFilterL->filterout(&outl[0]); - - if(stereo == 0) { //set the right channel=left channel - memcpy(outr, outl, synth->bufferbytes); - memcpy(bypassr, bypassl, synth->bufferbytes); - } - else - NoteGlobalPar.GlobalFilterR->filterout(&outr[0]); - - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] += bypassl[i]; - outr[i] += bypassr[i]; - } - - if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) - // Amplitude Interpolation - for(int i = 0; i < synth->buffersize; ++i) { - float tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, - globalnewamplitude, - i, - synth->buffersize); - outl[i] *= tmpvol * NoteGlobalPar.Panning; - outr[i] *= tmpvol * (1.0f - NoteGlobalPar.Panning); - } - else - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; - outr[i] *= globalnewamplitude * (1.0f - NoteGlobalPar.Panning); - } - - //Apply the punch - if(NoteGlobalPar.Punch.Enabled != 0) - for(int i = 0; i < synth->buffersize; ++i) { - float punchamp = NoteGlobalPar.Punch.initialvalue - * NoteGlobalPar.Punch.t + 1.0f; - outl[i] *= punchamp; - outr[i] *= punchamp; - NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; - if(NoteGlobalPar.Punch.t < 0.0f) { - NoteGlobalPar.Punch.Enabled = 0; - break; - } - } - - - // Apply legato-specific sound signal modifications - legato.apply(*this, outl, outr); - - - // Check if the global amplitude is finished. - // If it does, disable the note - if(NoteGlobalPar.AmpEnvelope->finished()) { - for(int i = 0; i < synth->buffersize; ++i) { //fade-out - float tmp = 1.0f - (float)i / synth->buffersize_f; - outl[i] *= tmp; - outr[i] *= tmp; - } - KillNote(); - } - return 1; -} - - -/* - * Relase the key (NoteOff) - */ -void ADnote::relasekey() -{ - for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) - NoteVoicePar[nvoice].releasekey(); - NoteGlobalPar.FreqEnvelope->relasekey(); - NoteGlobalPar.FilterEnvelope->relasekey(); - NoteGlobalPar.AmpEnvelope->relasekey(); -} - -/* - * Check if the note is finished - */ -int ADnote::finished() const -{ - if(NoteEnabled == ON) - return 0; - else - return 1; -} - -void ADnote::Voice::releasekey() -{ - if(!Enabled) - return; - if(AmpEnvelope) - AmpEnvelope->relasekey(); - if(FreqEnvelope) - FreqEnvelope->relasekey(); - if(FilterEnvelope) - FilterEnvelope->relasekey(); - if(FMFreqEnvelope) - FMFreqEnvelope->relasekey(); - if(FMAmpEnvelope) - FMAmpEnvelope->relasekey(); -} - -template -static inline void nullify(T &t) {delete t; t = NULL; } -template -static inline void arrayNullify(T &t) {delete [] t; t = NULL; } - -void ADnote::Voice::kill() -{ - arrayNullify(OscilSmp); - nullify(FreqEnvelope); - nullify(FreqLfo); - nullify(AmpEnvelope); - nullify(AmpLfo); - nullify(VoiceFilterL); - nullify(VoiceFilterR); - nullify(FilterEnvelope); - nullify(FilterLfo); - nullify(FMFreqEnvelope); - nullify(FMAmpEnvelope); - - if((FMEnabled != NONE) && (FMVoice < 0)) { - delete[] FMSmp; - FMSmp = NULL; - } - - if(VoiceOut) - memset(VoiceOut, 0, synth->bufferbytes); - //do not delete, yet: perhaps is used by another voice - - Enabled = OFF; -} - -void ADnote::Global::kill() -{ - nullify(FreqEnvelope); - nullify(FreqLfo); - nullify(AmpEnvelope); - nullify(AmpLfo); - nullify(GlobalFilterL); - nullify(GlobalFilterR); - nullify(FilterEnvelope); - nullify(FilterLfo); -} - -void ADnote::Global::initparameters(const ADnoteGlobalParam ¶m, - float basefreq, float velocity, - bool stereo) -{ - FreqEnvelope = new Envelope(param.FreqEnvelope, basefreq); - FreqLfo = new LFO(param.FreqLfo, basefreq); - - AmpEnvelope = new Envelope(param.AmpEnvelope, basefreq); - AmpLfo = new LFO(param.AmpLfo, basefreq); - - Volume = 4.0f * powf(0.1f, 3.0f * (1.0f - param.PVolume / 96.0f)) //-60 dB .. 0 dB - * VelF(velocity, param.PAmpVelocityScaleFunction); //sensing - - GlobalFilterL = Filter::generate(param.GlobalFilter); - if(stereo) - GlobalFilterR = Filter::generate(param.GlobalFilter); - else - GlobalFilterR = NULL; - - FilterEnvelope = new Envelope(param.FilterEnvelope, basefreq); - FilterLfo = new LFO(param.FilterLfo, basefreq); - FilterQ = param.GlobalFilter->getq(); - FilterFreqTracking = param.GlobalFilter->getfreqtracking(basefreq); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.h deleted file mode 100644 index 53420ee0e2e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/ADnote.h +++ /dev/null @@ -1,325 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ADnote.h - The "additive" synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef AD_NOTE_H -#define AD_NOTE_H - -#include "SynthNote.h" -#include "Envelope.h" -#include "LFO.h" -#include "../Params/ADnoteParameters.h" -#include "../Params/Controller.h" - -//Globals - -/**FM amplitude tune*/ -#define FM_AMP_MULTIPLIER 14.71280603f - -#define OSCIL_SMP_EXTRA_SAMPLES 5 - -/**The "additive" synthesizer*/ -class ADnote:public SynthNote -{ - public: - /**Constructor. - * @param pars Note Parameters - * @param ctl_ Pointer to system Controller - * @param freq Base frequency for note - * @param velocity Velocity of note - * @param portamento_ 1 if the note has portamento - * @param midinote_ The midi number of the note - * @param besilent Start silent note if true*/ - ADnote(ADnoteParameters *pars, Controller *ctl_, float freq, - float velocity, int portamento_, int midinote_, - bool besilent); - /**Destructor*/ - ~ADnote(); - - /**Alters the playing note for legato effect*/ - void legatonote(float freq, float velocity, int portamento_, - int midinote_, bool externcall); - - int noteout(float *outl, float *outr); - void relasekey(); - int finished() const; - private: - - /**Changes the frequency of an oscillator. - * @param nvoice voice to run computations on - * @param in_freq new frequency*/ - void setfreq(int nvoice, float in_freq); - /**Set the frequency of the modulator oscillator*/ - void setfreqFM(int nvoice, float in_freq); - /**Computes relative frequency for unison and unison's vibratto. - * Note: Must be called before setfreq* functions.*/ - void compute_unison_freq_rap(int nvoice); - /**Compute parameters for next tick*/ - void computecurrentparameters(); - /**Initializes All Parameters*/ - void initparameters(); - /**Deallocate/Cleanup given voice*/ - void KillVoice(int nvoice); - /**Deallocate Note resources and voice resources*/ - void KillNote(); - /**Get the Voice's base frequency*/ - inline float getvoicebasefreq(int nvoice) const; - /**Get modulator's base frequency*/ - inline float getFMvoicebasefreq(int nvoice) const; - /**Compute the Oscillator's samples. - * Affects tmpwave_unison and updates oscposhi/oscposlo*/ - inline void ComputeVoiceOscillator_LinearInterpolation(int nvoice); - /**Compute the Oscillator's samples. - * Affects tmpwave_unison and updates oscposhi/oscposlo - * @todo remove this declaration if it is commented out*/ - inline void ComputeVoiceOscillator_CubicInterpolation(int nvoice); - /**Computes the Oscillator samples with morphing. - * updates tmpwave_unison*/ - inline void ComputeVoiceOscillatorMorph(int nvoice); - /**Computes the Ring Modulated Oscillator.*/ - inline void ComputeVoiceOscillatorRingModulation(int nvoice); - /**Computes the Frequency Modulated Oscillator. - * @param FMmode modulation type 0=Phase 1=Frequency*/ - inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice, - int FMmode); - // inline void ComputeVoiceOscillatorFrequencyModulation(int nvoice); - /**TODO*/ - inline void ComputeVoiceOscillatorPitchModulation(int nvoice); - - /**Generate Noise Samples for Voice*/ - inline void ComputeVoiceNoise(int nvoice); - - /**Fadein in a way that removes clicks but keep sound "punchy"*/ - inline void fadein(float *smps) const; - - - //GLOBALS - ADnoteParameters *partparams; - unsigned char stereo; //if the note is stereo (allows note Panning) - int midinote; - float velocity, basefreq; - - ONOFFTYPE NoteEnabled; - Controller *ctl; - - /*****************************************************************/ - /* GLOBAL PARAMETERS */ - /*****************************************************************/ - - struct Global { - void kill(); - void initparameters(const ADnoteGlobalParam ¶m, - float basefreq, float velocity, - bool stereo); - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - float Detune; //cents - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - float Volume; // [ 0 .. 1 ] - - float Panning; // [ 0 .. 1 ] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - struct { - int Enabled; - float initialvalue, dt, t; - } Punch; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - class Filter * GlobalFilterL, *GlobalFilterR; - - float FilterCenterPitch; //octaves - float FilterQ; - float FilterFreqTracking; - - Envelope *FilterEnvelope; - - LFO *FilterLfo; - } NoteGlobalPar; - - - - /***********************************************************/ - /* VOICE PARAMETERS */ - /***********************************************************/ - struct Voice { - void releasekey(); - void kill(); - /* If the voice is enabled */ - ONOFFTYPE Enabled; - - /* Voice Type (sound/noise)*/ - int noisetype; - - /* Filter Bypass */ - int filterbypass; - - /* Delay (ticks) */ - int DelayTicks; - - /* Waveform of the Voice */ - float *OscilSmp; - - /************************************ - * FREQUENCY PARAMETERS * - ************************************/ - int fixedfreq; //if the frequency is fixed to 440 Hz - int fixedfreqET; //if the "fixed" frequency varies according to the note (ET) - - // cents = basefreq*VoiceDetune - float Detune, FineDetune; - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - - /*************************** - * AMPLITUDE PARAMETERS * - ***************************/ - - /* Panning 0.0f=left, 0.5f - center, 1.0f = right */ - float Panning; - float Volume; // [-1.0f .. 1.0f] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - /************************* - * FILTER PARAMETERS * - *************************/ - - class Filter * VoiceFilterL; - class Filter * VoiceFilterR; - - float FilterCenterPitch; /* Filter center Pitch*/ - float FilterFreqTracking; - - Envelope *FilterEnvelope; - LFO *FilterLfo; - - - /**************************** - * MODULLATOR PARAMETERS * - ****************************/ - - FMTYPE FMEnabled; - - int FMVoice; - - // Voice Output used by other voices if use this as modullator - float *VoiceOut; - - /* Wave of the Voice */ - float *FMSmp; - - float FMVolume; - float FMDetune; //in cents - - Envelope *FMFreqEnvelope; - Envelope *FMAmpEnvelope; - } NoteVoicePar[NUM_VOICES]; - - - /********************************************************/ - /* INTERNAL VALUES OF THE NOTE AND OF THE VOICES */ - /********************************************************/ - - //time from the start of the note - float time; - - //the size of unison for a single voice - int unison_size[NUM_VOICES]; - - //the stereo spread of the unison subvoices (0.0f=mono,1.0f=max) - float unison_stereo_spread[NUM_VOICES]; - - //fractional part (skip) - float *oscposlo[NUM_VOICES], *oscfreqlo[NUM_VOICES]; - - //integer part (skip) - int *oscposhi[NUM_VOICES], *oscfreqhi[NUM_VOICES]; - - //fractional part (skip) of the Modullator - float *oscposloFM[NUM_VOICES], *oscfreqloFM[NUM_VOICES]; - - //the unison base_value - float *unison_base_freq_rap[NUM_VOICES]; - - //how the unison subvoice's frequency is changed (1.0f for no change) - float *unison_freq_rap[NUM_VOICES]; - - //which subvoice has phase inverted - bool *unison_invert_phase[NUM_VOICES]; - - //unison vibratto - struct { - float amplitude; //amplitude which be added to unison_freq_rap - float *step; //value which increments the position - float *position; //between -1.0f and 1.0f - } unison_vibratto[NUM_VOICES]; - - - //integer part (skip) of the Modullator - unsigned int *oscposhiFM[NUM_VOICES], *oscfreqhiFM[NUM_VOICES]; - - //used to compute and interpolate the amplitudes of voices and modullators - float oldamplitude[NUM_VOICES], - newamplitude[NUM_VOICES], - FMoldamplitude[NUM_VOICES], - FMnewamplitude[NUM_VOICES]; - - //used by Frequency Modulation (for integration) - float *FMoldsmp[NUM_VOICES]; - - //temporary buffer - float *tmpwavel; - float *tmpwaver; - int max_unison; - float **tmpwave_unison; - - //Filter bypass samples - float *bypassl, *bypassr; - - //interpolate the amplitudes - float globaloldamplitude, globalnewamplitude; - - //1 - if it is the fitst tick (used to fade in the sound) - char firsttick[NUM_VOICES]; - - //1 if the note has portamento - int portamento; - - //how the fine detunes are made bigger or smaller - float bandwidthDetuneMultiplier; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/CMakeLists.txt deleted file mode 100644 index ce45fa54c3c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(zynaddsubfx_synth_SRCS - Synth/SynthNote.cpp - Synth/ADnote.cpp - Synth/Envelope.cpp - Synth/LFO.cpp - Synth/OscilGen.cpp - Synth/PADnote.cpp - Synth/Resonance.cpp - Synth/SUBnote.cpp - PARENT_SCOPE -) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.cpp deleted file mode 100644 index 41bb8047388..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Envelope.cpp - Envelope 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include "Envelope.h" -#include "../Params/EnvelopeParams.h" - -Envelope::Envelope(EnvelopeParams *envpars, float basefreq) -{ - int i; - envpoints = envpars->Penvpoints; - if(envpoints > MAX_ENVELOPE_POINTS) - envpoints = MAX_ENVELOPE_POINTS; - envsustain = (envpars->Penvsustain == 0) ? -1 : envpars->Penvsustain; - forcedrelase = envpars->Pforcedrelease; - envstretch = powf(440.0f / basefreq, envpars->Penvstretch / 64.0f); - linearenvelope = envpars->Plinearenvelope; - - if(envpars->Pfreemode == 0) - envpars->converttofree(); - - float bufferdt = synth->buffersize_f / synth->samplerate_f; - - int mode = envpars->Envmode; - - //for amplitude envelopes - if((mode == 1) && (linearenvelope == 0)) - mode = 2; //change to log envelope - if((mode == 2) && (linearenvelope != 0)) - mode = 1; //change to linear - - for(i = 0; i < MAX_ENVELOPE_POINTS; ++i) { - float tmp = envpars->getdt(i) / 1000.0f * envstretch; - if(tmp > bufferdt) - envdt[i] = bufferdt / tmp; - else - envdt[i] = 2.0f; //any value larger than 1 - - switch(mode) { - case 2: - envval[i] = (1.0f - envpars->Penvval[i] / 127.0f) * -40; - break; - case 3: - envval[i] = - (powf(2, 6.0f - * fabs(envpars->Penvval[i] - - 64.0f) / 64.0f) - 1.0f) * 100.0f; - if(envpars->Penvval[i] < 64) - envval[i] = -envval[i]; - break; - case 4: - envval[i] = (envpars->Penvval[i] - 64.0f) / 64.0f * 6.0f; //6 octaves (filtru) - break; - case 5: - envval[i] = (envpars->Penvval[i] - 64.0f) / 64.0f * 10; - break; - default: - envval[i] = envpars->Penvval[i] / 127.0f; - } - } - - envdt[0] = 1.0f; - - currentpoint = 1; //the envelope starts from 1 - keyreleased = false; - t = 0.0f; - envfinish = false; - inct = envdt[1]; - envoutval = 0.0f; -} - -Envelope::~Envelope() -{} - - -/* - * Relase the key (note envelope) - */ -void Envelope::relasekey() -{ - if(keyreleased) - return; - keyreleased = true; - if(forcedrelase != 0) - t = 0.0f; -} - -/* - * Envelope Output - */ -float Envelope::envout() -{ - float out; - - if(envfinish) { //if the envelope is finished - envoutval = envval[envpoints - 1]; - return envoutval; - } - if((currentpoint == envsustain + 1) && !keyreleased) { //if it is sustaining now - envoutval = envval[envsustain]; - return envoutval; - } - - if(keyreleased && (forcedrelase != 0)) { //do the forced release - int tmp = (envsustain < 0) ? (envpoints - 1) : (envsustain + 1); //if there is no sustain point, use the last point for release - - if(envdt[tmp] < 0.00000001f) - out = envval[tmp]; - else - out = envoutval + (envval[tmp] - envoutval) * t; - t += envdt[tmp] * envstretch; - - if(t >= 1.0f) { - currentpoint = envsustain + 2; - forcedrelase = 0; - t = 0.0f; - inct = envdt[currentpoint]; - if((currentpoint >= envpoints) || (envsustain < 0)) - envfinish = true; - } - return out; - } - if(inct >= 1.0f) - out = envval[currentpoint]; - else - out = envval[currentpoint - 1] - + (envval[currentpoint] - envval[currentpoint - 1]) * t; - - t += inct; - if(t >= 1.0f) { - if(currentpoint >= envpoints - 1) - envfinish = true; - else - currentpoint++; - t = 0.0f; - inct = envdt[currentpoint]; - } - - envoutval = out; - return out; -} - -inline float Envelope::env_dB2rap(float db) { - return (powf(10.0f, db / 20.0f) - 0.01)/.99f; -} - -inline float Envelope::env_rap2dB(float rap) { - return 20.0f * log10f(rap * 0.99f + 0.01); -} - -/* - * Envelope Output (dB) - */ -float Envelope::envout_dB() -{ - float out; - if(linearenvelope != 0) - return envout(); - - if((currentpoint == 1) && (!keyreleased || (forcedrelase == 0))) { //first point is always lineary interpolated - float v1 = env_dB2rap(envval[0]); - float v2 = env_dB2rap(envval[1]); - out = v1 + (v2 - v1) * t; - - t += inct; - if(t >= 1.0f) { - t = 0.0f; - inct = envdt[2]; - currentpoint++; - out = v2; - } - - if(out > 0.001f) - envoutval = env_rap2dB(out); - else - envoutval = MIN_ENVELOPE_DB; - } - else - out = env_dB2rap(envout()); - - return out; -} - -bool Envelope::finished() const -{ - return envfinish; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.h deleted file mode 100644 index 8c6b082a7a1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Envelope.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Envelope.h - Envelope 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef ENVELOPE_H -#define ENVELOPE_H - -#include "../globals.h" -#include "../Params/EnvelopeParams.h" - -/**Implementation of a general Envelope*/ -class Envelope -{ - public: - - /**Constructor*/ - Envelope(class EnvelopeParams *envpars, float basefreq); - /**Destructor*/ - ~Envelope(); - void relasekey(); - float envout(); - float envout_dB(); - /**Determines the status of the Envelope - * @return returns 1 if the envelope is finished*/ - bool finished() const; - private: - float env_rap2dB(float rap); - float env_dB2rap(float db); - int envpoints; - int envsustain; //"-1" means disabled - float envdt[MAX_ENVELOPE_POINTS]; //millisecons - float envval[MAX_ENVELOPE_POINTS]; // [0.0f .. 1.0f] - float envstretch; - int linearenvelope; - - int currentpoint; //current envelope point (starts from 1) - int forcedrelase; - bool keyreleased; //if the key was released - bool envfinish; - float t; // the time from the last point - float inct; // the time increment - float envoutval; //used to do the forced release -}; - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.cpp deleted file mode 100644 index af9d10d7711..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFO.cpp - LFO 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "LFO.h" -#include "../Misc/Util.h" - -#include -#include -#include - -LFO::LFO(LFOParams *lfopars, float basefreq) -{ - if(lfopars->Pstretch == 0) - lfopars->Pstretch = 1; - float lfostretch = powf(basefreq / 440.0f, - (lfopars->Pstretch - 64.0f) / 63.0f); //max 2x/octave - - float lfofreq = - (powf(2, lfopars->Pfreq * 10.0f) - 1.0f) / 12.0f * lfostretch; - incx = fabs(lfofreq) * synth->buffersize_f / synth->samplerate_f; - - if(lfopars->Pcontinous == 0) { - if(lfopars->Pstartphase == 0) - x = RND; - else - x = fmod((lfopars->Pstartphase - 64.0f) / 127.0f + 1.0f, 1.0f); - } - else { - float tmp = fmod(lfopars->time * incx, 1.0f); - x = fmod((lfopars->Pstartphase - 64.0f) / 127.0f + 1.0f + tmp, 1.0f); - } - - //Limit the Frequency(or else...) - if(incx > 0.49999999f) - incx = 0.499999999f; - - - lfornd = lfopars->Prandomness / 127.0f; - if(lfornd < 0.0f) - lfornd = 0.0f; - else - if(lfornd > 1.0f) - lfornd = 1.0f; - -// lfofreqrnd=powf(lfopars->Pfreqrand/127.0f,2.0f)*2.0f*4.0f; - lfofreqrnd = powf(lfopars->Pfreqrand / 127.0f, 2.0f) * 4.0f; - - switch(lfopars->fel) { - case 1: - lfointensity = lfopars->Pintensity / 127.0f; - break; - case 2: - lfointensity = lfopars->Pintensity / 127.0f * 4.0f; - break; //in octave - default: - lfointensity = powf(2, lfopars->Pintensity / 127.0f * 11.0f) - 1.0f; //in centi - x -= 0.25f; //chance the starting phase - break; - } - - amp1 = (1 - lfornd) + lfornd * RND; - amp2 = (1 - lfornd) + lfornd * RND; - lfotype = lfopars->PLFOtype; - lfodelay = lfopars->Pdelay / 127.0f * 4.0f; //0..4 sec - incrnd = nextincrnd = 1.0f; - freqrndenabled = (lfopars->Pfreqrand != 0); - computenextincrnd(); - computenextincrnd(); //twice because I want incrnd & nextincrnd to be random -} - -LFO::~LFO() -{} - -/* - * LFO out - */ -float LFO::lfoout() -{ - float out; - switch(lfotype) { - case 1: //LFO_TRIANGLE - if((x >= 0.0f) && (x < 0.25f)) - out = 4.0f * x; - else - if((x > 0.25f) && (x < 0.75f)) - out = 2 - 4 * x; - else - out = 4.0f * x - 4.0f; - break; - case 2: //LFO_SQUARE - if(x < 0.5f) - out = -1; - else - out = 1; - break; - case 3: //LFO_RAMPUP - out = (x - 0.5f) * 2.0f; - break; - case 4: //LFO_RAMPDOWN - out = (0.5f - x) * 2.0f; - break; - case 5: //LFO_EXP_DOWN 1 - out = powf(0.05f, x) * 2.0f - 1.0f; - break; - case 6: //LFO_EXP_DOWN 2 - out = powf(0.001f, x) * 2.0f - 1.0f; - break; - default: - out = cosf(x * 2.0f * PI); //LFO_SINE - } - - - if((lfotype == 0) || (lfotype == 1)) - out *= lfointensity * (amp1 + x * (amp2 - amp1)); - else - out *= lfointensity * amp2; - if(lfodelay < 0.00001f) { - if(freqrndenabled == 0) - x += incx; - else { - float tmp = (incrnd * (1.0f - x) + nextincrnd * x); - if(tmp > 1.0f) - tmp = 1.0f; - else - if(tmp < 0.0f) - tmp = 0.0f; - x += incx * tmp; - } - if(x >= 1) { - x = fmod(x, 1.0f); - amp1 = amp2; - amp2 = (1 - lfornd) + lfornd * RND; - - computenextincrnd(); - } - } - else - lfodelay -= synth->buffersize_f / synth->samplerate_f; - return out; -} - -/* - * LFO out (for amplitude) - */ -float LFO::amplfoout() -{ - float out; - out = 1.0f - lfointensity + lfoout(); - if(out < -1.0f) - out = -1.0f; - else - if(out > 1.0f) - out = 1.0f; - return out; -} - - -void LFO::computenextincrnd() -{ - if(freqrndenabled == 0) - return; - incrnd = nextincrnd; - nextincrnd = powf(0.5f, lfofreqrnd) + RND * (powf(2.0f, lfofreqrnd) - 1.0f); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.h deleted file mode 100644 index 2b933a34d73..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/LFO.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - LFO.h - LFO 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef LFO_H -#define LFO_H - -#include "../globals.h" -#include "../Params/LFOParams.h" - -/**Class for creating Low Frequency Ocillators*/ -class LFO -{ - public: - /**Constructor - * - * @param lfopars pointer to a LFOParams object - * @param basefreq base frequency of LFO - */ - LFO(LFOParams *lfopars, float basefreq); - /**Deconstructor*/ - ~LFO(); - float lfoout(); - float amplfoout(); - private: - float x; - float incx, incrnd, nextincrnd; - float amp1, amp2; // used for randomness - float lfointensity; - float lfornd, lfofreqrnd; - float lfodelay; - /**\todo see if an enum would be better here*/ - char lfotype; - int freqrndenabled; - - - void computenextincrnd(); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.cpp deleted file mode 100644 index d51957eaa7c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.cpp +++ /dev/null @@ -1,1503 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OscilGen.cpp - Waveform generator for ADnote - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "OscilGen.h" -#include "../Misc/WaveShapeSmps.h" - -#include -#include -#include -#include - - -//operations on FFTfreqs -inline void clearAll(fft_t *freqs) -{ - memset(freqs, 0, synth->oscilsize / 2 * sizeof(fft_t)); -} - -inline void clearDC(fft_t *freqs) -{ - freqs[0] = fft_t(0.0f, 0.0f); -} - -//return magnitude squared -inline float normal(const fft_t *freqs, off_t x) -{ - return norm(freqs[x]); -} - -//return magnitude -inline float abs(const fft_t *freqs, off_t x) -{ - return abs(freqs[x]); -} - -//return angle aka phase from a sine (not cosine wave) -inline float arg(const fft_t *freqs, off_t x) -{ - const fft_t tmp(freqs[x].imag(), freqs[x].real()); - return arg(tmp); -} - -/** - * Take frequency spectrum and ensure values are normalized based upon - * magnitude to 0<=x<=1 - */ -void normalize(fft_t *freqs) -{ - float normMax = 0.0f; - for(int i = 0; i < synth->oscilsize / 2; ++i) { - //magnitude squared - const float norm = normal(freqs, i); - if(normMax < norm) - normMax = norm; - } - - const float max = sqrt(normMax); - if(max < 1e-8) //data is all ~zero, do not amplify noise - return; - - for(int i = 0; i < synth->oscilsize / 2; ++i) - freqs[i] /= max; -} - -//Full RMS normalize -void rmsNormalize(fft_t *freqs) -{ - float sum = 0.0f; - for(int i = 1; i < synth->oscilsize / 2; ++i) - sum += normal(freqs, i); - - if(sum < 0.000001f) - return; //data is all ~zero, do not amplify noise - - const float gain = 1.0f / sqrt(sum); - - for(int i = 1; i < synth->oscilsize / 2; ++i) - freqs[i] *= gain; -} - -#define DIFF(par) (old ## par != P ## par) - -OscilGen::OscilGen(FFTwrapper *fft_, Resonance *res_):Presets() -{ - assert(fft_); - - setpresettype("Poscilgen"); - fft = fft_; - res = res_; - - - tmpsmps = new float[synth->oscilsize]; - outoscilFFTfreqs = new fft_t[synth->oscilsize / 2]; - oscilFFTfreqs = new fft_t[synth->oscilsize / 2]; - basefuncFFTfreqs = new fft_t[synth->oscilsize / 2]; - - randseed = 1; - ADvsPAD = false; - - defaults(); -} - -OscilGen::~OscilGen() -{ - delete[] tmpsmps; - delete[] outoscilFFTfreqs; - delete[] basefuncFFTfreqs; - delete[] oscilFFTfreqs; -} - - -void OscilGen::defaults() -{ - oldbasefunc = 0; - oldbasepar = 64; - oldhmagtype = 0; - oldwaveshapingfunction = 0; - oldwaveshaping = 64; - oldbasefuncmodulation = 0; - oldharmonicshift = 0; - oldbasefuncmodulationpar1 = 0; - oldbasefuncmodulationpar2 = 0; - oldbasefuncmodulationpar3 = 0; - oldmodulation = 0; - oldmodulationpar1 = 0; - oldmodulationpar2 = 0; - oldmodulationpar3 = 0; - - for(int i = 0; i < MAX_AD_HARMONICS; ++i) { - hmag[i] = 0.0f; - hphase[i] = 0.0f; - Phmag[i] = 64; - Phphase[i] = 64; - } - Phmag[0] = 127; - Phmagtype = 0; - if(ADvsPAD) - Prand = 127; //max phase randomness (usefull if the oscil will be imported to a ADsynth from a PADsynth - else - Prand = 64; //no randomness - - Pcurrentbasefunc = 0; - Pbasefuncpar = 64; - - Pbasefuncmodulation = 0; - Pbasefuncmodulationpar1 = 64; - Pbasefuncmodulationpar2 = 64; - Pbasefuncmodulationpar3 = 32; - - Pmodulation = 0; - Pmodulationpar1 = 64; - Pmodulationpar2 = 64; - Pmodulationpar3 = 32; - - Pwaveshapingfunction = 0; - Pwaveshaping = 64; - Pfiltertype = 0; - Pfilterpar1 = 64; - Pfilterpar2 = 64; - Pfilterbeforews = 0; - Psatype = 0; - Psapar = 64; - - Pamprandpower = 64; - Pamprandtype = 0; - - Pharmonicshift = 0; - Pharmonicshiftfirst = 0; - - Padaptiveharmonics = 0; - Padaptiveharmonicspower = 100; - Padaptiveharmonicsbasefreq = 128; - Padaptiveharmonicspar = 50; - - clearAll(oscilFFTfreqs); - clearAll(basefuncFFTfreqs); - oscilprepared = 0; - oldfilterpars = 0; - oldsapars = 0; - prepare(); -} - -void OscilGen::convert2sine() -{ - float mag[MAX_AD_HARMONICS], phase[MAX_AD_HARMONICS]; - float oscil[synth->oscilsize]; - fft_t *freqs = new fft_t[synth->oscilsize / 2]; - - get(oscil, -1.0f); - FFTwrapper *fft = new FFTwrapper(synth->oscilsize); - fft->smps2freqs(oscil, freqs); - delete (fft); - - normalize(freqs); - - mag[0] = 0; - phase[0] = 0; - for(int i = 0; i < MAX_AD_HARMONICS; ++i) { - mag[i] = abs(freqs, i + 1); - phase[i] = arg(freqs, i + 1); - } - - defaults(); - - for(int i = 0; i < MAX_AD_HARMONICS - 1; ++i) { - float newmag = mag[i]; - float newphase = phase[i]; - - Phmag[i] = (int) ((newmag) * 64.0f) + 64; - - Phphase[i] = 64 - (int) (64.0f * newphase / PI); - if(Phphase[i] > 127) - Phphase[i] = 127; - - if(Phmag[i] == 64) - Phphase[i] = 64; - } - delete[] freqs; - prepare(); -} - -/* - * Get the base function - */ -void OscilGen::getbasefunction(float *smps) -{ - int i; - float par = (Pbasefuncpar + 0.5f) / 128.0f; - if(Pbasefuncpar == 64) - par = 0.5f; - - float basefuncmodulationpar1 = Pbasefuncmodulationpar1 / 127.0f, - basefuncmodulationpar2 = Pbasefuncmodulationpar2 / 127.0f, - basefuncmodulationpar3 = Pbasefuncmodulationpar3 / 127.0f; - - switch(Pbasefuncmodulation) { - case 1: - basefuncmodulationpar1 = - (powf(2, basefuncmodulationpar1 * 5.0f) - 1.0f) / 10.0f; - basefuncmodulationpar3 = - floor((powf(2, basefuncmodulationpar3 * 5.0f) - 1.0f)); - if(basefuncmodulationpar3 < 0.9999f) - basefuncmodulationpar3 = -1.0f; - break; - case 2: - basefuncmodulationpar1 = - (powf(2, basefuncmodulationpar1 * 5.0f) - 1.0f) / 10.0f; - basefuncmodulationpar3 = 1.0f - + floor((powf(2, basefuncmodulationpar3 - * 5.0f) - 1.0f)); - break; - case 3: - basefuncmodulationpar1 = - (powf(2, basefuncmodulationpar1 * 7.0f) - 1.0f) / 10.0f; - basefuncmodulationpar3 = 0.01f - + (powf(2, basefuncmodulationpar3 - * 16.0f) - 1.0f) / 10.0f; - break; - } - - base_func func = getBaseFunction(Pcurrentbasefunc); - - for(i = 0; i < synth->oscilsize; ++i) { - float t = i * 1.0f / synth->oscilsize; - - switch(Pbasefuncmodulation) { - case 1: - t = t * basefuncmodulationpar3 + sinf( - (t - + basefuncmodulationpar2) * 2.0f - * PI) * basefuncmodulationpar1; //rev - break; - case 2: - t = t + sinf( - (t * basefuncmodulationpar3 - + basefuncmodulationpar2) * 2.0f - * PI) * basefuncmodulationpar1; //sine - break; - case 3: - t = t + powf((1.0f - cosf( - (t - + basefuncmodulationpar2) * 2.0f - * PI)) * 0.5f, - basefuncmodulationpar3) * basefuncmodulationpar1; //power - break; - } - - t = t - floor(t); - - if(func) - smps[i] = func(t, par); - else - smps[i] = -sinf(2.0f * PI * i / synth->oscilsize); - } -} - - -/* - * Filter the oscillator - */ -void OscilGen::oscilfilter() -{ - if(Pfiltertype == 0) - return; - - const float par = 1.0f - Pfilterpar1 / 128.0f; - const float par2 = Pfilterpar2 / 127.0f; - filter_func filter = getFilter(Pfiltertype); - - for(int i = 1; i < synth->oscilsize / 2; ++i) - oscilFFTfreqs[i] *= filter(i, par, par2); - - normalize(oscilFFTfreqs); -} - - -/* - * Change the base function - */ -void OscilGen::changebasefunction() -{ - if(Pcurrentbasefunc != 0) { - getbasefunction(tmpsmps); - fft->smps2freqs(tmpsmps, basefuncFFTfreqs); - clearDC(basefuncFFTfreqs); - } - else //in this case basefuncFFTfreqs are not used - clearAll(basefuncFFTfreqs); - oscilprepared = 0; - oldbasefunc = Pcurrentbasefunc; - oldbasepar = Pbasefuncpar; - oldbasefuncmodulation = Pbasefuncmodulation; - oldbasefuncmodulationpar1 = Pbasefuncmodulationpar1; - oldbasefuncmodulationpar2 = Pbasefuncmodulationpar2; - oldbasefuncmodulationpar3 = Pbasefuncmodulationpar3; -} - -inline void normalize(float *smps, size_t N) -{ - //Find max - float max = 0.0f; - for(size_t i = 0; i < N; ++i) - if(max < fabs(smps[i])) - max = fabs(smps[i]); - if(max < 0.00001f) - max = 1.0f; - - //Normalize to +-1 - for(size_t i = 0; i < N; ++i) - smps[i] /= max; -} - -/* - * Waveshape - */ -void OscilGen::waveshape() -{ - oldwaveshapingfunction = Pwaveshapingfunction; - oldwaveshaping = Pwaveshaping; - if(Pwaveshapingfunction == 0) - return; - - clearDC(oscilFFTfreqs); - //reduce the amplitude of the freqs near the nyquist - for(int i = 1; i < synth->oscilsize / 8; ++i) { - float gain = i / (synth->oscilsize / 8.0f); - oscilFFTfreqs[synth->oscilsize / 2 - i] *= gain; - } - fft->freqs2smps(oscilFFTfreqs, tmpsmps); - - //Normalize - normalize(tmpsmps, synth->oscilsize); - - //Do the waveshaping - waveShapeSmps(synth->oscilsize, tmpsmps, Pwaveshapingfunction, Pwaveshaping); - - fft->smps2freqs(tmpsmps, oscilFFTfreqs); //perform FFT -} - - -/* - * Do the Frequency Modulation of the Oscil - */ -void OscilGen::modulation() -{ - int i; - - oldmodulation = Pmodulation; - oldmodulationpar1 = Pmodulationpar1; - oldmodulationpar2 = Pmodulationpar2; - oldmodulationpar3 = Pmodulationpar3; - if(Pmodulation == 0) - return; - - - float modulationpar1 = Pmodulationpar1 / 127.0f, - modulationpar2 = 0.5f - Pmodulationpar2 / 127.0f, - modulationpar3 = Pmodulationpar3 / 127.0f; - - switch(Pmodulation) { - case 1: - modulationpar1 = (powf(2, modulationpar1 * 7.0f) - 1.0f) / 100.0f; - modulationpar3 = floor((powf(2, modulationpar3 * 5.0f) - 1.0f)); - if(modulationpar3 < 0.9999f) - modulationpar3 = -1.0f; - break; - case 2: - modulationpar1 = (powf(2, modulationpar1 * 7.0f) - 1.0f) / 100.0f; - modulationpar3 = 1.0f - + floor((powf(2, modulationpar3 * 5.0f) - 1.0f)); - break; - case 3: - modulationpar1 = (powf(2, modulationpar1 * 9.0f) - 1.0f) / 100.0f; - modulationpar3 = 0.01f - + (powf(2, modulationpar3 * 16.0f) - 1.0f) / 10.0f; - break; - } - - clearDC(oscilFFTfreqs); //remove the DC - //reduce the amplitude of the freqs near the nyquist - for(i = 1; i < synth->oscilsize / 8; ++i) { - float tmp = i / (synth->oscilsize / 8.0f); - oscilFFTfreqs[synth->oscilsize / 2 - i] *= tmp; - } - fft->freqs2smps(oscilFFTfreqs, tmpsmps); - int extra_points = 2; - float *in = new float[synth->oscilsize + extra_points]; - - //Normalize - normalize(tmpsmps, synth->oscilsize); - - for(i = 0; i < synth->oscilsize; ++i) - in[i] = tmpsmps[i]; - for(i = 0; i < extra_points; ++i) - in[i + synth->oscilsize] = tmpsmps[i]; - - //Do the modulation - for(i = 0; i < synth->oscilsize; ++i) { - float t = i * 1.0f / synth->oscilsize; - - switch(Pmodulation) { - case 1: - t = t * modulationpar3 - + sinf((t + modulationpar2) * 2.0f * PI) * modulationpar1; //rev - break; - case 2: - t = t - + sinf((t * modulationpar3 - + modulationpar2) * 2.0f * PI) * modulationpar1; //sine - break; - case 3: - t = t + powf((1.0f - cosf( - (t + modulationpar2) * 2.0f * PI)) * 0.5f, - modulationpar3) * modulationpar1; //power - break; - } - - t = (t - floor(t)) * synth->oscilsize; - - int poshi = (int) t; - float poslo = t - floor(t); - - tmpsmps[i] = in[poshi] * (1.0f - poslo) + in[poshi + 1] * poslo; - } - - delete [] in; - fft->smps2freqs(tmpsmps, oscilFFTfreqs); //perform FFT -} - - -/* - * Adjust the spectrum - */ -void OscilGen::spectrumadjust() -{ - if(Psatype == 0) - return; - float par = Psapar / 127.0f; - switch(Psatype) { - case 1: - par = 1.0f - par * 2.0f; - if(par >= 0.0f) - par = powf(5.0f, par); - else - par = powf(8.0f, par); - break; - case 2: - par = powf(10.0f, (1.0f - par) * 3.0f) * 0.001f; - break; - case 3: - par = powf(10.0f, (1.0f - par) * 3.0f) * 0.001f; - break; - } - - - normalize(oscilFFTfreqs); - - for(int i = 0; i < synth->oscilsize / 2; ++i) { - float mag = abs(oscilFFTfreqs, i); - float phase = M_PI_2 - arg(oscilFFTfreqs, i); - - switch(Psatype) { - case 1: - mag = powf(mag, par); - break; - case 2: - if(mag < par) - mag = 0.0f; - break; - case 3: - mag /= par; - if(mag > 1.0f) - mag = 1.0f; - break; - } - oscilFFTfreqs[i] = std::polar(mag, phase); - } -} - -void OscilGen::shiftharmonics() -{ - if(Pharmonicshift == 0) - return; - - int harmonicshift = -Pharmonicshift; - fft_t h; - - if(harmonicshift > 0) - for(int i = synth->oscilsize / 2 - 2; i >= 0; i--) { - int oldh = i - harmonicshift; - if(oldh < 0) - h = 0.0f; - else - h = oscilFFTfreqs[oldh + 1]; - oscilFFTfreqs[i + 1] = h; - } - else - for(int i = 0; i < synth->oscilsize / 2 - 1; ++i) { - int oldh = i + abs(harmonicshift); - if(oldh >= (synth->oscilsize / 2 - 1)) - h = 0.0f; - else { - h = oscilFFTfreqs[oldh + 1]; - if(abs(h) < 0.000001f) - h = 0.0f; - } - - oscilFFTfreqs[i + 1] = h; - } - - clearDC(oscilFFTfreqs); -} - -/* - * Prepare the Oscillator - */ -void OscilGen::prepare() -{ - if((oldbasepar != Pbasefuncpar) || (oldbasefunc != Pcurrentbasefunc) - || DIFF(basefuncmodulation) || DIFF(basefuncmodulationpar1) - || DIFF(basefuncmodulationpar2) || DIFF(basefuncmodulationpar3)) - changebasefunction(); - - for(int i = 0; i < MAX_AD_HARMONICS; ++i) - hphase[i] = (Phphase[i] - 64.0f) / 64.0f * PI / (i + 1); - - for(int i = 0; i < MAX_AD_HARMONICS; ++i) { - const float hmagnew = 1.0f - fabs(Phmag[i] / 64.0f - 1.0f); - switch(Phmagtype) { - case 1: - hmag[i] = expf(hmagnew * logf(0.01f)); - break; - case 2: - hmag[i] = expf(hmagnew * logf(0.001f)); - break; - case 3: - hmag[i] = expf(hmagnew * logf(0.0001f)); - break; - case 4: - hmag[i] = expf(hmagnew * logf(0.00001f)); - break; - default: - hmag[i] = 1.0f - hmagnew; - break; - } - - if(Phmag[i] < 64) - hmag[i] = -hmag[i]; - } - - //remove the harmonics where Phmag[i]==64 - for(int i = 0; i < MAX_AD_HARMONICS; ++i) - if(Phmag[i] == 64) - hmag[i] = 0.0f; - - - clearAll(oscilFFTfreqs); - if(Pcurrentbasefunc == 0) //the sine case - for(int i = 0; i < MAX_AD_HARMONICS - 1; ++i) { - oscilFFTfreqs[i + 1] = - std::complex(-hmag[i] * sinf(hphase[i] * (i + 1)) / 2.0f, - hmag[i] * cosf(hphase[i] * (i + 1)) / 2.0f); - } - else - for(int j = 0; j < MAX_AD_HARMONICS; ++j) { - if(Phmag[j] == 64) - continue; - for(int i = 1; i < synth->oscilsize / 2; ++i) { - int k = i * (j + 1); - if(k >= synth->oscilsize / 2) - break; - oscilFFTfreqs[k] += basefuncFFTfreqs[i] * std::polar( - hmag[j], - hphase[j] * k); - } - } - - if(Pharmonicshiftfirst != 0) - shiftharmonics(); - - if(Pfilterbeforews == 0) { - waveshape(); - oscilfilter(); - } - else { - oscilfilter(); - waveshape(); - } - - modulation(); - spectrumadjust(); - if(Pharmonicshiftfirst == 0) - shiftharmonics(); - - clearDC(oscilFFTfreqs); - - oldhmagtype = Phmagtype; - oldharmonicshift = Pharmonicshift + Pharmonicshiftfirst * 256; - - oscilprepared = 1; -} - -void OscilGen::adaptiveharmonic(fft_t *f, float freq) -{ - if(Padaptiveharmonics == 0 /*||(freq<1.0f)*/) - return; - if(freq < 1.0f) - freq = 440.0f; - - fft_t *inf = new fft_t[synth->oscilsize / 2]; - for(int i = 0; i < synth->oscilsize / 2; ++i) - inf[i] = f[i]; - clearAll(f); - clearDC(inf); - - float hc = 0.0f, hs = 0.0f; - float basefreq = 30.0f * powf(10.0f, Padaptiveharmonicsbasefreq / 128.0f); - float power = (Padaptiveharmonicspower + 1.0f) / 101.0f; - - float rap = freq / basefreq; - - rap = powf(rap, power); - - bool down = false; - if(rap > 1.0f) { - rap = 1.0f / rap; - down = true; - } - - for(int i = 0; i < synth->oscilsize / 2 - 2; ++i) { - float h = i * rap; - int high = (int)(i * rap); - float low = fmod(h, 1.0f); - - if(high >= (synth->oscilsize / 2 - 2)) - break; - else { - if(down) { - f[high] = - std::complex(f[high].real() + inf[i].real() * (1.0f - low), - f[high].imag() + inf[i].imag() * (1.0f - low)); - - f[high + 1] = std::complex(f[high + 1].real() + inf[i].real() * low, - f[high + 1].imag() + inf[i].imag() * low); - } - else { - hc = inf[high].real() - * (1.0f - low) + inf[high + 1].real() * low; - hs = inf[high].imag() - * (1.0f - low) + inf[high + 1].imag() * low; - } - if(fabs(hc) < 0.000001f) - hc = 0.0f; - if(fabs(hs) < 0.000001f) - hs = 0.0f; - } - - if(!down) { - if(i == 0) { //corect the aplitude of the first harmonic - hc *= rap; - hs *= rap; - } - f[i] = fft_t(hc, hs); - } - } - - f[1] += f[0]; - clearDC(f); - delete[] inf; -} - -void OscilGen::adaptiveharmonicpostprocess(fft_t *f, int size) -{ - if(Padaptiveharmonics <= 1) - return; - fft_t *inf = new fft_t[size]; - float par = Padaptiveharmonicspar * 0.01f; - par = 1.0f - powf((1.0f - par), 1.5f); - - for(int i = 0; i < size; ++i) { - inf[i] = f[i] * par; - f[i] *= (1.0f - par); - } - - - if(Padaptiveharmonics == 2) { //2n+1 - for(int i = 0; i < size; ++i) - if((i % 2) == 0) - f[i] += inf[i]; //i=0 pt prima armonica,etc. - } - else { //celelalte moduri - int nh = (Padaptiveharmonics - 3) / 2 + 2; - int sub_vs_add = (Padaptiveharmonics - 3) % 2; - if(sub_vs_add == 0) { - for(int i = 0; i < size; ++i) - if(((i + 1) % nh) == 0) - f[i] += inf[i]; - } - else - for(int i = 0; i < size / nh - 1; ++i) - f[(i + 1) * nh - 1] += inf[i]; - } - - delete [] inf; -} - -void OscilGen::newrandseed(unsigned int randseed) -{ - this->randseed = randseed; -} - -bool OscilGen::needPrepare(void) -{ - bool outdated = false; - - //Check function parameters - if((oldbasepar != Pbasefuncpar) || (oldbasefunc != Pcurrentbasefunc) - || DIFF(hmagtype) || DIFF(waveshaping) || DIFF(waveshapingfunction)) - outdated = true; - - //Check filter parameters - if(oldfilterpars != Pfiltertype * 256 + Pfilterpar1 + Pfilterpar2 * 65536 - + Pfilterbeforews * 16777216) { - outdated = true; - oldfilterpars = Pfiltertype * 256 + Pfilterpar1 + Pfilterpar2 * 65536 - + Pfilterbeforews * 16777216; - } - - //Check spectrum adjustments - if(oldsapars != Psatype * 256 + Psapar) { - outdated = true; - oldsapars = Psatype * 256 + Psapar; - } - - //Check function modulation - if(DIFF(basefuncmodulation) || DIFF(basefuncmodulationpar1) - || DIFF(basefuncmodulationpar2) || DIFF(basefuncmodulationpar3)) - outdated = true; - - //Check overall modulation - if(DIFF(modulation) || DIFF(modulationpar1) - || DIFF(modulationpar2) || DIFF(modulationpar3)) - outdated = true; - - //Check harmonic shifts - if(oldharmonicshift != Pharmonicshift + Pharmonicshiftfirst * 256) - outdated = true; - - return outdated == true || oscilprepared == false; -} - -/* - * Get the oscillator function - */ -short int OscilGen::get(float *smps, float freqHz, int resonance) -{ - if(needPrepare()) - prepare(); - - int outpos = - (int)((RND * 2.0f - - 1.0f) * synth->oscilsize_f * (Prand - 64.0f) / 64.0f); - outpos = (outpos + 2 * synth->oscilsize) % synth->oscilsize; - - - clearAll(outoscilFFTfreqs); - - int nyquist = (int)(0.5f * synth->samplerate_f / fabs(freqHz)) + 2; - if(ADvsPAD) - nyquist = (int)(synth->oscilsize / 2); - if(nyquist > synth->oscilsize / 2) - nyquist = synth->oscilsize / 2; - - //Process harmonics - { - int realnyquist = nyquist; - - if(Padaptiveharmonics != 0) - nyquist = synth->oscilsize / 2; - for(int i = 1; i < nyquist - 1; ++i) - outoscilFFTfreqs[i] = oscilFFTfreqs[i]; - - adaptiveharmonic(outoscilFFTfreqs, freqHz); - adaptiveharmonicpostprocess(&outoscilFFTfreqs[1], - synth->oscilsize / 2 - 1); - - nyquist = realnyquist; - } - - if(Padaptiveharmonics) //do the antialiasing in the case of adaptive harmonics - for(int i = nyquist; i < synth->oscilsize / 2; ++i) - outoscilFFTfreqs[i] = fft_t(0.0f, 0.0f); - - // Randomness (each harmonic), the block type is computed - // in ADnote by setting start position according to this setting - if((Prand > 64) && (freqHz >= 0.0f) && (!ADvsPAD)) { - const float rnd = PI * powf((Prand - 64.0f) / 64.0f, 2.0f); - for(int i = 1; i < nyquist - 1; ++i) //to Nyquist only for AntiAliasing - outoscilFFTfreqs[i] *= - std::polar(1.0f, (float)(rnd * i * RND)); - } - - //Harmonic Amplitude Randomness - if((freqHz > 0.1f) && (!ADvsPAD)) { - unsigned int realrnd = prng(); - sprng(randseed); - float power = Pamprandpower / 127.0f; - float normalize = 1.0f / (1.2f - power); - switch(Pamprandtype) { - case 1: - power = power * 2.0f - 0.5f; - power = powf(15.0f, power); - for(int i = 1; i < nyquist - 1; ++i) - outoscilFFTfreqs[i] *= powf(RND, power) * normalize; - break; - case 2: - power = power * 2.0f - 0.5f; - power = powf(15.0f, power) * 2.0f; - float rndfreq = 2 * PI * RND; - for(int i = 1; i < nyquist - 1; ++i) - outoscilFFTfreqs[i] *= powf(fabs(sinf(i * rndfreq)), power) - * normalize; - break; - } - sprng(realrnd + 1); - } - - if((freqHz > 0.1f) && (resonance != 0)) - res->applyres(nyquist - 1, outoscilFFTfreqs, freqHz); - - rmsNormalize(outoscilFFTfreqs); - - if((ADvsPAD) && (freqHz > 0.1f)) //in this case the smps will contain the freqs - for(int i = 1; i < synth->oscilsize / 2; ++i) - smps[i - 1] = abs(outoscilFFTfreqs, i); - else { - fft->freqs2smps(outoscilFFTfreqs, smps); - for(int i = 0; i < synth->oscilsize; ++i) - smps[i] *= 0.25f; //correct the amplitude - } - - if(Prand < 64) - return outpos; - else - return 0; -} - - -/* - * Get the spectrum of the oscillator for the UI - */ -void OscilGen::getspectrum(int n, float *spc, int what) -{ - if(n > synth->oscilsize / 2) - n = synth->oscilsize / 2; - - for(int i = 1; i < n; ++i) { - if(what == 0) - spc[i - 1] = abs(oscilFFTfreqs, i); - else { - if(Pcurrentbasefunc == 0) - spc[i - 1] = ((i == 1) ? (1.0f) : (0.0f)); - else - spc[i - 1] = abs(basefuncFFTfreqs, i); - } - } - - if(what == 0) { - for(int i = 0; i < n; ++i) - outoscilFFTfreqs[i] = fft_t(spc[i], spc[i]); - memset(outoscilFFTfreqs + n, 0, - (synth->oscilsize / 2 - n) * sizeof(fft_t)); - adaptiveharmonic(outoscilFFTfreqs, 0.0f); - adaptiveharmonicpostprocess(outoscilFFTfreqs, n - 1); - for(int i = 0; i < n; ++i) - spc[i] = outoscilFFTfreqs[i].imag(); - } -} - - -/* - * Convert the oscillator as base function - */ -void OscilGen::useasbase() -{ - for(int i = 0; i < synth->oscilsize / 2; ++i) - basefuncFFTfreqs[i] = oscilFFTfreqs[i]; - - oldbasefunc = Pcurrentbasefunc = 127; - prepare(); -} - - -/* - * Get the base function for UI - */ -void OscilGen::getcurrentbasefunction(float *smps) -{ - if(Pcurrentbasefunc != 0) - fft->freqs2smps(basefuncFFTfreqs, smps); - else - getbasefunction(smps); //the sine case -} - -void OscilGen::add2XML(XMLwrapper *xml) -{ - xml->addpar("harmonic_mag_type", Phmagtype); - - xml->addpar("base_function", Pcurrentbasefunc); - xml->addpar("base_function_par", Pbasefuncpar); - xml->addpar("base_function_modulation", Pbasefuncmodulation); - xml->addpar("base_function_modulation_par1", Pbasefuncmodulationpar1); - xml->addpar("base_function_modulation_par2", Pbasefuncmodulationpar2); - xml->addpar("base_function_modulation_par3", Pbasefuncmodulationpar3); - - xml->addpar("modulation", Pmodulation); - xml->addpar("modulation_par1", Pmodulationpar1); - xml->addpar("modulation_par2", Pmodulationpar2); - xml->addpar("modulation_par3", Pmodulationpar3); - - xml->addpar("wave_shaping", Pwaveshaping); - xml->addpar("wave_shaping_function", Pwaveshapingfunction); - - xml->addpar("filter_type", Pfiltertype); - xml->addpar("filter_par1", Pfilterpar1); - xml->addpar("filter_par2", Pfilterpar2); - xml->addpar("filter_before_wave_shaping", Pfilterbeforews); - - xml->addpar("spectrum_adjust_type", Psatype); - xml->addpar("spectrum_adjust_par", Psapar); - - xml->addpar("rand", Prand); - xml->addpar("amp_rand_type", Pamprandtype); - xml->addpar("amp_rand_power", Pamprandpower); - - xml->addpar("harmonic_shift", Pharmonicshift); - xml->addparbool("harmonic_shift_first", Pharmonicshiftfirst); - - xml->addpar("adaptive_harmonics", Padaptiveharmonics); - xml->addpar("adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq); - xml->addpar("adaptive_harmonics_power", Padaptiveharmonicspower); - - xml->beginbranch("HARMONICS"); - for(int n = 0; n < MAX_AD_HARMONICS; ++n) { - if((Phmag[n] == 64) && (Phphase[n] == 64)) - continue; - xml->beginbranch("HARMONIC", n + 1); - xml->addpar("mag", Phmag[n]); - xml->addpar("phase", Phphase[n]); - xml->endbranch(); - } - xml->endbranch(); - - if(Pcurrentbasefunc == 127) { - normalize(basefuncFFTfreqs); - - xml->beginbranch("BASE_FUNCTION"); - for(int i = 1; i < synth->oscilsize / 2; ++i) { - float xc = basefuncFFTfreqs[i].real(); - float xs = basefuncFFTfreqs[i].imag(); - if((fabs(xs) > 0.00001f) && (fabs(xs) > 0.00001f)) { - xml->beginbranch("BF_HARMONIC", i); - xml->addparreal("cos", xc); - xml->addparreal("sin", xs); - xml->endbranch(); - } - } - xml->endbranch(); - } -} - -void OscilGen::getfromXML(XMLwrapper *xml) -{ - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); - - Pcurrentbasefunc = xml->getpar127("base_function", Pcurrentbasefunc); - Pbasefuncpar = xml->getpar127("base_function_par", Pbasefuncpar); - - Pbasefuncmodulation = xml->getpar127("base_function_modulation", - Pbasefuncmodulation); - Pbasefuncmodulationpar1 = xml->getpar127("base_function_modulation_par1", - Pbasefuncmodulationpar1); - Pbasefuncmodulationpar2 = xml->getpar127("base_function_modulation_par2", - Pbasefuncmodulationpar2); - Pbasefuncmodulationpar3 = xml->getpar127("base_function_modulation_par3", - Pbasefuncmodulationpar3); - - Pmodulation = xml->getpar127("modulation", Pmodulation); - Pmodulationpar1 = xml->getpar127("modulation_par1", - Pmodulationpar1); - Pmodulationpar2 = xml->getpar127("modulation_par2", - Pmodulationpar2); - Pmodulationpar3 = xml->getpar127("modulation_par3", - Pmodulationpar3); - - Pwaveshaping = xml->getpar127("wave_shaping", Pwaveshaping); - Pwaveshapingfunction = xml->getpar127("wave_shaping_function", - Pwaveshapingfunction); - - Pfiltertype = xml->getpar127("filter_type", Pfiltertype); - Pfilterpar1 = xml->getpar127("filter_par1", Pfilterpar1); - Pfilterpar2 = xml->getpar127("filter_par2", Pfilterpar2); - Pfilterbeforews = xml->getpar127("filter_before_wave_shaping", - Pfilterbeforews); - - Psatype = xml->getpar127("spectrum_adjust_type", Psatype); - Psapar = xml->getpar127("spectrum_adjust_par", Psapar); - - Prand = xml->getpar127("rand", Prand); - Pamprandtype = xml->getpar127("amp_rand_type", Pamprandtype); - Pamprandpower = xml->getpar127("amp_rand_power", Pamprandpower); - - Pharmonicshift = xml->getpar("harmonic_shift", - Pharmonicshift, - -64, - 64); - Pharmonicshiftfirst = xml->getparbool("harmonic_shift_first", - Pharmonicshiftfirst); - - Padaptiveharmonics = xml->getpar("adaptive_harmonics", - Padaptiveharmonics, - 0, - 127); - Padaptiveharmonicsbasefreq = xml->getpar( - "adaptive_harmonics_base_frequency", - Padaptiveharmonicsbasefreq, - 0, - 255); - Padaptiveharmonicspower = xml->getpar("adaptive_harmonics_power", - Padaptiveharmonicspower, - 0, - 200); - - - if(xml->enterbranch("HARMONICS")) { - Phmag[0] = 64; - Phphase[0] = 64; - for(int n = 0; n < MAX_AD_HARMONICS; ++n) { - if(xml->enterbranch("HARMONIC", n + 1) == 0) - continue; - Phmag[n] = xml->getpar127("mag", 64); - Phphase[n] = xml->getpar127("phase", 64); - xml->exitbranch(); - } - xml->exitbranch(); - } - - if(Pcurrentbasefunc != 0) - changebasefunction(); - - - if(xml->enterbranch("BASE_FUNCTION")) { - for(int i = 1; i < synth->oscilsize / 2; ++i) - if(xml->enterbranch("BF_HARMONIC", i)) { - basefuncFFTfreqs[i] = - std::complex(xml->getparreal("cos", 0.0f), - xml->getparreal("sin", 0.0f)); - xml->exitbranch(); - } - xml->exitbranch(); - - clearDC(basefuncFFTfreqs); - normalize(basefuncFFTfreqs); - } -} - - -//Define basic functions -#define FUNC(b) float basefunc_ ## b(float x, float a) - -FUNC(pulse) -{ - return (fmod(x, 1.0f) < a) ? -1.0f : 1.0f; -} - -FUNC(saw) -{ - if(a < 0.00001f) - a = 0.00001f; - else - if(a > 0.99999f) - a = 0.99999f; - x = fmod(x, 1); - if(x < a) - return x / a * 2.0f - 1.0f; - else - return (1.0f - x) / (1.0f - a) * 2.0f - 1.0f; -} - -FUNC(triangle) -{ - x = fmod(x + 0.25f, 1); - a = 1 - a; - if(a < 0.00001f) - a = 0.00001f; - if(x < 0.5f) - x = x * 4 - 1.0f; - else - x = (1.0f - x) * 4 - 1.0f; - x /= -a; - if(x < -1.0f) - x = -1.0f; - if(x > 1.0f) - x = 1.0f; - return x; -} - -FUNC(power) -{ - x = fmod(x, 1); - if(a < 0.00001f) - a = 0.00001f; - else - if(a > 0.99999f) - a = 0.99999f; - return powf(x, expf((a - 0.5f) * 10.0f)) * 2.0f - 1.0f; -} - -FUNC(gauss) -{ - x = fmod(x, 1) * 2.0f - 1.0f; - if(a < 0.00001f) - a = 0.00001f; - return expf(-x * x * (expf(a * 8) + 5.0f)) * 2.0f - 1.0f; -} - -FUNC(diode) -{ - if(a < 0.00001f) - a = 0.00001f; - else - if(a > 0.99999f) - a = 0.99999f; - a = a * 2.0f - 1.0f; - x = cosf((x + 0.5f) * 2.0f * PI) - a; - if(x < 0.0f) - x = 0.0f; - return x / (1.0f - a) * 2 - 1.0f; -} - -FUNC(abssine) -{ - x = fmod(x, 1); - if(a < 0.00001f) - a = 0.00001f; - else - if(a > 0.99999f) - a = 0.99999f; - return sinf(powf(x, expf((a - 0.5f) * 5.0f)) * PI) * 2.0f - 1.0f; -} - -FUNC(pulsesine) -{ - if(a < 0.00001f) - a = 0.00001f; - x = (fmod(x, 1) - 0.5f) * expf((a - 0.5f) * logf(128)); - if(x < -0.5f) - x = -0.5f; - else - if(x > 0.5f) - x = 0.5f; - x = sinf(x * PI * 2.0f); - return x; -} - -FUNC(stretchsine) -{ - x = fmod(x + 0.5f, 1) * 2.0f - 1.0f; - a = (a - 0.5f) * 4; - if(a > 0.0f) - a *= 2; - a = powf(3.0f, a); - float b = powf(fabs(x), a); - if(x < 0) - b = -b; - return -sinf(b * PI); -} - -FUNC(chirp) -{ - x = fmod(x, 1.0f) * 2.0f * PI; - a = (a - 0.5f) * 4; - if(a < 0.0f) - a *= 2.0f; - a = powf(3.0f, a); - return sinf(x / 2.0f) * sinf(a * x * x); -} - -FUNC(absstretchsine) -{ - x = fmod(x + 0.5f, 1) * 2.0f - 1.0f; - a = (a - 0.5f) * 9; - a = powf(3.0f, a); - float b = powf(fabs(x), a); - if(x < 0) - b = -b; - return -powf(sinf(b * PI), 2); -} - -FUNC(chebyshev) -{ - a = a * a * a * 30.0f + 1.0f; - return cosf(acosf(x * 2.0f - 1.0f) * a); -} - -FUNC(sqr) -{ - a = a * a * a * a * 160.0f + 0.001f; - return -atanf(sinf(x * 2.0f * PI) * a); -} - -FUNC(spike) -{ - float b = a * 0.66666; // the width of the range: if a == 0.5, b == 0.33333 - - if(x < 0.5) { - if(x < (0.5 - (b / 2.0))) - return 0.0; - else { - x = (x + (b / 2) - 0.5) * (2.0 / b); // shift to zero, and expand to range from 0 to 1 - return x * (2.0 / b); // this is the slope: 1 / (b / 2) - } - } - else { - if(x > (0.5 + (b / 2.0))) - return 0.0; - else { - x = (x - 0.5) * (2.0 / b); - return (1 - x) * (2.0 / b); - } - } -} - -FUNC(circle) -{ - // a is parameter: 0 -> 0.5 -> 1 // O.5 = circle - float b, y; - - b = 2 - (a * 2); // b goes from 2 to 0 - x = x * 4; - - if(x < 2) { - x = x - 1; // x goes from -1 to 1 - if((x < -b) || (x > b)) - y = 0; - else - y = sqrt(1 - (pow(x, 2) / pow(b, 2))); // normally * a^2, but a stays 1 - } - else { - x = x - 3; // x goes from -1 to 1 as well - if((x < -b) || (x > b)) - y = 0; - else - y = -sqrt(1 - (pow(x, 2) / pow(b, 2))); - } - return y; -} - -typedef float (*base_func)(float, float); - -base_func getBaseFunction(unsigned char func) -{ - if(!func) - return NULL; - - if(func == 127) //should be the custom wave - return NULL; - - func--; - assert(func < 15); - base_func functions[] = { - basefunc_triangle, - basefunc_pulse, - basefunc_saw, - basefunc_power, - basefunc_gauss, - basefunc_diode, - basefunc_abssine, - basefunc_pulsesine, - basefunc_stretchsine, - basefunc_chirp, - basefunc_absstretchsine, - basefunc_chebyshev, - basefunc_sqr, - basefunc_spike, - basefunc_circle, - }; - return functions[func]; -} - -//And filters - -#define FILTER(x) float osc_ ## x(unsigned int i, float par, float par2) -FILTER(lp) -{ - float gain = powf(1.0f - par * par * par * 0.99f, i); - float tmp = par2 * par2 * par2 * par2 * 0.5f + 0.0001f; - if(gain < tmp) - gain = powf(gain, 10.0f) / powf(tmp, 9.0f); - return gain; -} - -FILTER(hp1) -{ - float gain = 1.0f - powf(1.0f - par * par, i + 1); - return powf(gain, par2 * 2.0f + 0.1f); -} - -FILTER(hp1b) -{ - if(par < 0.2f) - par = par * 0.25f + 0.15f; - float gain = 1.0f - powf(1.0f - par * par * 0.999f + 0.001f, - i * 0.05f * i + 1.0f); - float tmp = powf(5.0f, par2 * 2.0f); - return powf(gain, tmp); -} - -FILTER(bp1) -{ - float gain = i + 1 - powf(2, (1.0f - par) * 7.5f); - gain = 1.0f / (1.0f + gain * gain / (i + 1.0f)); - float tmp = powf(5.0f, par2 * 2.0f); - gain = powf(gain, tmp); - if(gain < 1e-5) - gain = 1e-5; - return gain; -} - -FILTER(bs1) -{ - float gain = i + 1 - powf(2, (1.0f - par) * 7.5f); - gain = powf(atanf(gain / (i / 10.0f + 1)) / 1.57f, 6); - return powf(gain, par2 * par2 * 3.9f + 0.1f); -} - -FILTER(lp2) -{ - return (i + 1 > - powf(2, (1.0f - par) * 10) ? 0.0f : 1.0f) * par2 + (1.0f - par2); -} - -FILTER(hp2) -{ - if(par == 1) - return 1.0f; - return (i + 1 > - powf(2, (1.0f - par) * 7) ? 1.0f : 0.0f) * par2 + (1.0f - par2); -} - -FILTER(bp2) -{ - return (fabs(powf(2, - (1.0f - - par) - * 7) - - i) > i / 2 + 1 ? 0.0f : 1.0f) * par2 + (1.0f - par2); -} - -FILTER(bs2) -{ - return (fabs(powf(2, - (1.0f - - par) - * 7) - - i) < i / 2 + 1 ? 0.0f : 1.0f) * par2 + (1.0f - par2); -} - -bool floatEq(float a, float b) -{ - const float fudge = .01; - return a + fudge > b && a - fudge < b; -} - -FILTER(cos) -{ - float tmp = powf(5.0f, par2 * 2.0f - 1.0f); - tmp = powf(i / 32.0f, tmp) * 32.0f; - if(floatEq(par2 * 127.0f, 64.0f)) - tmp = i; - float gain = cosf(par * par * PI / 2.0f * tmp); - gain *= gain; - return gain; -} - -FILTER(sin) -{ - float tmp = powf(5.0f, par2 * 2.0f - 1.0f); - tmp = powf(i / 32.0f, tmp) * 32.0f; - if(floatEq(par2 * 127.0f, 64.0f)) - tmp = i; - float gain = sinf(par * par * PI / 2.0f * tmp); - gain *= gain; - return gain; -} - -FILTER(low_shelf) -{ - float p2 = 1.0f - par + 0.2f; - float x = i / (64.0f * p2 * p2); - if(x < 0.0f) - x = 0.0f; - else - if(x > 1.0f) - x = 1.0f; - float tmp = powf(1.0f - par2, 2.0f); - return cosf(x * PI) * (1.0f - tmp) + 1.01f + tmp; -} - -FILTER(s) -{ - unsigned int tmp = (int) (powf(2.0f, (1.0f - par) * 7.2f)); - float gain = 1.0f; - if(i == tmp) - gain = powf(2.0f, par2 * par2 * 8.0f); - return gain; -} -#undef FILTER - -typedef float (*filter_func)(unsigned int, float, float); -filter_func getFilter(unsigned char func) -{ - if(!func) - return NULL; - - func--; - assert(func < 13); - filter_func functions[] = { - osc_lp, - osc_hp1, - osc_hp1b, - osc_bp1, - osc_bs1, - osc_lp2, - osc_hp2, - osc_bp2, - osc_bs2, - osc_cos, - osc_sin, - osc_low_shelf, - osc_s - }; - return functions[func]; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.h deleted file mode 100644 index 483a3859a1b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OscilGen.h - Waveform generator for ADnote - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef OSCIL_GEN_H -#define OSCIL_GEN_H - -#include "../globals.h" -#include "../Misc/XMLwrapper.h" -#include "../DSP/FFTwrapper.h" -#include "../Params/Presets.h" -#include "Resonance.h" - -class OscilGen:public Presets -{ - public: - OscilGen(FFTwrapper *fft_, Resonance *res_); - ~OscilGen(); - - /**computes the full spectrum of oscil from harmonics,phases and basefunc*/ - void prepare(); - - /**do the antialiasing(cut off higher freqs.),apply randomness and do a IFFT*/ - //returns where should I start getting samples, used in block type randomness - short get(float *smps, float freqHz, int resonance = 0); - //if freqHz is smaller than 0, return the "un-randomized" sample for UI - - void getbasefunction(float *smps); - - //called by UI - void getspectrum(int n, float *spc, int what); //what=0 pt. oscil,1 pt. basefunc - void getcurrentbasefunction(float *smps); - /**convert oscil to base function*/ - void useasbase(); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - void convert2sine(); - - //Parameters - - /** - * The hmag and hphase starts counting from 0, so the first harmonic(1) has the index 0, - * 2-nd harmonic has index 1, ..the 128 harminic has index 127 - */ - unsigned char Phmag[MAX_AD_HARMONICS], Phphase[MAX_AD_HARMONICS]; //the MIDI parameters for mag. and phases - - - /**The Type of magnitude: - * 0 - Linear - * 1 - dB scale (-40) - * 2 - dB scale (-60) - * 3 - dB scale (-80) - * 4 - dB scale (-100)*/ - unsigned char Phmagtype; - - unsigned char Pcurrentbasefunc; //The base function used - 0=sin, 1=... - unsigned char Pbasefuncpar; //the parameter of the base function - - unsigned char Pbasefuncmodulation; //what modulation is applied to the basefunc - unsigned char Pbasefuncmodulationpar1, Pbasefuncmodulationpar2, - Pbasefuncmodulationpar3; //the parameter of the base function modulation - - /*the Randomness: - 64=no randomness - 63..0 - block type randomness - 0 is maximum - 65..127 - each harmonic randomness - 127 is maximum*/ - unsigned char Prand; - unsigned char Pwaveshaping, Pwaveshapingfunction; - unsigned char Pfiltertype, Pfilterpar1, Pfilterpar2; - unsigned char Pfilterbeforews; - unsigned char Psatype, Psapar; //spectrum adjust - - unsigned char Pamprandpower, Pamprandtype; //amplitude randomness - int Pharmonicshift; //how the harmonics are shifted - int Pharmonicshiftfirst; //if the harmonic shift is done before waveshaping and filter - - unsigned char Padaptiveharmonics; //the adaptive harmonics status (off=0,on=1,etc..) - unsigned char Padaptiveharmonicsbasefreq; //the base frequency of the adaptive harmonic (30..3000Hz) - unsigned char Padaptiveharmonicspower; //the strength of the effect (0=off,100=full) - unsigned char Padaptiveharmonicspar; //the parameters in 2,3,4.. modes of adaptive harmonics - - unsigned char Pmodulation; //what modulation is applied to the oscil - unsigned char Pmodulationpar1, Pmodulationpar2, Pmodulationpar3; //the parameter of the parameters - - - //makes a new random seed for Amplitude Randomness - //this should be called every note on event - void newrandseed(unsigned int randseed); - - bool ADvsPAD; //if it is used by ADsynth or by PADsynth - - private: - //This array stores some termporary data and it has OSCIL_SIZE elements - float *tmpsmps; - fft_t *outoscilFFTfreqs; - - float hmag[MAX_AD_HARMONICS], hphase[MAX_AD_HARMONICS]; //the magnituides and the phases of the sine/nonsine harmonics -// private: - FFTwrapper *fft; - //computes the basefunction and make the FFT; newbasefunc<0 = same basefunc - void changebasefunction(); - //Waveshaping - void waveshape(); - - //Filter the oscillator accotding to Pfiltertype and Pfilterpar - void oscilfilter(); - - //Adjust the spectrum - void spectrumadjust(); - - //Shift the harmonics - void shiftharmonics(); - - //Do the oscil modulation stuff - void modulation(); - - //Check system for needed updates - bool needPrepare(void); - - //Do the adaptive harmonic stuff - void adaptiveharmonic(fft_t *f, float freq); - - //Do the adaptive harmonic postprocessing (2n+1,2xS,2xA,etc..) - //this function is called even for the user interface - //this can be called for the sine and components, and for the spectrum - //(that's why the sine and cosine components should be processed with a separate call) - void adaptiveharmonicpostprocess(fft_t *f, int size); - - //Internal Data - unsigned char oldbasefunc, oldbasepar, oldhmagtype, - oldwaveshapingfunction, oldwaveshaping; - int oldfilterpars, oldsapars, oldbasefuncmodulation, - oldbasefuncmodulationpar1, oldbasefuncmodulationpar2, - oldbasefuncmodulationpar3, oldharmonicshift; - int oldmodulation, oldmodulationpar1, oldmodulationpar2, - oldmodulationpar3; - - - fft_t *basefuncFFTfreqs; //Base Function Frequencies - fft_t *oscilFFTfreqs; //Oscillator Frequencies - this is different than the hamonics set-up by the user, it may contains time-domain data if the antialiasing is turned off - int oscilprepared; //1 if the oscil is prepared, 0 if it is not prepared and is need to call ::prepare() before ::get() - - Resonance *res; - - unsigned int randseed; -}; - -typedef float (*filter_func)(unsigned int, float, float); -filter_func getFilter(unsigned char func); -typedef float (*base_func)(float, float); -base_func getBaseFunction(unsigned char func); - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.cpp deleted file mode 100644 index 1778b338843..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - pADnote.cpp - The "pad" synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include "PADnote.h" -#include "../Misc/Config.h" -#include "../DSP/Filter.h" - -PADnote::PADnote(PADnoteParameters *parameters, - Controller *ctl_, - float freq, - float velocity, - int portamento_, - int midinote, - bool besilent) - :SynthNote(freq, velocity, portamento_, midinote, besilent) -{ - pars = parameters; - - ctl = ctl_; - firsttime = true; - setup(freq, velocity, portamento_, midinote); -} - - -void PADnote::setup(float freq, - float velocity, - int portamento_, - int midinote, - bool legato) -{ - portamento = portamento_; - this->velocity = velocity; - finished_ = false; - - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0f; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - float tmp = - (midinote - - 69.0f) / 12.0f - * (powf(2.0f, (fixedfreqET - 1) / 63.0f) - 1.0f); - if(fixedfreqET <= 64) - basefreq *= powf(2.0f, tmp); - else - basefreq *= powf(3.0f, tmp); - } - } - - firsttime = true; - released = false; - realfreq = basefreq; - if(!legato) - NoteGlobalPar.Detune = getdetune(pars->PDetuneType, pars->PCoarseDetune, - pars->PDetune); - - - //find out the closest note - float logfreq = logf(basefreq * powf(2.0f, NoteGlobalPar.Detune / 1200.0f)); - float mindist = fabs(logfreq - logf(pars->sample[0].basefreq + 0.0001f)); - nsample = 0; - for(int i = 1; i < PAD_MAX_SAMPLES; ++i) { - if(pars->sample[i].smp == NULL) - break; - float dist = fabs(logfreq - logf(pars->sample[i].basefreq + 0.0001f)); - - if(dist < mindist) { - nsample = i; - mindist = dist; - } - } - - int size = pars->sample[nsample].size; - if(size == 0) - size = 1; - - - if(!legato) { //not sure - poshi_l = (int)(RND * (size - 1)); - if(pars->PStereo != 0) - poshi_r = (poshi_l + size / 2) % size; - else - poshi_r = poshi_l; - poslo = 0.0f; - } - - - if(pars->PPanning == 0) - NoteGlobalPar.Panning = RND; - else - NoteGlobalPar.Panning = pars->PPanning / 128.0f; - - NoteGlobalPar.FilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + pars->PFilterVelocityScale / 127.0f - * 6.0f //velocity sensing - * (VelF(velocity, - pars-> - PFilterVelocityScaleFunction) - 1); - - if(!legato) { - if(pars->PPunchStrength != 0) { - NoteGlobalPar.Punch.Enabled = 1; - NoteGlobalPar.Punch.t = 1.0f; //start from 1.0f and to 0.0f - NoteGlobalPar.Punch.initialvalue = - ((powf(10, 1.5f * pars->PPunchStrength / 127.0f) - 1.0f) - * VelF(velocity, - pars->PPunchVelocitySensing)); - float time = - powf(10, 3.0f * pars->PPunchTime / 127.0f) / 10000.0f; //0.1f .. 100 ms - float stretch = powf(440.0f / freq, pars->PPunchStretch / 64.0f); - NoteGlobalPar.Punch.dt = 1.0f - / (time * synth->samplerate_f * stretch); - } - else - NoteGlobalPar.Punch.Enabled = 0; - - NoteGlobalPar.FreqEnvelope = new Envelope(pars->FreqEnvelope, basefreq); - NoteGlobalPar.FreqLfo = new LFO(pars->FreqLfo, basefreq); - - NoteGlobalPar.AmpEnvelope = new Envelope(pars->AmpEnvelope, basefreq); - NoteGlobalPar.AmpLfo = new LFO(pars->AmpLfo, basefreq); - } - - NoteGlobalPar.Volume = 4.0f - * powf(0.1f, 3.0f * (1.0f - pars->PVolume / 96.0f)) //-60 dB .. 0 dB - * VelF(velocity, pars->PAmpVelocityScaleFunction); //velocity sensing - - NoteGlobalPar.AmpEnvelope->envout_dB(); //discard the first envelope output - globaloldamplitude = globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope-> - envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - if(!legato) { - NoteGlobalPar.GlobalFilterL = Filter::generate(pars->GlobalFilter); - NoteGlobalPar.GlobalFilterR = Filter::generate(pars->GlobalFilter); - - NoteGlobalPar.FilterEnvelope = new Envelope(pars->FilterEnvelope, - basefreq); - NoteGlobalPar.FilterLfo = new LFO(pars->FilterLfo, basefreq); - } - NoteGlobalPar.FilterQ = pars->GlobalFilter->getq(); - NoteGlobalPar.FilterFreqTracking = pars->GlobalFilter->getfreqtracking( - basefreq); - - if(pars->sample[nsample].smp == NULL) { - finished_ = true; - return; - } -} - -void PADnote::legatonote(float freq, - float velocity, - int portamento_, - int midinote, - bool externcall) -{ - // Manage legato stuff - if(legato.update(freq, velocity, portamento_, midinote, externcall)) - return; - - setup(freq, velocity, portamento_, midinote, true); -} - - -PADnote::~PADnote() -{ - delete (NoteGlobalPar.FreqEnvelope); - delete (NoteGlobalPar.FreqLfo); - delete (NoteGlobalPar.AmpEnvelope); - delete (NoteGlobalPar.AmpLfo); - delete (NoteGlobalPar.GlobalFilterL); - delete (NoteGlobalPar.GlobalFilterR); - delete (NoteGlobalPar.FilterEnvelope); - delete (NoteGlobalPar.FilterLfo); -} - - -inline void PADnote::fadein(float *smps) -{ - int zerocrossings = 0; - for(int i = 1; i < synth->buffersize; ++i) - if((smps[i - 1] < 0.0f) && (smps[i] > 0.0f)) - zerocrossings++; //this is only the possitive crossings - - float tmp = (synth->buffersize_f - 1.0f) / (zerocrossings + 1) / 3.0f; - if(tmp < 8.0f) - tmp = 8.0f; - - int n; - F2I(tmp, n); //how many samples is the fade-in - if(n > synth->buffersize) - n = synth->buffersize; - for(int i = 0; i < n; ++i) { //fade-in - float tmp = 0.5f - cosf((float)i / (float) n * PI) * 0.5f; - smps[i] *= tmp; - } -} - - -void PADnote::computecurrentparameters() -{ - float globalpitch, globalfilterpitch; - globalpitch = 0.01f * (NoteGlobalPar.FreqEnvelope->envout() - + NoteGlobalPar.FreqLfo->lfoout() - * ctl->modwheel.relmod + NoteGlobalPar.Detune); - globaloldamplitude = globalnewamplitude; - globalnewamplitude = NoteGlobalPar.Volume - * NoteGlobalPar.AmpEnvelope->envout_dB() - * NoteGlobalPar.AmpLfo->amplfoout(); - - globalfilterpitch = NoteGlobalPar.FilterEnvelope->envout() - + NoteGlobalPar.FilterLfo->lfoout() - + NoteGlobalPar.FilterCenterPitch; - - float tmpfilterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + NoteGlobalPar.FilterFreqTracking; - - tmpfilterfreq = Filter::getrealfreq(tmpfilterfreq); - - float globalfilterq = NoteGlobalPar.FilterQ * ctl->filterq.relq; - NoteGlobalPar.GlobalFilterL->setfreq_and_q(tmpfilterfreq, globalfilterq); - NoteGlobalPar.GlobalFilterR->setfreq_and_q(tmpfilterfreq, globalfilterq); - - //compute the portamento, if it is used by this note - float portamentofreqrap = 1.0f; - if(portamento != 0) { //this voice use portamento - portamentofreqrap = ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - ; - } - - realfreq = basefreq * portamentofreqrap - * powf(2.0f, globalpitch / 12.0f) * ctl->pitchwheel.relfreq; -} - - -int PADnote::Compute_Linear(float *outl, - float *outr, - int freqhi, - float freqlo) -{ - float *smps = pars->sample[nsample].smp; - if(smps == NULL) { - finished_ = true; - return 1; - } - int size = pars->sample[nsample].size; - for(int i = 0; i < synth->buffersize; ++i) { - poshi_l += freqhi; - poshi_r += freqhi; - poslo += freqlo; - if(poslo >= 1.0f) { - poshi_l += 1; - poshi_r += 1; - poslo -= 1.0f; - } - if(poshi_l >= size) - poshi_l %= size; - if(poshi_r >= size) - poshi_r %= size; - - outl[i] = smps[poshi_l] * (1.0f - poslo) + smps[poshi_l + 1] * poslo; - outr[i] = smps[poshi_r] * (1.0f - poslo) + smps[poshi_r + 1] * poslo; - } - return 1; -} -int PADnote::Compute_Cubic(float *outl, - float *outr, - int freqhi, - float freqlo) -{ - float *smps = pars->sample[nsample].smp; - if(smps == NULL) { - finished_ = true; - return 1; - } - int size = pars->sample[nsample].size; - float xm1, x0, x1, x2, a, b, c; - for(int i = 0; i < synth->buffersize; ++i) { - poshi_l += freqhi; - poshi_r += freqhi; - poslo += freqlo; - if(poslo >= 1.0f) { - poshi_l += 1; - poshi_r += 1; - poslo -= 1.0f; - } - if(poshi_l >= size) - poshi_l %= size; - if(poshi_r >= size) - poshi_r %= size; - - - //left - xm1 = smps[poshi_l]; - x0 = smps[poshi_l + 1]; - x1 = smps[poshi_l + 2]; - x2 = smps[poshi_l + 3]; - a = (3.0f * (x0 - x1) - xm1 + x2) * 0.5f; - b = 2.0f * x1 + xm1 - (5.0f * x0 + x2) * 0.5f; - c = (x1 - xm1) * 0.5f; - outl[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; - //right - xm1 = smps[poshi_r]; - x0 = smps[poshi_r + 1]; - x1 = smps[poshi_r + 2]; - x2 = smps[poshi_r + 3]; - a = (3.0f * (x0 - x1) - xm1 + x2) * 0.5f; - b = 2.0f * x1 + xm1 - (5.0f * x0 + x2) * 0.5f; - c = (x1 - xm1) * 0.5f; - outr[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; - } - return 1; -} - - -int PADnote::noteout(float *outl, float *outr) -{ - computecurrentparameters(); - float *smps = pars->sample[nsample].smp; - if(smps == NULL) { - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] = 0.0f; - outr[i] = 0.0f; - } - return 1; - } - float smpfreq = pars->sample[nsample].basefreq; - - - float freqrap = realfreq / smpfreq; - int freqhi = (int) (floor(freqrap)); - float freqlo = freqrap - floor(freqrap); - - - if(config.cfg.Interpolation) - Compute_Cubic(outl, outr, freqhi, freqlo); - else - Compute_Linear(outl, outr, freqhi, freqlo); - - - if(firsttime) { - fadein(outl); - fadein(outr); - firsttime = false; - } - - NoteGlobalPar.GlobalFilterL->filterout(outl); - NoteGlobalPar.GlobalFilterR->filterout(outr); - - //Apply the punch - if(NoteGlobalPar.Punch.Enabled != 0) - for(int i = 0; i < synth->buffersize; ++i) { - float punchamp = NoteGlobalPar.Punch.initialvalue - * NoteGlobalPar.Punch.t + 1.0f; - outl[i] *= punchamp; - outr[i] *= punchamp; - NoteGlobalPar.Punch.t -= NoteGlobalPar.Punch.dt; - if(NoteGlobalPar.Punch.t < 0.0f) { - NoteGlobalPar.Punch.Enabled = 0; - break; - } - } - - if(ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude, globalnewamplitude)) - // Amplitude Interpolation - for(int i = 0; i < synth->buffersize; ++i) { - float tmpvol = INTERPOLATE_AMPLITUDE(globaloldamplitude, - globalnewamplitude, - i, - synth->buffersize); - outl[i] *= tmpvol * NoteGlobalPar.Panning; - outr[i] *= tmpvol * (1.0f - NoteGlobalPar.Panning); - } - else - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] *= globalnewamplitude * NoteGlobalPar.Panning; - outr[i] *= globalnewamplitude * (1.0f - NoteGlobalPar.Panning); - } - - - // Apply legato-specific sound signal modifications - legato.apply(*this, outl, outr); - - // Check if the global amplitude is finished. - // If it does, disable the note - if(NoteGlobalPar.AmpEnvelope->finished() != 0) { - for(int i = 0; i < synth->buffersize; ++i) { //fade-out - float tmp = 1.0f - (float)i / synth->buffersize_f; - outl[i] *= tmp; - outr[i] *= tmp; - } - finished_ = 1; - } - - return 1; -} - -int PADnote::finished() const -{ - return finished_; -} - -void PADnote::relasekey() -{ - NoteGlobalPar.FreqEnvelope->relasekey(); - NoteGlobalPar.FilterEnvelope->relasekey(); - NoteGlobalPar.AmpEnvelope->relasekey(); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.h deleted file mode 100644 index f401996727c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/PADnote.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PADnote.h - The "pad" synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PAD_NOTE_H -#define PAD_NOTE_H - -#include "SynthNote.h" -#include "../globals.h" -#include "../Params/PADnoteParameters.h" -#include "../Params/Controller.h" -#include "Envelope.h" -#include "LFO.h" -#include "../Params/Controller.h" - -/**The "pad" synthesizer*/ -class PADnote:public SynthNote -{ - public: - PADnote(PADnoteParameters *parameters, - Controller *ctl_, - float freq, - float velocity, - int portamento_, - int midinote, - bool besilent); - ~PADnote(); - - void legatonote(float freq, float velocity, int portamento_, - int midinote, bool externcall); - - int noteout(float *outl, float *outr); - int finished() const; - void relasekey(); - private: - void setup(float freq, float velocity, int portamento_, - int midinote, bool legato = false); - void fadein(float *smps); - void computecurrentparameters(); - bool finished_; - PADnoteParameters *pars; - - int poshi_l, poshi_r; - float poslo; - - float basefreq; - bool firsttime, released; - - int nsample, portamento; - - int Compute_Linear(float *outl, - float *outr, - int freqhi, - float freqlo); - int Compute_Cubic(float *outl, - float *outr, - int freqhi, - float freqlo); - - - struct { - /****************************************** - * FREQUENCY GLOBAL PARAMETERS * - ******************************************/ - float Detune; //cents - - Envelope *FreqEnvelope; - LFO *FreqLfo; - - /******************************************** - * AMPLITUDE GLOBAL PARAMETERS * - ********************************************/ - float Volume; // [ 0 .. 1 ] - - float Panning; // [ 0 .. 1 ] - - Envelope *AmpEnvelope; - LFO *AmpLfo; - - struct { - int Enabled; - float initialvalue, dt, t; - } Punch; - - /****************************************** - * FILTER GLOBAL PARAMETERS * - ******************************************/ - class Filter * GlobalFilterL, *GlobalFilterR; - - float FilterCenterPitch; //octaves - float FilterQ; - float FilterFreqTracking; - - Envelope *FilterEnvelope; - - LFO *FilterLfo; - } NoteGlobalPar; - - - float globaloldamplitude, globalnewamplitude, velocity, realfreq; - Controller *ctl; -}; - - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.cpp deleted file mode 100644 index 4eb4e019757..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Resonance.cpp - Resonance - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include "Resonance.h" - -Resonance::Resonance():Presets() -{ - setpresettype("Presonance"); - defaults(); -} - -Resonance::~Resonance() -{} - - -void Resonance::defaults() -{ - Penabled = 0; - PmaxdB = 20; - Pcenterfreq = 64; //1 kHz - Poctavesfreq = 64; - Pprotectthefundamental = 0; - ctlcenter = 1.0f; - ctlbw = 1.0f; - for(int i = 0; i < N_RES_POINTS; ++i) - Prespoints[i] = 64; -} - -/* - * Set a point of resonance function with a value - */ -void Resonance::setpoint(int n, unsigned char p) -{ - if((n < 0) || (n >= N_RES_POINTS)) - return; - Prespoints[n] = p; -} - -/* - * Apply the resonance to FFT data - */ -void Resonance::applyres(int n, fft_t *fftdata, float freq) -{ - if(Penabled == 0) - return; //if the resonance is disabled - float sum = 0.0f, - l1 = logf(getfreqx(0.0f) * ctlcenter), - l2 = logf(2.0f) * getoctavesfreq() * ctlbw; - - for(int i = 0; i < N_RES_POINTS; ++i) - if(sum < Prespoints[i]) - sum = Prespoints[i]; - if(sum < 1.0f) - sum = 1.0f; - - for(int i = 1; i < n; ++i) { - float x = (logf(freq * i) - l1) / l2; //compute where the n-th hamonics fits to the graph - if(x < 0.0f) - x = 0.0f; - - x *= N_RES_POINTS; - float dx = x - floor(x); - x = floor(x); - int kx1 = (int)x; - if(kx1 >= N_RES_POINTS) - kx1 = N_RES_POINTS - 1; - int kx2 = kx1 + 1; - if(kx2 >= N_RES_POINTS) - kx2 = N_RES_POINTS - 1; - float y = - (Prespoints[kx1] - * (1.0f - dx) + Prespoints[kx2] * dx) / 127.0f - sum / 127.0f; - - y = powf(10.0f, y * PmaxdB / 20.0f); - - if((Pprotectthefundamental != 0) && (i == 1)) - y = 1.0f; - - fftdata[i] *= y; - } -} - -/* - * Gets the response at the frequency "freq" - */ - -float Resonance::getfreqresponse(float freq) -{ - float l1 = logf(getfreqx(0.0f) * ctlcenter), - l2 = logf(2.0f) * getoctavesfreq() * ctlbw, sum = 0.0f; - - for(int i = 0; i < N_RES_POINTS; ++i) - if(sum < Prespoints[i]) - sum = Prespoints[i]; - if(sum < 1.0f) - sum = 1.0f; - - float x = (logf(freq) - l1) / l2; //compute where the n-th hamonics fits to the graph - if(x < 0.0f) - x = 0.0f; - x *= N_RES_POINTS; - float dx = x - floor(x); - x = floor(x); - int kx1 = (int)x; - if(kx1 >= N_RES_POINTS) - kx1 = N_RES_POINTS - 1; - int kx2 = kx1 + 1; - if(kx2 >= N_RES_POINTS) - kx2 = N_RES_POINTS - 1; - float result = - (Prespoints[kx1] - * (1.0f - dx) + Prespoints[kx2] * dx) / 127.0f - sum / 127.0f; - result = powf(10.0f, result * PmaxdB / 20.0f); - return result; -} - - -/* - * Smooth the resonance function - */ -void Resonance::smooth() -{ - float old = Prespoints[0]; - for(int i = 0; i < N_RES_POINTS; ++i) { - old = old * 0.4f + Prespoints[i] * 0.6f; - Prespoints[i] = (int) old; - } - old = Prespoints[N_RES_POINTS - 1]; - for(int i = N_RES_POINTS - 1; i > 0; i--) { - old = old * 0.4f + Prespoints[i] * 0.6f; - Prespoints[i] = (int) old + 1; - if(Prespoints[i] > 127) - Prespoints[i] = 127; - } -} - -/* - * Randomize the resonance function - */ -void Resonance::randomize(int type) -{ - int r = (int)(RND * 127.0f); - for(int i = 0; i < N_RES_POINTS; ++i) { - Prespoints[i] = r; - if((RND < 0.1f) && (type == 0)) - r = (int)(RND * 127.0f); - if((RND < 0.3f) && (type == 1)) - r = (int)(RND * 127.0f); - if(type == 2) - r = (int)(RND * 127.0f); - } - smooth(); -} - -/* - * Interpolate the peaks - */ -void Resonance::interpolatepeaks(int type) -{ - int x1 = 0, y1 = Prespoints[0]; - for(int i = 1; i < N_RES_POINTS; ++i) - if((Prespoints[i] != 64) || (i + 1 == N_RES_POINTS)) { - int y2 = Prespoints[i]; - for(int k = 0; k < i - x1; ++k) { - float x = (float) k / (i - x1); - if(type == 0) - x = (1 - cosf(x * PI)) * 0.5f; - Prespoints[x1 + k] = (int)(y1 * (1.0f - x) + y2 * x); - } - x1 = i; - y1 = y2; - } -} - -/* - * Get the frequency from x, where x is [0..1]; x is the x coordinate - */ -float Resonance::getfreqx(float x) -{ - if(x > 1.0f) - x = 1.0f; - float octf = powf(2.0f, getoctavesfreq()); - return getcenterfreq() / sqrt(octf) * powf(octf, x); -} - -/* - * Get the x coordinate from frequency (used by the UI) - */ -float Resonance::getfreqpos(float freq) -{ - return (logf(freq) - logf(getfreqx(0.0f))) / logf(2.0f) / getoctavesfreq(); -} - -/* - * Get the center frequency of the resonance graph - */ -float Resonance::getcenterfreq() -{ - return 10000.0f * powf(10, -(1.0f - Pcenterfreq / 127.0f) * 2.0f); -} - -/* - * Get the number of octave that the resonance functions applies to - */ -float Resonance::getoctavesfreq() -{ - return 0.25f + 10.0f * Poctavesfreq / 127.0f; -} - -void Resonance::sendcontroller(MidiControllers ctl, float par) -{ - if(ctl == C_resonance_center) - ctlcenter = par; - else - ctlbw = par; -} - - - - -void Resonance::add2XML(XMLwrapper *xml) -{ - xml->addparbool("enabled", Penabled); - - if((Penabled == 0) && (xml->minimal)) - return; - - xml->addpar("max_db", PmaxdB); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); - xml->addparbool("protect_fundamental_frequency", Pprotectthefundamental); - xml->addpar("resonance_points", N_RES_POINTS); - for(int i = 0; i < N_RES_POINTS; ++i) { - xml->beginbranch("RESPOINT", i); - xml->addpar("val", Prespoints[i]); - xml->endbranch(); - } -} - - -void Resonance::getfromXML(XMLwrapper *xml) -{ - Penabled = xml->getparbool("enabled", Penabled); - - PmaxdB = xml->getpar127("max_db", PmaxdB); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - Pprotectthefundamental = xml->getparbool("protect_fundamental_frequency", - Pprotectthefundamental); - for(int i = 0; i < N_RES_POINTS; ++i) { - if(xml->enterbranch("RESPOINT", i) == 0) - continue; - Prespoints[i] = xml->getpar127("val", Prespoints[i]); - xml->exitbranch(); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.h deleted file mode 100644 index 7778571100e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/Resonance.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Resonance.h - Resonance - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef RESONANCE_H -#define RESONANCE_H - -#include "../globals.h" -#include "../Misc/Util.h" -#include "../Misc/XMLwrapper.h" -#include "../Params/Presets.h" -#include "../DSP/FFTwrapper.h" - -#define N_RES_POINTS 256 - -class Resonance:public Presets -{ - public: - Resonance(); - ~Resonance(); - void setpoint(int n, unsigned char p); - void applyres(int n, fft_t *fftdata, float freq); - void smooth(); - void interpolatepeaks(int type); - void randomize(int type); - - void add2XML(XMLwrapper *xml); - void defaults(); - void getfromXML(XMLwrapper *xml); - - - float getfreqpos(float freq); - float getfreqx(float x); - float getfreqresponse(float freq); - float getcenterfreq(); - float getoctavesfreq(); - void sendcontroller(MidiControllers ctl, float par); - - //parameters - unsigned char Penabled; //if the ressonance is enabled - unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function - unsigned char PmaxdB; //how many dB the signal may be amplified - unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves - unsigned char Pprotectthefundamental; //the fundamental (1-st harmonic) is not damped, even it resonance function is low - - //controllers - float ctlcenter; //center frequency(relative) - float ctlbw; //bandwidth(relative) - - private: -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.cpp deleted file mode 100644 index 6c61447187c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.cpp +++ /dev/null @@ -1,613 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnote.cpp - The "subtractive" synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include -#include -#include "../globals.h" -#include "SUBnote.h" -#include "../Misc/Util.h" - -SUBnote::SUBnote(SUBnoteParameters *parameters, - Controller *ctl_, - float freq, - float velocity, - int portamento_, - int midinote, - bool besilent) - :SynthNote(freq, velocity, portamento_, midinote, besilent) -{ - pars = parameters; - ctl = ctl_; - NoteEnabled = ON; - setup(freq, velocity, portamento_, midinote); -} - -void SUBnote::setup(float freq, - float velocity, - int portamento_, - int midinote, - bool legato) -{ - portamento = portamento_; - NoteEnabled = ON; - volume = powf(0.1f, 3.0f * (1.0f - pars->PVolume / 96.0f)); //-60 dB .. 0 dB - volume *= VelF(velocity, pars->PAmpVelocityScaleFunction); - if(pars->PPanning != 0) - panning = pars->PPanning / 127.0f; - else - panning = RND; - if(!legato) { - numstages = pars->Pnumstages; - stereo = pars->Pstereo; - start = pars->Pstart; - firsttick = 1; - } - int pos[MAX_SUB_HARMONICS]; - - if(pars->Pfixedfreq == 0) - basefreq = freq; - else { - basefreq = 440.0f; - int fixedfreqET = pars->PfixedfreqET; - if(fixedfreqET != 0) { //if the frequency varies according the keyboard note - float tmp = - (midinote - - 69.0f) / 12.0f - * (powf(2.0f, (fixedfreqET - 1) / 63.0f) - 1.0f); - if(fixedfreqET <= 64) - basefreq *= powf(2.0f, tmp); - else - basefreq *= powf(3.0f, tmp); - } - } - float detune = getdetune(pars->PDetuneType, - pars->PCoarseDetune, - pars->PDetune); - basefreq *= powf(2.0f, detune / 1200.0f); //detune -// basefreq*=ctl->pitchwheel.relfreq;//pitch wheel - - //global filter - GlobalFilterCenterPitch = pars->GlobalFilter->getfreq() //center freq - + (pars->PGlobalFilterVelocityScale / 127.0f - * 6.0f) //velocity sensing - * (VelF(velocity, - pars->PGlobalFilterVelocityScaleFunction) - - 1); - - if(!legato) { - GlobalFilterL = NULL; - GlobalFilterR = NULL; - GlobalFilterEnvelope = NULL; - } - - int harmonics = 0; - - //select only harmonics that desire to compute - for(int n = 0; n < MAX_SUB_HARMONICS; ++n) { - if(pars->Phmag[n] == 0) - continue; - pos[harmonics++] = n; - } - if(!legato) - firstnumharmonics = numharmonics = harmonics; - else { - if(harmonics > firstnumharmonics) - numharmonics = firstnumharmonics; - else - numharmonics = harmonics; - } - - - if(numharmonics == 0) { - NoteEnabled = OFF; - return; - } - - - if(!legato) { - lfilter = new bpfilter[numstages * numharmonics]; - if(stereo != 0) - rfilter = new bpfilter[numstages * numharmonics]; - } - - //how much the amplitude is normalised (because the harmonics) - float reduceamp = 0.0f; - - for(int n = 0; n < numharmonics; ++n) { - float freq = basefreq * pars->POvertoneFreqMult[pos[n]]; - overtone_freq[n] = freq; - overtone_rolloff[n] = computerolloff(freq); - - //the bandwidth is not absolute(Hz); it is relative to frequency - float bw = - powf(10, (pars->Pbandwidth - 127.0f) / 127.0f * 4) * numstages; - - //Bandwidth Scale - bw *= powf(1000 / freq, (pars->Pbwscale - 64.0f) / 64.0f * 3.0f); - - //Relative BandWidth - bw *= powf(100, (pars->Phrelbw[pos[n]] - 64.0f) / 64.0f); - - if(bw > 25.0f) - bw = 25.0f; - - //try to keep same amplitude on all freqs and bw. (empirically) - float gain = sqrt(1500.0f / (bw * freq)); - - float hmagnew = 1.0f - pars->Phmag[pos[n]] / 127.0f; - float hgain; - - switch(pars->Phmagtype) { - case 1: - hgain = expf(hmagnew * logf(0.01f)); - break; - case 2: - hgain = expf(hmagnew * logf(0.001f)); - break; - case 3: - hgain = expf(hmagnew * logf(0.0001f)); - break; - case 4: - hgain = expf(hmagnew * logf(0.00001f)); - break; - default: - hgain = 1.0f - hmagnew; - } - gain *= hgain; - reduceamp += hgain; - - for(int nph = 0; nph < numstages; ++nph) { - float amp = 1.0f; - if(nph == 0) - amp = gain; - initfilter(lfilter[nph + n * numstages], freq, bw, amp, hgain); - if(stereo != 0) - initfilter(rfilter[nph + n * numstages], freq, bw, amp, hgain); - } - } - - if(reduceamp < 0.001f) - reduceamp = 1.0f; - volume /= reduceamp; - - oldpitchwheel = 0; - oldbandwidth = 64; - if(!legato) { - if(pars->Pfixedfreq == 0) - initparameters(basefreq); - else - initparameters(basefreq / 440.0f * freq); - } - else { - if(pars->Pfixedfreq == 0) - freq = basefreq; - else - freq *= basefreq / 440.0f; - - if(pars->PGlobalFilterEnabled != 0) { - globalfiltercenterq = pars->GlobalFilter->getq(); - GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking( - basefreq); - } - } - - oldamplitude = newamplitude; -} - -void SUBnote::legatonote(float freq, float velocity, int portamento_, - int midinote, bool externcall) -{ - // Manage legato stuff - if(legato.update(freq, velocity, portamento_, midinote, externcall)) - return; - - setup(freq, velocity, portamento_, midinote, true); -} - -SUBnote::~SUBnote() -{ - if(NoteEnabled != OFF) - KillNote(); -} - -/* - * Kill the note - */ -void SUBnote::KillNote() -{ - if(NoteEnabled != OFF) { - delete [] lfilter; - lfilter = NULL; - if(stereo != 0) - delete [] rfilter; - rfilter = NULL; - delete AmpEnvelope; - delete FreqEnvelope; - delete BandWidthEnvelope; - delete GlobalFilterL; - delete GlobalFilterR; - delete GlobalFilterEnvelope; - NoteEnabled = OFF; - } -} - - -/* - * Compute the filters coefficients - */ -void SUBnote::computefiltercoefs(bpfilter &filter, - float freq, - float bw, - float gain) -{ - if(freq > synth->samplerate_f / 2.0f - 200.0f) - freq = synth->samplerate_f / 2.0f - 200.0f; - - - float omega = 2.0f * PI * freq / synth->samplerate_f; - float sn = sinf(omega); - float cs = cosf(omega); - float alpha = sn * sinh(LOG_2 / 2.0f * bw * omega / sn); - - if(alpha > 1) - alpha = 1; - if(alpha > bw) - alpha = bw; - - filter.b0 = alpha / (1.0f + alpha) * filter.amp * gain; - filter.b2 = -alpha / (1.0f + alpha) * filter.amp * gain; - filter.a1 = -2.0f * cs / (1.0f + alpha); - filter.a2 = (1.0f - alpha) / (1.0f + alpha); -} - - -/* - * Initialise the filters - */ -void SUBnote::initfilter(bpfilter &filter, - float freq, - float bw, - float amp, - float mag) -{ - filter.xn1 = 0.0f; - filter.xn2 = 0.0f; - - if(start == 0) { - filter.yn1 = 0.0f; - filter.yn2 = 0.0f; - } - else { - float a = 0.1f * mag; //empirically - float p = RND * 2.0f * PI; - if(start == 1) - a *= RND; - filter.yn1 = a * cosf(p); - filter.yn2 = a * cosf(p + freq * 2.0f * PI / synth->samplerate_f); - - //correct the error of computation the start amplitude - //at very high frequencies - if(freq > synth->samplerate_f * 0.96f) { - filter.yn1 = 0.0f; - filter.yn2 = 0.0f; - } - } - - filter.amp = amp; - filter.freq = freq; - filter.bw = bw; - computefiltercoefs(filter, freq, bw, 1.0f); -} - -/* - * Do the filtering - */ - -inline void SubFilterA(const float coeff[4], float &src, float work[4]) -{ - work[3] = src*coeff[0]+work[1]*coeff[1]+work[2]*coeff[2]+work[3]*coeff[3]; - work[1] = src; - src = work[3]; -} - -inline void SubFilterB(const float coeff[4], float &src, float work[4]) -{ - work[2] = src*coeff[0]+work[0]*coeff[1]+work[3]*coeff[2]+work[2]*coeff[3]; - work[0] = src; - src = work[2]; -} - -//This dance is designed to minimize unneeded memory operations which can result -//in quite a bit of wasted time -void SUBnote::filter(bpfilter &filter, float *smps) -{ - assert(synth->buffersize % 8 == 0); - float coeff[4] = {filter.b0, filter.b2, -filter.a1, -filter.a2}; - float work[4] = {filter.xn1, filter.xn2, filter.yn1, filter.yn2}; - - for(int i = 0; i < synth->buffersize; i += 8) { - SubFilterA(coeff, smps[i + 0], work); - SubFilterB(coeff, smps[i + 1], work); - SubFilterA(coeff, smps[i + 2], work); - SubFilterB(coeff, smps[i + 3], work); - SubFilterA(coeff, smps[i + 4], work); - SubFilterB(coeff, smps[i + 5], work); - SubFilterA(coeff, smps[i + 6], work); - SubFilterB(coeff, smps[i + 7], work); - } - filter.xn1 = work[0]; - filter.xn2 = work[1]; - filter.yn1 = work[2]; - filter.yn2 = work[3]; -} - -/* - * Init Parameters - */ -void SUBnote::initparameters(float freq) -{ - AmpEnvelope = new Envelope(pars->AmpEnvelope, freq); - if(pars->PFreqEnvelopeEnabled != 0) - FreqEnvelope = new Envelope(pars->FreqEnvelope, freq); - else - FreqEnvelope = NULL; - if(pars->PBandWidthEnvelopeEnabled != 0) - BandWidthEnvelope = new Envelope(pars->BandWidthEnvelope, freq); - else - BandWidthEnvelope = NULL; - if(pars->PGlobalFilterEnabled != 0) { - globalfiltercenterq = pars->GlobalFilter->getq(); - GlobalFilterL = Filter::generate(pars->GlobalFilter); - if(stereo) - GlobalFilterR = Filter::generate(pars->GlobalFilter); - GlobalFilterEnvelope = new Envelope(pars->GlobalFilterEnvelope, - freq); - GlobalFilterFreqTracking = pars->GlobalFilter->getfreqtracking(basefreq); - } - computecurrentparameters(); -} - -/* - * Compute how much to reduce amplitude near nyquist or subaudible frequencies. - */ -float SUBnote::computerolloff(float freq) -{ - const float lower_limit = 10.0f; - const float lower_width = 10.0f; - const float upper_width = 200.0f; - float upper_limit = synth->samplerate / 2.0f; - - if (freq > lower_limit + lower_width && - freq < upper_limit - upper_width) - return 1.0f; - if (freq <= lower_limit || freq >= upper_limit) - return 0.0f; - if (freq <= lower_limit + lower_width) - return (1.0f - cosf(M_PI * (freq - lower_limit) / lower_width)) / 2.0f; - return (1.0f - cosf(M_PI * (freq - upper_limit) / upper_width)) / 2.0f; -} - -/* - * Compute Parameters of SUBnote for each tick - */ -void SUBnote::computecurrentparameters() -{ - if((FreqEnvelope != NULL) || (BandWidthEnvelope != NULL) - || (oldpitchwheel != ctl->pitchwheel.data) - || (oldbandwidth != ctl->bandwidth.data) - || (portamento != 0)) { - float envfreq = 1.0f; - float envbw = 1.0f; - float gain = 1.0f; - - if(FreqEnvelope != NULL) { - envfreq = FreqEnvelope->envout() / 1200; - envfreq = powf(2.0f, envfreq); - } - envfreq *= ctl->pitchwheel.relfreq; //pitch wheel - if(portamento != 0) { //portamento is used - envfreq *= ctl->portamento.freqrap; - if(ctl->portamento.used == 0) //the portamento has finished - portamento = 0; //this note is no longer "portamented" - ; - } - - if(BandWidthEnvelope != NULL) { - envbw = BandWidthEnvelope->envout(); - envbw = powf(2, envbw); - } - envbw *= ctl->bandwidth.relbw; //bandwidth controller - - float tmpgain = 1.0f / sqrt(envbw * envfreq); - - for(int n = 0; n < numharmonics; ++n) { - overtone_rolloff[n] = computerolloff(overtone_freq[n] * envfreq); - } - for(int n = 0; n < numharmonics; ++n) - for(int nph = 0; nph < numstages; ++nph) { - if(nph == 0) - gain = tmpgain; - else - gain = 1.0f; - computefiltercoefs(lfilter[nph + n * numstages], - lfilter[nph + n * numstages].freq * envfreq, - lfilter[nph + n * numstages].bw * envbw, - gain); - } - if(stereo != 0) - for(int n = 0; n < numharmonics; ++n) - for(int nph = 0; nph < numstages; ++nph) { - if(nph == 0) - gain = tmpgain; - else - gain = 1.0f; - computefiltercoefs( - rfilter[nph + n * numstages], - rfilter[nph + n - * numstages].freq * envfreq, - rfilter[nph + n * numstages].bw * envbw, - gain); - } - - - oldbandwidth = ctl->bandwidth.data; - oldpitchwheel = ctl->pitchwheel.data; - } - newamplitude = volume * AmpEnvelope->envout_dB() * 2.0f; - - //Filter - if(GlobalFilterL != NULL) { - float globalfilterpitch = GlobalFilterCenterPitch - + GlobalFilterEnvelope->envout(); - float filterfreq = globalfilterpitch + ctl->filtercutoff.relfreq - + GlobalFilterFreqTracking; - filterfreq = Filter::getrealfreq(filterfreq); - - GlobalFilterL->setfreq_and_q(filterfreq, - globalfiltercenterq * ctl->filterq.relq); - if(GlobalFilterR != NULL) - GlobalFilterR->setfreq_and_q( - filterfreq, - globalfiltercenterq - * ctl->filterq.relq); - } -} - -/* - * Note Output - */ -int SUBnote::noteout(float *outl, float *outr) -{ - memcpy(outl, denormalkillbuf, synth->bufferbytes); - memcpy(outr, denormalkillbuf, synth->bufferbytes); - - if(NoteEnabled == OFF) - return 0; - - float tmprnd[synth->buffersize]; - float tmpsmp[synth->buffersize]; - //left channel - for(int i = 0; i < synth->buffersize; ++i) - tmprnd[i] = RND * 2.0f - 1.0f; - for(int n = 0; n < numharmonics; ++n) { - float rolloff = overtone_rolloff[n]; - memcpy(tmpsmp, tmprnd, synth->bufferbytes); - for(int nph = 0; nph < numstages; ++nph) - filter(lfilter[nph + n * numstages], tmpsmp); - for(int i = 0; i < synth->buffersize; ++i) - outl[i] += tmpsmp[i] * rolloff; - } - - if(GlobalFilterL != NULL) - GlobalFilterL->filterout(&outl[0]); - - //right channel - if(stereo != 0) { - for(int i = 0; i < synth->buffersize; ++i) - tmprnd[i] = RND * 2.0f - 1.0f; - for(int n = 0; n < numharmonics; ++n) { - float rolloff = overtone_rolloff[n]; - memcpy(tmpsmp, tmprnd, synth->bufferbytes); - for(int nph = 0; nph < numstages; ++nph) - filter(rfilter[nph + n * numstages], tmpsmp); - for(int i = 0; i < synth->buffersize; ++i) - outr[i] += tmpsmp[i] * rolloff; - } - if(GlobalFilterR != NULL) - GlobalFilterR->filterout(&outr[0]); - } - else - memcpy(outr, outl, synth->bufferbytes); - - if(firsttick != 0) { - int n = 10; - if(n > synth->buffersize) - n = synth->buffersize; - for(int i = 0; i < n; ++i) { - float ampfadein = 0.5f - 0.5f * cosf( - (float) i / (float) n * PI); - outl[i] *= ampfadein; - outr[i] *= ampfadein; - } - firsttick = 0; - } - - if(ABOVE_AMPLITUDE_THRESHOLD(oldamplitude, newamplitude)) - // Amplitude interpolation - for(int i = 0; i < synth->buffersize; ++i) { - float tmpvol = INTERPOLATE_AMPLITUDE(oldamplitude, - newamplitude, - i, - synth->buffersize); - outl[i] *= tmpvol * panning; - outr[i] *= tmpvol * (1.0f - panning); - } - else - for(int i = 0; i < synth->buffersize; ++i) { - outl[i] *= newamplitude * panning; - outr[i] *= newamplitude * (1.0f - panning); - } - - oldamplitude = newamplitude; - computecurrentparameters(); - - // Apply legato-specific sound signal modifications - legato.apply(*this, outl, outr); - - // Check if the note needs to be computed more - if(AmpEnvelope->finished() != 0) { - for(int i = 0; i < synth->buffersize; ++i) { //fade-out - float tmp = 1.0f - (float)i / synth->buffersize_f; - outl[i] *= tmp; - outr[i] *= tmp; - } - KillNote(); - } - return 1; -} - -/* - * Relase Key (Note Off) - */ -void SUBnote::relasekey() -{ - AmpEnvelope->relasekey(); - if(FreqEnvelope) - FreqEnvelope->relasekey(); - if(BandWidthEnvelope) - BandWidthEnvelope->relasekey(); - if(GlobalFilterEnvelope) - GlobalFilterEnvelope->relasekey(); -} - -/* - * Check if the note is finished - */ -int SUBnote::finished() const -{ - if(NoteEnabled == OFF) - return 1; - else - return 0; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.h deleted file mode 100644 index 87e1e93a26f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SUBnote.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - SUBnote.h - The subtractive synthesizer - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef SUB_NOTE_H -#define SUB_NOTE_H - -#include "SynthNote.h" -#include "../globals.h" -#include "../Params/SUBnoteParameters.h" -#include "../Params/Controller.h" -#include "Envelope.h" -#include "../DSP/Filter.h" - -class SUBnote:public SynthNote -{ - public: - SUBnote(SUBnoteParameters *parameters, Controller *ctl_, float freq, - float velocity, int portamento_, int midinote, bool besilent); - ~SUBnote(); - - void legatonote(float freq, float velocity, int portamento_, - int midinote, bool externcall); - - int noteout(float *outl, float *outr); //note output,return 0 if the note is finished - void relasekey(); - int finished() const; - private: - - void setup(float freq, - float velocity, - int portamento_, - int midinote, - bool legato = false); - void computecurrentparameters(); - void initparameters(float freq); - void KillNote(); - - SUBnoteParameters *pars; - - //parameters - int stereo; - int numstages; //number of stages of filters - int numharmonics; //number of harmonics (after the too higher hamonics are removed) - int firstnumharmonics; //To keep track of the first note's numharmonics value, useful in legato mode. - int start; //how the harmonics start - float basefreq; - float panning; - Envelope *AmpEnvelope; - Envelope *FreqEnvelope; - Envelope *BandWidthEnvelope; - - Filter *GlobalFilterL, *GlobalFilterR; - - Envelope *GlobalFilterEnvelope; - - //internal values - ONOFFTYPE NoteEnabled; - int firsttick, portamento; - float volume, oldamplitude, newamplitude; - - float GlobalFilterCenterPitch; //octaves - float GlobalFilterFreqTracking; - - struct bpfilter { - float freq, bw, amp; //filter parameters - float a1, a2, b0, b2; //filter coefs. b1=0 - float xn1, xn2, yn1, yn2; //filter internal values - }; - - void initfilter(bpfilter &filter, - float freq, - float bw, - float amp, - float mag); - float computerolloff(float freq); - void computefiltercoefs(bpfilter &filter, - float freq, - float bw, - float gain); - inline void filter(bpfilter &filter, float *smps); - - bpfilter *lfilter, *rfilter; - - float overtone_rolloff[MAX_SUB_HARMONICS]; - float overtone_freq[MAX_SUB_HARMONICS]; - - Controller *ctl; - int oldpitchwheel, oldbandwidth; - float globalfiltercenterq; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.cpp deleted file mode 100644 index 578a117339c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "SynthNote.h" -#include "../globals.h" -#include - -SynthNote::SynthNote(float freq, float vel, int port, int note, bool quiet) - :legato(freq, vel, port, note, quiet) -{} - -SynthNote::Legato::Legato(float freq, float vel, int port, - int note, bool quiet) -{ - // Initialise some legato-specific vars - msg = LM_Norm; - fade.length = (int)(synth->samplerate_f * 0.005f); // 0.005f seems ok. - if(fade.length < 1) - fade.length = 1; // (if something's fishy) - fade.step = (1.0f / fade.length); - decounter = -10; - param.freq = freq; - param.vel = vel; - param.portamento = port; - param.midinote = note; - lastfreq = 0.0f; - silent = quiet; -} - -int SynthNote::Legato::update(float freq, float velocity, int portamento_, - int midinote_, bool externcall) -{ - if(externcall) - msg = LM_Norm; - if(msg != LM_CatchUp) { - lastfreq = param.freq; - param.freq = freq; - param.vel = velocity; - param.portamento = portamento_; - param.midinote = midinote_; - if(msg == LM_Norm) { - if(silent) { - fade.m = 0.0f; - msg = LM_FadeIn; - } - else { - fade.m = 1.0f; - msg = LM_FadeOut; - return 1; - } - } - if(msg == LM_ToNorm) - msg = LM_Norm; - } - return 0; -} - -void SynthNote::Legato::apply(SynthNote ¬e, float *outl, float *outr) -{ - if(silent) // Silencer - if(msg != LM_FadeIn) { - memset(outl, 0, synth->bufferbytes); - memset(outr, 0, synth->bufferbytes); - } - switch(msg) { - case LM_CatchUp: // Continue the catch-up... - if(decounter == -10) - decounter = fade.length; - //Yea, could be done without the loop... - for(int i = 0; i < synth->buffersize; ++i) { - decounter--; - if(decounter < 1) { - // Catching-up done, we can finally set - // the note to the actual parameters. - decounter = -10; - msg = LM_ToNorm; - note.legatonote(param.freq, param.vel, param.portamento, - param.midinote, false); - break; - } - } - break; - case LM_FadeIn: // Fade-in - if(decounter == -10) - decounter = fade.length; - silent = false; - for(int i = 0; i < synth->buffersize; ++i) { - decounter--; - if(decounter < 1) { - decounter = -10; - msg = LM_Norm; - break; - } - fade.m += fade.step; - outl[i] *= fade.m; - outr[i] *= fade.m; - } - break; - case LM_FadeOut: // Fade-out, then set the catch-up - if(decounter == -10) - decounter = fade.length; - for(int i = 0; i < synth->buffersize; ++i) { - decounter--; - if(decounter < 1) { - for(int j = i; j < synth->buffersize; ++j) { - outl[j] = 0.0f; - outr[j] = 0.0f; - } - decounter = -10; - silent = true; - // Fading-out done, now set the catch-up : - decounter = fade.length; - msg = LM_CatchUp; - //This freq should make this now silent note to catch-up/resync - //with the heard note for the same length it stayed at the - //previous freq during the fadeout. - float catchupfreq = param.freq * (param.freq / lastfreq); - note.legatonote(catchupfreq, param.vel, param.portamento, - param.midinote, false); - break; - } - fade.m -= fade.step; - outl[i] *= fade.m; - outr[i] *= fade.m; - } - break; - default: - break; - } -} - -void SynthNote::setVelocity(float velocity_) { - legato.setSilent(true); //Let legato.update(...) returns 0. - legatonote(legato.getFreq(), velocity_, - legato.getPortamento(), legato.getMidinote(), true); - legato.setDecounter(0); //avoid chopping sound due fade-in -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.h b/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.h deleted file mode 100644 index 3058e5d3fa3..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Synth/SynthNote.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Note.h - Abstract Base Class for synthesizers - Copyright (C) 2010-2010 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#ifndef SYNTH_NOTE_H -#define SYNTH_NOTE_H -#include "../globals.h" -#include "../Params/FilterParams.h" - -class SynthNote -{ - public: - SynthNote(float freq, float vel, int port, int note, bool quiet); - virtual ~SynthNote() {} - - /**Compute Output Samples - * @return 0 if note is finished*/ - virtual int noteout(float *outl, float *outr) = 0; - - //TODO fix this spelling error [noisey commit] - /**Release the key for the note and start release portion of envelopes.*/ - virtual void relasekey() = 0; - - /**Return if note is finished. - * @return finished=1 unfinished=0*/ - virtual int finished() const = 0; - - virtual void legatonote(float freq, float velocity, - int portamento_, int midinote_, - bool externcall) = 0; - /* For polyphonic aftertouch needed */ - void setVelocity(float velocity_); - protected: - // Legato transitions - class Legato - { - public: - Legato(float freq, float vel, int port, - int note, bool quiet); - - void apply(SynthNote ¬e, float *outl, float *outr); - int update(float freq, float velocity, int portamento_, - int midinote_, bool externalcall); - - private: - bool silent; - float lastfreq; - LegatoMsg msg; - int decounter; - struct { // Fade In/Out vars - int length; - float m, step; - } fade; - struct { // Note parameters - float freq, vel; - int portamento, midinote; - } param; - - public: /* Some get routines for legatonote calls (aftertouch feature)*/ - float getFreq() {return param.freq; } - float getVelocity() {return param.vel; } - int getPortamento() {return param.portamento; } - int getMidinote() {return param.midinote; } - void setSilent(bool silent_) {silent = silent_; } - void setDecounter(int decounter_) {decounter = decounter_; } - } legato; -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/AdNoteTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/AdNoteTest.h deleted file mode 100644 index bd66704e0c5..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/AdNoteTest.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AdNoteTest.h - CxxTest for Synth/ADnote - Copyright (C) 2009-2011 Mark McCurry - Copyright (C) 2009 Harald Hvaal - Authors: Mark McCurry, Harald Hvaal - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#include -#include -#include -#include -#include -#include "../Misc/Master.h" -#include "../Misc/Util.h" -#include "../Synth/ADnote.h" -#include "../Params/Presets.h" -#include "../DSP/FFTwrapper.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - - -class AdNoteTest:public CxxTest::TestSuite -{ - public: - - ADnote *note; - Master *master; - FFTwrapper *fft; - Controller *controller; - unsigned char testnote; - - - float *outR, *outL; - - void setUp() { - //First the sensible settings and variables that have to be set: - synth = new SYNTH_T; - synth->buffersize = 256; - - outL = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outL + i) = 0; - outR = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outR + i) = 0; - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = 0; - - //phew, glad to get thouse out of my way. took me a lot of sweat and gdb to get this far... - - fft = new FFTwrapper(synth->oscilsize); - //prepare the default settings - ADnoteParameters *defaultPreset = new ADnoteParameters(fft); - - //Assert defaults - TS_ASSERT(!defaultPreset->VoicePar[1].Enabled); - - XMLwrapper *wrap = new XMLwrapper(); - cout << string(SOURCE_DIR) + string("/guitar-adnote.xmz") - << endl; - wrap->loadXMLfile(string(SOURCE_DIR) - + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 0)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS")); - defaultPreset->getfromXML(wrap); - //defaultPreset->defaults(); - - //verify xml was loaded - TS_ASSERT(defaultPreset->VoicePar[1].Enabled); - - - - controller = new Controller(); - - //lets go with.... 50! as a nice note - testnote = 50; - float freq = 440.0f * powf(2.0f, (testnote - 69.0f) / 12.0f); - - note = new ADnote(defaultPreset, - controller, - freq, - 120, - 0, - testnote, - false); - - delete defaultPreset; - delete wrap; - } - - void willNoteBeRunButIsHereForLinkingReasonsHowsThisForCamelCaseEh() - { - master = new Master(); - } - - void tearDown() { - delete note; - delete controller; - delete fft; - delete [] outL; - delete [] outR; - delete [] denormalkillbuf; - FFT_cleanup(); - delete synth; - } - - void testDefaults() { - int sampleCount = 0; - -//#define WRITE_OUTPUT - -#ifdef WRITE_OUTPUT - ofstream file("adnoteout", ios::out); -#endif - note->noteout(outL, outR); -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - - TS_ASSERT_DELTA(outL[255], 0.254609f, 0.0001f); - - note->relasekey(); - - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.102197f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.111261f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.021375f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], 0.149149f, 0.0001f); - - while(!note->finished()) { - note->noteout(outL, outR); -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - } -#ifdef WRITE_OUTPUT - file.close(); -#endif - - TS_ASSERT_EQUALS(sampleCount, 9472); - } - -#define OUTPUT_PROFILE -#ifdef OUTPUT_PROFILE - void testSpeed() { - const int samps = 15000; - - int t_on = clock(); // timer before calling func - for(int i = 0; i < samps; ++i) - note->noteout(outL, outR); - int t_off = clock(); // timer when func returns - - printf("AdNoteTest: %f seconds for %d Samples to be generated.\n", - (static_cast(t_off - t_on)) / CLOCKS_PER_SEC, samps); - } -#endif -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/CMakeLists.txt deleted file mode 100644 index 373fd40ba1a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -#for tests looking for files stored in the source dir -add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") - -CXXTEST_ADD_TEST(ControllerTest ControllerTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ControllerTest.h) -CXXTEST_ADD_TEST(EchoTest EchoTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/EchoTest.h) -#CXXTEST_ADD_TEST(SampleTest SampleTest.h) -CXXTEST_ADD_TEST(MicrotonalTest MicrotonalTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MicrotonalTest.h) -CXXTEST_ADD_TEST(XMLwrapperTest XMLwrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/XMLwrapperTest.h) -CXXTEST_ADD_TEST(ADnoteTest AdNoteTest.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/AdNoteTest.h) -CXXTEST_ADD_TEST(SUBnoteTest SubNoteTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SubNoteTest.h) -CXXTEST_ADD_TEST(OscilGenTest OscilGenTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/OscilGenTest.h) -CXXTEST_ADD_TEST(RandTest RandTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/RandTest.h) -CXXTEST_ADD_TEST(PADnoteTest PadNoteTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/PadNoteTest.h) -CXXTEST_ADD_TEST(PluginTest PluginTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/PluginTest.h) -CXXTEST_ADD_TEST(UnisonTest UnisonTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/UnisonTest.h) - -#Extra libraries added to make test and full compilation use the same library -#links for quirky compilers -set(test_lib zynaddsubfx_core ${ZLIB_LIBRARY} ${FFTW_LIBRARIES} ${MXML_LIBRARIES} pthread) - -message(STATUS "Linking tests with: ${test_lib}") -target_link_libraries(ADnoteTest ${test_lib}) -target_link_libraries(SUBnoteTest ${test_lib}) -target_link_libraries(ControllerTest ${test_lib}) -target_link_libraries(EchoTest ${test_lib}) -target_link_libraries(MicrotonalTest ${test_lib}) -target_link_libraries(OscilGenTest ${test_lib}) -target_link_libraries(XMLwrapperTest ${test_lib}) -target_link_libraries(RandTest ${test_lib}) -target_link_libraries(PADnoteTest ${test_lib}) -target_link_libraries(PluginTest zynaddsubfx_core zynaddsubfx_nio - ${OS_LIBRARIES} ${AUDIO_LIBRARIES}) -target_link_libraries(UnisonTest ${test_lib}) - diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/ControllerTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/ControllerTest.h deleted file mode 100644 index f9b97046ba2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/ControllerTest.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ControllerTest.h - CxxTest for Params/Controller - Copyright (C) 2009-2011 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include "../Params/Controller.h" -#include "../globals.h" -SYNTH_T *synth; - -class ControllerTest:public CxxTest::TestSuite -{ - public: - void setUp() { - synth = new SYNTH_T; - testCtl = new Controller(); - } - - void tearDown() { - delete testCtl; - delete synth; - } - - - void testPortamentoRange() { - //Initialize portamento - testCtl->setportamento(127); - testCtl->portamento.time = 127; - testCtl->initportamento(40.0f, 400.0f, false); - //Bounds Check - while(testCtl->portamento.used) { - TS_ASSERT((0.0f <= testCtl->portamento.x) - && (testCtl->portamento.x <= 1.0f)); - TS_ASSERT((0.1f <= testCtl->portamento.freqrap) - && (testCtl->portamento.freqrap <= 1.0f)); - testCtl->updateportamento(); - } - TS_ASSERT((0.0f <= testCtl->portamento.x) - && (testCtl->portamento.x <= 1.0f)); - TS_ASSERT((0.1f <= testCtl->portamento.freqrap) - && (testCtl->portamento.freqrap <= 1.0f)); - } - - void testPortamentoValue() { - testCtl->setportamento(127); - testCtl->portamento.time = 127; - testCtl->initportamento(40.0f, 400.0f, false); - int i; - for(i = 0; i < 10; ++i) - testCtl->updateportamento(); - //Assert that the numbers are the same as they were at release - TS_ASSERT_DELTA(testCtl->portamento.x, 0.0290249f, 0.000001f) - TS_ASSERT_DELTA(testCtl->portamento.freqrap, 0.126122f, 0.000001f) - } - - private: - Controller *testCtl; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/EchoTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/EchoTest.h deleted file mode 100644 index c0a295ed62b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/EchoTest.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - EchoTest.h - CxxTest for Effect/Echo - Copyright (C) 2009-2011 Mark McCurry - Copyright (C) 2009 Harald Hvaal - Authors: Mark McCurry, Harald Hvaal - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include -#include -#include "../Effects/Echo.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -class EchoTest:public CxxTest::TestSuite -{ - public: - void setUp() { - synth = new SYNTH_T; - outL = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - outL[i] = 0.0f; - outR = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - outR[i] = 0.0f; - input = new Stereo(new float[synth->buffersize], - new float[synth->buffersize]); - for(int i = 0; i < synth->buffersize; ++i) - input->l[i] = input->r[i] = 0.0f; - testFX = new Echo(true, outL, outR, 44100, 256); - } - - void tearDown() { - delete[] input->r; - delete[] input->l; - delete input; - delete[] outL; - delete[] outR; - delete testFX; - delete synth; - } - - - void testInit() { - //Make sure that the output will be zero at start - //(given a zero input) - testFX->out(*input); - for(int i = 0; i < synth->buffersize; ++i) { - TS_ASSERT_DELTA(outL[i], 0.0f, 0.0001f); - TS_ASSERT_DELTA(outR[i], 0.0f, 0.0001f); - } - } - - void testClear() { - char DELAY = 2; - testFX->changepar(DELAY, 127); - - //flood with high input - for(int i = 0; i < synth->buffersize; ++i) - input->r[i] = input->l[i] = 1.0f; - - for(int i = 0; i < 500; ++i) - testFX->out(*input); - for(int i = 0; i < synth->buffersize; ++i) { - TS_ASSERT_DIFFERS(outL[i], 0.0f); - TS_ASSERT_DIFFERS(outR[i], 0.0f) - } - //After making sure the internal buffer has a nonzero value - //cleanup - //Then get the next output, which should be zereoed out if DELAY - //is large enough - testFX->cleanup(); - testFX->out(*input); - for(int i = 0; i < synth->buffersize; ++i) { - TS_ASSERT_DELTA(outL[i], 0.0f, 0.0001f); - TS_ASSERT_DELTA(outR[i], 0.0f, 0.0001f); - } - } - //Insures that the proper decay occurs with high feedback - void testDecaywFb() { - //flood with high input - for(int i = 0; i < synth->buffersize; ++i) - input->r[i] = input->l[i] = 1.0f; - char FEEDBACK = 5; - testFX->changepar(FEEDBACK, 127); - for(int i = 0; i < 100; ++i) - testFX->out(*input); - for(int i = 0; i < synth->buffersize; ++i) { - TS_ASSERT_DIFFERS(outL[i], 0.0f); - TS_ASSERT_DIFFERS(outR[i], 0.0f) - } - float amp = abs(outL[0] + outR[0]) / 2; - //reset input to zero - for(int i = 0; i < synth->buffersize; ++i) - input->r[i] = input->l[i] = 0.0f; - - //give the echo time to fade based upon zero input and high feedback - for(int i = 0; i < 50; ++i) - testFX->out(*input); - TS_ASSERT_LESS_THAN_EQUALS(abs(outL[0] + outR[0]) / 2, amp); - } - - - private: - Stereo *input; - float *outR, *outL; - Echo *testFX; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/MicrotonalTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/MicrotonalTest.h deleted file mode 100644 index 6ce1ca5242a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/MicrotonalTest.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - MicrotonalTest.h - CxxTest for Misc/Microtonal - Copyright (C) 2009-2012 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include "../Misc/Microtonal.h" -#include -#include -#include -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -class MicrotonalTest:public CxxTest::TestSuite -{ - public: - void setUp() { - synth = new SYNTH_T; - testMicro = new Microtonal(); - } - - void tearDown() { - delete testMicro; - delete synth; - } - - //Verifies that the object is initialized correctly - void testinit() { - TS_ASSERT_EQUALS(testMicro->Pinvertupdown, 0); - TS_ASSERT_EQUALS(testMicro->Pinvertupdowncenter, 60); - TS_ASSERT_EQUALS(testMicro->getoctavesize(), 12); - TS_ASSERT_EQUALS(testMicro->Penabled, 0); - TS_ASSERT_EQUALS(testMicro->PAnote, 69); - TS_ASSERT_EQUALS(testMicro->PAfreq, 440.0f); - TS_ASSERT_EQUALS(testMicro->Pscaleshift, 64); - TS_ASSERT_EQUALS(testMicro->Pfirstkey, 0); - TS_ASSERT_EQUALS(testMicro->Plastkey, 127); - TS_ASSERT_EQUALS(testMicro->Pmiddlenote, 60); - TS_ASSERT_EQUALS(testMicro->Pmapsize, 12); - TS_ASSERT_EQUALS(testMicro->Pmappingenabled, 0); - TS_ASSERT_EQUALS(testMicro->Pglobalfinedetune, 64); - - TS_ASSERT_EQUALS(string((const char *)testMicro->Pname), "12tET"); - TS_ASSERT_EQUALS(string( - (const char *)testMicro->Pcomment), - "Equal Temperament 12 notes per octave"); - - for(int i = 0; i < 128; ++i) - TS_ASSERT_EQUALS(testMicro->Pmapping[i], i); - - TS_ASSERT_DELTA(testMicro->getnotefreq(19, 0), 24.4997f, 0.0001f); - } - - //Tests saving/loading to XML - void testXML() { - //Gah, the XMLwrapper is a twisted maze - testMicro->Penabled = 1; - XMLwrapper xml; - xml.beginbranch("Dummy"); //this should not be needed, but odd behavior - //seems to exist from MICROTONAL being on the - //top of the stack - xml.beginbranch("MICROTONAL"); - testMicro->add2XML(&xml); - xml.endbranch(); - xml.endbranch(); - - char *tmp = xml.getXMLdata(); - Microtonal other; - - other.Penabled = 1; - strcpy((char *)other.Pname, "Myname"); //will be nicer with strings - - TS_ASSERT(*testMicro != other); //sanity check - - TS_ASSERT(xml.enterbranch("Dummy")); - TS_ASSERT(xml.enterbranch("MICROTONAL")); - - other.getfromXML(&xml); - xml.exitbranch(); - xml.exitbranch(); - char *tmpo = xml.getXMLdata(); - - TS_ASSERT(!strcmp(tmp, tmpo)); - free(tmp); - free(tmpo); - } - -#if 0 - /**\todo Test Saving/loading from file*/ - - //Test texttomapping TODO finish - void _testTextToMapping() { - //the mapping is from old documentation for "Intense Diatonic" scale - const char *mapping[12] = - {"0", "x", "1", "x", "2", "3", "x", "4", "x", "5", "x", "6"}; - //for(int i=0;i<20;++i) - // cout << i << ':' << testMicro->getnotefreq(i,0) << endl; - // - // octave size == 7 - // find dead notes - } - //Test texttotunings TODO finish - void _testTextToTunings() { - //the tuning is from old documentation for "Intense Diatonic" scale - const char *tuning[7] = - {"9/8", "5/4", "4/3", "3/2", "5/3", "15/8", "2/1"}; - const int numTunings = 7; - //for(int i=0;i<20;++i) - // cout << i << ':' << testMicro->getnotefreq(i,0) << endl; - // go to middle key and verify the proportions - } - /**\TODO test loading from scl and kbm files*/ -#endif - - private: - Microtonal *testMicro; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/OscilGenTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/OscilGenTest.h deleted file mode 100644 index b0e13b254c1..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/OscilGenTest.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AdNoteTest.h - CxxTest for Synth/OscilGen - Copyright (C) 20011-2012 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include "../Synth/OscilGen.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -class OscilGenTest:public CxxTest::TestSuite -{ - public: - float freq; - float *outR, *outL; - FFTwrapper *fft; - OscilGen *oscil; - - void setUp() { - synth = new SYNTH_T; - //First the sensible settings and variables that have to be set: - synth->buffersize = 256; - synth->oscilsize = 1024; - - outL = new float[synth->oscilsize]; - outR = new float[synth->oscilsize]; - memset(outL, 0, sizeof(float) * synth->oscilsize); - memset(outR, 0, sizeof(float) * synth->oscilsize); - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = 0; - - //prepare the default settings - fft = new FFTwrapper(synth->oscilsize); - oscil = new OscilGen(fft, NULL); - - //Assert defaults [TODO] - - - XMLwrapper *wrap = new XMLwrapper(); - wrap->loadXMLfile(string(SOURCE_DIR) - + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 0)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS")); - TS_ASSERT(wrap->enterbranch("VOICE", 0)); - TS_ASSERT(wrap->enterbranch("OSCIL")); - oscil->getfromXML(wrap); - delete wrap; - - //verify xml was loaded [TODO] - - //lets go with.... 50! as a nice note - const char testnote = 50; - freq = 440.0f * powf(2.0f, (testnote - 69.0f) / 12.0f); - } - - void tearDown() { - delete oscil; - delete fft; - delete[] outL; - delete[] outR; - delete[] denormalkillbuf; - FFT_cleanup(); - delete synth; - } - - //verifies that initialization occurs - void testInit(void) - { - oscil->get(outL, freq); - } - - void testOutput(void) - { - oscil->get(outL, freq); - TS_ASSERT_DELTA(outL[23], -0.044547f, 0.0001f); - TS_ASSERT_DELTA(outL[129], -0.018169f, 0.0001f); - TS_ASSERT_DELTA(outL[586], 0.045647f, 0.0001f); - TS_ASSERT_DELTA(outL[1023], -0.038334f, 0.0001f); - } - - void testSpectrum(void) - { - oscil->getspectrum(synth->oscilsize / 2, outR, 1); - TS_ASSERT_DELTA(outR[0], 350.698059f, 0.0001f); - TS_ASSERT_DELTA(outR[1], 228.889267f, 0.0001f); - TS_ASSERT_DELTA(outR[2], 62.187931f, 0.0001f); - TS_ASSERT_DELTA(outR[3], 22.295225f, 0.0001f); - TS_ASSERT_DELTA(outR[4], 6.942001f, 0.0001f); - TS_ASSERT_DELTA(outR[26], 0.015110f, 0.0001f); - TS_ASSERT_DELTA(outR[47], 0.003425f, 0.0001f); - TS_ASSERT_DELTA(outR[65], 0.001293f, 0.0001f); - } - - //performance testing - void testSpeed() { - const int samps = 15000; - - int t_on = clock(); // timer before calling func - for(int i = 0; i < samps; ++i) - oscil->prepare(); - int t_off = clock(); // timer when func returns - - printf("OscilGenTest: %f seconds for %d prepares.\n", - (static_cast(t_off - t_on)) / CLOCKS_PER_SEC, samps); - - t_on = clock(); // timer before calling func - for(int i = 0; i < samps; ++i) - oscil->get(outL, freq); - t_off = clock(); // timer when func returns - - printf("OscilGenTest: %f seconds for %d gets.\n", - (static_cast(t_off - t_on)) / CLOCKS_PER_SEC, samps); - } -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PadNoteTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PadNoteTest.h deleted file mode 100644 index 086efcdf03d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PadNoteTest.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PadNoteTest.h - CxxTest for Synth/PADnote - Copyright (C) 20012 zco - Author: zco - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -//Based Upon AdNoteTest.h and SubNoteTest.h -#include -#include -#include -#include -#include -#include "../Misc/Master.h" -#include "../Misc/Util.h" -#include "../Synth/PADnote.h" -#include "../Params/Presets.h" -#include "../DSP/FFTwrapper.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -class PadNoteTest:public CxxTest::TestSuite -{ - public: - PADnote *note; - Master *master; - FFTwrapper *fft; - Controller *controller; - unsigned char testnote; - - - float *outR, *outL; - - void setUp() { - synth = new SYNTH_T; - //First the sensible settings and variables that have to be set: - synth->buffersize = 256; - - outL = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outL + i) = 0; - outR = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outR + i) = 0; - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = 0; - - //phew, glad to get thouse out of my way. took me a lot of sweat and gdb to get this far... - - fft = new FFTwrapper(synth->oscilsize); - //prepare the default settings - PADnoteParameters *defaultPreset = new PADnoteParameters(fft,NULL); - - - //Assert defaults - ///TS_ASSERT(!defaultPreset->VoicePar[1].Enabled); - - XMLwrapper *wrap = new XMLwrapper(); - cout << string(SOURCE_DIR) + string("/guitar-adnote.xmz") - << endl; - wrap->loadXMLfile(string(SOURCE_DIR) - + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 2)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("PAD_SYNTH_PARAMETERS")); - defaultPreset->getfromXML(wrap); - - - //defaultPreset->defaults(); - defaultPreset->applyparameters(false); - - //verify xml was loaded - ///TS_ASSERT(defaultPreset->VoicePar[1].Enabled); - - - - controller = new Controller(); - - //lets go with.... 50! as a nice note - testnote = 50; - float freq = 440.0f * powf(2.0f, (testnote - 69.0f) / 12.0f); - - note = new PADnote(defaultPreset, - controller, - freq, - 120, - 0, - testnote, - false); - - //delete defaultPreset; - delete wrap; - } - - void willNoteBeRunButIsHereForLinkingReasonsHowsThisForCamelCaseEh() - { - master = new Master(); - } - - void tearDown() { - delete note; - delete controller; - delete fft; - delete [] outL; - delete [] outR; - delete [] denormalkillbuf; - FFT_cleanup(); - delete synth; - } - - void testDefaults() { - int sampleCount = 0; - - -//#define WRITE_OUTPUT - -#ifdef WRITE_OUTPUT - ofstream file("padnoteout", ios::out); -#endif - note->noteout(outL, outR); - -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - - TS_ASSERT_DELTA(outL[255], 0.0660f, 0.0001f); - - - note->relasekey(); - - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.0729f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], 0.060818f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], 0.036895f, 0.0005f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.006623f, 0.0001f); - - while(!note->finished()) { - note->noteout(outL, outR); - -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - } -#ifdef WRITE_OUTPUT - file.close(); -#endif - - TS_ASSERT_EQUALS(sampleCount, 2304); - } - -#define OUTPUT_PROFILE -#ifdef OUTPUT_PROFILE - void testSpeed() { - const int samps = 15000; - - int t_on = clock(); // timer before calling func - for(int i = 0; i < samps; ++i) - note->noteout(outL, outR); - int t_off = clock(); // timer when func returns - - printf("PadNoteTest: %f seconds for %d Samples to be generated.\n", - (static_cast(t_off - t_on)) / CLOCKS_PER_SEC, samps); - } -#endif -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PluginTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PluginTest.h deleted file mode 100644 index b88e9ba404a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/PluginTest.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - PluginTest.h - CxxTest for embedding zyn - Copyright (C) 2013-2013 Mark McCurry - Authors: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include -#include -#include -#include -#include "../Misc/Master.h" -#include "../Misc/Util.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -char *instance_name=(char*)""; - -class PluginTest:public CxxTest::TestSuite -{ - public: - void setUp() { - synth = new SYNTH_T; - synth->buffersize = 256; - synth->samplerate = 48000; - synth->alias(); - - outL = new float[1024]; - for(int i = 0; i < synth->buffersize; ++i) - outL[i] = 0.0f; - outR = new float[1024]; - for(int i = 0; i < synth->buffersize; ++i) - outR[i] = 0.0f; - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = 0; - - for(int i = 0; i < 16; ++i) - master[i] = new Master(); - } - - void tearDown() { - for(int i = 0; i < 16; ++i) - delete master[i]; - - delete[] outL; - delete[] outR; - delete synth; - } - - - void testInit() { - - for(int x=0; x<100; ++x) - for(int i=0; i<16; ++i) - master[i]->GetAudioOutSamples(rand()%1025, - synth->samplerate, outL, outR); - } - - void testPanic() - { - master[0]->setController(0, 0x64, 0); - master[0]->noteOn(0,64,64); - master[0]->AudioOut(outL, outR); - - float sum = 0.0f; - for(int i = 0; i < synth->buffersize; ++i) - sum += fabs(outL[i]); - - TS_ASSERT_LESS_THAN(0.1f, sum); - } - - string loadfile(string fname) const - { - std::ifstream t(fname.c_str()); - std::string str((std::istreambuf_iterator(t)), - std::istreambuf_iterator()); - return str; - } - - - void testLoadSave(void) - { - const string fname = string(SOURCE_DIR) + "/guitar-adnote.xmz"; - const string fdata = string("\n") + loadfile(fname); - char *result = NULL; - master[0]->putalldata((char*)fdata.c_str(), fdata.length()); - int res = master[0]->getalldata(&result); - - TS_ASSERT_EQUALS(fdata.length()+1, res); - TS_ASSERT(fdata == result); - } - - - private: - float *outR, *outL; - Master *master[16]; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/RandTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/RandTest.h deleted file mode 100644 index 2a51e952c88..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/RandTest.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - RandTest.h - CxxTest for Pseudo-Random Number Generator - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "../Misc/Util.h" -SYNTH_T *synth; - -#include -#include -#include - -class RandTest:public CxxTest::TestSuite -{ - public: - void testPRNG(void) { - //verify RND returns expected pattern when unseeded - TS_ASSERT_DELTA(RND, 0.607781, 0.00001); - TS_ASSERT_DELTA(RND, 0.591761, 0.00001); - TS_ASSERT_DELTA(RND, 0.186133, 0.00001); - TS_ASSERT_DELTA(RND, 0.286319, 0.00001); - TS_ASSERT_DELTA(RND, 0.511766, 0.00001); - } -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/SubNoteTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/SubNoteTest.h deleted file mode 100644 index e5cefd860b3..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/SubNoteTest.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AdNoteTest.h - CxxTest for Synth/SUBnote - Copyright (C) 2009-2011 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -//Based Upon AdNoteTest.h -#include -#include -#include -#include -#include -#include "../Misc/Master.h" -#include "../Misc/Util.h" -#include "../Synth/SUBnote.h" -#include "../Params/Presets.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - -class SubNoteTest:public CxxTest::TestSuite -{ - public: - - SUBnote *note; - Master *master; - Controller *controller; - unsigned char testnote; - - - float *outR, *outL; - - void setUp() { - synth = new SYNTH_T; - //First the sensible settings and variables that have to be set: - synth->buffersize = 256; - - outL = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outL + i) = 0; - outR = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - *(outR + i) = 0; - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = 0; - - //prepare the default settings - SUBnoteParameters *defaultPreset = new SUBnoteParameters(); - XMLwrapper *wrap = new XMLwrapper(); - wrap->loadXMLfile(string(SOURCE_DIR) - + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 1)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("SUB_SYNTH_PARAMETERS")); - defaultPreset->getfromXML(wrap); - - controller = new Controller(); - - //lets go with.... 50! as a nice note - testnote = 50; - float freq = 440.0f * powf(2.0f, (testnote - 69.0f) / 12.0f); - - note = new SUBnote(defaultPreset, - controller, - freq, - 120, - 0, - testnote, - false); - delete wrap; - delete defaultPreset; - } - - void willNoteBeRunButIsHereForLinkingReasonsHowsThisForCamelCaseEh() - { - master = new Master(); - } - - void tearDown() { - delete controller; - delete note; - delete [] outL; - delete [] outR; - delete [] denormalkillbuf; - delete synth; - } - - void testDefaults() { - //Note: if these tests fail it is due to the relationship between - //global.h::RND and SUBnote.cpp - - int sampleCount = 0; - -//#define WRITE_OUTPUT - -#ifdef WRITE_OUTPUT - ofstream file("subnoteout", ios::out); -#endif - note->noteout(outL, outR); -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - - TS_ASSERT_DELTA(outL[255], 0.0000f, 0.0001f); - - note->relasekey(); - - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], 0.0016f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.0000f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.0013f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.0002f, 0.0001f); - - while(!note->finished()) { - note->noteout(outL, outR); -#ifdef WRITE_OUTPUT - for(int i = 0; i < synth->buffersize; ++i) - file << outL[i] << std::endl; - -#endif - sampleCount += synth->buffersize; - } -#ifdef WRITE_OUTPUT - file.close(); -#endif - - TS_ASSERT_EQUALS(sampleCount, 2304); - } - -#define OUTPUT_PROFILE -#ifdef OUTPUT_PROFILE - void testSpeed() { - const int samps = 15000; - - int t_on = clock(); // timer before calling func - for(int i = 0; i < samps; ++i) - note->noteout(outL, outR); - int t_off = clock(); // timer when func returns - - printf("SubNoteTest: %f seconds for %d Samples to be generated.\n", - (static_cast(t_off - t_on)) / CLOCKS_PER_SEC, samps); - } -#endif -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/UnisonTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/UnisonTest.h deleted file mode 100644 index 86635004c2f..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/UnisonTest.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - AdNoteTest.h - CxxTest for Synth/ADnote - Copyright (C) 2009-2011 Mark McCurry - Copyright (C) 2009 Harald Hvaal - Authors: Mark McCurry, Harald Hvaal - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#include -#include -#include -#include -#include -#include "../Misc/Util.h" -#include "../Synth/ADnote.h" -#include "../Synth/OscilGen.h" -#include "../Params/Presets.h" -#include "../DSP/FFTwrapper.h" -#include "../globals.h" -SYNTH_T *synth; - -using namespace std; - - -#define BUF 256 -class AdNoteTest:public CxxTest::TestSuite -{ - public: - - ADnote *note; - FFTwrapper *fft; - Controller *controller; - unsigned char testnote; - ADnoteParameters *params; - float freq; - - - float outR[BUF], outL[BUF]; - - void setUp() { - //First the sensible settings and variables that have to be set: - synth = new SYNTH_T; - synth->buffersize = BUF; - - memset(outL,0,sizeof(outL)); - memset(outR,0,sizeof(outR)); - - //next the bad global variables that for some reason have not been properly placed in some - //initialization routine, but rather exist as cryptic oneliners in main.cpp: - denormalkillbuf = new float[BUF]; - memset(denormalkillbuf, 0, sizeof(float)*BUF); - - fft = new FFTwrapper(BUF); - //prepare the default settings - params = new ADnoteParameters(fft); - - //sawtooth to make things a bit more interesting - params->VoicePar[0].OscilSmp->Pcurrentbasefunc = 3; - - controller = new Controller(); - - //lets go with.... 50! as a nice note - testnote = 50; - freq = 440.0f * powf(2.0f, (testnote - 69.0f) / 12.0f); - - } - - void tearDown() { - delete note; - delete controller; - delete fft; - delete [] denormalkillbuf; - FFT_cleanup(); - delete synth; - delete params; - } - - void run_test(int a, int b, int c, int d, int e, int f, float values[4]) - { - sprng(0); - params->set_unison_size_index(0,a); - params->VoicePar[0].Unison_frequency_spread = b; - params->VoicePar[0].Unison_stereo_spread = c; - params->VoicePar[0].Unison_vibratto = d; - params->VoicePar[0].Unison_vibratto_speed = e; - params->VoicePar[0].Unison_invert_phase = f; - - note = new ADnote(params, controller, freq, 120, 0, testnote, false); - note->noteout(outL, outR); - TS_ASSERT_DELTA(outL[80], values[0], 1e-5); - //printf("{%f,", outL[80]); - note->noteout(outL, outR); - TS_ASSERT_DELTA(outR[90], values[1], 1e-5); - //printf("%f,", outR[90]); - note->noteout(outL, outR); - TS_ASSERT_DELTA(outL[20], values[2], 1e-5); - //printf("%f,", outL[20]); - note->noteout(outL, outR); - TS_ASSERT_DELTA(outR[200], values[3], 1e-5); - //printf("%f},\n", outR[200]); - } - - void testUnison() { - sprng(0xbeef); - - float data[][4] = { - {-0.034547,0.034349,-0.000000,0.138284}, - {0.023612,-0.093842,0.000000,-0.040384}, - {-0.015980,0.001871,-0.014463,-0.000726}, - {-0.040970,-0.000275,0.000000,-0.121016}, - {0.019250,-0.045252,0.000270,0.105372}, - {-0.086575,0.001130,-0.018921,0.001329}, - {0.009203,-0.006176,0.017344,-0.003316}, - {0.029411,-0.000248,-0.112797,-0.012883}, - {0.043657,-0.014062,-0.003374,-0.071821}, - {0.007973,0.068019,-0.038900,0.047639}, - {-0.002055,0.011170,-0.058152,-0.043493}, - {-0.005298,0.000605,-0.070932,-0.005678}, - {0.025028,-0.027742,0.020985,-0.015417}, - {0.074349,0.000640,0.080613,0.066636}, - {-0.045721,0.000279,0.009819,0.032202}, - }; - - int freq_spread[15]; - int stereo_spread[15]; - int vibrato[15]; - int vibrato_speed[15]; - int inv_phase[15]; - for(int i=0; i<15; ++i) - { - freq_spread[i] = prng()%0x7f; - stereo_spread[i] = prng()%0x7f; - vibrato[i] = prng()%0x7f; - vibrato_speed[i] = prng()%0x7f; - inv_phase[i] = prng()%5; - } - - for(int i=0; i<15; ++i) - { - run_test(i, freq_spread[i], stereo_spread[i], - vibrato[i], vibrato_speed[i], inv_phase[i], data[i]); - } -#if 0 - int sampleCount = 0; - - sampleCount += synth->buffersize; - - TS_ASSERT_DELTA(outL[255], 0.254609f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.102197f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.111422f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], -0.021375f, 0.0001f); - - note->noteout(outL, outR); - sampleCount += synth->buffersize; - TS_ASSERT_DELTA(outL[255], 0.149882f, 0.0001f); -#endif - } -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/XMLwrapperTest.h b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/XMLwrapperTest.h deleted file mode 100644 index bf31ae085b2..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/XMLwrapperTest.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapperTest.h - CxxTest for Misc/XMLwrapper - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include "../Misc/XMLwrapper.h" -#include -#include "../globals.h" -SYNTH_T *synth; -using namespace std; - -class XMLwrapperTest:public CxxTest::TestSuite -{ - public: - void setUp() { - xmla = new XMLwrapper; - xmlb = new XMLwrapper; - } - - - void testAddPar() { - xmla->addpar("my Pa*_ramet@er", 75); - TS_ASSERT_EQUALS(xmla->getpar("my Pa*_ramet@er", 0, -200, 200), 75); - } - - //here to verify that no leaks occur - void testLoad() { - string location = string(SOURCE_DIR) + string( - "/Tests/guitar-adnote.xmz"); - xmla->loadXMLfile(location); - } - - void testAnotherLoad() - { - string dat = - "\n\n\ -\n\ -\n\ -\n"; - xmlb->putXMLdata(dat.c_str()); - } - - void tearDown() { - delete xmla; - delete xmlb; - } - - - private: - XMLwrapper *xmla; - XMLwrapper *xmlb; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/guitar-adnote.xmz b/plugins/zynaddsubfx/zynaddsubfx/src/Tests/guitar-adnote.xmz deleted file mode 100644 index 595a770c291..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/Tests/guitar-adnote.xmz +++ /dev/null @@ -1,3842 +0,0 @@ - - - - - - - - - - - - - - - - - - - -12tET -Equal Temperament 12 notes per octave - - - - - - - - - - - - - - - - - - - - - - - -Dist Guitar 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ADnoteUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/ADnoteUI.fl deleted file mode 100644 index 1a21cb18fbf..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ADnoteUI.fl +++ /dev/null @@ -1,1169 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "../Params/ADnoteParameters.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "OscilGenUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class ADvoicelistitem {open : {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window ADnoteVoiceListItem {open - private xywh {262 736 615 100} type Double box UP_FRAME - class Fl_Group visible - } { - Fl_Group voicelistitemgroup { - private xywh {50 0 570 25} - code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} - } { - Fl_Value_Slider voicevolume { - callback {pars->VoicePar[nvoice].PVolume=(int)o->value();} - tooltip Volume xywh {90 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PVolume);} - } - Fl_Check_Button voiceresonanceenabled { - callback {pars->VoicePar[nvoice].Presonance=(int)o->value();} - tooltip {Resonance On/Off} xywh {245 7 15 17} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 11 align 4 - code0 {o->value(pars->VoicePar[nvoice].Presonance);} - } - Fl_Value_Slider voicelfofreq { - callback {pars->VoicePar[nvoice].FreqLfo->Pintensity=(int)o->value();} - tooltip {Frequency LFO amount} xywh {500 5 115 20} type {Horz Knob} box FLAT_BOX labelsize 8 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].FreqLfo->Pintensity);} - } - Fl_Dial voicepanning { - callback {pars->VoicePar[nvoice].PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {215 5 20 20} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PPanning);} - class WidgetPDial - } - Fl_Group voiceoscil {open - xywh {60 5 30 20} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);} - code2 {if (pars->VoicePar[nvoice].Pextoscil != -1) {osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,master);}} - } {} - Fl_Value_Output detunevalueoutput { - callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - xywh {265 5 45 20} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->VoicePar[nvoice].PDetuneType,0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - } - Fl_Slider voicedetune { - callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {315 5 185 20} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);} - } - Fl_Box noiselabel { - label N - callback {if (pars->VoicePar[nvoice].Type==0) { - o->hide(); - voiceresonanceenabled->activate(); - detunevalueoutput->activate(); - voicedetune->activate(); - voicelfofreq->activate(); - voiceoscil->activate(); -} else { - o->show(); - voiceresonanceenabled->deactivate(); - detunevalueoutput->deactivate(); - voicedetune->deactivate(); - voicelfofreq->deactivate(); - voiceoscil->deactivate(); -};} - xywh {65 5 20 20} labelfont 1 labelsize 13 labelcolor 53 - code0 {if (pars->VoicePar[nvoice].Type==0) o->hide();} - } - } - Fl_Check_Button voiceenabled { - label 01 - callback {pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voicelistitemgroup->deactivate(); -else voicelistitemgroup->activate(); -o->redraw();} - private xywh {30 5 20 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 4 - code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));} - code1 {o->value(pars->VoicePar[nvoice].Enabled);} - } - } - } - Function {ADvoicelistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {nvoice=0; -pars=NULL;} {} - } - Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {} { - code {pars=parameters; -nvoice=nvoice_; -master=master_; -make_window(); -ADnoteVoiceListItem->show(); -end();} {} - } - Function {refreshlist()} {} { - code {voiceenabled->value(pars->VoicePar[nvoice].Enabled); -voiceresonanceenabled->value(pars->VoicePar[nvoice].Presonance); -voicevolume->value(pars->VoicePar[nvoice].PVolume); -voicedetune->value(pars->VoicePar[nvoice].PDetune-8192); -voicepanning->value(pars->VoicePar[nvoice].PPanning); -voicelfofreq->value(pars->VoicePar[nvoice].FreqLfo->Pintensity); -if (pars->VoicePar[nvoice].Pextoscil != -1) { - osc->init(pars->VoicePar[pars->VoicePar[nvoice].Pextoscil].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); -} else - osc->init(pars->VoicePar[nvoice].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master); -if (pars->VoicePar[nvoice].Enabled==0) voicelistitemgroup->deactivate(); - else voicelistitemgroup->activate(); -detunevalueoutput->do_callback(); -noiselabel->do_callback(); -ADnoteVoiceListItem->redraw();} {} - } - Function {~ADvoicelistitem()} {} { - code {ADnoteVoiceListItem->hide(); -//delete(ADnoteVoiceListItem);} {} - } - decl {ADnoteParameters *pars;} {} - decl {int nvoice;} {} - decl {Oscilloscope *osc;} {} - decl {Master *master;} {} -} - -class ADvoiceUI {open : {public Fl_Group} -} { - Function {make_window()} {open - } { - Fl_Window ADnoteVoiceParameters { - label Voice open - xywh {863 89 765 595} type Double box NO_BOX - class Fl_Group visible - } { - Fl_Group voiceparametersgroup {open - xywh {0 0 770 590} color 48 - code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} - } { - Fl_Group voicemodegroup {open - xywh {0 5 770 585} color 64 - } { - Fl_Group voiceFMparametersgroup { - label MODULATOR open - xywh {530 5 230 580} box UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - code0 {if (pars->VoicePar[nvoice].PFMEnabled==0) o->deactivate();} - } { - Fl_Group modfrequency { - label {Mod.FREQUENCY} - xywh {535 220 220 155} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group voiceFMfreqenvgroup { - label {ADSynth Modulator - Frequency Envelope} - xywh {540 300 210 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FMFreqEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMfreqenvgroup->deactivate(); -else voiceFMfreqenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {545 305 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFMFreqEnvelopeEnabled);} - } - Fl_Counter {} { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PFMCoarseDetune = k+ - (pars->VoicePar[nvoice].PFMCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {685 280 60 15} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Counter {} { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PFMCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PFMCoarseDetune%1024;} - tooltip Octave xywh {625 280 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PFMCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Slider {} { - callback {pars->VoicePar[nvoice].PFMDetune=(int)o->value()+8192; -fmdetunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {590 245 155 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMDetune-8192);} - } - Fl_Value_Output fmdetunevalueoutput { - label Detune - callback {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));} - xywh {540 245 45 18} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8 - code0 {o->value(getdetune((pars->VoicePar[nvoice].PFMDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PFMDetuneType),0,pars->VoicePar[nvoice].PFMDetune));} - code1 {//o->value(getdetune(pars->VoicePar[nvoice].PFMDetuneType,0,pars->VoicePar[nvoice].PFMDetune));} - } - Fl_Choice {} { - label {Detune Type} - callback {pars->VoicePar[nvoice].PFMDetuneType=(int) o->value(); -fmdetunevalueoutput->do_callback();} open - xywh {540 280 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->VoicePar[nvoice].PFMDetuneType);} - } {} - } - Fl_Group {} { - label {Mod.AMPLITUDE} - xywh {535 60 220 160} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider {} { - label Vol - callback {pars->VoicePar[nvoice].PFMVolume=(int)o->value();} - tooltip Volume xywh {540 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVolume);} - } - Fl_Value_Slider {} { - label {V.Sns} - callback {pars->VoicePar[nvoice].PFMVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {540 100 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVelocityScaleFunction);} - } - Fl_Group voiceFMampenvgroup { - label {ADSynth Modulator - Amplitude Envelope} open - xywh {540 145 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FMAmpEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceFMampenvgroup->deactivate(); -else voiceFMampenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {545 150 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFMAmpEnvelopeEnabled);} - } - Fl_Value_Slider {} { - label {F.Damp} - callback {pars->VoicePar[nvoice].PFMVolumeDamp=(int) o->value()+64;} - tooltip {Modulator Damp at Higher frequency} xywh {540 120 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 minimum -64 maximum 63 step 1 - code0 {o->value(pars->VoicePar[nvoice].PFMVolumeDamp-64);} - } - } - Fl_Group modoscil {open - xywh {535 365 220 220} - } { - Fl_Group fmoscil {open - xywh {535 440 220 140} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {oscFM=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;} - code2 {oscFM->init(pars->VoicePar[nv].FMSmp,0,pars->VoicePar[nvoice].PFMoscilphase,master);} - } {} - Fl_Box {} { - label {Mod.Oscillator} - xywh {535 375 155 20} labelfont 1 align 20 - } - Fl_Button changeFMoscilbutton { - label Change - callback {if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,NULL,master);} - xywh {700 380 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - code0 {if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE);} - } - Fl_Slider {} { - label Phase - callback {pars->VoicePar[nvoice].PFMoscilphase=64-(int)o->value(); -oscFM->phase=64-(int) o->value(); -fmoscil->redraw();} - xywh {645 415 105 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(64-pars->VoicePar[nvoice].PFMoscilphase);} - } - Fl_Choice {} { - label Use - callback {pars->VoicePar[nvoice].PextFMoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - oscFM->init(pars->VoicePar[(int) o->value()-1].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLUE); -} else { - oscFM->init(pars->VoicePar[nvoice].FMSmp,master); - changeFMoscilbutton->labelcolor(FL_BLACK); -}; -voiceFMparametersgroup->redraw();} open - xywh {560 410 75 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code0 {o->add("Internal");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(pars->VoicePar[nvoice].PextFMoscil+1);} - } {} - } - Fl_Choice {} { - label {External Mod.} - callback {pars->VoicePar[nvoice].PFMVoice=(int)o->value()-1; -if ((int) o->value() != 0) { - modoscil->deactivate(); - modfrequency->deactivate(); -} else { - modoscil->activate(); - modfrequency->activate(); -}; -voiceFMparametersgroup->redraw();} open - xywh {635 40 85 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code2 {o->value(pars->VoicePar[nvoice].PFMVoice+1);} - code3 {if ((int) o->value() != 0) {modoscil->deactivate();modfrequency->deactivate();}} - } {} - } - Fl_Choice {} { - label {Type:} - callback {pars->VoicePar[nvoice].PFMEnabled=(int)o->value(); -if (o->value()==0) voiceFMparametersgroup->deactivate(); -else voiceFMparametersgroup->activate(); -o->redraw();} - xywh {535 40 80 20} down_box BORDER_BOX align 5 - code0 {o->value(pars->VoicePar[nvoice].PFMEnabled);} - } { - MenuItem {} { - label OFF - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label MORPH - xywh {50 50 100 20} labelfont 1 - } - MenuItem {} { - label RING - xywh {60 60 100 20} labelfont 1 - } - MenuItem {} { - label PM - xywh {70 70 100 20} labelfont 1 - } - MenuItem {} { - label FM - xywh {80 80 100 20} labelfont 1 - } - MenuItem {} { - label PITCH - xywh {90 90 100 20} labelfont 1 deactivate - } - } - Fl_Group {} { - label FREQUENCY - xywh {5 265 525 120} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group voicefreqenvgroup { - label {ADSynth Voice - Frequency Envelope} open - xywh {10 305 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FreqEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFreqEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefreqenvgroup->deactivate(); -else voicefreqenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 310 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFreqEnvelopeEnabled);} - } - Fl_Group voicefreqlfogroup { - label {Frequency LFO } open - xywh {220 305 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].FreqLfo);} - code1 {if (pars->VoicePar[nvoice].PFreqLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFreqLfoEnabled=(int)o->value(); -if (o->value()==0) voicefreqlfogroup->deactivate(); -else voicefreqlfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {225 311 55 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFreqLfoEnabled);} - } - Fl_Counter {} { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->VoicePar[nvoice].PCoarseDetune = k*1024+ - pars->VoicePar[nvoice].PCoarseDetune%1024;} - tooltip Octave xywh {470 285 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter {} { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->VoicePar[nvoice].PCoarseDetune = k+ - (pars->VoicePar[nvoice].PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {455 355 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->VoicePar[nvoice].PCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Slider {} { - callback {pars->VoicePar[nvoice].PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {58 287 392 13} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - xywh {10 287 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune((pars->VoicePar[nvoice].PDetuneType==0)?(pars->GlobalPar.PDetuneType) : (pars->VoicePar[nvoice].PDetuneType),0,pars->VoicePar[nvoice].PDetune)*pars->getBandwidthDetuneMultiplier());} - } - Fl_Check_Button {} { - label 440Hz - callback {int x=(int) o->value(); -pars->VoicePar[nvoice].Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {Set the voice base frequency to 440Hz} xywh {345 268 55 15} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->VoicePar[nvoice].PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {405 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PfixedfreqET);} - code1 {if (pars->VoicePar[nvoice].Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - Fl_Choice {} { - label {Detune Type} - callback {pars->VoicePar[nvoice].PDetuneType=(int) o->value(); -detunevalueoutput->do_callback();} open - xywh {455 320 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->VoicePar[nvoice].PDetuneType);} - } {} - } - Fl_Group voiceoscil { - xywh {80 390 445 145} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {int nv=nvoice; if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil;} - code2 {osc->init(pars->VoicePar[nv].OscilSmp,0,pars->VoicePar[nvoice].Poscilphase,master);} - } {} - Fl_Button changevoiceoscilbutton { - label Change - callback {if (oscedit!=NULL) delete(oscedit); - -int nv=nvoice; -if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil; - -oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,NULL,master);} - xywh {5 490 65 20} box THIN_UP_BOX labelfont 1 labelsize 11 - code0 {if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE);} - } - Fl_Box {} { - label {Voice Oscillator} - xywh {5 390 75 35} labelfont 1 labelsize 12 align 128 - } - Fl_Slider {} { - label Phase - callback {pars->VoicePar[nvoice].Poscilphase=64-(int)o->value(); -osc->phase=64-(int) o->value(); -voiceoscil->redraw();} - xywh {10 435 65 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {o->value(64-pars->VoicePar[nvoice].Poscilphase);} - } - Fl_Check_Button {} { - label {R.} - callback {pars->VoicePar[nvoice].Presonance=(int) o->value();} - tooltip {Resonance On/Off} xywh {210 5 35 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].Presonance);} - } - Fl_Choice {} { - label {Use Oscil.} - callback {pars->VoicePar[nvoice].Pextoscil=(int)o->value()-1; -if ((int) o->value() != 0) { - osc->init(pars->VoicePar[(int) o->value()-1].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLUE); -} else { - osc->init(pars->VoicePar[nvoice].OscilSmp,master); - changevoiceoscilbutton->labelcolor(FL_BLACK); -}; - -voiceparametersgroup->redraw(); -voiceonbutton->redraw();} open - xywh {5 470 65 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("Internal");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(pars->VoicePar[nvoice].Pextoscil+1);} - } {} - Fl_Group {} {open - xywh {5 540 520 50} box UP_FRAME - } { - Fl_Dial {} { - label Stereo - callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} - tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_stereo_spread);} - class WidgetPDial - } - Fl_Choice {} { - label Unison - callback {pars->set_unison_size_index(nvoice,(int) o->value());} open - tooltip {Unison size} xywh {10 560 75 20} down_box BORDER_BOX labelfont 1 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");char tmp[100];for (int i=1;ADnote_unison_sizes[i];i++){snprintf(tmp,100,"size %d",ADnote_unison_sizes[i]);o->add(tmp);};} - code1 {o->value(pars->get_unison_size_index(nvoice));} - } {} - Fl_Dial {} { - label Vibrato - callback {pars->VoicePar[nvoice].Unison_vibratto=(int)o->value();} - tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto);} - class WidgetPDial - } - Fl_Choice {} { - label Invert - callback {pars->VoicePar[nvoice].Unison_invert_phase=(int) o->value();} open - tooltip {Phase Invert} xywh {445 560 65 15} down_box BORDER_BOX labelsize 11 align 5 textfont 1 textsize 10 - code0 {o->add("None");o->add("Random");char tmp[100];for (int i=2;i<=5;i++){snprintf(tmp,100,"%d %%",100/i);o->add(tmp);};} - code1 {o->value(pars->VoicePar[nvoice].Unison_invert_phase);} - } {} - Fl_Slider {} { - label {Frequency Spread} - callback {pars->VoicePar[nvoice].Unison_frequency_spread=(int)o->value(); -unisonspreadoutput->do_callback();} - tooltip {Frequency Spread of the Unison} xywh {95 562 125 13} type {Horz Knob} box FLAT_BOX labelsize 12 align 1 maximum 127 step 1 value 64 - code0 {o->value(pars->VoicePar[nvoice].Unison_frequency_spread);} - } - Fl_Value_Output unisonspreadoutput { - label {(cents)} - callback {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} - xywh {225 560 40 15} labelsize 10 align 5 maximum 1000 step 0.1 textfont 1 textsize 10 - code0 {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} - } - Fl_Dial {} { - label {V.speed} - callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} selected - tooltip {Vibrato Average Speed} xywh {406 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto_speed);} - class WidgetPDial - } - Fl_Dial {} { - label {Ph.rand} - callback {pars->VoicePar[nvoice].Unison_phase_randomness=(int)o->value();} - tooltip {Phase randomness} xywh {280 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].Unison_phase_randomness);} - class WidgetPDial - } - } - } - Fl_Group {} { - label AMPLITUDE open - xywh {5 40 240 220} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider {} { - label Vol - callback {pars->VoicePar[nvoice].PVolume=(int)o->value();} - tooltip Volume xywh {10 60 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PVolume);} - } - Fl_Value_Slider {} { - label {V.Sns} - callback {pars->VoicePar[nvoice].PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 80 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PAmpVelocityScaleFunction);} - } - Fl_Group voiceampenvgroup { - label {ADSynth Voice - Amplitude Envelope} open - xywh {10 105 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].AmpEnvelope);} - code1 {if (pars->VoicePar[nvoice].PAmpEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Dial {} { - label Pan - callback {pars->VoicePar[nvoice].PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 60 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PPanning);} - class WidgetPDial - } - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PAmpEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voiceampenvgroup->deactivate(); -else voiceampenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 110 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PAmpEnvelopeEnabled);} - } - Fl_Group voiceamplfogroup { - label {Amplitude LFO } open - xywh {10 180 230 75} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].AmpLfo);} - code1 {if (pars->VoicePar[nvoice].PAmpLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PAmpLfoEnabled=(int)o->value(); -if (o->value()==0) voiceamplfogroup->deactivate(); -else voiceamplfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {15 185 55 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PAmpLfoEnabled);} - } - Fl_Check_Button {} { - label Minus - callback {pars->VoicePar[nvoice].PVolumeminus=(int)o->value();} - xywh {10 45 50 10} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->VoicePar[nvoice].PVolumeminus);} - } - } - Fl_Group voicefiltergroup { - label FILTER open - xywh {245 5 285 260} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - code0 {if (pars->VoicePar[nvoice].PFilterEnabled==0) o->deactivate();} - } { - Fl_Group {} { - label {ADsynth Voice - Filter} open - xywh {250 30 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->VoicePar[nvoice].VoiceFilter,NULL,NULL);} - class FilterUI - } {} - Fl_Group voicefilterenvgroup { - label {ADSynth Voice - Filter Envelope} open - xywh {250 115 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->VoicePar[nvoice].FilterEnvelope);} - code1 {if (pars->VoicePar[nvoice].PFilterEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFilterEnvelopeEnabled=(int)o->value(); -if (o->value()==0) voicefilterenvgroup->deactivate(); -else voicefilterenvgroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {255 119 55 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFilterEnvelopeEnabled);} - } - Fl_Group voicefilterlfogroup { - label {Filter LFO } open - xywh {250 190 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->VoicePar[nvoice].FilterLfo);} - code1 {if (pars->VoicePar[nvoice].PFilterLfoEnabled==0) o->deactivate();} - class LFOUI - } {} - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFilterLfoEnabled=(int)o->value(); -if (o->value()==0) voicefilterlfogroup->deactivate(); -else voicefilterlfogroup->activate(); -o->redraw();} - tooltip {Forced Relase} xywh {255 196 55 10} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFilterLfoEnabled);} - } - } - Fl_Group {} { - label 01 - xywh {5 5 55 35} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 22 align 16 - code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));} - } {} - Fl_Choice {} { - callback {int x=(int) o->value(); -pars->VoicePar[nvoice].Type=x; -if (x==0) voicemodegroup->activate(); - else voicemodegroup->deactivate(); -noiselabel->do_callback();} - tooltip {Oscillator Type (sound/noise)} xywh {5 515 65 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code0 {o->value(pars->VoicePar[nvoice].Type);} - code1 {if (pars->VoicePar[nvoice].Type!=0) voicemodegroup->deactivate();} - } { - MenuItem {} { - label Sound - xywh {5 5 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label NOISE - xywh {15 15 100 20} labelfont 1 labelsize 11 labelcolor 1 - } - } - Fl_Check_Button bypassfiltercheckbutton { - label {Bypass Global F.} - callback {pars->VoicePar[nvoice].Pfilterbypass=(int)o->value();} - xywh {425 10 100 20} down_box DOWN_BOX labelfont 1 labelsize 10 align 148 - code0 {o->value(pars->VoicePar[nvoice].Pfilterbypass);} - } - Fl_Group {} {open - xywh {115 5 95 35} box THIN_UP_BOX - } { - Fl_Value_Slider {} { - label Delay - callback {pars->VoicePar[nvoice].PDelay=(int)o->value();} - tooltip Volume xywh {120 21 84 12} type {Horz Knob} box FLAT_BOX labelsize 11 align 5 maximum 127 step 1 - code0 {o->value(pars->VoicePar[nvoice].PDelay);} - } - } - Fl_Check_Button {} { - label On - callback {pars->VoicePar[nvoice].PFilterEnabled=(int)o->value(); -if (o->value()==0) voicefiltergroup->deactivate(); -else voicefiltergroup->activate(); -o->redraw(); -bypassfiltercheckbutton->redraw();} - tooltip {Enable Filter} xywh {250 15 60 15} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->VoicePar[nvoice].PFilterEnabled);} - } - Fl_Box noiselabel { - label {White Noise} - callback {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} - xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 53 - code0 {if (pars->VoicePar[nvoice].Type==0) o->hide(); else o->show();} - } - } - Fl_Check_Button voiceonbutton { - label On - callback {pars->VoicePar[nvoice].Enabled=(int)o->value(); -if (o->value()==0) voiceparametersgroup->deactivate(); -else voiceparametersgroup->activate(); -o->redraw();} - xywh {60 5 55 35} box THIN_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {o->value(pars->VoicePar[nvoice].Enabled);} - } - } - } - Function {ADvoiceUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {nvoice=0; -pars=NULL; -oscedit=NULL;} {} - } - Function {init(ADnoteParameters *parameters,int nvoice_,Master *master_)} {open - } { - code {pars=parameters; -nvoice=nvoice_; -master=master_; -make_window(); -end(); -ADnoteVoiceParameters->show();} {} - } - Function {~ADvoiceUI()} {open - } { - code {ADnoteVoiceParameters->hide(); -hide(); -if (oscedit!=NULL) { - delete(oscedit); -}; -//delete (ADnoteVoiceParameters);} {} - } - decl {int nvoice;} {} - decl {ADnoteParameters *pars;} {} - decl {OscilEditor *oscedit;} {} - decl {Oscilloscope *osc;} {} - decl {Oscilloscope *oscFM;} {} - decl {Master *master;} {} -} - -class ADnoteUI {open : {public PresetsUI_} -} { - Function {make_window()} {open private - } { - Fl_Window ADnoteGlobalParameters { - label {ADsynth Global Parameters of the Instrument} open - xywh {457 319 540 430} type Double visible - } { - Fl_Group {} { - label FREQUENCY open - xywh {5 280 530 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group freqenv { - label {ADSynth Global - Frequency Envelope} open - xywh {10 320 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.FreqEnvelope);} - class EnvelopeUI - } {} - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->GlobalPar.PCoarseDetune = k*1024+ - pars->GlobalPar.PCoarseDetune%1024;} - tooltip Octave xywh {455 300 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->GlobalPar.PCoarseDetune = k+ - (pars->GlobalPar.PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {460 370 60 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Group freqlfo { - label {Frequency LFO } open - xywh {220 320 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.FreqLfo);} - class LFOUI - } {} - Fl_Slider freq { - callback {pars->GlobalPar.PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {60 300 385 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->GlobalPar.PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));} - xywh {12 300 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));} - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->GlobalPar.PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {455 340 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->GlobalPar.PDetuneType-1);} - } {} - Fl_Dial {} { - label relBW - callback {pars->GlobalPar.PBandwidth=(int) o->value(); - -pars->getBandwidthDetuneMultiplier(); - -for (int i=0;irefreshlist(); -};} - tooltip {Bandwidth - how the relative fine detune of the voice are changed} xywh {505 295 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PBandwidth);} - class WidgetPDial - } - } - Fl_Group {} { - label AMPLITUDE - xywh {5 5 240 260} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider volume { - label Vol - callback {pars->GlobalPar.PVolume=(int)o->value();} - tooltip Volume xywh {10 30 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->GlobalPar.PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->GlobalPar.PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPanning);} - class WidgetPDial - } - Fl_Dial pstr { - label {P.Str.} - callback {pars->GlobalPar.PPunchStrength=(int) o->value();} - tooltip {Punch Strength} xywh {125 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchStrength);} - class WidgetPDial - } - Fl_Dial pt { - label {P.t.} - callback {pars->GlobalPar.PPunchTime=(int) o->value();} - tooltip {Punch Time (duration)} xywh {155 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchTime);} - class WidgetPDial - } - Fl_Dial pstc { - label {P.Stc.} - callback {pars->GlobalPar.PPunchStretch=(int) o->value();} - tooltip {Punch Stretch} xywh {185 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchStretch);} - class WidgetPDial - } - Fl_Dial pvel { - label {P.Vel.} - callback {pars->GlobalPar.PPunchVelocitySensing=(int) o->value();} - tooltip {Punch Velocity Sensing} xywh {215 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->GlobalPar.PPunchVelocitySensing);} - class WidgetPDial - } - Fl_Group ampenv { - label {ADSynth Global - Amplitude Envelope} open - xywh {10 75 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.AmpEnvelope);} - class EnvelopeUI - } {} - Fl_Group amplfo { - label {Amplitude LFO } open - xywh {10 150 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.AmpLfo);} - class LFOUI - } {} - Fl_Check_Button rndgrp { - label {Rnd Grp} - callback {pars->GlobalPar.Hrandgrouping=(int) o->value();} - tooltip {How the Harmonic Amplitude is applied to voices that use the same oscillator} xywh {70 235 40 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(pars->GlobalPar.Hrandgrouping);} - } - } - Fl_Group {} { - label FILTER open selected - xywh {250 5 285 265} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group filterenv { - label {ADSynth Global - Filter Envelope} open - xywh {255 118 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalPar.FilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterlfo { - label {Filter LFO} open - xywh {255 195 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->GlobalPar.FilterLfo);} - class LFOUI - } {} - Fl_Group filterui { - label {ADsynth Global - Filter} open - xywh {255 35 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalPar.GlobalFilter,&pars->GlobalPar.PFilterVelocityScale,&pars->GlobalPar.PFilterVelocityScaleFunction);} - class FilterUI - } {} - } - Fl_Check_Button stereo { - label Stereo - callback {pars->GlobalPar.PStereo=(int) o->value();} - xywh {5 230 65 35} down_box DOWN_BOX labelsize 11 - code0 {o->value(pars->GlobalPar.PStereo);} - } - Fl_Button {} { - label {Show Voice List} - callback {for (int i=0;irefreshlist(); -} -ADnoteVoiceList->show();} - xywh {180 400 125 25} labelsize 12 - } - Fl_Button {} { - label {Show Voice Parameters} - callback {ADnoteVoice->show();} - xywh {5 400 170 25} labelsize 12 - } - Fl_Button {} { - label Close - callback {ADnoteGlobalParameters->hide();} - xywh {475 400 60 25} box THIN_UP_BOX - } - Fl_Button {} { - label Resonance - callback {resui->resonancewindow->redraw(); -resui->resonancewindow->show();} - tooltip Resonance xywh {309 400 86 25} box THIN_UP_BOX labelsize 12 - } - Fl_Button {} { - label C - callback {presetsui->copyArray(pars);} - xywh {405 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->pasteArray(pars,this);} - xywh {435 405 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - Fl_Window ADnoteVoice { - label {ADsynth Voice Parameters} open - xywh {1142 229 765 630} type Double visible - } { - Fl_Group advoice {open - xywh {0 0 765 595} - code0 {o->init(pars,nvoice,master);} - code1 {o->show();} - class ADvoiceUI - } {} - Fl_Button {} { - label {Close Window} - callback {ADnoteVoice->hide();} - xywh {305 601 195 25} box THIN_UP_BOX labelfont 1 - } - Fl_Counter currentvoicecounter { - label {Current Voice} - callback {nvoice=(int)o->value()-1; -advoice->hide(); -ADnoteVoice->remove(advoice); -delete advoice; -advoice=new ADvoiceUI(0,0,765,590); -ADnoteVoice->add(advoice); -advoice->init(pars,nvoice,master); -advoice->show(); -ADnoteVoice->redraw();} - xywh {10 601 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 - code0 {o->bounds(1,NUM_VOICES);} - } - Fl_Button {} { - label C - callback {presetsui->copy(pars,nvoice);} - xywh {705 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this,nvoice);} - xywh {735 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - Fl_Window ADnoteVoiceList { - label {ADsynth Voices list} - xywh {32 266 650 260} type Double hide - } { - Fl_Text_Display {} { - label {No.} - xywh {10 15 30 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Vol - xywh {145 15 30 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Detune - xywh {384 15 25 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label Pan - xywh {210 15 30 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label {Vib. Depth} - xywh {560 15 30 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Text_Display {} { - label {R.} - xywh {245 15 25 10} box FLAT_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label {Hide Voice List} - callback {ADnoteVoiceList->hide();} - xywh {255 237 125 20} - } - Fl_Scroll {} {open - xywh {0 15 640 220} type VERTICAL box THIN_UP_BOX - } { - Fl_Pack {} {open - xywh {0 20 620 210} - code0 {for (int i=0;iinit(pars,i,master);}} - } {} - } - } - } - Function {ADnoteUI(ADnoteParameters *parameters,Master *master_)} {} { - code {pars=parameters; -master=master_; -nvoice=0; -resui=new ResonanceUI(pars->GlobalPar.Reson); -make_window();} {} - } - Function {~ADnoteUI()} {} { - code {ADnoteVoiceList->hide(); -ADnoteGlobalParameters->hide(); -ADnoteVoice->hide(); -delete(ADnoteVoiceList); -delete(ADnoteGlobalParameters); -delete(ADnoteVoice); -delete(resui);} {} - } - Function {refresh()} {} { - code {volume->value(pars->GlobalPar.PVolume); -vsns->value(pars->GlobalPar.PAmpVelocityScaleFunction); -pan->value(pars->GlobalPar.PPanning); - -stereo->value(pars->GlobalPar.PStereo); -rndgrp->value(pars->GlobalPar.Hrandgrouping); - -pstr->value(pars->GlobalPar.PPunchStrength); -pt->value(pars->GlobalPar.PPunchTime); -pstc->value(pars->GlobalPar.PPunchStretch); -pvel->value(pars->GlobalPar.PPunchVelocitySensing); - -detunevalueoutput->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); -freq->value(pars->GlobalPar.PDetune-8192); - -int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->GlobalPar.PDetuneType-1); -k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); -amplfo->refresh(); -freqlfo->refresh(); -filterlfo->refresh(); - -ampenv->refresh(); -freqenv->refresh(); -filterenv->refresh(); -filterui->refresh(); - -for (int i=0;irefreshlist(); - -resui->refresh(); -currentvoicecounter->do_callback();} {} - } - decl {ADnoteParameters *pars;} {} - decl {ResonanceUI *resui;} {} - decl {Master *master;} {} - decl {int nvoice;} {} - decl {ADvoicelistitem *voicelistitem[NUM_VOICES];} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/BankUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/BankUI.fl deleted file mode 100644 index a7eab825a04..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/BankUI.fl +++ /dev/null @@ -1,368 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Part.h"} {public -} - -decl {\#include "../Misc/Bank.h"} {public -} - -decl {\#include "../Misc/Config.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -class BankProcess_ {} { - Function {process()} {open return_type {virtual void} - } { - code {;} {} - } - decl {Bank *bank;} {public - } -} - -class BankSlot {open : {public Fl_Button,BankProcess_} -} { - Function {BankSlot(int x,int y, int w, int h, const char *label=0):Fl_Button(x,y,w,h,label)} {open - } { - code {what=NULL; -whatslot=NULL; -nslot=0; -nselected=NULL;} {selected - } - } - Function {handle(int event)} {return_type int - } { - code {if (what==NULL) return(0); -if (Fl::event_inside(this)){ - *what=0;*whatslot=nslot; - if ((event==FL_RELEASE)&&(Fl::event_button()==1))*what=1; - if ((event==FL_RELEASE)&&(Fl::event_button()==3))*what=2; - if (event==FL_PUSH) highlight=1; -}else highlight=0; - -int tmp=Fl_Button::handle(event); -if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)(); -return(tmp);} {} - } - Function {init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_)} {} { - code {nslot=nslot_; -what=what_; -whatslot=whatslot_; -fnc=fnc_; -bp=bp_; -bank=bank_; -nselected=nselected_; -box(FL_THIN_UP_BOX); -labelfont(0); -labelsize(13); -align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); - -highlight=0; -refresh();} {} - } - Function {refresh()} {} { - code {if (bank->emptyslot(nslot)) - color(46); -else if (bank->isPADsynth_used(nslot)) - color(124); -else - color(51); - - -if (*nselected==nslot) - color(6); - - -copy_label(bank->getnamenumbered(nslot).c_str());} {} - } - decl {int *what,*whatslot,nslot,highlight, *nselected;} {} - decl {void (BankProcess_:: *fnc)(void);} {} - decl {BankProcess_ *bp;} {} -} - -class BankUI {open : {public BankProcess_} -} { - Function {make_window()} {open - } { - Fl_Window bankuiwindow { - label Bank - xywh {492 406 785 575} type Double - code0 {o->label(bank->bankfiletitle.c_str());} - code1 {if (bank->bankfiletitle.empty()) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank.");} visible - } { - Fl_Button {} { - label Close - callback {bankuiwindow->hide();} - xywh {705 546 70 24} box THIN_UP_BOX - } - Fl_Group {} { - xywh {5 34 772 491} box ENGRAVED_FRAME - } { - Fl_Pack {} { - xywh {10 39 150 481} box BORDER_FRAME - code0 {o->box(FL_FLAT_BOX);} - code1 {for (int i=0;i<32;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {163 39 150 481} box BORDER_FRAME - code0 {o->box(FL_FLAT_BOX);} - code1 {for (int i=32;i<64;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {316 39 150 481} box BORDER_FRAME - code0 {o->box(FL_FLAT_BOX);} - code1 {for (int i=64;i<96;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {469 39 150 481} box BORDER_FRAME - code0 {o->box(FL_FLAT_BOX);} - code1 {for (int i=96;i<128;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - Fl_Pack {} { - xywh {622 39 150 481} box BORDER_FRAME - code0 {o->box(FL_FLAT_BOX);} - code1 {for (int i=128;i<160;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);};} - } {} - } - Fl_Group modeselect { - xywh {5 528 425 42} box ENGRAVED_BOX - } { - Fl_Check_Button writebutton { - label WRITE - callback {if (o->value()>0.5) mode=2; -removeselection();} - xywh {116 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - Fl_Check_Button readbutton { - label READ selected - callback {if (o->value()>0.5) mode=1; -removeselection();} - xywh {11 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {o->value(1);} - } - Fl_Check_Button clearbutton { - label CLEAR - callback {if (o->value()>0.5) mode=3; -removeselection();} - xywh {221 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - Fl_Check_Button swapbutton { - label SWAP - callback {if (o->value()>0.5) mode=4; -removeselection();} - xywh {325 534 99 30} type Radio box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 13 - code0 {if (bank->locked()) o->deactivate();} - } - } - Fl_Button {} { - label {New Bank...} - callback {const char *dirname; - -dirname=fl_input("New empty Bank:"); -if (dirname==NULL) return; - - -int result=bank->newbank(dirname); - -if (result!=0) fl_alert("Error: Could not make a new bank (directory).."); - -refreshmainwindow();} - xywh {685 5 93 25} labelfont 1 labelsize 11 align 128 - } - Fl_Check_Button {} { - label {auto close} - callback {config.cfg.BankUIAutoClose=(int) o->value();} - tooltip {automatically close the bank window if the instrument is loaded} xywh {705 529 60 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(config.cfg.BankUIAutoClose);} - } - Fl_Choice banklist { - callback {int n=o->value(); -std::string dirname=bank->banks[n].dir; -if (dirname.empty()) return; - -if (bank->loadbank(dirname)==2) - fl_alert("Error: Could not load the bank from the directory\\n%s.",dirname.c_str()); -for (int i=0;irefresh(); -refreshmainwindow();} - xywh {5 8 220 20} down_box BORDER_BOX labelfont 1 align 0 textfont 1 textsize 11 - } {} - Fl_Button {} { - label {Refresh bank list} - callback {rescan_for_banks(); -banklist->value(0);} - tooltip {Refresh the bank list (rescan)} xywh {230 8 105 20} box THIN_UP_BOX color 50 labelsize 11 - } - Fl_Check_Button {} { - label {Show PADsynth status} - callback {config.cfg.CheckPADsynth=(int) o->value(); -refreshmainwindow();} - xywh {435 530 150 15} down_box DOWN_BOX labelsize 11 - code0 {o->value(config.cfg.CheckPADsynth);} - } - } - } - Function {BankUI(Master *master_,int *npart_)} {} { - code {fnc=&BankProcess_::process; -master=master_; -npart=npart_; -bank=&master_->bank; -what=0; -nselected=-1; -make_window(); -mode=1;} {} - } - Function {~BankUI()} {return_type virtual - } { - code {bankuiwindow->hide(); -delete(bankuiwindow);} {} - } - Function {show()} {} { - code {bankuiwindow->show(); -simplesetmode(config.cfg.UserInterfaceMode==2);} {} - } - Function {hide()} {} { - code {bankuiwindow->hide();} {} - } - Function {init(Fl_Valuator *cbwig_)} {} { - code {cbwig=cbwig_; -rescan_for_banks();} {} - } - Function {process()} {return_type void - } { - code {int slot=this->slot; - -if ((what==2)&&(bank->emptyslot(slot)==0)&&(mode!=4)) {//Rename slot - const char *tmp=fl_input("Slot (instrument) name:",bank->getname(slot).c_str()); - if (tmp!=NULL) bank->setname(slot,tmp,-1); - bs[slot]->refresh(); -}; - -if ((what==1)&&(mode==1)&&(!bank->emptyslot(slot))){//Reads from slot - pthread_mutex_lock(&master->part[*npart]->load_mutex); - bank->loadfromslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->part[*npart]->load_mutex); - master->part[*npart]->applyparameters(); - snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot).c_str()); - cbwig->do_callback(); - - if (config.cfg.BankUIAutoClose!=0) - bankuiwindow->hide(); - -}; - -if ((what==1)&&(mode==2)){//save(write) to slot - if (!bank->emptyslot(slot)){ - if (!fl_choice("Overwrite the slot no. %d ?","No","Yes",NULL,slot+1)) goto nooverwriteslot; - }; - pthread_mutex_lock(&master->part[*npart]->load_mutex); - bank->savetoslot(slot,master->part[*npart]); - pthread_mutex_unlock(&master->part[*npart]->load_mutex); - - bs[slot]->refresh(); - mode=1;readbutton->value(1);writebutton->value(0); - nooverwriteslot:; -}; - - - -if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot - if (fl_choice("Clear the slot no. %d ?","No","Yes",NULL,slot+1)){ - bank->clearslot(slot); - bs[slot]->refresh(); - }; -}; - -if (mode==4){//swap - bool done=false; - if ((what==1)&&(nselected>=0)){ - bank->swapslot(nselected,slot); - int ns=nselected; - nselected=-1; - bs[slot]->refresh(); - bs[ns]->refresh(); - done=true; - }; - if (((nselected<0)||(what==2))&&(!done)){ - int ns=nselected; - nselected=slot; - if (ns>0) bs[ns]->refresh(); - bs[slot]->refresh(); - }; -}; -if (mode!=4) refreshmainwindow();} {} - } - Function {refreshmainwindow()} {} { - code {bankuiwindow->label(bank->bankfiletitle.c_str()); -mode=1;readbutton->value(1);writebutton->value(0);clearbutton->value(0);swapbutton->value(0); -nselected=-1; -if (bank->locked()){ - writebutton->deactivate(); - clearbutton->deactivate(); - swapbutton->deactivate(); -} else { - writebutton->activate(); - clearbutton->activate(); - swapbutton->activate(); -}; -for (int i=0;irefresh();} {} - } - Function {removeselection()} {} { - code {if (nselected>=0) { - int ns=nselected; - nselected=-1; - bs[ns]->refresh(); -};} {} - } - Function {rescan_for_banks()} {} { - code {banklist->clear(); -bank->rescanforbanks(); - -for (unsigned int i=0;ibanks.size();i++) { - banklist->add(bank->banks[i].name.c_str()); -} -if (banklist->size() == 0) - banklist->add(" ");} {} - } - Function {simplesetmode(bool beginnerui)} {} { - code {readbutton->value(1); -mode=1; -removeselection(); -if (beginnerui) modeselect->hide(); - else modeselect->show();} {} - } - decl {BankSlot *bs[BANK_SIZE];} {} - decl {int slot,what;//"what"=what button is pressed} {} - decl {int mode,*npart,nselected;} {} - decl {Master *master;} {} - decl {void (BankProcess_::* fnc)(void);} {} - decl {Fl_Valuator *cbwig;} {public - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/CMakeLists.txt b/plugins/zynaddsubfx/zynaddsubfx/src/UI/CMakeLists.txt deleted file mode 100644 index 38ea1e1134d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -set(UI_fl_files - ADnoteUI.fl - BankUI.fl - ConfigUI.fl - EffUI.fl - EnvelopeUI.fl - FilterUI.fl - LFOUI.fl - MasterUI.fl - MicrotonalUI.fl - OscilGenUI.fl - PADnoteUI.fl - PartUI.fl - PresetsUI.fl - ResonanceUI.fl - SUBnoteUI.fl - VirKeyboard.fl -) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -set_source_files_properties(UI/MasterUI.h PROPERTIES GENERATED 1) -fltk_wrap_ui(zynaddsubfx_gui ${UI_fl_files}) - -add_definitions(-DPIXMAP_PATH="${CMAKE_INSTALL_PREFIX}/share/zynaddsubfx/pixmaps/") -add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") - -if(LibloEnable) - set(zynaddsubfx_gui_FLTK_UI_SRCS ${zynaddsubfx_gui_FLTK_UI_SRCS} NSM.C NSM/Client.C) -endif() - -add_library(zynaddsubfx_gui STATIC - ${UI_objs} - ${zynaddsubfx_gui_FLTK_UI_SRCS} - NioUI.cpp - WidgetPDial.cpp - ) - -if(NtkGui) - target_link_libraries(zynaddsubfx_gui ${NTK_LIBRARIES}) -endif(NtkGui) - -if(FltkGui) - target_link_libraries(zynaddsubfx_gui ${FLTK_LIBRARIES}) -endif(FltkGui) diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ConfigUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/ConfigUI.fl deleted file mode 100644 index c7ec12d5372..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ConfigUI.fl +++ /dev/null @@ -1,415 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0302 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local -} - -decl {//License: GNU GPL version 2 or later} {private local -} - -decl {\#include } {public local -} - -decl {\#include } {public local -} - -decl {\#include } {public local -} - -decl {\#include } {public local -} - -decl {\#include "../globals.h"} {public local -} - -decl {\#include "../Misc/Util.h"} {public local -} - -decl {\#include "../Misc/Dump.h"} {public local -} - -decl {extern Dump dump;} {public local -} - -class ConfigUI {} { - Function {make_window()} {} { - Fl_Window configwindow { - label {ZynAddSubFX Settings} - callback {writebankcfg(); -o->hide();} - xywh {554 443 510 370} type Double visible - } { - Fl_Tabs {} { - xywh {5 5 500 330} - } { - Fl_Group {} { - label {Main settings} - xywh {5 25 500 310} - } { - Fl_Group {} { - label {Sample Rate} - xywh {15 45 165 30} box ENGRAVED_FRAME - } { - Fl_Choice {} { - callback {if ((int)o->value()==0) samplerateinput->activate(); - else samplerateinput->deactivate(); - -int samplerates[8]={44100,16000,22050,32000,44100,48000,88200,96000}; -config.cfg.SampleRate=samplerates[(int)o->value()]; - -setsamplerateinput();} - xywh {20 50 85 20} down_box BORDER_BOX textsize 10 - code0 {o->value(getsamplerateorder());} - } { - MenuItem {} { - label Custom - xywh {10 10 100 20} labelfont 1 - } - MenuItem {} { - label 16000Hz - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label 22050Hz - xywh {20 20 100 20} labelfont 1 - } - MenuItem {} { - label 32000Hz - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label 44100Hz - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label 48000Hz - xywh {50 50 100 20} labelfont 1 - } - MenuItem {} { - label 88200Hz - xywh {60 60 100 20} labelfont 1 - } - MenuItem {} { - label 96000Hz - xywh {70 70 100 20} labelfont 1 - } - } - Fl_Input samplerateinput { - callback {char *tmp; -config.cfg.SampleRate=strtoul(o->value(),&tmp,10);} - xywh {115 50 60 20} type Int textfont 1 - code0 {setsamplerateinput();} - code1 {if (getsamplerateorder()!=0) o->deactivate();} - } - } - Fl_Input {} { - label {Buffer Size} - callback {char *tmp; -config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} - tooltip {Internal Sound Buffer Size (samples)} xywh {190 45 60 20} type Int labelsize 11 align 129 textfont 1 - code0 {char *tmpbuf=new char[100];o->cut(0,o->maximum_size());} - code1 {snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf);} - code2 {delete []tmpbuf;} - } - Fl_Check_Button {} { - label {Swap Stereo } - callback {config.cfg.SwapStereo=(int) o->value();} - xywh {15 80 95 20} box NO_BOX labelsize 11 - code0 {o->value(config.cfg.SwapStereo);} - } - Fl_Choice {} { - label OscilSize - callback {config.cfg.OscilSize=128<value();} - tooltip {ADSynth Oscillator Size (samples)} xywh {175 80 75 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 10 - code0 {o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1);} - } { - MenuItem {} { - label 128 - xywh {25 25 100 20} labelfont 1 - } - MenuItem {} { - label 256 - xywh {35 35 100 20} labelfont 1 - } - MenuItem {} { - label 512 - xywh {45 45 100 20} labelfont 1 - } - MenuItem {} { - label 1024 - xywh {45 45 100 20} labelfont 1 - } - MenuItem {} { - label 2048 - xywh {55 55 100 20} labelfont 1 - } - MenuItem {} { - label 4096 - xywh {55 55 100 20} labelfont 1 - } - MenuItem {} { - label 8192 - xywh {65 65 100 20} labelfont 1 - } - MenuItem {} { - label 16384 - xywh {75 75 100 20} labelfont 1 - } - } - Fl_Box {} { - label {Most settings has effect only after ZynAddSubFX is restarted.} - xywh {10 300 235 30} labelfont 1 labelsize 11 align 128 - } - Fl_Box {} { - label {Read the Readme.txt for other settings} - xywh {10 280 240 15} labelfont 1 labelsize 11 align 128 - } - Fl_Group {} { - xywh {15 125 230 85} box ENGRAVED_BOX - } { - Fl_File_Input {} { - label {Dump File} - callback {config.cfg.DumpFile = o->value();} - xywh {20 170 220 35} align 5 - code0 {o->insert(config.cfg.DumpFile.c_str());} - } - Fl_Check_Button {} { - label {Dump notes} - callback {config.cfg.DumpNotesToFile=(int) o->value(); -dump.startnow();//this has effect only if this option was disabled} - xywh {20 130 110 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpNotesToFile);} - } - Fl_Check_Button {} { - label Append - callback {config.cfg.DumpAppend=(int) o->value();} - xywh {160 130 80 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpAppend);} - } - } - Fl_Counter {} { - label {XML compression level} - callback {config.cfg.GzipCompression=(int) o->value();} - tooltip {gzip compression level (0 - uncompressed)} xywh {20 215 65 15} type Simple labelsize 11 align 8 minimum 0 maximum 9 step 1 - code0 {o->value(config.cfg.GzipCompression);} - } - Fl_Choice {} { - label {PADsynth Interpolation} - callback {config.cfg.Interpolation=(int) o->value();} - xywh {175 105 75 15} down_box BORDER_BOX labelsize 10 textsize 11 - code0 {o->value(config.cfg.Interpolation);} - } { - MenuItem {} { - label {Linear(fast)} - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Cubic(slow)} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice {} { - label {Virtual Keyboard Layout} - callback {config.cfg.VirKeybLayout=(int) o->value();;} - xywh {155 235 85 20} down_box BORDER_BOX labelsize 12 textfont 1 textsize 11 - code0 {o->value(config.cfg.VirKeybLayout);} - } { - MenuItem {} { - label { } - xywh {5 5 100 20} labelfont 1 labelsize 11 deactivate - } - MenuItem {} { - label QWERTY - xywh {15 15 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Dvorak - xywh {25 25 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label QWERTZ - xywh {35 35 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label AZERTY - xywh {45 45 100 20} labelfont 1 labelsize 11 - } - } - Fl_Check_Button {} { - label {Ignore MIDI Program Change} - callback {config.cfg.IgnoreProgramChange=(int) o->value();} - xywh {10 255 220 20} down_box DOWN_BOX - code0 {o->value(config.cfg.IgnoreProgramChange);} - } - } - Fl_Group {} { - label {Bank root dirs} - xywh {5 25 500 285} hide - } { - Fl_Browser rootsbrowse { - callback {activatebutton_rootdir(o->value()!=0);} - xywh {15 35 485 220} type Hold - } - Fl_Button {} { - label {Add root directory...} - callback {const char *dirname; -dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0); -if (dirname==NULL) return; - -rootsbrowse->add(dirname);} - xywh {15 265 80 35} box THIN_UP_BOX align 128 - } - Fl_Button removerootdirbutton { - label {Remove root dir...} - callback {if (rootsbrowse->value()!=0) { - rootsbrowse->remove(rootsbrowse->value()); -}; -activatebutton_rootdir(false);} - xywh {105 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - Fl_Button makedefaultrootdirbutton { - label {Make default} - callback {int n=rootsbrowse->value(); - -if (n!=0) { - rootsbrowse->move(1,n); - rootsbrowse->value(1); - rootsbrowse->redraw(); -}; -activatebutton_rootdir(true);} - xywh {190 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - } - Fl_Group {} { - label {Presets dirs} - xywh {5 25 500 285} hide - } { - Fl_Browser presetbrowse { - callback {activatebutton_presetdir(o->value()!=0);} - xywh {15 35 485 220} type Hold - } - Fl_Button {} { - label {Add preset directory...} - callback {const char *dirname; -dirname=fl_dir_chooser("Add a preset directory :",NULL,0); -if (dirname==NULL) return; - -presetbrowse->add(dirname);} - xywh {15 265 80 35} box THIN_UP_BOX align 128 - } - Fl_Button removepresetbutton { - label {Remove preset dir...} - callback {if (presetbrowse->value()!=0) { - presetbrowse->remove(presetbrowse->value()); -}; -activatebutton_presetdir(false);} - xywh {105 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - Fl_Button makedefaultpresetbutton { - label {Make default} - callback {int n=presetbrowse->value(); - -if (n!=0) { - presetbrowse->move(1,n); - presetbrowse->value(1); - presetbrowse->redraw(); -}; -activatebutton_presetdir(true);} - xywh {190 265 80 35} box THIN_UP_BOX align 128 - code0 {o->deactivate();} - } - } - } - Fl_Button {} { - label Close - callback {configwindow->hide(); -writebankcfg(); -writepresetcfg();} - xywh {200 345 105 20} box THIN_UP_BOX - } - } - } - Function {ConfigUI()} {} { - code {make_window(); -readbankcfg(); -readpresetcfg();} {} - } - Function {activatebutton_rootdir(bool active)} {} { - code {if (active) { - removerootdirbutton->activate(); - makedefaultrootdirbutton->activate(); -}else{ - removerootdirbutton->deactivate(); - makedefaultrootdirbutton->deactivate(); -};} {} - } - Function {activatebutton_presetdir(bool active)} {} { - code {if (active) { - removepresetbutton->activate(); - makedefaultpresetbutton->activate(); -}else{ - removepresetbutton->deactivate(); - makedefaultpresetbutton->deactivate(); -};} {} - } - Function {readbankcfg()} {} { - code {rootsbrowse->clear(); - -for (int i=0;iadd(config.cfg.bankRootDirList[i].c_str()); -};} {} - } - Function {writebankcfg()} {} { - code {config.clearbankrootdirlist(); - -for (int n=0;nsize();n++){ - config.cfg.bankRootDirList[n] = rootsbrowse->text(n+1); -};} {} - } - Function {readpresetcfg()} {} { - code {presetbrowse->clear(); - -for(int i=0;iadd(config.cfg.presetsDirList[i].c_str()); -};} {} - } - Function {writepresetcfg()} {} { - code {config.clearpresetsdirlist(); - -for (int n=0;nsize();n++) - config.cfg.presetsDirList[n] = presetbrowse->text(n+1);} {} - } - Function {getsamplerateorder()} {return_type int - } { - code {int smpr=config.cfg.SampleRate; -int order=0; -switch(smpr){ - case 16000:order=1;break; - case 22050:order=2;break; - case 32000:order=3;break; - case 44100:order=4;break; - case 48000:order=5;break; - case 88200:order=6;break; - case 96000:order=7;break; - default:order=0;break; -}; -return(order);} {} - } - Function {setsamplerateinput()} {return_type void - } { - code {char *tmpbuf=new char[100]; -samplerateinput->cut(0,samplerateinput->maximum_size()); -snprintf(tmpbuf,100,"%d",config.cfg.SampleRate); -samplerateinput->insert(tmpbuf); -delete []tmpbuf;} {} - } - Function {show()} {} { - code {configwindow->show();} {} - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/EffUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/EffUI.fl deleted file mode 100644 index 3df5093a1fc..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/EffUI.fl +++ /dev/null @@ -1,2351 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Effects/EffectMgr.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "common.H"} {public -} - -class EQGraph {: {public Fl_Box} -} { - Function {EQGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {eff=NULL; -maxdB=30;} {} - } - Function {init(EffectMgr *eff_)} {} { - code {eff=eff_; -oldx=-1; -khzval=-1;} {} - } - Function {draw_freq_line(float freq,int type)} {} { - code {fl_color(FL_GRAY); -float freqx=getfreqpos(freq); -switch(type){ - case 0:if (active_r()) fl_color(FL_WHITE); - else fl_color(205,205,205); - fl_line_style(FL_SOLID); - break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i; - double iy,oiy; -float freqx; - -if (active_r()) fl_color(fl_darker(FL_GRAY)); - else fl_color(FL_GRAY); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(fl_lighter( FL_GRAY)); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*10.0,2); - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*10.0,1); - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - - -fl_line_style(FL_DOT); -int GY=6;if (lysynth->samplerate/2) break; - iy=getresponse(ly,frq); - if ((oiy>=0) && (oiy=0) && (iygetEQfreqresponse(freq); -int idbresp=(int) ((dbresp/maxdB+1.0)*maxy/2.0); - - -//fprintf(stderr,"%.5f\\n",(dbresp/maxdB+1.0)*maxy/2.0); - - -return(idbresp);} {} - } - Function {getfreqx(float x)} {return_type float - } { - code {if (x>1.0) x=1.0; -return(20.0*pow((float)1000.0,x));} {} - } - Function {getfreqpos(float freq)} {return_type float - } { - code {if (freq<0.00001) freq=0.00001; -return(log(freq/20.0)/log(1000.0));} {} - } - decl {int oldx;} {} - decl {float khzval;} {public - } - decl {EffectMgr *eff;} {} - decl {int maxdB;} {} -} - -class EffUI {open : {public Fl_Group,public PresetsUI_} -} { - Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {eff=NULL; -filterwindow=NULL;} {} - } - Function {~EffUI()} {} { - code {effnullwindow->hide();//delete (effnullwindow); -effreverbwindow->hide();//delete (effreverbwindow); -effechowindow->hide();//delete (effechowindow); -effchoruswindow->hide();//delete (effchoruswindow); -effphaserwindow->hide();//delete (effphaserwindow); -effalienwahwindow->hide();//delete (effalienwahwindow); -effdistorsionwindow->hide();//delete (effdistorsionwindow); -effeqwindow->hide();//delete (effeqwindow); -effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow); - -if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); -};} {} - } - Function {make_null_window()} {open - } { - Fl_Window effnullwindow { - label {No Effect} - xywh {612 881 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 16 - code0 {set_module_parameters(o);} - class Fl_Group visible - } {} - } - Function {make_reverb_window()} {open - } { - Fl_Window effreverbwindow { - label Reverb open - xywh {377 636 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice revp { - label Preset - callback {eff->changepreset((int)o->value()); - -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Cathedral 1} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Cathedral 2} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Cathedral 3} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Hall 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Hall 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Room 1} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Room 2} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Basement - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Tunnel - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echoed 1} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echoed 2} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Very Long 1} - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Very Long 2} - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice revp10 { - label Type - callback {eff->seteffectpar(10,(int) o->value()); -if (eff->geteffectpar(10)==2) revp12->activate(); - else revp12->deactivate();} - xywh {110 15 85 15} down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label Random - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Freeverb - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Bandwidth - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial revp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp2 { - label Time - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {Duration of Effect} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp3 { - label {I.del} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Initial Delay} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial revp4 { - label {I.delfb} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Initial Delay Feedback} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp12 { - label bw - callback {eff->seteffectpar(12,(int) o->value());} - xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 deactivate - code0 {if (eff->geteffectpar(10)==2) o->activate();} - class WidgetPDial - } - Fl_Dial revp6 { - label {E/R} - callback {eff->seteffectpar(6,(int) o->value());} - xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 deactivate - class WidgetPDial - } - Fl_Dial revp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp8 { - label HPF - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {High Pass Filter} xywh {305 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp9 { - label Damp - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Dampening xywh {340 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 minimum 64 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial revp11 { - label {R.S.} - callback {int x=64; -if (Fl::event_button1()) x=(int)o->value(); - else o->value(x); -eff->seteffectpar(11,x);} - tooltip RoomSize xywh {200 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 8 align 8 minimum 1 maximum 127 step 1 - class WidgetPDial - } - } - } - Function {make_echo_window()} {open - } { - Fl_Window effechowindow { - label Echo - xywh {897 611 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice echop { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Echo 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echo 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echo 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Simple Echo} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Canyon - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Feedback Echo} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial echop0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop2 { - label Delay - callback {eff->seteffectpar(2,(int) o->value());} - xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop3 { - label {LRdl.} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Delay Between L/R} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop4 { - label {LRc.} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {L/R Crossover} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop5 { - label {Fb.} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip Feedback xywh {195 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop6 { - label Damp - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Dampening xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - Function {make_chorus_window()} {open - } { - Fl_Window effchoruswindow { - label Chorus open - xywh {467 742 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice chorusp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Chorus 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Chorus 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Chorus 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Celeste 1} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Celeste 2} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 4} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 5} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial chorusp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {L/R Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp7 { - label Delay - callback {eff->seteffectpar(7,(int) o->value());} - xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp8 { - label Fb - callback {eff->seteffectpar(8,(int) o->value());} - tooltip Feedback xywh {305 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {Channel Routing} xywh {340 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button {} { - label Flange - callback {eff->seteffectpar(10,(int) o->value());} - xywh {120 10 55 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 hide deactivate - code0 {o->value(eff->geteffectpar(10));} - } - Fl_Check_Button chorusp11 { - label Substract - callback {eff->seteffectpar(11,(int) o->value());} - tooltip {inverts the output} xywh {185 10 70 20} box THIN_UP_BOX down_box DOWN_BOX color 51 labelsize 10 - } - Fl_Choice chorusp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - } - } - Function {make_phaser_window()} {open - } { - Fl_Window effphaserwindow { - label Phaser open - xywh {101 232 380 95} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice phaserp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 100 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Phaser 1} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 2} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 3} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 4} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 5} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 6} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 5} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {APhaser 6} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial phaserp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {85 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO randomness} xywh {120 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Choice phaserp4 { - label LFO - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {245 55 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SIN - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial phaserp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {155 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {120 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {185 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter phaserp8 { - label Stages - callback {eff->seteffectpar(8,(int) o->value());} - xywh {290 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_PHASER_STAGES);} - } - Fl_Dial phaserp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {Channel Routing} xywh {215 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp10 { - label Substract - callback {eff->seteffectpar(10,(int) o->value());} selected - tooltip {inverts output} xywh {200 10 74 20} box THIN_UP_BOX down_box DOWN_BOX color 51 labelfont 1 labelsize 10 - } - Fl_Dial phaserp11 { - label Phase - callback {eff->seteffectpar(11,(int) o->value());} - xywh {155 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp12 { - label {hyp.} - callback {eff->seteffectpar(12,(int) o->value());} - tooltip hyper xywh {245 35 55 15} down_box DOWN_BOX - } - Fl_Dial phaserp13 { - label dist - callback {eff->seteffectpar(13,(int) o->value());} - tooltip Distortion xywh {340 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button phaserp14 { - label Analog - callback {eff->seteffectpar(14,(int) o->value());} - xywh {305 35 70 15} down_box DOWN_BOX - } - } - } - Function {make_alienwah_window()} {open - } { - Fl_Window effalienwahwindow { - label AlienWah - xywh {253 353 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice awp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Alienwah 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial awp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial awp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {270 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp9 { - label {L/R} - callback {eff->seteffectpar(9,(int) o->value());} - xywh {345 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice awp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial awp10 { - label Phase - callback {eff->seteffectpar(10,(int) o->value());} - xywh {160 5 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter awp8 { - label Delay - callback {eff->seteffectpar(8,(int) o->value());} - xywh {305 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_ALIENWAH_DELAY);} - } - } - } - Function {make_distorsion_window()} {open - } { - Fl_Window effdistorsionwindow { - label Distortion open - xywh {544 217 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice distp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Overdrive 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Overdrive 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {A. Exciter 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {A. Exciter 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Guitar Amp} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Quantisize - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial distp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp2 { - label {LRc.} - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {L/R Mix} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp3 { - label Drive - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Input Amplification} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp4 { - label Level - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Output Amplification} xywh {155 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {285 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp8 { - label HPF - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {High Pass Filter} xywh {320 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice distp5 { - label Type - callback {eff->seteffectpar(5,(int) o->value());} - xywh {190 50 60 20} box UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 align 2 textsize 10 - } { - MenuItem {} { - label Atan - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {125 125 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {135 135 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {147 147 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {157 157 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button distp6 { - label {Neg.} - callback {eff->seteffectpar(6,(int) o->value());} - xywh {260 55 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - Fl_Check_Button distp9 { - label {St.} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Stereo xywh {355 60 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - Fl_Check_Button distp10 { - label PF - callback {eff->seteffectpar(10,(int) o->value());} - tooltip {Applies the filters(before or after) the distorsion} xywh {355 44 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 1 - } - } - } - Function {make_eq_window()} {open - } { - Fl_Window effeqwindow { - label EQ open - xywh {682 881 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Dial eqp0 { - label Gain - callback {eff->seteffectpar(0,(int) o->value()); -eqgraph->redraw();} - xywh {10 35 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter bandcounter { - label {B.} - callback {eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl);} - tooltip {Band no.} xywh {240 20 45 15} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 1 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_EQ_BANDS-1);} - } - Fl_Group bandgroup { - xywh {245 40 130 50} box ENGRAVED_FRAME - code0 {if (eff->geteffectpar(10)==0) o->deactivate();} - } { - Fl_Dial freqdial { - label Freq - callback {int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {250 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Dial gaindial { - label Gain - callback {int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {280 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Resonance/Bandwidth} xywh {310 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Counter stagescounter { - label {St.} - callback {int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Additional filter stages} xywh {340 60 30 15} type Simple labelfont 1 labelsize 10 minimum 1 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_FILTER_STAGES-1);} - } - } - Fl_Choice typechoice { - label {T.} - callback {int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw();} - tooltip Type xywh {290 20 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp1 - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp1 - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp2 - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp2 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Bp2 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label N2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pk - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HSh - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Box eqgraph { - xywh {45 10 190 75} box BORDER_BOX color 50 - code0 {o->init(eff);} - class EQGraph - } - } - } - Function {make_dynamicfilter_window()} {open - } { - Fl_Window effdynamicfilterwindow { - label DynFilter open - xywh {819 290 380 100} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 25 - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice dfp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 14 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label WahWah - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AutoWah - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sweep - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label VocalMorph1 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label VocalMorph2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial dfp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp1 { - label Pan - callback {eff->seteffectpar(1,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp3 { - label Rnd - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {LFO Randomness} xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial dfp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {200 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp6 { - label LfoD - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO Depth} xywh {235 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice dfp4 { - label {LFO type} - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {LFO function} xywh {155 50 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 130 textsize 8 - } { - MenuItem {} { - label SINE - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - } - Fl_Button {} { - label Filter - callback {filterwindow->show();} - xywh {115 10 55 25} box THIN_UP_BOX - } - Fl_Group {} { - xywh {270 40 105 45} box UP_FRAME color 51 - } { - Fl_Dial dfp7 { - label {A.S.} - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Filter vs Amplitude} xywh {275 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp9 { - label {A.M} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {rate that amplitude changes the filter} xywh {305 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button dfp8 { - label {A.Inv.} - callback {eff->seteffectpar(8,(int) o->value());} - tooltip {enable for filter frequency to lower with higher input amplitude} xywh {345 55 15 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 2 - } - } - } - } - Function {make_filter_window()} {open - } { - Fl_Window filterwindow { - label {Filter Parameters for DynFilter Eff.} - xywh {801 474 290 110} type Double - code0 {set_module_parameters(o);} visible - } { - Fl_Group {} { - label {DynFilter effect - Filter} - xywh {5 5 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(eff->filterpars,NULL,NULL);} - code1 {o->use_for_dynamic_filter();} - class FilterUI - } {} - Fl_Button {} { - label Close - callback {filterwindow->hide();} - xywh {105 85 70 20} box THIN_UP_BOX - } - } - } - Function {init(EffectMgr *eff_)} {} { - code {eff=eff_; - -make_null_window(); -make_reverb_window(); -make_echo_window(); -make_chorus_window(); -make_phaser_window(); -make_alienwah_window(); -make_distorsion_window(); -make_eq_window(); -make_dynamicfilter_window(); - -int px=this->parent()->x(); -int py=this->parent()->y(); - -effnullwindow->position(px,py); -effreverbwindow->position(px,py); -effechowindow->position(px,py); -effchoruswindow->position(px,py); -effphaserwindow->position(px,py); -effalienwahwindow->position(px,py); -effdistorsionwindow->position(px,py); -effeqwindow->position(px,py); -effdynamicfilterwindow->position(px,py); - -refresh(eff);} {} - } - Function {refresh(EffectMgr *eff_)} {open - } { - code {eff=eff_; -this->hide(); - -effnullwindow->hide(); -effreverbwindow->hide(); -effechowindow->hide(); -effchoruswindow->hide(); -effphaserwindow->hide(); -effalienwahwindow->hide(); -effdistorsionwindow->hide(); -effeqwindow->hide(); -effdynamicfilterwindow->hide(); - -eqband=0; - -if (filterwindow!=NULL){ - filterwindow->hide(); - delete(filterwindow); - filterwindow=NULL; -}; - -switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp1->value(eff->geteffectpar(1)); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp4->value(eff->geteffectpar(4)); - //revp5->value(eff->geteffectpar(5)); - revp6->value(eff->geteffectpar(6)); - revp7->value(eff->geteffectpar(7)); - revp8->value(eff->geteffectpar(8)); - revp9->value(eff->geteffectpar(9)); - revp10->value(eff->geteffectpar(10)); - revp11->value(eff->geteffectpar(11)); - revp12->value(eff->geteffectpar(12)); - - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop1->value(eff->geteffectpar(1)); - echop2->value(eff->geteffectpar(2)); - echop3->value(eff->geteffectpar(3)); - echop4->value(eff->geteffectpar(4)); - echop5->value(eff->geteffectpar(5)); - echop6->value(eff->geteffectpar(6)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp1->value(eff->geteffectpar(1)); - chorusp2->value(eff->geteffectpar(2)); - chorusp3->value(eff->geteffectpar(3)); - chorusp4->value(eff->geteffectpar(4)); - chorusp5->value(eff->geteffectpar(5)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - chorusp9->value(eff->geteffectpar(9)); - chorusp11->value(eff->geteffectpar(11)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp1->value(eff->geteffectpar(1)); - phaserp2->value(eff->geteffectpar(2)); - phaserp3->value(eff->geteffectpar(3)); - phaserp4->value(eff->geteffectpar(4)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - phaserp9->value(eff->geteffectpar(9)); - phaserp10->value(eff->geteffectpar(10)); - phaserp11->value(eff->geteffectpar(11)); - phaserp12->value(eff->geteffectpar(12)); - phaserp13->value(eff->geteffectpar(13)); - phaserp14->value(eff->geteffectpar(14)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp1->value(eff->geteffectpar(1)); - awp2->value(eff->geteffectpar(2)); - awp3->value(eff->geteffectpar(3)); - awp4->value(eff->geteffectpar(4)); - awp5->value(eff->geteffectpar(5)); - awp6->value(eff->geteffectpar(6)); - awp7->value(eff->geteffectpar(7)); - awp8->value(eff->geteffectpar(8)); - awp9->value(eff->geteffectpar(9)); - awp10->value(eff->geteffectpar(10)); - - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp1->value(eff->geteffectpar(1)); - distp2->value(eff->geteffectpar(2)); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp6->value(eff->geteffectpar(6)); - distp7->value(eff->geteffectpar(7)); - distp8->value(eff->geteffectpar(8)); - distp9->value(eff->geteffectpar(9)); - distp10->value(eff->geteffectpar(10)); - effdistorsionwindow->show(); - break; - case 7:eqband=0; - eqp0->value(eff->geteffectpar(0)); - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8:make_filter_window(); - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp1->value(eff->geteffectpar(1)); - dfp2->value(eff->geteffectpar(2)); - dfp3->value(eff->geteffectpar(3)); - dfp4->value(eff->geteffectpar(4)); - dfp5->value(eff->geteffectpar(5)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp8->value(eff->geteffectpar(8)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; -}; - -this->show();} {} - } - Function {refresh()} {open - } { - code {refresh(eff);} {} - } - decl {EffectMgr *eff;} {} - decl {int eqband;} {} -} - -class SimpleEffUI {open : {public Fl_Group,public PresetsUI_} -} { - Function {SimpleEffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {eff=NULL;} {} - } - Function {~SimpleEffUI()} {} { - code {effnullwindow->hide();//delete (effnullwindow); -effreverbwindow->hide();//delete (effreverbwindow); -effechowindow->hide();//delete (effechowindow); -effchoruswindow->hide();//delete (effchoruswindow); -effphaserwindow->hide();//delete (effphaserwindow); -effalienwahwindow->hide();//delete (effalienwahwindow); -effdistorsionwindow->hide();//delete (effdistorsionwindow); -effeqwindow->hide();//delete (effeqwindow); -effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow);} {} - } - Function {make_null_window()} {open - } { - Fl_Window effnullwindow { - label {No Effect} open - xywh {1047 755 230 95} type Double box UP_BOX color 221 labelfont 1 labelsize 19 align 16 - code0 {set_module_parameters(o);} - class Fl_Group visible - } {} - } - Function {make_reverb_window()} {open - } { - Fl_Window effreverbwindow { - label Reverb open - xywh {1047 463 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice revp { - label Preset - callback {eff->changepreset((int)o->value()); - -refresh(eff);} - xywh {10 15 90 15} down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Cathedral 1} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Cathedral 2} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Cathedral 3} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Hall 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Hall 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Room 1} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Room 2} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Basement - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Tunnel - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echoed 1} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echoed 2} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Very Long 1} - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Very Long 2} - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial revp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp2 { - label Time - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {Duration of Reverb} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial revp3 { - label {I.del} - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Initial Delay} xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial revp9 { - label Damp - callback {eff->seteffectpar(9,(int) o->value());} - tooltip Dampening xywh {120 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 minimum 64 maximum 127 step 1 - class WidgetPDial - } - } - } - Function {make_echo_window()} {open - } { - Fl_Window effechowindow { - label Echo open - xywh {428 823 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice echop { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Echo 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echo 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Echo 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Simple Echo} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Canyon - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Panning Echo 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Feedback Echo} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial echop0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial echop2 { - label Delay - callback {eff->seteffectpar(2,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial echop5 { - label {Fb.} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip Feedback xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - Function {make_chorus_window()} {open - } { - Fl_Window effchoruswindow { - label Chorus open - xywh {719 588 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice chorusp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Chorus 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Chorus 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Chorus 3} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Celeste 1} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Celeste 2} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 1} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 2} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 3} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 4} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Flange 5} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial chorusp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO Frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp7 { - label Delay - callback {eff->seteffectpar(7,(int) o->value());} - xywh {115 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial chorusp8 { - label Fb - callback {eff->seteffectpar(8,(int) o->value());} - tooltip Feedback xywh {150 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Check_Button {} { - label Flange - callback {eff->seteffectpar(10,(int) o->value());} - xywh {120 10 55 20} box THIN_UP_BOX down_box DOWN_BOX color 230 labelfont 1 labelsize 10 hide deactivate - code0 {o->value(eff->geteffectpar(10));} - } - } - } - Function {make_phaser_window()} {open - } { - Fl_Window effphaserwindow { - label Phaser open - xywh {1047 831 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice phaserp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 0 labelfont 1 labelsize 10 labelcolor 55 align 5 textfont 1 textsize 10 textcolor 7 - } { - MenuItem {} { - label {Phaser 1} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 2} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 3} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 4} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 5} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Phaser 6} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial phaserp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp5 { - label {St.df} - callback {eff->seteffectpar(5,(int) o->value());} - tooltip {Left/Right Channel Phase Shift} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {115 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial phaserp7 { - label Fb - callback {eff->seteffectpar(7,(int) o->value());} - tooltip Feedback xywh {150 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter phaserp8 { - label Stages - callback {eff->seteffectpar(8,(int) o->value());} - xywh {185 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_PHASER_STAGES);} - } - } - } - Function {make_alienwah_window()} {open - } { - Fl_Window effalienwahwindow { - label AlienWah open - xywh {403 480 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice awp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Alienwah 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 3} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Alienwah 4} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial awp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial awp6 { - label Dpth - callback {eff->seteffectpar(6,(int) o->value());} - tooltip Depth xywh {85 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Counter awp8 { - label Delay - callback {eff->seteffectpar(8,(int) o->value());} - xywh {125 55 35 15} type Simple labelfont 1 labelsize 11 minimum 0 maximum 127 step 1 - code0 {o->range(1,MAX_ALIENWAH_DELAY);} - } - } - } - Function {make_distorsion_window()} {open - } { - Fl_Window effdistorsionwindow { - label Distortion open - xywh {353 881 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice distp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {11 15 95 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label {Overdrive 1} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Overdrive 2} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {A. Exciter 1} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {A. Exciter 2} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Guitar Amp} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Quantisize - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial distp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp3 { - label Drive - callback {eff->seteffectpar(3,(int) o->value());} - tooltip {Input amplification} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 when 4 maximum 127 - class WidgetPDial - } - Fl_Dial distp4 { - label Level - callback {eff->seteffectpar(4,(int) o->value());} - tooltip {Output Amplification} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial distp7 { - label LPF - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {Low Pass Filter} xywh {190 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Choice distp5 { - label Type - callback {eff->seteffectpar(5,(int) o->value());} - xywh {120 50 60 20} box UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 align 2 textsize 10 - } { - MenuItem {} { - label Atan - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {125 125 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {135 135 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {147 147 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {157 157 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - } - } - } - Function {make_eq_window()} {open - } { - Fl_Window effeqwindow { - label EQ open - xywh {1047 881 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Counter bandcounter { - label Band - callback {eqband=(int) o->value(); -int npb=eqband*5+10; - -int type=eff->geteffectpar(npb); -typechoice->value(type); - -if (type>6) gaindial->activate(); - else gaindial->deactivate(); - -if (type==0) bandgroup->deactivate(); -else bandgroup->activate(); - -int freq=eff->geteffectpar(npb+1); -freqdial->value(freq); - -int gain=eff->geteffectpar(npb+2); -gaindial->value(gain); - -int q=eff->geteffectpar(npb+3); -qdial->value(q); - -int dbl=eff->geteffectpar(npb+4); -stagescounter->value(dbl);} - tooltip {Band no.} xywh {85 15 45 15} type Simple labelfont 1 labelsize 11 align 1 minimum 0 maximum 1 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_EQ_BANDS-1);} - } - Fl_Group bandgroup { - xywh {5 5 75 85} box UP_FRAME - code0 {if (eff->geteffectpar(10)==0) o->deactivate();} - } { - Fl_Dial freqdial { - label Freq - callback {int np=eqband*5+11; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {10 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Dial gaindial { - label Gain - callback {int np=eqband*5+12; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - xywh {45 10 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {int np=eqband*5+13; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Bandwidth/Resonance} xywh {10 50 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 when 3 maximum 127 - class WidgetPDial - } - Fl_Counter stagescounter { - label Stages - callback {int np=eqband*5+14; -eff->seteffectpar(np,(int) o->value()); -eqgraph->redraw();} - tooltip {Additional filter stages} xywh {40 55 30 15} type Simple labelfont 1 labelsize 10 minimum 1 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,MAX_FILTER_STAGES-1);} - } - } - Fl_Choice typechoice { - label Type - callback {int np=eqband*5+10; -eff->seteffectpar(np,(int) o->value()); -bandcounter->do_callback(); -eqgraph->redraw();} - tooltip Type xywh {135 15 40 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp1 - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp1 - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lp2 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Hp2 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Bp2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label N2 - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pk - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HSh - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Box eqgraph { - xywh {85 35 140 55} box BORDER_BOX color 50 - code0 {o->init(eff);} - class EQGraph - } - } - } - Function {make_dynamicfilter_window()} {open - } { - Fl_Window effdynamicfilterwindow { - label DynFilter open - xywh {965 527 230 100} type Double box UP_BOX color 51 labelfont 1 labelsize 19 align 25 - code3 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Choice dfp { - label Preset - callback {eff->changepreset((int)o->value()); -refresh(eff);} - xywh {10 15 90 15} box UP_BOX down_box BORDER_BOX color 47 selection_color 7 labelfont 1 labelsize 10 align 5 textfont 1 textsize 10 - } { - MenuItem {} { - label WahWah - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AutoWah - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sweep - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label VocalMorph1 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label VocalMorph2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial dfp0 { - label Vol - callback {eff->seteffectpar(0,(int) o->value());} - tooltip {Effect Volume} xywh {10 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp2 { - label Freq - callback {eff->seteffectpar(2,(int) o->value());} - tooltip {LFO frequency} xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp6 { - label LfoD - callback {eff->seteffectpar(6,(int) o->value());} - tooltip {LFO depth} xywh {80 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Group {} { - xywh {115 40 65 45} box UP_FRAME - } { - Fl_Dial dfp7 { - label {A.S.} - callback {eff->seteffectpar(7,(int) o->value());} - tooltip {how filter varies with amplitude} xywh {120 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - Fl_Dial dfp9 { - label {A.M} - callback {eff->seteffectpar(9,(int) o->value());} - tooltip {how quickly the filter varies with amplitude} xywh {150 45 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 - class WidgetPDial - } - } - } - } - Function {init(EffectMgr *eff_)} {open - } { - code {eff=eff_; - -make_null_window(); -make_reverb_window(); -make_echo_window(); -make_chorus_window(); -make_phaser_window(); -make_alienwah_window(); -make_distorsion_window(); -make_eq_window(); -make_dynamicfilter_window(); - -int px=this->parent()->x(); -int py=this->parent()->y(); - -effnullwindow->position(px,py); -effreverbwindow->position(px,py); -effechowindow->position(px,py); -effchoruswindow->position(px,py); -effphaserwindow->position(px,py); -effalienwahwindow->position(px,py); -effdistorsionwindow->position(px,py); -effeqwindow->position(px,py); -effdynamicfilterwindow->position(px,py); - -refresh(eff);} {} - } - Function {refresh(EffectMgr *eff_)} {} { - code {eff=eff_; -this->hide(); - -effnullwindow->hide(); -effreverbwindow->hide(); -effechowindow->hide(); -effchoruswindow->hide(); -effphaserwindow->hide(); -effalienwahwindow->hide(); -effdistorsionwindow->hide(); -effeqwindow->hide(); -effdynamicfilterwindow->hide(); - -eqband=0; - - -switch(eff->geteffect()){ - case 1: - revp->value(eff->getpreset()); - revp0->value(eff->geteffectpar(0));if (eff->insertion!=0) revp0->label("D/W"); - revp2->value(eff->geteffectpar(2)); - revp3->value(eff->geteffectpar(3)); - revp9->value(eff->geteffectpar(9)); - effreverbwindow->show(); - break; - case 2: - echop->value(eff->getpreset()); - echop0->value(eff->geteffectpar(0));if (eff->insertion!=0) echop0->label("D/W"); - echop2->value(eff->geteffectpar(2)); - echop5->value(eff->geteffectpar(5)); - effechowindow->show(); - break; - case 3: - chorusp->value(eff->getpreset()); - chorusp0->value(eff->geteffectpar(0));if (eff->insertion!=0) chorusp0->label("D/W"); - chorusp2->value(eff->geteffectpar(2)); - chorusp6->value(eff->geteffectpar(6)); - chorusp7->value(eff->geteffectpar(7)); - chorusp8->value(eff->geteffectpar(8)); - effchoruswindow->show(); - break; - case 4: - phaserp->value(eff->getpreset()); - phaserp0->value(eff->geteffectpar(0));if (eff->insertion!=0) phaserp0->label("D/W"); - phaserp2->value(eff->geteffectpar(2)); - phaserp5->value(eff->geteffectpar(5)); - phaserp6->value(eff->geteffectpar(6)); - phaserp7->value(eff->geteffectpar(7)); - phaserp8->value(eff->geteffectpar(8)); - effphaserwindow->show(); - break; - case 5: - awp->value(eff->getpreset()); - awp0->value(eff->geteffectpar(0));if (eff->insertion!=0) awp0->label("D/W"); - awp2->value(eff->geteffectpar(2)); - awp6->value(eff->geteffectpar(6)); - awp8->value(eff->geteffectpar(8)); - effalienwahwindow->show(); - break; - case 6: - distp->value(eff->getpreset()); - distp0->value(eff->geteffectpar(0));if (eff->insertion!=0) distp0->label("D/W"); - distp3->value(eff->geteffectpar(3)); - distp4->value(eff->geteffectpar(4)); - distp5->value(eff->geteffectpar(5)); - distp7->value(eff->geteffectpar(7)); - effdistorsionwindow->show(); - break; - case 7: - bandcounter->value(eqband); - bandcounter->do_callback(); - typechoice->value(eff->geteffectpar(10)); - eqgraph->redraw(); - freqdial->value(eff->geteffectpar(11)); - gaindial->value(eff->geteffectpar(12)); - if (eff->geteffectpar(10)<6) gaindial->deactivate(); - qdial->value(eff->geteffectpar(13)); - stagescounter->value(eff->geteffectpar(14)); - eqgraph->init(eff); - effeqwindow->show(); - break; - case 8: - dfp->value(eff->getpreset()); - dfp0->value(eff->geteffectpar(0));if (eff->insertion!=0) dfp0->label("D/W"); - dfp2->value(eff->geteffectpar(2)); - dfp6->value(eff->geteffectpar(6)); - dfp7->value(eff->geteffectpar(7)); - dfp9->value(eff->geteffectpar(9)); - - - effdynamicfilterwindow->show(); - break; - default:effnullwindow->show(); - break; -}; - -this->show();} {} - } - Function {refresh()} {} { - code {refresh(eff);} {} - } - decl {EffectMgr *eff;} {} - decl {int eqband;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/EnvelopeUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/EnvelopeUI.fl deleted file mode 100644 index 359f64caf30..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/EnvelopeUI.fl +++ /dev/null @@ -1,907 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/EnvelopeParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "common.H"} {public -} - -class EnvelopeFreeEdit {: {public Fl_Box} -} { - Function {EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {env=NULL; -pair=NULL;} {} - } - Function {init(EnvelopeParams *env_)} {} { - code {env=env_; -oldx=-1; -currentpoint=-1; -cpx=0; -lastpoint=-1; -ctrldown=false;} {} - } - Function {setpair(Fl_Box *pair_)} {} { - code {pair=pair_;} {} - } - Function {getpointx(int n)} {return_type int - } { - code {int lx=w()-10; -int npoints=env->Penvpoints; - -float sum=0; -for (int i=1;igetdt(i)+1; - -float sumbefore=0;//the sum of all points before the computed point -for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1; - -return((int) (sumbefore/(float) sum*lx));} {} - } - Function {getpointy(int n)} {return_type int - } { - code {int ly=h()-10; - -return((int) ((1.0-env->Penvval[n]/127.0)*ly));} {} - } - Function {getnearest(int x,int y)} {return_type int - } { - code {x-=5;y-=5; - -int nearestpoint=0; -int nearestval=1000000;//a big value -for (int i=0;iPenvpoints;i++){ - int distance=abs(x-getpointx(i))+abs(y-getpointy(i)); - if (distancePfreemode==0) env->converttofree(); -int npoints=env->Penvpoints; - -if (active_r()) fl_color(FL_BLACK); - else fl_color(90,90,90); -if (!active_r()) currentpoint=-1; - -fl_rectf(ox,oy,lx,ly); - -ox+=5;oy+=5;lx-=10;ly-=10; - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -//draws the evelope points and lines -Fl_Color alb=FL_WHITE; -if (!active_r()) alb=fl_rgb_color(180,180,180); -fl_color(alb); -int oldxx=0,xx=0,oldyy=0,yy=getpointy(0); -fl_rectf(ox-3,oy+yy-3,6,6); -for (int i=1;i=0){ - fl_color(FL_CYAN); - fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10); -}; - -//draw the sustain position -if (env->Penvsustain>0){ - fl_color(FL_YELLOW); - xx=getpointx(env->Penvsustain); - fl_line(ox+xx,oy+0,ox+xx,oy+ly); -}; - -//Show the envelope duration and the current line duration -fl_font(FL_HELVETICA|FL_BOLD,10); -float time=0.0; -if (currentpoint<=0 && (!ctrldown||lastpoint <= 0)){ - fl_color(alb); - for (int i=1;igetdt(i); -} else { - fl_color(255,0,0); - time=env->getdt(lastpoint); -}; -char tmpstr[20]; -if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time); - else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0); -fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0); -if (lastpoint>=0){ - snprintf((char *)&tmpstr,20,"%d", env->Penvval[lastpoint]); - fl_draw(tmpstr,ox+lx-20,oy+ly-23,20,10,FL_ALIGN_RIGHT,NULL,0); -}} {} - } - Function {handle(int event)} {return_type int - } { - code {int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); - -// Some window magic makes us lose focus, so reassert it. -if (event==FL_ENTER) - Fl::focus(this); - -if ((event==FL_KEYDOWN || event==FL_KEYUP)){ - int key = Fl::event_key(); - if (key==FL_Control_L || key==FL_Control_R){ - ctrldown = (event==FL_KEYDOWN); - redraw(); - if (pair!=NULL) pair->redraw(); - } -} - -if (event==FL_MOUSEWHEEL && lastpoint>=0) { - if (!ctrldown) { - int ny=env->Penvval[lastpoint] - Fl::event_dy(); - env->Penvval[lastpoint]=ny < 0 ? 0 : ny > 127 ? 127 : ny; - } else if (lastpoint > 0) { - int newdt = Fl::event_dy() + env->Penvdt[lastpoint]; - env->Penvdt[lastpoint] = newdt < 0 ? 0 : newdt > 127 ? 127 : newdt; - } - redraw(); - if (pair!=NULL) pair->redraw(); -} - -if (event==FL_PUSH) { - currentpoint=getnearest(x_,y_); - cpx=x_; - cpdt=env->Penvdt[currentpoint]; - lastpoint=currentpoint; - redraw(); - if (pair!=NULL) pair->redraw(); -}; - -if (event==FL_RELEASE){ - currentpoint=-1; - redraw(); - if (pair!=NULL) pair->redraw(); -}; - -if ((event==FL_DRAG)&&(currentpoint>=0)){ - int ny=127-(int) (y_*127.0/h()); - if (ny<0) ny=0;if (ny>127) ny=127; - env->Penvval[currentpoint]=ny; - - int dx=(int)((x_-cpx)*0.1); - int newdt=cpdt+dx; - if (newdt<0) newdt=0;if (newdt>127) newdt=127; - if (currentpoint!=0) env->Penvdt[currentpoint]=newdt; - else env->Penvdt[currentpoint]=0; - - redraw(); - if (pair!=NULL) pair->redraw(); -}; - - -return(1);} {} - } - decl {Fl_Box *pair;} {} - decl {EnvelopeParams *env;} {} - decl {int oldx;} {} - decl {int currentpoint,cpx,cpdt;} {} - decl {int lastpoint;} {public - } - decl {bool ctrldown;} {} -} - -class EnvelopeUI {open : {public Fl_Group,PresetsUI_} -} { - Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {env=NULL; -freemodeeditwindow=NULL; -envADSR=NULL; -envASR=NULL; -envADSRfilter=NULL; -envASRbw=NULL; -envfree=NULL;} {} - } - Function {~EnvelopeUI()} {} { - code {envwindow->hide(); -hide(); -freemodeeditwindow->hide(); -delete (freemodeeditwindow);} {} - } - Function {make_freemode_edit_window()} {open - } { - Fl_Window freemodeeditwindow { - label Envelope - xywh {702 269 575 180} type Double visible - } { - Fl_Box freeedit { - label Envelope - xywh {5 5 565 145} box FLAT_BOX color 0 - code0 {o->init(env);} - class EnvelopeFreeEdit - } - Fl_Button addpoint { - label {Add point} - callback {int curpoint=freeedit->lastpoint; -if (curpoint<0) return; -//if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return; - -for (int i=env->Penvpoints;i>=curpoint+1;i--){ - env->Penvdt[i]=env->Penvdt[i-1]; - env->Penvval[i]=env->Penvval[i-1]; -}; - -if (curpoint==0) { - env->Penvdt[1]=64; -}; - -env->Penvpoints++; -if (curpoint<=env->Penvsustain) env->Penvsustain++; - -freeedit->lastpoint+=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2);} - xywh {115 155 80 20} box THIN_UP_BOX labelsize 11 - code0 {if (env->Pfreemode==0) o->hide();} - } - Fl_Button deletepoint { - label {Delete point} - callback {int curpoint=freeedit->lastpoint; -if (curpoint<1) return; -if (curpoint>=env->Penvpoints-1) return; -if (env->Penvpoints<=3) return; - -for (int i=curpoint+1;iPenvpoints;i++){ - env->Penvdt[i-1]=env->Penvdt[i]; - env->Penvval[i-1]=env->Penvval[i]; -}; - -env->Penvpoints--; - -if (curpoint<=env->Penvsustain) env->Penvsustain--; - - -freeedit->lastpoint-=1; -freeedit->redraw(); -envfree->redraw(); - -sustaincounter->value(env->Penvsustain); -sustaincounter->maximum(env->Penvpoints-2);} - xywh {200 155 80 20} box THIN_UP_BOX labelsize 11 - code0 {if (env->Pfreemode==0) o->hide();} - } - Fl_Check_Button freemodebutton { - label FreeMode - callback {reinit(); - -freeedit->lastpoint=-1; -freeedit->redraw();} - tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11 - } - Fl_Check_Button forcedreleasecheck { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(env->Pforcedrelease);} - code1 {if (env->Pfreemode==0) o->hide();} - } - Fl_Dial envstretchdial { - label {Str.} - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - code1 {if (env->Pfreemode==0) o->hide();} - class WidgetPDial - } - Fl_Button {} { - label Close - callback {freemodeeditwindow->hide();} - xywh {510 155 60 20} box THIN_UP_BOX - } - Fl_Check_Button linearenvelopecheck { - label L - callback {env->Plinearenvelope=(int)o->value();} - tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(env->Plinearenvelope);} - code1 {if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide();} - } - Fl_Counter sustaincounter { - label Sust - callback {env->Penvsustain=(int) o->value(); -freeedit->redraw(); -envfree->redraw();} - tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 11 align 4 minimum 0 maximum 127 step 1 - code0 {o->value(env->Penvsustain);} - code1 {if (env->Pfreemode==0) o->hide();} - code2 {o->maximum(env->Penvpoints-2);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - Function {make_ADSR_window()} {open - } { - Fl_Window envADSR {open - xywh {344 788 205 70} type Double color 50 labelfont 1 - class Fl_Group visible - } { - Fl_Group {} { - label {Amplitude Envelope} - xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters(o);} - } { - Fl_Dial e1adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e1ddt { - label {D.dt} - callback {env->PD_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_dt);} - class WidgetPDial - } - Fl_Dial e1rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e1sval { - label {S.val} - callback {env->PS_val=(int)o->value(); -freeedit->redraw();} - tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PS_val);} - class WidgetPDial - } - Fl_Check_Button e1forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {180 35 20 15} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Dial e1envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - tooltip {Envelope window} xywh {185 5 15 15} labelfont 1 labelsize 10 - } - Fl_Check_Button e1linearenvelope { - label L - callback {env->Plinearenvelope=(int)o->value();} - tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 10 align 4 - code0 {o->value(env->Plinearenvelope);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - } - Function {make_ASR_window()} {open - } { - Fl_Window envASR {open - xywh {648 667 210 70} type Double - class Fl_Group visible - } { - Fl_Group {} { - label {Frequency Envelope} - xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters(o);} - } { - Fl_Dial e2aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e2adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e2rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e2rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e2envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e2forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - tooltip {Envelope window} xywh {190 5 15 15} labelfont 1 labelsize 10 - } - } - } - Function {make_ADSRfilter_window()} {open - } { - Fl_Window envADSRfilter {open selected - xywh {627 569 275 70} type Double color 50 labelfont 1 - class Fl_Group visible - } { - Fl_Group {} { - label {Filter Envelope} - xywh {0 0 275 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters(o);} - } { - Fl_Dial e3aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e3adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e3dval { - label {D.val} - callback {env->PD_val=(int)o->value(); -freeedit->redraw();} - tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_val);} - class WidgetPDial - } - Fl_Dial e3ddt { - label {D.dt} - callback {env->PD_dt=(int)o->value(); -freeedit->redraw();} - tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PD_dt);} - class WidgetPDial - } - Fl_Dial e3rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e3rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e3envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {215 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e3forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced Relase} xywh {250 30 15 20} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {255 5 15 15} labelfont 1 labelsize 10 - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - } - Function {make_ASRbw_window()} {open - } { - Fl_Window envASRbw {open - xywh {362 642 210 70} type Double - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Group {} { - label {BandWidth Envelope} - xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters(o);} - } { - Fl_Dial e4aval { - label {A.val} - callback {env->PA_val=(int)o->value(); -freeedit->redraw();} - tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_val);} - class WidgetPDial - } - Fl_Dial e4adt { - label {A.dt} - callback {env->PA_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PA_dt);} - class WidgetPDial - } - Fl_Dial e4rval { - label {R.val} - callback {env->PR_val=(int)o->value(); -freeedit->redraw();} - tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_val);} - class WidgetPDial - } - Fl_Dial e4rdt { - label {R.dt} - callback {env->PR_dt=(int)o->value(); -freeedit->redraw();} - tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->PR_dt);} - class WidgetPDial - } - Fl_Dial e4envstretch { - label Stretch - callback {env->Penvstretch=(int)o->value();} - tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(env->Penvstretch);} - class WidgetPDial - } - Fl_Check_Button e4forcedrelease { - label frcR - callback {env->Pforcedrelease=(int)o->value();} - tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6 - code0 {o->value(env->Pforcedrelease);} - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {190 5 15 15} labelfont 1 labelsize 10 - } - } - } - Function {make_free_window()} {open - } { - Fl_Window envfree {open - xywh {376 436 205 70} type Double color 50 labelfont 1 resizable - code0 {set_module_parameters(o);} - class Fl_Group visible - } { - Fl_Group envfreegroup { - label {Amplitude Envelope} - xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 resizable - code0 {set_module_parameters(o);} - } { - Fl_Box freeeditsmall { - label Envelope - callback {envfree->redraw();} - xywh {5 20 195 45} box FLAT_BOX color 0 resizable - code0 {o->init(env);} - class EnvelopeFreeEdit - } - Fl_Button {} { - label E - callback {freemodeeditwindow->show();} - xywh {185 5 15 15} labelfont 1 labelsize 10 - } - Fl_Button {} { - label C - callback {presetsui->copy(env);} - xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(env,this);} - xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - } - Function {init(EnvelopeParams *env_)} {open - } { - code {env=env_; -make_ADSR_window(); -make_ASR_window(); -make_ADSRfilter_window(); -make_ASRbw_window(); -make_free_window(); - -make_freemode_edit_window(); - -envwindow=NULL; -if (env->Envmode==3) envfreegroup->label("Frequency Envelope"); -if (env->Envmode==4) envfreegroup->label("Filter Envelope"); -if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope"); - -freemodeeditwindow->label(this->label()); - - -freeeditsmall->setpair(freeedit); -freeedit->setpair(freeeditsmall); - - -refresh();} {} - } - Function {reinit()} {} { - code {if (env->Pfreemode!=0){ - int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL); - if (env->Pfreemode!=0) freemodebutton->value(1); - else freemodebutton->value(0); - if (answer==0) return; -}; - -if (env->Pfreemode==0) env->Pfreemode=1; - else env->Pfreemode=0; - -hide(); -int winx=freemodeeditwindow->x(); -int winy=freemodeeditwindow->y(); - -freemodeeditwindow->hide(); - -envwindow->hide(); -Fl_Group *par=envwindow->parent(); -par->hide(); - - -refresh(); -envwindow->show(); -par->redraw(); - -par->show(); -show(); -freemodeeditwindow->position(winx,winy); -freemodeeditwindow->show(); - -if (env->Pfreemode!=0) { - freemodebutton->value(1); - addpoint->show(); - deletepoint->show(); - forcedreleasecheck->show(); -}else{ - freemodebutton->value(0); - addpoint->hide(); - deletepoint->hide(); - forcedreleasecheck->hide(); -};} {} - } - Function {refresh()} {open - } { - code {freemodebutton->value(env->Pfreemode); - -sustaincounter->value(env->Penvsustain); -if (env->Pfreemode==0) sustaincounter->hide(); - else sustaincounter->show(); -sustaincounter->maximum(env->Penvpoints-2); - -envstretchdial->value(env->Penvstretch); -if (env->Pfreemode==0) envstretchdial->hide(); - else envstretchdial->show(); - -linearenvelopecheck->value(env->Plinearenvelope); -if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide(); - else linearenvelopecheck->show(); - -forcedreleasecheck->value(env->Pforcedrelease); -if (env->Pfreemode==0) forcedreleasecheck->hide(); - else forcedreleasecheck->show(); - -if (env->Pfreemode==0){ - addpoint->hide(); - deletepoint->hide(); -} else { - addpoint->show(); - deletepoint->show(); -} - -freeedit->redraw(); - -if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - e1adt->value(env->PA_dt); - e1ddt->value(env->PD_dt); - e1sval->value(env->PS_val); - e1rdt->value(env->PR_dt); - e1envstretch->value(env->Penvstretch); - e1linearenvelope->value(env->Plinearenvelope); - e1forcedrelease->value(env->Pforcedrelease); - break; - case(3): - e2aval->value(env->PA_val); - e2adt->value(env->PA_dt); - e2rdt->value(env->PR_dt); - e2rval->value(env->PR_val); - e2envstretch->value(env->Penvstretch); - e2forcedrelease->value(env->Pforcedrelease); - break; - case(4): - e3aval->value(env->PA_val); - e3adt->value(env->PA_dt); - e3dval->value(env->PD_val); - e3ddt->value(env->PD_dt); - e3rdt->value(env->PR_dt); - e3rval->value(env->PR_val); - e3envstretch->value(env->Penvstretch); - e3forcedrelease->value(env->Pforcedrelease); - break; - case(5): - e4aval->value(env->PA_val); - e4adt->value(env->PA_dt); - e4rdt->value(env->PR_dt); - e4rval->value(env->PR_val); - e4envstretch->value(env->Penvstretch); - e4forcedrelease->value(env->Pforcedrelease); - break; - default: - break; - }; -}else{ - envfree->redraw(); -}; - - -envADSR->hide(); -envASR->hide(); -envADSRfilter->hide(); -envASRbw->hide(); -envfree->hide(); - -if (env->Pfreemode==0){ - switch(env->Envmode){ - case(1): - case(2): - envwindow=envADSR; - break; - case(3): - envwindow=envASR; - break; - case(4): - envwindow=envADSRfilter; - break; - case(5): - envwindow=envASRbw; - break; - default: - break; - }; -}else{ - envwindow=envfree; -}; - -envwindow->resize(this->x(),this->y(),this->w(),this->h()); - -envwindow->show();} {} - } - decl {EnvelopeParams *env;} {} - decl {Fl_Group *envwindow;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/FilterUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/FilterUI.fl deleted file mode 100644 index 632e37b602c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/FilterUI.fl +++ /dev/null @@ -1,638 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {} - -decl {\#include } {global -} - -decl {\#include } {global -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/FilterParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "common.H"} {public -} - -class FormantFilterGraph {open : {public Fl_Box} -} { - Function {FormantFilterGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL; -nvowel=NULL; -nformant=NULL; -graphpoints=NULL;} {} - } - Function {init(FilterParams *pars_,int *nvowel_,int *nformant_)} {} { - code {pars=pars_; -nvowel=nvowel_; -nformant=nformant_; -oldx=-1; -graphpoints=new float [w()];} {} - } - Function {draw_freq_line(float freq,int type)} {} { - code {float freqx=pars->getfreqpos(freq); -switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {open - } { - code {int maxdB=30; -int ox=x(),oy=y(),lx=w(),ly=h(),i,oiy; -float freqx; - -fl_color(FL_BLACK); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -//fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=pars->getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - -fl_line_style(FL_DOT); -int GY=10;if (lyPnumformants){ - draw_freq_line(pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq),2); - -//show some information (like current formant frequency,amplitude) - char tmpstr[20]; - - snprintf(tmpstr,20,"%.2f kHz",pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq)*0.001); - fl_draw(tmpstr,ox+1,oy+1,40,12,FL_ALIGN_LEFT,NULL,0); - - snprintf(tmpstr,20,"%d dB",(int)( rap2dB(1e-9 + pars->getformantamp(pars->Pvowels[*nvowel].formants[*nformant].amp)) + pars->getgain() )); - fl_draw(tmpstr,ox+1,oy+15,40,12,FL_ALIGN_LEFT,NULL,0); - -}; - -//draw the data - -fl_color(FL_RED); -fl_line_style(FL_SOLID); - -pars->formantfilterH(*nvowel,lx,graphpoints); - -fl_line_style( FL_SOLID, 2 ); -fl_begin_line(); -oiy=(int) ((graphpoints[0]/maxdB+1.0)*ly/2.0); -for (i=1;i=0)&&(oiy>=0)&&(iyhide(); -formantparswindow->hide(); -hide(); -//delete (filterui); -delete (formantparswindow);} {} - } - Function {make_window()} {open - } { - Fl_Window filterui {open - xywh {498 346 275 70} type Double color 50 labelfont 1 - class Fl_Group visible - } { - Fl_Group filterparamswindow { - label {Filter Parameters} - xywh {0 0 275 75} box UP_FRAME color 183 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters( o );} - } { - Fl_Choice analogfiltertypechoice { - label FilterType - callback {pars->Ptype=(int)o->value(); -pars->changed=true;} - tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code1 {o->value(pars->Ptype);} - } { - MenuItem {} { - label LPF1 - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HPF1 - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LPF2 - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HPF2 - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BPF2 - xywh {82 82 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label NF2 - xywh {94 94 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label PkF2 - xywh {104 104 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh2 - xywh {114 114 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HSh2 - xywh {124 124 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice svfiltertypechoice { - label FilterType - callback {pars->Ptype=(int)o->value(); -pars->changed=true;} - tooltip {The Filter type} xywh {10 50 50 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code1 {o->value(pars->Ptype);} - } { - MenuItem {} { - label 1LPF - xywh {134 134 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 1HPF - xywh {144 144 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 1BPF - xywh {154 154 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 1NF - xywh {164 164 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice filtertype { - label Category - callback {switchcategory((int)o->value()); -pars->changed=true;} - tooltip {The Category of the Filter (Analog/Formantic/etc.)} xywh {10 20 60 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Pcategory);} - } { - MenuItem {} { - label Analog - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Formant - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label StVarF - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial cfreqdial { - label {C.Freq} - callback {pars->Pfreq=(int)o->value();} - tooltip {Center Frequency of the Filter or the base position in the vowel's sequence} xywh {75 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pfreq);} - class WidgetPDial - } - Fl_Dial qdial { - label Q - callback {pars->Pq=(int)o->value(); -formantfiltergraph->redraw();} - tooltip {Filter resonance or bandwidth} xywh {110 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pq);} - class WidgetPDial - } - Fl_Dial freqtrdial { - label {freq.tr.} - callback {pars->Pfreqtrack=(int) o->value();} - tooltip {Filter frequency tracking (left is negative, middle is 0, and right is positive)} xywh {215 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pfreqtrack);} - class WidgetPDial - } - Fl_Dial vsnsadial { - label {V.SnsA.} - callback {if (velsnsamp!=NULL) *velsnsamp=(int)o->value();} - tooltip {Velocity sensing amount of the Filter} xywh {145 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial vsnsdial { - label {V.Sns.} - callback {if (velsns!=NULL) *velsns=(int)o->value();} - tooltip {Velocity Sensing Function of the Filter} xywh {180 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial gaindial { - label gain - callback {pars->Pgain=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Filter output gain/damp} xywh {250 35 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pgain);} - class WidgetPDial - } - Fl_Choice stcounter { - label St - callback {pars->Pstages=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} open - tooltip {Filter stages (in order to increase dB/oct. value and the order of the filter)} xywh {235 5 35 15} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 - code1 {for (int i=0;iadd(tmp);};} - code2 {o->value(pars->Pstages);} - } {} - } - Fl_Button editbutton { - label Edit - callback {formantparswindow->show();} - xywh {15 40 50 25} labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copyArray(pars);} - xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->pasteArray(pars,this);} - xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - Function {make_formant_window()} {open - } { - Fl_Window formantparswindow { - label {Formant Filter Parameters} selected - xywh {518 473 700 205} type Double visible - } { - Fl_Group {} { - xywh {485 47 105 113} box THIN_UP_BOX - } { - Fl_Counter {} { - label {Formant } - callback {nformant=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw();} - xywh {545 80 40 15} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_FORMANTS-1);} - code1 {o->value(nformant);} - } - Fl_Counter {} { - label {Vowel no.} - callback {nvowel=(int) o->value(); -update_formant_window(); -formantfiltergraph->redraw();} - xywh {545 55 40 20} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(0,FF_MAX_VOWELS-1);} - code1 {o->value(nvowel);} - } - Fl_Group formantparsgroup { - xywh {490 105 95 50} box ENGRAVED_FRAME - } { - Fl_Dial formant_freq_dial { - label freq - callback {pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant frequency} xywh {495 115 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial formant_q_dial { - label Q - callback {pars->Pvowels[nvowel].formants[nformant].q=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant's Q} xywh {525 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial formant_amp_dial { - label amp - callback {pars->Pvowels[nvowel].formants[nformant].amp=(int) o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Formant amplitude} xywh {555 115 24 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Group {} { - xywh {590 47 100 113} box THIN_UP_BOX - } { - Fl_Counter {} { - label {Seq.Size} - callback {pars->Psequencesize=(int) o->value(); -update_formant_window(); -pars->changed=true;} - xywh {595 62 55 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->bounds(1,FF_MAX_SEQUENCE-1);} - code1 {o->value(pars->Psequencesize);} - } - Fl_Counter {} { - label {S.Pos.} - callback {nseqpos=(int) o->value(); -update_formant_window(); -pars->changed=true;} - tooltip {Current position from the sequence} xywh {595 97 40 15} type Simple labelfont 1 labelsize 10 align 9 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_SEQUENCE-2);} - code1 {o->value(nseqpos);} - } - Fl_Counter vowel_counter { - label Vowel - callback {pars->Psequence[nseqpos].nvowel=(int) o->value(); -pars->changed=true;} - xywh {640 97 40 15} type Simple labelsize 10 align 1 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->bounds(0,FF_MAX_VOWELS-1);} - } - Fl_Check_Button {} { - label {Neg.Input} - callback {pars->Psequencereversed=(int) o->value(); -pars->changed=true;} - tooltip {Negate the input from LFO/envelopes/etc.} xywh {625 132 60 20} down_box DOWN_BOX labelsize 10 - code0 {o->value(pars->Psequencereversed);} - } - Fl_Dial strchdial { - label Strch - callback {pars->Psequencestretch=(int) o->value(); -pars->changed=true;} - tooltip {Sequence Stretch} xywh {595 130 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Psequencestretch);} - class WidgetPDial - } - } - Fl_Counter {} { - label {Num.Formants} - callback {pars->Pnumformants=(int) o->value(); -update_formant_window(); -pars->changed=true; -formantfiltergraph->redraw();} - xywh {485 15 65 20} type Simple labelfont 1 labelsize 10 align 5 minimum 0 maximum 127 step 1 - code0 {o->bounds(1,FF_MAX_FORMANTS);} - code1 {o->value(pars->Pnumformants);} - } - Fl_Dial frsldial { - label {Fr.Sl.} - callback {pars->Pformantslowness=(int) o->value(); -pars->changed=true;} - tooltip {Formant's Slowness (Morphing)} xywh {565 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pformantslowness);} - class WidgetPDial - } - Fl_Value_Output centerfreqvo { - label {C.f.} - callback {o->value(pars->getcenterfreq()/1000.0);} - tooltip {Center Frequency (kHz)} xywh {515 164 33 18} when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1 - code0 {o->value(pars->getcenterfreq()/1000.0);} - } - Fl_Value_Output octavesfreqvo { - label {Oct.} - callback {o->value(pars->getoctavesfreq());} - tooltip {No. of octaves} xywh {515 182 33 18} when 3 minimum 1 maximum 127 step 1 value 5 textfont 1 - code0 {o->value(pars->getoctavesfreq());} - } - Fl_Slider cfknob { - callback {pars->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -formantfiltergraph->redraw(); -pars->changed=true;} - xywh {551 167 84 15} type {Horz Knob} box FLAT_BOX maximum 127 - code0 {o->value(pars->Pcenterfreq);} - } - Fl_Slider octknob { - callback {pars->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -formantfiltergraph->redraw();} - xywh {551 185 84 15} type {Horz Knob} box FLAT_BOX maximum 127 - code0 {o->value(pars->Poctavesfreq);} - } - Fl_Box formantfiltergraph { - xywh {5 5 475 195} box BORDER_BOX - code0 {o->init(pars,&nvowel,&nformant);} - class FormantFilterGraph - } - Fl_Dial wvknob { - label {Vw.Cl.} - callback {pars->Pvowelclearness=(int) o->value(); -pars->changed=true;} - tooltip {Vowel "clearness" (how the mixed vowels are avoided)} xywh {600 15 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pvowelclearness);} - class WidgetPDial - } - Fl_Button {} { - label Close - callback {formantparswindow->hide();} - xywh {645 180 50 25} box THIN_UP_BOX - } - Fl_Button {} { - label C - callback {presetsui->copy(pars,nvowel);} - xywh {635 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this,nvowel);} - xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Box {} { - label Vowel - xywh {635 10 55 15} - } - } - } - Function {update_formant_window()} {open - } { - code {formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq); -formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q); -formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp); -if (nformantPnumformants) formantparsgroup->activate(); - else formantparsgroup->deactivate(); - -if (nseqposPsequencesize) vowel_counter->activate(); - else vowel_counter->deactivate(); - - -vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {} - } - Function {refresh()} {} { - code {update_formant_window(); -formantfiltergraph->redraw(); - -if (pars->Pcategory==2) svfiltertypechoice->value(pars->Ptype); -if (pars->Pcategory==0) analogfiltertypechoice->value(pars->Ptype); - -filtertype->value(pars->Pcategory); - -cfreqdial->value(pars->Pfreq); -qdial->value(pars->Pq); - -freqtrdial->value(pars->Pfreqtrack); -gaindial->value(pars->Pgain); - -stcounter->value(pars->Pstages); - -int categ=pars->Pcategory; -if ((categ==0)||(categ==2)) { - if (categ==0) { - analogfiltertypechoice->show(); - svfiltertypechoice->hide(); - } else { - svfiltertypechoice->show(); - analogfiltertypechoice->hide(); - }; - editbutton->hide(); - formantparswindow->hide(); - cfreqdial->label("C.freq"); -} else { - analogfiltertypechoice->hide(); - svfiltertypechoice->hide(); - editbutton->show(); - cfreqdial->label("BS.pos"); -}; - -filterparamswindow->redraw();} {} - } - Function {init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_)} {} { - code {pars=filterpars_; -velsnsamp=velsnsamp_; -velsns=velsns_; - -make_window(); -end(); -make_formant_window(); - - -filterui->resize(this->x(),this->y(),this->w(),this->h()); - - -if (velsnsamp==NULL){ - vsnsadial->deactivate(); - vsnsadial->value(127); - } else vsnsadial->value(*velsnsamp); - -if (velsns==NULL){ - vsnsdial->deactivate(); - vsnsdial->value(127); - } else vsnsdial->value(*velsns); - -switchcategory(pars->Pcategory); - - -formantparswindow->label(this->label()); - -update_formant_window();} {} - } - Function {switchcategory(int newcat)} {open - } { - code {if (pars->Pcategory!=newcat){ - pars->Pgain=64; - gaindial->value(64); - analogfiltertypechoice->value(0); - analogfiltertypechoice->do_callback(); - svfiltertypechoice->value(0); - svfiltertypechoice->do_callback(); -}; -pars->Pcategory=newcat; - -refresh();} {} - } - Function {use_for_dynamic_filter()} {open - } { - code {freqtrdial->deactivate(); -gaindial->when(0); - -cfknob->when(FL_WHEN_RELEASE); -octknob->when(FL_WHEN_RELEASE); - -frsldial->when(0); -wvknob->when(0); -formant_freq_dial->when(0); -formant_q_dial->when(0); -formant_amp_dial->when(0); -strchdial->when(0);} {} - } - decl {FilterParams *pars;} {} - decl {unsigned char *velsnsamp,*velsns;} {} - decl {int nvowel,nformant,nseqpos;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/LFOUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/LFOUI.fl deleted file mode 100644 index 2f6cecda961..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/LFOUI.fl +++ /dev/null @@ -1,181 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/LFOParams.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "common.H"} {public -} - -class LFOUI {open : {public Fl_Group, PresetsUI_} -} { - Function {LFOUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {~LFOUI()} {} { - code {lfoui->hide(); -hide(); -//delete (lfoui);} {} - } - Function {make_window()} {open - } { - Fl_Window lfoui {open selected - xywh {630 351 230 70} type Double color 50 labelfont 1 - class Fl_Group visible - } { - Fl_Group lfoparamswindow { - label LFO - xywh {0 0 230 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 - code0 {set_module_parameters(o);} - } { - Fl_Dial freq { - label {Freq.} - callback {pars->Pfreq=o->value();} - tooltip {LFO Frequency} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 step 1e-05 - class WidgetPDial - } - Fl_Dial intensity { - label Depth - callback {pars->Pintensity=(int)o->value();} - tooltip {LFO Amount} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial delay { - label Delay - callback {pars->Pdelay=(int)o->value();} - tooltip {LFO delay} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial startphase { - label Start - callback {pars->Pstartphase=(int)o->value();} - tooltip {LFO Startphase (leftmost is Random)} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial randomness { - label {A.R.} - callback {pars->Prandomness=(int)o->value();} - tooltip {LFO Amplitude Randomness} xywh {180 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Choice LFOtype { - label Type - callback {pars->PLFOtype=(int)o->value();} - tooltip {LFO function} xywh {180 40 45 15} down_box BORDER_BOX labelsize 10 align 2 textsize 8 - } { - MenuItem {} { - label SINE - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label TRI - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label SQR - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {R.up} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {R.dn} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label E1dn - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label E2dn - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button continous { - label {C.} - callback {pars->Pcontinous=(int)o->value();} - tooltip {Continous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2 - } - Fl_Dial freqrand { - label {F.R.} - callback {pars->Pfreqrand=(int)o->value();} - tooltip {LFO Frequency Randomness} xywh {205 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Dial stretch { - label {Str.} - callback {pars->Pstretch=(int)o->value();} - tooltip {LFO stretch} xywh {144 30 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - class WidgetPDial - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {145 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {162 10 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55 - } - } - } - } - Function {refresh()} {} { - code {freq->value(pars->Pfreq); -intensity->value(pars->Pintensity); -startphase->value(pars->Pstartphase); -delay->value(pars->Pdelay); -continous->value(pars->Pcontinous); -stretch->value(pars->Pstretch); -randomness->value(pars->Prandomness); -freqrand->value(pars->Pfreqrand); -LFOtype->value(pars->PLFOtype);} {} - } - Function {init(LFOParams *lfopars_)} {} { - code {pars=lfopars_; - -make_window(); -end(); - -refresh(); - -lfoui->resize(this->x(),this->y(),this->w(),this->h()); - -lfoparamswindow->label(this->label());} {} - } - decl {LFOParams *pars;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/MasterUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/MasterUI.fl deleted file mode 100644 index 254e505a2dd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/MasterUI.fl +++ /dev/null @@ -1,1889 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2009 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "ADnoteUI.h"} {public -} - -decl {\#include "SUBnoteUI.h"} {public -} - -decl {\#include "EffUI.h"} {public -} - -decl {\#include "VirKeyboard.h"} {public -} - -decl {\#include "ConfigUI.h"} {public -} - -decl {\#include "BankUI.h"} {public -} - -decl {\#include "PartUI.h"} {public -} - -decl {\#include "MicrotonalUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include "NioUI.h"} {public global -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Part.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "common.H"} {public -} - -decl {\#if USE_NSM -\#include "NSM.H" -extern NSM_Client *nsm; -\#endif} {public -} - -decl {\#include "../globals.h"} {public -} - -class VUMeter {: {public Fl_Box} -} { - Function {VUMeter(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {master=NULL; -npart=-1;} {} - } - Function {init(Master *master_,int part_)} {} { - code {//the "part_" parameters sets the part (if it is >=0), else it sets the master -master=master_; -label(NULL); -npart=part_; -olddbl=0.0; -olddbr=0.0; -oldrmsdbl=0.0; -oldrmsdbr=0.0;} {} - } - Function {draw_master()} {} { - code {\#define MIN_DB (-48) - -int ox=x(); int oy=y(); int lx=w(); int ly=h(); - -vuData data = master->getVuData(); - -//pthread_mutex_lock(&master->mutex); -float dbl=rap2dB(data.outpeakl); -float dbr=rap2dB(data.outpeakr); -float rmsdbl=rap2dB(data.rmspeakl); -float rmsdbr=rap2dB(data.rmspeakr); -float maxdbl=rap2dB(data.maxoutpeakl); -float maxdbr=rap2dB(data.maxoutpeakr); -int clipped=data.clipped; -//pthread_mutex_unlock(&master->mutex); - -dbl=(MIN_DB-dbl)/MIN_DB; -if (dbl<0.0) dbl=0.0; - else if (dbl>1.0)dbl=1.0; - -dbr=(MIN_DB-dbr)/MIN_DB; -if (dbr<0.0) dbr=0.0; - else if (dbr>1.0) dbr=1.0; - -dbl=dbl*0.4+olddbl*0.6; -dbr=dbr*0.4+olddbr*0.6; - -if ( damage() & FL_DAMAGE_USER1 ) -{ - if ( olddbl == dbl && olddbr == dbr ) - return; -} - -olddbl=dbl; -olddbr=dbr; - -\#define VULENX (lx-35) -\#define VULENY (ly/2-3) - -dbl*=VULENX;dbr*=VULENX; - -int idbl=(int) dbl; -int idbr=(int) dbr; - -//compute RMS - start -rmsdbl=(MIN_DB-rmsdbl)/MIN_DB; -if (rmsdbl<0.0) rmsdbl=0.0; - else if (rmsdbl>1.0) rmsdbl=1.0; - -rmsdbr=(MIN_DB-rmsdbr)/MIN_DB; -if (rmsdbr<0.0) rmsdbr=0.0; - else if (rmsdbr>1.0) rmsdbr=1.0; - -rmsdbl=rmsdbl*0.4+oldrmsdbl*0.6; -rmsdbr=rmsdbr*0.4+oldrmsdbr*0.6; - -oldrmsdbl=rmsdbl; -oldrmsdbr=rmsdbr; - - -rmsdbl*=VULENX;rmsdbr*=VULENX; - -int irmsdbl=(int) rmsdbl; -int irmsdbr=(int) rmsdbr; -//compute RMS - end - - - -//draw the vu-meter lines -//db -fl_rectf(ox,oy,idbr,VULENY,0,200,255); -fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255); -//black -fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0); -fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0); - -//draw the scales -float tmp=VULENX*1.0/MIN_DB; -for (int i=1;i<1-MIN_DB;i++){ - int tx=VULENX+(int) (tmp*i); - fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200); - if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240); - if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255); -}; - -//rms -if (irmsdbr>2) fl_rectf(ox+irmsdbr-1,oy,3,VULENY,255,255,0); -if (irmsdbl>2) fl_rectf(ox+irmsdbl-1,oy+ly/2,3,VULENY,255,255,0); - - -//draw the red box if clipping has occured -if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10); - else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10); - -//draw the maxdB -fl_font(FL_HELVETICA|FL_BOLD,10); -fl_color(255,255,255); -char tmpstr[10]; -if ((maxdbl>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr); - fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); -}; -if ((maxdbr>MIN_DB-20)){ - snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl); - fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0); -};} {} - } - Function {draw_part()} {} { - code {\#define MIN_DB (-48) -int ox=x(); int oy=y(); int lx=w(); int ly=h(); - -if (!active_r()){ - pthread_mutex_lock(&master->vumutex); - int fakedb=master->fakepeakpart[npart]; - pthread_mutex_unlock(&master->vumutex); - fl_rectf(ox,oy,lx,ly,140,140,140); - if (fakedb>0){ - fakedb=(int)(fakedb/255.0*ly)+4; - fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0); - }; - - return; -}; - -//draw the vu lines -pthread_mutex_lock(&master->vumutex); - float db=rap2dB(master->vuoutpeakpart[npart]); -pthread_mutex_unlock(&master->vumutex); - -db=(MIN_DB-db)/MIN_DB; -if (db<0.0) db=0.0; - else if (db>1.0) db=1.0; - -db*=ly-2; - -int idb=(int) db; - -fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255); -fl_rectf(ox,oy,lx,ly-idb,0,0,0); - - -//draw the scales -float tmp=ly*1.0/MIN_DB; - for (int i=1;i<1-MIN_DB;i++){ - int ty=ly+(int) (tmp*i); - if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200); - if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240); -};} {} - } - Function {draw()} {} { - code {if (npart>=0) draw_part(); - else draw_master();} {} - } - Function {tickdraw(VUMeter *o)} {return_type {static void} - } { - code {o->damage(FL_DAMAGE_USER1);} {} - } - Function {tick(void *v)} {return_type {static void} - } { - code {tickdraw((VUMeter *) v); - Fl::repeat_timeout(1.0/18.0,tick,v);//18 fps} {} - } - Function {handle(int event)} {return_type int - } { - code {switch(event){ - case FL_SHOW: - Fl::add_timeout(1.0/18.0,tick,this); - break; - case FL_HIDE: - Fl::remove_timeout(tick,this); - break; - case FL_PUSH: - if (npart>=0) break; - pthread_mutex_lock(&master->mutex); - master->vuresetpeaks(); - pthread_mutex_unlock(&master->mutex); - break; -}; -return(1);} {} - } - decl {Master *master;} {} - decl {int npart;} {} - decl {float olddbl,olddbr;} {} - decl {float oldrmsdbl,oldrmsdbr;} {} -} - -class SysEffSend {open : {public WidgetPDial} -} { - Function {SysEffSend(int x,int y, int w, int h, const char *label=0):WidgetPDial(x,y,w,h,label)} {} { - code {master=NULL; -neff1=0; -neff2=0;} {} - } - Function {init(Master *master_,int neff1_,int neff2_)} {} { - code {neff1=neff1_; -neff2=neff2_; -master=master_; -minimum(0); -maximum(127); -step(1); -labelfont(1); -labelsize(10); -align(FL_ALIGN_TOP); - -value(master->Psysefxsend[neff1][neff2]); -char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1); -this->copy_label(tmp);} {} - } - Function {~SysEffSend()} {} { - code {hide();} {} - } - Function {handle(int event)} {return_type int - } { - code {if ((event==FL_PUSH) || (event==FL_DRAG)){ - master->setPsysefxsend(neff1,neff2,(int) value()); -}; - -return(WidgetPDial::handle(event));} {} - } - decl {Master *master;} {} - decl {int neff1;} {} - decl {int neff2;} {} -} - -class Panellistitem {open : {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window panellistitem {open - private xywh {608 711 100 260} type Double box FLAT_BOX - class Fl_Group visible - } { - Fl_Group panellistitemgroup {open - private xywh {0 20 70 240} box UP_FRAME - code0 {if (master->part[npart]->Penabled==0) o->deactivate();} - code1 {set_module_parameters( o );} - } { - Fl_Group {} { - xywh {45 65 15 110} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {V U} - xywh {45 65 15 110} box FLAT_BOX color 0 selection_color 75 labelcolor 55 align 128 - code0 {o->init(master,npart);} - class VUMeter - } - } - Fl_Button partname { - label { } - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show();} - xywh {5 27 60 30} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 208 - } - Fl_Slider partvolume { - callback {master->part[npart]->setPvolume((int) o->value());} - xywh {10 65 30 110} type {Vert Knob} box FLAT_BOX minimum 127 maximum 0 step 1 value 127 - code0 {o->value(master->part[npart]->Pvolume);} - } - Fl_Dial partpanning { - callback {master->part[npart]->setPpanning((int) o->value());} - xywh {20 180 30 30} maximum 127 step 1 - code0 {o->value(master->part[npart]->Ppanning);} - class WidgetPDial - } - Fl_Button {} { - label edit - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -};} - xywh {15 235 40 20} labelsize 10 - } - Fl_Choice partrcv { - callback {master->part[npart]->Prcvchn=(int) o->value();} - tooltip {receive from Midi channel} xywh {10 213 50 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");};} - code1 {o->value(master->part[npart]->Prcvchn);} - } {} - } - Fl_Check_Button partenabled { - label 01 - callback {pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) panellistitemgroup->deactivate(); - else { - panellistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw();} - private xywh {5 0 45 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24 - code0 {char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);} - code1 {o->value(master->part[npart]->Penabled);} - } - } - } - Function {Panellistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {npart=0; -master=NULL; -bankui=NULL;} {} - } - Function {init(Master *master_, int npart_,BankUI *bankui_)} {} { - code {npart=npart_; -master=master_; -bankui=bankui_; - -make_window(); -panellistitem->show(); -end();} {} - } - Function {refresh()} {} { - code {partenabled->value(master->part[npart]->Penabled); -if (master->part[npart]->Penabled!=0) panellistitemgroup->activate(); - else panellistitemgroup->deactivate(); - -partvolume->value(master->part[npart]->Pvolume); -partpanning->value(master->part[npart]->Ppanning); -partrcv->value(master->part[npart]->Prcvchn); - -partname->label((char *)master->part[npart]->Pname); - -if ((int)bankui->cbwig->value()!=(npart+1)) - panellistitemgroup->color(fl_rgb_color(160,160,160)); -else - panellistitemgroup->color(fl_rgb_color(50,190,240)); - -panellistitemgroup->redraw();} {} - } - Function {~Panellistitem()} {} { - code {panellistitem->hide(); -//delete(panellistitem);} {} - } - decl {int npart;} {} - decl {Master *master;} {} - decl {BankUI *bankui;} {} -} - -class MasterUI {open -} { - Function {make_window()} {open - } { - Fl_Window masterwindow { - label zynaddsubfx - callback {if (( -\#ifdef PLUGINVERSION -1 -\#elif USE_NSM -(nsm && nsm->is_active()) -\#else -0 -\#endif - || fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))) { - config.save(); - *exitprogram=1; -}; -} open - xywh {80 370 390 525} type Double xclass zynaddsubfx visible - } { - Fl_Menu_Bar mastermenu { - xywh {-5 0 690 25} - } { - Submenu {} { - label {&File} - xywh {0 0 100 20} - } { - MenuItem {} { - label {&New (erase all)...} - callback {do_new_master();} - xywh {20 20 100 20} - } - MenuItem {} { - label {&Open Parameters...} - callback {\#if USE_NSM - if ( nsm && nsm->is_active() ) - { - do_load_master(); - do_save_master( nsm->project_filename ); - } - else -\#endif - { - do_load_master(); - }} - xywh {20 20 100 20} - } - MenuItem {} { - label {&Save All Parameters...} - callback {\#if USE_NSM - if ( nsm && nsm->is_active() ) - { - do_save_master( nsm->project_filename ); - } - else -\#endif - { - do_save_master(); - }} - xywh {10 10 100 20} divider - } - MenuItem {} { - label {&Load Scale Settings...} - callback {char *filename; -filename=fl_file_chooser("Open:","({*.xsz})",NULL,0); -if (filename==NULL) return; - -pthread_mutex_lock(&master->mutex); - //clear all parameters - master->microtonal.defaults(); - - //load the data - int result=master->microtonal.loadXML(filename); -pthread_mutex_unlock(&master->mutex); - - - delete microtonalui; - microtonalui=new MicrotonalUI(&master->microtonal); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a scale file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {35 35 100 20} - } - MenuItem {} { - label {Save Sc&ale Settings ..} - callback {char *filename; -int result=0; - -filename=fl_file_chooser("Save:","({*.xsz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xsz"); - -result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->microtonal.saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - - -updatepanel();} - xywh {25 25 100 20} - } - MenuItem {} { - label {Show Scale Settings...} - callback {microtonalui->show();} - xywh {0 0 100 20} divider - } - MenuItem {} { - label {&Settings...} - callback {configui->show();} - xywh {25 25 100 20} - } - MenuItem {} { - label {N&io Settings} - callback {nioui.refresh(); -nioui.show();} - xywh {0 0 36 21} divider - } - MenuItem {} { - label {&Copyright...} - callback {aboutwindow->show();} - xywh {15 15 100 20} divider - } - MenuItem {} { - label {E&xit} - callback {masterwindow->do_callback();} - xywh {10 10 100 20} - } - } - Submenu {} { - label {&Instrument} - xywh {10 10 100 20} - } { - MenuItem {} { - label {&Clear Instrument...} - callback {if (fl_choice("Clear instrument's parameters ?","No","Yes",NULL)){ -// int npart=(int)npartcounter->value()-1; - pthread_mutex_lock(&master->mutex); - master->part[npart]->defaultsinstrument(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->do_callback(); -}; - -updatepanel();} - xywh {35 35 100 20} - } - MenuItem {} { - label {&Open Instrument...} - callback {const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -npartcounter->do_callback(); -updatepanel(); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Save Instrument ...} - callback {char *filename; - -filename=fl_file_chooser("Save:","({*.xiz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xiz"); - -int result=fileexists(filename); -if (result) { - result=0; - if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return; - -}; - - -pthread_mutex_lock(&master->mutex); -result=master->part[npart]->saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - -updatepanel();} - xywh {20 20 100 20} divider - } - MenuItem {} { - label {Show Instrument &Bank...} - callback {bankui->show();} - xywh {0 0 100 20} divider - } - MenuItem {} { - label {&Virtual Keyboard...} - callback {virkeyboard->show();} - xywh {10 10 100 20} - } - } - Submenu recordmenu { - label {&Record} - xywh {0 0 100 20} - } { - MenuItem {} { - label {&Choose WAV file...} - callback {char *filename; -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -stopbutton->deactivate(); -filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,".wav"); - -int result=master->HDDRecorder.preparefile(filename,0); -if (result==1) { - result=0; - if (fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) - master->HDDRecorder.preparefile(filename,1); -}; -if (result==0) recordbutton->activate(); - -if (result!=0) fl_alert("Error: Could not save the file.");} - xywh {0 0 100 20} - } - } - Submenu {} { - label Misc - xywh {10 10 100 20} - } { - MenuItem {} { - label {Switch User Interface Mode} - callback {if (fl_choice("Switch the User Interface to Beginner mode ?","No","Yes",NULL)){ - masterwindow->hide(); - refresh_master_ui(); - simplemasterwindow->show(); - config.cfg.UserInterfaceMode=2; -};} - xywh {10 10 100 20} - } - } - } - Fl_Dial mastervolumedial { - label {Master Volume} - callback {master->setPvolume((int) o->value());} - tooltip {Master Volume} xywh {15 32 55 55} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 - code0 {o->value(master->Pvolume);} - class WidgetPDial - } - Fl_Counter masterkeyshiftcounter { - label {Master KeyShift} - callback {master->setPkeyshift((int) o->value()+64);} - xywh {150 97 120 23} type Simple labelsize 9 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->Pkeyshift-64);} - } - Fl_Button {} { - label {Panic!} - callback {virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex);} - xywh {280 29 105 53} color 90 labelfont 1 - } - Fl_Group partuigroup {open - xywh {0 310 390 205} - } { - Fl_Group partui {open selected - xywh {0 310 383 175} - code0 {o->init(master->part[0],master,0,bankui);} - code1 {o->show();} - class PartUI - } {} - } - Fl_Tabs {} {open - xywh {0 145 390 165} box UP_FRAME - } { - Fl_Group {} { - label {System Effects} open - xywh {0 162 390 145} labelsize 15 align 9 - } { - Fl_Counter syseffnocounter { - label {Sys.Effect No.} - callback {nsyseff=(int) o->value()-1; -sysefftype->value(master->sysefx[nsyseff]->geteffect()); -syseffectui->refresh(master->sysefx[nsyseff]);} - xywh {5 181 80 22} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_SYS_EFX);} - code1 {o->value(nsyseff+1);} - } - Fl_Choice sysefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -syseffectui->refresh(master->sysefx[nsyseff]);} - xywh {285 176 100 22} down_box BORDER_BOX labelsize 10 - code0 {o->value(master->sysefx[nsyseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group syseffectuigroup {open - xywh {5 203 380 95} color 48 - } { - Fl_Group syseffectui { - xywh {5 203 380 95} - code0 {o->init(master->sysefx[nsyseff]);} - class EffUI - } {} - } - Fl_Button {} { - label {Send to...} - callback {syseffsendwindow->show();} - xywh {90 181 85 22} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copy(master->sysefx[nsyseff]);} - xywh {180 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],syseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {210 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - Fl_Group {} { - label {Insertion Effects} open - xywh {0 165 390 145} labelsize 15 align 9 hide - } { - Fl_Counter inseffnocounter { - label {Ins.Effect No.} - callback {ninseff=(int) o->value()-1; -insefftype->value(master->insefx[ninseff]->geteffect()); -inseffpart->value(master->Pinsparts[ninseff]+2); -inseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - insefftype->activate(); - inseffectui->activate(); - inseffectuigroup->activate(); -} else { - insefftype->deactivate(); - inseffectui->deactivate(); - inseffectuigroup->deactivate(); -};} - xywh {5 183 80 22} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_INS_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice insefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -inseffectui->refresh(master->insefx[ninseff]); -inseffectui->show();} - xywh {285 173 100 22} down_box BORDER_BOX labelsize 10 - code0 {o->value(master->insefx[ninseff]->geteffect());} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - } { - MenuItem {} { - label {No Effect} - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group inseffectuigroup {open - xywh {5 205 380 95} box FLAT_BOX color 48 - } { - Fl_Group inseffectui { - xywh {5 205 380 90} box UP_FRAME - code0 {o->init(master->insefx[ninseff]);} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - class EffUI - } {} - } - Fl_Choice inseffpart { - label {Insert To.} - callback {master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - inseffectuigroup->deactivate(); - insefftype->deactivate(); - inseffectui->deactivate(); -} else { - inseffectuigroup->activate(); - insefftype->activate(); - inseffectui->activate(); -}; -master->insefx[ninseff]->cleanup();} open - xywh {95 183 80 22} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10 - code0 {o->add("Master Out");o->add("Off");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(master->Pinsparts[ninseff]+2);} - } {} - Fl_Button {} { - label C - callback {presetsui->copy(master->insefx[ninseff]);} - xywh {180 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {210 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - } - Fl_Button {} { - label Scales - callback {microtonalui->show();} - xywh {320 87 65 23} color 51 labelfont 1 - } - Fl_Group {} { - xywh {150 40 117 45} box UP_FRAME - } { - Fl_Button recordbutton { - label {Rec.} - callback {o->deactivate(); -recordmenu->deactivate(); -recordmenu->label("&Record(*)"); -stopbutton->activate(); -pausebutton->activate(); -pauselabel->activate(); -master->HDDRecorder.start(); -master->vuresetpeaks(); -mastermenu->redraw();} - tooltip {Start Recording} xywh {159 46 21 21} box ROUND_UP_BOX color 88 labelfont 1 labelsize 10 align 2 deactivate - } - Fl_Button stopbutton { - label Stop - callback {o->deactivate(); -master->HDDRecorder.stop(); -recordbutton->deactivate(); -pausebutton->deactivate(); -pauselabel->deactivate(); -recordmenu->activate(); -recordmenu->label("&Record"); -mastermenu->redraw();} - tooltip {Stop Recording and close the audio file} xywh {237 46 21 21} box THIN_UP_BOX color 4 labelfont 1 labelsize 10 align 2 deactivate - } - Fl_Button pausebutton { - label {@||} - callback {o->deactivate(); -master->HDDRecorder.pause(); -recordbutton->activate(); -mastermenu->redraw();} - tooltip {Pause Recording} xywh {198 46 21 21} box THIN_UP_BOX color 4 selection_color 4 labelfont 1 labelcolor 3 align 16 deactivate - } - Fl_Box pauselabel { - label Pause - xywh {192 66 30 15} labelfont 1 labelsize 10 deactivate - } - } - Fl_Group {} {open - xywh {1 490 389 55} - } { - Fl_Box {} { - label {VU-Meter} - xywh {5 490 380 30} box FLAT_BOX color 48 selection_color 75 - code0 {o->init(master,-1);} - class VUMeter - } - } - Fl_Check_Button nrpnbutton { - label NRPN - callback {master->ctl.NRPN.receive=(int) o->value();} - tooltip {Receive NRPNs} xywh {10 115 60 25} down_box DOWN_BOX labelsize 12 - code0 {o->value(master->ctl.NRPN.receive);} - } - Fl_Counter npartcounter { - callback {int nval=(int) o->value()-1; -partuigroup->remove(partui); -delete partui; -partui=new PartUI(0,0,765,525); -partuigroup->add(partui); -partui->init(master->part[nval],master,nval,bankui); -partui->redraw(); -o->redraw(); -npart=nval; - -updatepanel(); -simplenpartcounter->value(nval+1); -simplenpartcounter->do_callback();} - tooltip {The part number} xywh {5 312 50 18} type Simple labelfont 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_MIDI_PARTS);} - code1 {bankui->init(o);} - } - Fl_Button {} { - label vK - callback {virkeyboard->show();} - tooltip {Virtual Keyboard} xywh {280 87 40 23} color 51 labelfont 1 - } - Fl_Group {} {open - xywh {85 32 55 110} box UP_FRAME - } { - Fl_Button {} { - label Reset - callback {globalfinedetuneslider->value(64.0); -globalfinedetuneslider->do_callback();} - tooltip {Master fine detune reset} xywh {90 37 45 23} box THIN_UP_BOX labelsize 10 - } - Fl_Dial globalfinedetuneslider { - label {Fine Detune} - callback {master->microtonal.Pglobalfinedetune=(int) o->value();} - tooltip {global fine detune} xywh {90 68 45 45} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 value 64 - code0 {o->value(master->microtonal.Pglobalfinedetune);} - class WidgetPDial - } - } - Fl_Button {} { - label {Panel Window} - callback {updatepanel(); -panelwindow->show();} - tooltip {Panel Window} xywh {280 112 105 23} color 51 labelfont 1 labelsize 10 - } - Fl_Button sm_indicator1 { - label SM - xywh {350 5 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate - } - } - Fl_Window aboutwindow { - label {Copyright...} - xywh {411 344 365 280} type Double hide - } { - Fl_Box {} { - label {Copyright (c) 2002-2009 Nasca O. PAUL and others. Please read AUTHORS.txt} - xywh {15 35 335 55} labeltype EMBOSSED_LABEL labelsize 15 align 208 - } - Fl_Box {} { - label {This is free software; you may redistribute it and/or modify it under the terms of the -version 2 (or any later version) of the GNU General Public License as published by the Free Software Fundation. - This program comes with - ABSOLUTELY NO WARRANTY. - See the version 2 (or any later version) of the -GNU General Public License for details.} - xywh {15 90 335 145} labelfont 1 labelsize 11 align 144 - } - Fl_Button {} { - label {Close this window} - callback {aboutwindow->hide();} - xywh {80 245 190 25} box THIN_UP_BOX labelsize 11 - } - Fl_Box {} { - label ZynAddSubFX - xywh {15 5 335 30} labeltype EMBOSSED_LABEL labelfont 1 labelsize 20 align 16 - } - } - Fl_Window syseffsendwindow { - label {System Effects Send} - xywh {171 234 120 250} type Double hide resizable - } { - Fl_Scroll {} {open - xywh {0 45 120 170} box FLAT_BOX resizable - code0 {for (int neff1=0;neff1x()+(neff2-1)*35,o->y()+15+neff1*50,30,30);syseffsend[neff1][neff2]->label("aaa");syseffsend[neff1][neff2]->init(master,neff1,neff2);};} - } {} - Fl_Button {} { - label Close - callback {syseffsendwindow->hide();} - xywh {25 220 80 25} box THIN_UP_BOX - } - Fl_Box {} { - label {Send system effect's output to other system effects} - xywh {5 5 110 35} labelsize 10 align 192 - } - } - Fl_Window panelwindow { - label {ZynAddSubFX Panel} - xywh {89 59 630 635} type Double hide - } { - Fl_Scroll {} { - xywh {0 5 570 310} type HORIZONTAL box THIN_UP_BOX - } { - Fl_Pack {} { - xywh {5 10 560 285} type HORIZONTAL - code0 {for (int i=0;iinit(master,i,bankui);}} - } {} - } - Fl_Scroll {} { - xywh {0 320 570 310} type HORIZONTAL box THIN_UP_BOX - } { - Fl_Pack {} { - xywh {5 325 560 285} type HORIZONTAL - code0 {for (int i=NUM_MIDI_PARTS/2;iinit(master,i,bankui);}} - } {} - } - Fl_Button {} { - label Close - callback {panelwindow->hide(); -updatepanel();} - xywh {575 605 50 25} box THIN_UP_BOX labelsize 13 - } - Fl_Button {} { - label Refresh - callback {updatepanel();} - xywh {575 570 55 25} box THIN_UP_BOX labelsize 13 - } - } - Fl_Window simplemasterwindow { - label ZynAddSubFX - callback {\#ifndef PLUGINVERSION -if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL)) -\#endif -{ - config.save(); - *exitprogram=1; -}; -} open - xywh {283 262 600 335} type Double visible - } { - Fl_Menu_Bar simplemastermenu { - xywh {0 0 690 25} - } { - Submenu {} { - label {&File} - xywh {10 10 100 20} - } { - MenuItem {} { - label {&New (erase all)...} - callback {do_new_master();} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Open Parameters...} - callback {do_load_master();} - xywh {30 30 100 20} - } - MenuItem {} { - label {&Save All Parameters...} - callback {\#if USE_NSM - if ( nsm && nsm->is_active() ) - { - do_save_master( nsm->project_filename ); - } - else -\#endif - { - do_save_master(); - }} - xywh {20 20 100 20} divider - } - MenuItem {} { - label {&Settings...} - callback {configui->show();} - xywh {35 35 100 20} divider - } - MenuItem {} { - label {&Copyright...} - callback {aboutwindow->show();} - xywh {25 25 100 20} divider - } - MenuItem {} { - label {E&xit} - callback {masterwindow->do_callback();} - xywh {20 20 100 20} - } - } - Submenu {} { - label {&Instrument} - xywh {20 20 100 20} - } { - MenuItem {} { - label {&Open Instrument...} - callback {const char *filename; -filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); -if (filename==NULL) return; - - -pthread_mutex_lock(&master->mutex); -// int npart=(int)npartcounter->value()-1; - - //clear all instrument parameters, first - master->part[npart]->defaultsinstrument(); - - //load the instr. parameters - int result=master->part[npart]->loadXMLinstrument(filename); - -pthread_mutex_unlock(&master->mutex); -master->part[npart]->applyparameters(); - -simplenpartcounter->do_callback(); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file."); - else if (result<0) fl_alert("Error: Could not load the file.");} - xywh {40 40 100 20} - } - MenuItem {} { - label {Show Instrument &Bank...} - callback {bankui->show();} - xywh {10 10 100 20} divider - } - } - Submenu {} { - label Misc - xywh {0 0 100 20} - } { - MenuItem {} { - label {Switch User Interface Mode} - callback {if (fl_choice("Switch the User Interface to Advanced mode ?","No","Yes",NULL)){ - simplemasterwindow->hide(); - refresh_master_ui(); - masterwindow->show(); - config.cfg.UserInterfaceMode=1; -};} - xywh {0 0 100 20} - } - } - } - Fl_Group simplelistitemgroup {open - private xywh {125 65 215 145} box UP_FRAME - code0 {if (master->part[npart]->Penabled==0) o->deactivate();} - } { - Fl_Button partname { - callback {if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); -}; -bankui->show();} - xywh {130 72 205 18} box THIN_DOWN_BOX down_box FLAT_BOX color 50 labelfont 1 labelsize 11 align 208 - } - Fl_Slider partpanning { - label Pan - callback {master->part[npart]->setPpanning((int) o->value());} - xywh {185 95 145 15} type {Horz Knob} box FLAT_BOX labelsize 11 maximum 127 step 1 value 64 - code0 {o->value(master->part[npart]->Ppanning);} - } - Fl_Choice partrcv { - label {Midi Channel Receive} - callback {virkeys->relaseallkeys(0); -master->part[npart]->Prcvchn=(int) o->value(); -virkeys->midich=(int) o->value();} open - tooltip {receive from Midi channel} xywh {140 157 65 18} down_box BORDER_BOX labelsize 10 align 130 textfont 1 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Dr10");};} - code1 {o->value(master->part[npart]->Prcvchn);} - } {} - Fl_Dial partvolume { - callback {master->part[npart]->setPvolume((int) o->value());} - xywh {135 95 45 40} labelsize 9 maximum 127 step 1 - code0 {o->value(master->part[npart]->Pvolume);} - class WidgetPDial - } - Fl_Box {} { - label Volume - xywh {130 130 55 20} labelsize 10 - } - Fl_Check_Button simplepartportamento { - label Portamento - callback {master->part[npart]->ctl.portamento.portamento=(int) o->value();} - tooltip {Enable/Disable the portamento} xywh {193 127 79 23} down_box DOWN_BOX labelsize 9 - code0 {o->value(master->part[npart]->ctl.portamento.portamento);} - } - Fl_Counter simpleminkcounter { - label {Min.key} - callback {master->part[npart]->Pminkey=(int) o->value(); -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Minimum key (that the part receives NoteOn messages)} xywh {210 158 40 15} type Simple labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(master->part[npart]->Pminkey);} - } - Fl_Counter simplemaxkcounter { - label {Max.key} - callback {master->part[npart]->Pmaxkey=(int) o->value(); - -if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Maximum key (that the part receives NoteOn messages)} xywh {255 158 40 15} type Simple labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(master->part[npart]->Pmaxkey);} - } - Fl_Button {} { - label m - callback {if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote); -simpleminkcounter->do_callback(); -simplemaxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {230 188 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote); -simplemaxkcounter->do_callback(); -simpleminkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {260 188 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {simpleminkcounter->value(0); -simpleminkcounter->do_callback(); -simplemaxkcounter->value(127); -simplemaxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {245 188 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Counter simplepartkeyshiftcounter { - label KeyShift - callback {master->part[npart]->Pkeyshift=(int) o->value()+64;} - xywh {280 120 50 20} type Simple labelsize 11 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->part[npart]->Pkeyshift-64);} - } - Fl_Dial simplesyseffsend { - callback {master->setPsysefxvol(npart,nsyseff,(int) o->value());} - xywh {300 160 30 30} maximum 127 step 1 - class WidgetPDial - } - Fl_Box {} { - label Effect - xywh {295 190 40 15} labelsize 10 - } - } - Fl_Check_Button partenabled { - label Enabled - callback {pthread_mutex_lock(&master->mutex); - master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if ((int) o->value()==0) simplelistitemgroup->deactivate(); - else { - simplelistitemgroup->activate(); - if ((int)bankui->cbwig->value()!=(npart+1)){ - bankui->cbwig->value(npart+1); - bankui->cbwig->do_callback(); - }; -}; - -o->redraw();} - private xywh {250 40 85 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24 - code0 {//char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);} - code1 {o->value(master->part[npart]->Penabled);} - } - Fl_Box virkeys { - label Keyboard - xywh {5 215 590 80} box BORDER_BOX color 17 - code0 {o->init(master);} - class VirKeys - } - Fl_Group {} {open - xywh {340 30 255 185} - } { - Fl_Tabs {} {open - xywh {345 35 245 175} box UP_FRAME align 18 - } { - Fl_Group {} { - label {System Effects} open - xywh {345 55 245 155} box UP_FRAME labelfont 1 labelsize 12 align 18 - } { - Fl_Counter simplesyseffnocounter { - label {Sys.Effect No.} - callback {nsyseff=(int) o->value()-1; -simplesysefftype->value(master->sysefx[nsyseff]->geteffect()); -simplesyseffectui->refresh(master->sysefx[nsyseff]); -simplerefresh();} - xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_SYS_EFX);} - code1 {o->value(nsyseff+1);} - } - Fl_Choice simplesysefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->sysefx[nsyseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simplesyseffectui->refresh(master->sysefx[nsyseff]);} - xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5 - code0 {o->value(master->sysefx[nsyseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group simplesyseffectuigroup {open - xywh {350 95 235 95} color 48 - } { - Fl_Group simplesyseffectui { - xywh {350 95 234 95} - code0 {o->init(master->sysefx[nsyseff]);} - class SimpleEffUI - } {} - } - Fl_Button {} { - label {Send to...} - callback {syseffsendwindow->show();} - xywh {435 75 75 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->sysefx[nsyseff],simplesyseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - Fl_Group {} { - label {Insertion Effects} - xywh {345 55 245 155} box UP_FRAME labelfont 1 labelsize 12 align 18 hide - } { - Fl_Counter simpleinseffnocounter { - label {Ins.Effect No.} - callback {ninseff=(int) o->value()-1; -simpleinsefftype->value(master->insefx[ninseff]->geteffect()); -simpleinseffpart->value(master->Pinsparts[ninseff]+2); -simpleinseffectui->refresh(master->insefx[ninseff]); - -if (master->Pinsparts[ninseff]!=-1) { - simpleinsefftype->activate(); - simpleinseffectui->activate(); - simpleinseffectuigroup->activate(); -} else { - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); - simpleinseffectuigroup->deactivate(); -};} - xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_INS_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice simpleinsefftype { - label EffType - callback {pthread_mutex_lock(&master->mutex); -master->insefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(&master->mutex); -simpleinseffectui->refresh(master->insefx[ninseff]); -simpleinseffectui->show();} - xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5 - code0 {o->value(master->insefx[ninseff]->geteffect());} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - } { - MenuItem {} { - label {No Effect} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group simpleinseffectuigroup { - xywh {350 95 234 95} box FLAT_BOX color 48 - } { - Fl_Group simpleinseffectui { - xywh {350 95 234 95} - code0 {o->init(master->insefx[ninseff]);} - code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();} - class SimpleEffUI - } {} - } - Fl_Choice simpleinseffpart { - label {Insert To.} - callback {master->Pinsparts[ninseff]=(int) o->value()-2; -if ((int) o->value()==1){ - simpleinseffectuigroup->deactivate(); - simpleinsefftype->deactivate(); - simpleinseffectui->deactivate(); -} else { - simpleinseffectuigroup->activate(); - simpleinsefftype->activate(); - simpleinseffectui->activate(); -}; -master->insefx[ninseff]->cleanup();} open - xywh {435 75 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10 - code0 {o->add("Master Out");o->add("Off");} - code1 {char tmp[50]; for (int i=0;iadd(tmp);};} - code3 {o->value(master->Pinsparts[ninseff]+2);} - } {} - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(master->insefx[ninseff],simpleinseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - } - } - Fl_Group {} {open - xywh {5 300 590 30} box ENGRAVED_FRAME - } { - Fl_Box {} { - label {VU-Meter} - xywh {5 300 590 30} box FLAT_BOX color 41 selection_color 75 - code0 {o->init(master,-1);} - class VUMeter - } - } - Fl_Dial simplemastervolumedial { - label {Master Volume} - callback {master->setPvolume((int) o->value());} - tooltip {Master Volume} xywh {10 35 40 40} box ROUND_UP_BOX labelfont 1 labelsize 11 align 130 maximum 127 step 1 - code0 {o->value(master->Pvolume);} - class WidgetPDial - } - Fl_Counter simplemasterkeyshiftcounter { - label {Master KeyShift} - callback {master->setPkeyshift((int) o->value()+64);} - xywh {15 110 90 20} labelsize 11 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(master->Pkeyshift-64);} - } - Fl_Button {} { - label {Stop ALL sounds!} - callback {virkeyboard->relaseallkeys(); -pthread_mutex_lock(&master->mutex); -master->shutup=1; -pthread_mutex_unlock(&master->mutex);} - xywh {5 149 115 31} color 90 labelfont 1 labelsize 10 - } - Fl_Button {} { - label Reset - callback {simpleglobalfinedetuneslider->value(64.0); -simpleglobalfinedetuneslider->do_callback();} - tooltip {Master fine detune reset} xywh {70 30 50 17} box THIN_UP_BOX labelsize 11 align 128 - } - Fl_Dial simpleglobalfinedetuneslider { - label {Fine Detune} - callback {master->microtonal.Pglobalfinedetune=(int) o->value();} - tooltip {global fine detune} xywh {80 50 30 30} box ROUND_UP_BOX labelsize 11 align 130 maximum 127 step 1 value 64 - code0 {o->value(master->microtonal.Pglobalfinedetune);} - class WidgetPDial - } - Fl_Counter simplenpartcounter { - label Part - callback {virkeys->relaseallkeys(0); -npartcounter->value(o->value()); -npart=(int) o->value()-1; - -simplerefresh(); -virkeys->midich=master->part[npart]->Prcvchn;} - tooltip {The part number} xywh {170 40 70 20} type Simple labelfont 1 align 4 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->bounds(1,NUM_MIDI_PARTS);} - } - Fl_Counter {} { - label {Keyb.Oct.} - callback {virkeys->relaseallkeys(0); -virkeys->midioct=(int) o->value(); -virkeys->take_focus();} - tooltip {Midi Octave} xywh {5 190 55 20} type Simple labelsize 11 align 8 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 11 - code0 {o->value(virkeys->midioct);} - } - Fl_Button sm_indicator2 { - label SM - xywh {560 5 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate - } - } - Fl_Window selectuiwindow { - label {User Interface mode} - callback {*exitprogram=1;} - xywh {342 246 430 250} type Double hide non_modal - } { - Fl_Box {} { - label {Welcome to ZynAddSubFX} - xywh {5 5 425 40} labeltype SHADOW_LABEL labelfont 1 labelsize 26 - } - Fl_Box {} { - label {Please choose the interface mode:} - xywh {10 50 265 25} labelfont 1 labelsize 13 - } - Fl_Button {} { - label Advanced - callback {config.cfg.UserInterfaceMode=1; -masterwindow->show(); -selectuiwindow->hide();} - xywh {10 165 100 35} color 229 labelfont 1 labelsize 16 - } - Fl_Box {} { - label {.. if you have used ZynAddSubFX before, or you like to have full controll to all parameters.} - xywh {110 165 310 35} labelfont 1 labelsize 11 align 144 - } - Fl_Button {} { - label Beginner - callback {simplemasterwindow->show(); -selectuiwindow->hide(); -config.cfg.UserInterfaceMode=2;} - xywh {10 80 100 65} color 238 labelfont 1 labelsize 16 - } - Fl_Box {} { - label {..if you are a beginner, you prefer using presets or you prefer to use simpler user interfaces. Most functionality of ZynAddSubFX will be hidden in this mode to make simple the learning/using it.} - xywh {110 75 320 75} labelfont 1 labelsize 11 align 144 - } - Fl_Box {} { - label {You can switch the interface modes anytime you want.} - xywh {30 215 360 25} box BORDER_BOX color 51 labelfont 1 labelsize 11 align 144 - } - } - } - Function {updatesendwindow()} {} { - code {for (int neff1=0;neff1value(master->Psysefxsend[neff1][neff2]);} {} - } - Function {updatepanel()} {} { - code {for (int npart=0;npartrefresh(); -};} {} - } - Function {setfilelabel(const char *filename)} {} { - code {if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename)); - else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX"); -masterwindowlabel[99]='\\0'; -masterwindow->label(&masterwindowlabel[0]); -simplemasterwindow->label(&masterwindowlabel[0]);} {} - } - Function {MasterUI(Master *master_,int *exitprogram_)} {} { - code {master=master_; -exitprogram=exitprogram_; -ninseff=0; -nsyseff=0; -npart=0; - -for (int i=0;imicrotonal); -virkeyboard=new VirKeyboard(master); -bankui=new BankUI(master,&npart); -configui=new ConfigUI(); - -make_window(); -\#ifdef OS_WINDOWS -masterwindow->icon((char *)LoadIcon(GetModuleHandle(NULL), "zynaddsubfx_icon")); -\#endif - -presetsui=new PresetsUI(); -setfilelabel(NULL); -swapefftype=0; -simplerefresh();} {} - } - Function {~MasterUI()} {} { - code {masterwindow->hide(); -delete masterwindow; -simplemasterwindow->hide(); -delete simplemasterwindow; -aboutwindow->hide(); -delete aboutwindow; -syseffsendwindow->hide(); -delete syseffsendwindow; - -delete virkeyboard; -delete microtonalui; -delete bankui; -delete configui; - -delete presetsui; -delete panelwindow; -delete selectuiwindow;} {} - } - Function {showUI()} {} { - code {switch (config.cfg.UserInterfaceMode){ - case 0:selectuiwindow->show(); - break; - case 1:masterwindow->show(); - break; - case 2:simplemasterwindow->show(); - break; -};} {} - } - Function {simplerefresh()} {} { - code {partenabled->value(master->part[npart]->Penabled); -if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate(); - else simplelistitemgroup->deactivate(); - -partvolume->value(master->part[npart]->Pvolume); -partpanning->value(master->part[npart]->Ppanning); -partrcv->value(master->part[npart]->Prcvchn); - -if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname); - else partname->label("Click here to load a instrument"); - -simplelistitemgroup->redraw(); -simplepartportamento->value(master->part[npart]->ctl.portamento.portamento); -simpleminkcounter->value(master->part[npart]->Pminkey); -simplemaxkcounter->value(master->part[npart]->Pmaxkey); - -simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64); -simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]);} {} - } - Function {do_new_master_unconditional()} {} { - code {delete microtonalui; - - pthread_mutex_lock(&master->mutex); - master->defaults(); - pthread_mutex_unlock(&master->mutex); - - npartcounter->value(1); - refresh_master_ui(); - updatepanel();} {} - } - Function {do_new_master()} {} { - code {if (fl_choice("Clear *ALL* the parameters ?","No","Yes",NULL)){ - do_new_master_unconditional(); - }} {} - } - Function {do_load_master_unconditional(const char *filename, const char *display_name)} {return_type int - } { - code {pthread_mutex_lock(&master->mutex); - //clear all parameters - master->defaults(); - - //load the data - int result=master->loadXML(filename); - - master->applyparameters(false); - pthread_mutex_unlock(&master->mutex); - - npartcounter->value(1); - refresh_master_ui(); - updatepanel(); - - if (result>=0) setfilelabel(display_name); - - return result;} {} - } - Function {do_load_master(const char* file = NULL)} {} { - code {const char *filename; - if (file == NULL) { - filename=fl_file_chooser("Open:","({*.xmz})",NULL,0); - if (filename==NULL) return; - } - else { - filename = file; - } - - int result = do_load_master_unconditional( filename, filename ); - -if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a zynaddsubfx parameters file."); - else if (result<0) fl_alert("Error: Could not load the file.");} {} - } - Function {do_save_master(const char* file = NULL)} {} { - code {const char *filename; -char *tmp; - int result=0; - if (file == NULL) { - tmp=fl_file_chooser("Save:","({*.xmz})",NULL,0); - if (tmp==NULL) return; - tmp=fl_filename_setext(tmp,".xmz"); - filename=tmp; - result=fileexists(tmp); - if (result) { - result=0; - if (!fl_choice("The file exists. Overwrite it?","No","Yes",NULL)) return; - - } - } - else { - filename = file; - } - - -pthread_mutex_lock(&master->mutex); -result=master->saveXML(filename); -pthread_mutex_unlock(&master->mutex); - -if (result<0) fl_alert("Error: Could not save the file."); - else -{ -\#if USE_NSM - if ( nsm && nsm->is_active() ) - setfilelabel( nsm->display_name ); - else -\#endif - setfilelabel(filename); -} -updatepanel();} {} - } - Function {refresh_master_ui()} {} { - code {ninseff=0; -nsyseff=0; -npart=0; - -//the Master UI -npartcounter->do_callback(); -syseffnocounter->do_callback(); -inseffnocounter->do_callback(); -masterkeyshiftcounter->value(master->Pkeyshift-64); -mastervolumedial->value(master->Pvolume); -globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); -microtonalui=new MicrotonalUI(&master->microtonal); -nrpnbutton->value(master->ctl.NRPN.receive); -updatesendwindow(); -updatepanel(); - -//the simle MasterUI -simplenpartcounter->value(1); -simplesyseffnocounter->value(1); -simpleinseffnocounter->value(1); -simplenpartcounter->do_callback(); -simplesyseffnocounter->do_callback(); -simpleinseffnocounter->do_callback(); -simplemasterkeyshiftcounter->value(master->Pkeyshift-64); -simplemastervolumedial->value(master->Pvolume); -simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune); -virkeys->midich=master->part[npart]->Prcvchn; - -simplerefresh(); -bankui->hide();} {} - } - decl {Master *master;} {} - decl {MicrotonalUI *microtonalui;} {} - decl {BankUI *bankui;} {} - decl {int ninseff,npart;} {} - decl {int nsyseff;} {} - decl {int *exitprogram;} {} - decl {SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX];} {} - decl {VirKeyboard *virkeyboard;} {} - decl {ConfigUI *configui;} {} - decl {int swapefftype;} {} - decl {char masterwindowlabel[100];} {} - decl {Panellistitem *panellistitem[NUM_MIDI_PARTS];} {} - decl {NioUI nioui;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/MicrotonalUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/MicrotonalUI.fl deleted file mode 100644 index 1f1af9583eb..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/MicrotonalUI.fl +++ /dev/null @@ -1,270 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0106 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Misc/Microtonal.h"} {public -} - -class MicrotonalUI {} { - Function {make_window()} {} { - Fl_Window microtonaluiwindow { - label Scales - xywh {99 164 405 450} type Double hide - } { - Fl_Group {} { - tooltip {Center where the note's freqs. are turned upside-down} xywh {249 2 155 45} box ENGRAVED_FRAME - } { - Fl_Check_Button {} { - label {Invert keys} - callback {microtonal->Pinvertupdown=(int) o->value(); -if (microtonal->Pinvertupdown==0) centerinvertcounter->deactivate(); - else centerinvertcounter->activate();} - tooltip {Turn upside-down the note frequencies} xywh {254 13 55 30} down_box DOWN_BOX labelfont 1 labelsize 11 align 148 - code0 {o->value(microtonal->Pinvertupdown);} - } - Fl_Counter centerinvertcounter { - label Center - callback {microtonal->Pinvertupdowncenter=(int) o->value();} - xywh {319 13 80 20} labelfont 1 labelsize 11 align 130 minimum 0 maximum 127 step 1 textfont 1 - code0 {o->lstep(microtonal->getoctavesize());} - code1 {o->value(microtonal->Pinvertupdowncenter);} - code2 {if (microtonal->Pinvertupdown==0) o->deactivate();} - } - } - Fl_Group microtonalgroup {selected - xywh {3 49 402 398} box ENGRAVED_FRAME - code0 {if (microtonal->Penabled==0) o->deactivate();} - } { - Fl_Button applybutton { - label Retune - callback {apply();} - tooltip {Retune the synth accorging to the inputs from "Tunnings" and "Keyboard Mappings"} xywh {8 413 107 28} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 - } - Fl_Value_Output octavesizeoutput { - label {nts./oct.} - callback {o->value(microtonal->getoctavesize());} - tooltip {Notes/Octave} xywh {150 423 35 17} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1 - code0 {o->value(microtonal->getoctavesize());} - } - Fl_Input nameinput { - label {Name:} - callback {snprintf((char *)microtonal->Pname,MICROTONAL_MAX_NAME_LEN,"%s",o->value());} - xywh {8 64 285 25} labelfont 1 labelsize 11 align 5 - code0 {o->insert((char *)microtonal->Pname);} - } - Fl_Input tuningsinput { - label {Tunings:} - xywh {8 144 182 264} type Multiline labelfont 1 labelsize 11 align 5 when 2 - code0 {updateTuningsInput();} - } - Fl_Input commentinput { - label {Comment:} - callback {snprintf((char *)microtonal->Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",o->value());} - xywh {8 104 391 25} labelfont 1 labelsize 11 align 5 - code0 {o->insert((char *)microtonal->Pcomment);} - } - Fl_Counter {} { - label Shift - callback {microtonal->Pscaleshift=(int) o->value()+64;} - xywh {313 69 70 20} type Simple labelsize 11 align 1 minimum -63 maximum 64 step 1 textfont 1 - code0 {o->value(microtonal->Pscaleshift-64);} - } - Fl_Button {} { - label {Import .SCL file} - callback {const char *filename; -filename=fl_file_chooser("Open:","(*.scl)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadscl(filename); -if (result==0) { - updateTuningsInput(); - nameinput->cut(0,nameinput->maximum_size()); - nameinput->insert((char *)microtonal->Pname); - nameinput->position(0); - commentinput->cut(0,commentinput->maximum_size()); - commentinput->insert((char *)microtonal->Pname); - commentinput->position(0); - tuningsinput->position(0); - octavesizeoutput->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - };} - tooltip {Inport Scala .scl file (tunnings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Group keymappinggroup { - label {Keyboard Mapping} open - xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 11 - } { - Fl_Input mappinginput { - xywh {250 147 146 258} type Multiline labelfont 1 labelsize 11 align 5 when 2 - code0 {updateMappingInput();} - } - Fl_Counter firstnotecounter { - label {First note} - callback {microtonal->Pfirstkey=(int) o->value();} - tooltip {First MIDI note number} xywh {199 195 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11 - code0 {o->value(microtonal->Pfirstkey);} - } - Fl_Counter lastnotecounter { - label {Last note} - callback {microtonal->Plastkey=(int) o->value();} - tooltip {Last MIDI note number} xywh {199 225 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 11 - code0 {o->value(microtonal->Plastkey);} - } - Fl_Counter middlenotecounter { - label {Midle note} - callback {microtonal->Pmiddlenote=(int) o->value();} - tooltip {Midle note (where scale degree 0 is mapped to)} xywh {199 267 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 11 - code0 {o->value(microtonal->Pmiddlenote);} - } - Fl_Value_Output mapsizeoutput { - label {Map Size} - callback {o->value(microtonal->Pmapsize);} - xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1 - code0 {o->value(microtonal->Pmapsize);} - } - } - Fl_Check_Button mappingenabledbutton { - label ON - callback {int x=(int) o->value(); -microtonal->Pmappingenabled=x; -if (x==0) keymappinggroup->deactivate(); - else keymappinggroup->activate(); -o->show();} - tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1 - code0 {o->value(microtonal->Pmappingenabled);} - code1 {if (microtonal->Pmappingenabled==0) keymappinggroup->deactivate();} - } - Fl_Button {} { - label {Import .kbm file} - callback {const char *filename; -filename=fl_file_chooser("Open:","(*.kbm)",NULL,0); -if (filename==NULL) return; -int result=microtonal->loadkbm(filename); -if (result==0) { - updateMappingInput(); - mappinginput->position(0); - mapsizeoutput->do_callback(); - firstnotecounter->value(microtonal->Pfirstkey); - lastnotecounter->value(microtonal->Plastkey); - middlenotecounter->value(microtonal->Pmiddlenote); - mapsizeoutput->do_callback(); - mappingenabledbutton->value(microtonal->Pmappingenabled); - mappingenabledbutton->do_callback(); - afreqinput->value(microtonal->PAfreq); - anotecounter->value(microtonal->PAnote); - anotecounter->do_callback(); - } else { - fl_alert("Error: Could not load the file."); - };} - tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10 - } - } - Fl_Group {} { - xywh {108 2 140 45} box ENGRAVED_FRAME - } { - Fl_Counter anotecounter { - label {"A" Note} - callback {microtonal->PAnote=(int) o->value(); -if (microtonal->getnotefreq(microtonal->PAnote,0)<0.0) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK); - -o->redraw();} - tooltip {The "A" note (the reference note for which freq. ("A" freq) is given)} xywh {173 17 65 20} labelfont 1 labelsize 10 align 129 minimum 0 maximum 127 step 1 value 69 textfont 1 textsize 10 - code0 {o->lstep(12);} - code1 {o->value(microtonal->PAnote);} - } - Fl_Value_Input afreqinput { - label {"A" Freq.} - callback {microtonal->PAfreq=o->value();} - tooltip {The freq. of "A" note (default=440.0)} xywh {118 17 45 20} labelfont 1 labelsize 10 align 1 minimum 1 maximum 20000 step 0.001 value 440 textfont 1 textsize 10 - code0 {o->value(microtonal->PAfreq);} - } - } - Fl_Button {} { - label Close - callback {microtonaluiwindow->hide();} - xywh {333 413 67 28} box THIN_UP_BOX - } - Fl_Check_Button {} { - label {Enable Microtonal} - callback {microtonal->Penabled=(int) o->value(); -if (microtonal->Penabled==0) microtonalgroup->deactivate(); - else microtonalgroup->activate();} - xywh {3 3 102 45} box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 align 148 - code0 {o->value(microtonal->Penabled);} - } - } - } - Function {updateTuningsInput()} {} { - code {char *tmpbuf=new char[100]; - -tuningsinput->cut(0,tuningsinput->maximum_size()); - -for (int i=0;igetoctavesize();i++){ - if (i!=0) tuningsinput->insert("\\n"); - microtonal->tuningtoline(i,tmpbuf,100); - tuningsinput->insert(tmpbuf); -}; - -delete []tmpbuf;} {} - } - Function {updateMappingInput()} {} { - code {char *tmpbuf=new char[100]; - -mappinginput->cut(0,tuningsinput->maximum_size()); - -for (int i=0;iPmapsize;i++){ - if (i!=0) mappinginput->insert("\\n"); - if ((microtonal->Pmapping[i])==-1) - snprintf(tmpbuf,100,"x"); - else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]); - mappinginput->insert(tmpbuf); -}; - -delete []tmpbuf;} {} - } - Function {MicrotonalUI(Microtonal *microtonal_)} {} { - code {microtonal=microtonal_; - -make_window();} {} - } - Function {~MicrotonalUI()} {} { - code {microtonaluiwindow->hide(); -delete(microtonaluiwindow);} {} - } - Function {show()} {} { - code {microtonaluiwindow->show();} {} - } - Function {apply()} {} { - code {int err=microtonal->texttotunings(tuningsinput->value()); -if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\\n or divisions (like 121/64)."); -if (err==-2) fl_alert("Parse Error: The input is empty."); -octavesizeoutput->do_callback(); - -microtonal->texttomapping(mappinginput->value()); -mapsizeoutput->do_callback(); -anotecounter->do_callback(); - -//applybutton->color(FL_GRAY);} {} - } - decl {Microtonal *microtonal;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.C b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.C deleted file mode 100644 index 7b7e6fc2e62..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.C +++ /dev/null @@ -1,163 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* */ -/* 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. */ -/* */ -/* 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 General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - - -#include "NSM.H" - -#include "../Nio/Nio.h" - -#include "MasterUI.h" -#include -#include -#include -#include -#include - -extern int Pexitprogram; -extern MasterUI *ui; - -extern NSM_Client *nsm; -extern char *instance_name; - -NSM_Client::NSM_Client() -{ - project_filename = 0; - display_name = 0; -} - -int command_open(const char *name, - const char *display_name, - const char *client_id, - char **out_msg); -int command_save(char **out_msg); - -int -NSM_Client::command_save(char **out_msg) -{ - (void) out_msg; - int r = ERR_OK; - - ui->do_save_master(project_filename); - - return r; -} - -int -NSM_Client::command_open(const char *name, - const char *display_name, - const char *client_id, - char **out_msg) -{ - Nio::stop(); - - if(instance_name) - free(instance_name); - - instance_name = strdup(client_id); - - Nio::start(); - - char *new_filename; - - asprintf(&new_filename, "%s.xmz", name); - - struct stat st; - - int r = ERR_OK; - - if(0 == stat(new_filename, &st)) { - if(ui->do_load_master_unconditional(new_filename, display_name) < 0) { - *out_msg = strdup("Failed to load for unknown reason"); - r = ERR_GENERAL; - - return r; - } - } - else - ui->do_new_master_unconditional(); - - if(project_filename) - free(project_filename); - - if(this->display_name) - free(this->display_name); - - project_filename = new_filename; - - this->display_name = strdup(display_name); - - return r; -} - -static void save_callback(Fl_Widget *, void *v) -{ - MasterUI *ui = static_cast(v); - ui->do_save_master(); -} - -void -NSM_Client::command_active(bool active) -{ - if(active) { - Fl_Menu_Item *m; - //TODO see if there is a cleaner way of doing this without voiding - //constness - if((m=const_cast(ui->mastermenu->find_item( - "&File/&Open Parameters...")))) - m->label("&Import Parameters..."); - if((m=const_cast(ui->simplemastermenu->find_item( - "&File/&Open Parameters...")))) - m->label("&Import Parameters..."); - - //TODO get this menu entry inserted at the right point - if((m=const_cast(ui->mastermenu->find_item("&File/&Export Parameters...")))) - m->show(); - else - ui->mastermenu->add("&File/&Export Parameters...",0,save_callback,ui); - - if((m=const_cast(ui->simplemastermenu->find_item("&File/&Export Parameters...")))) - m->show(); - else - ui->simplemastermenu->add("&File/&Export Parameters...",0,save_callback,ui); - - ui->sm_indicator1->value(1); - ui->sm_indicator2->value(1); - ui->sm_indicator1->tooltip(session_manager_name()); - ui->sm_indicator2->tooltip(session_manager_name()); - } - else { - Fl_Menu_Item *m; - if((m=const_cast(ui->mastermenu->find_item( - "&File/&Import Parameters...")))) - m->label("&Open Parameters..."); - if((m=const_cast(ui->simplemastermenu->find_item( - "&File/&Open Parameters...")))) - m->label("&Open Parameters..."); - - if((m=const_cast(ui->mastermenu->find_item("&File/&Export Parameters...")))) - m->hide(); - if((m=const_cast(ui->simplemastermenu->find_item("&File/&Export Parameters...")))) - m->hide(); - - ui->sm_indicator1->value(0); - ui->sm_indicator2->value(0); - ui->sm_indicator1->tooltip(NULL); - ui->sm_indicator2->tooltip(NULL); - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.H b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.H deleted file mode 100644 index 1c70de9d69b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM.H +++ /dev/null @@ -1,45 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* */ -/* 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. */ -/* */ -/* 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 General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -#pragma once - -#if USE_NSM -#include "NSM/Client.H" - -class NSM_Client:public NSM::Client -{ - public: - - char *project_filename; - char *display_name; - - NSM_Client(); - ~NSM_Client() { } - - protected: - - int command_open(const char *name, - const char *display_name, - const char *client_id, - char **out_msg); - int command_save(char **out_msg); - - void command_active(bool active); -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.C b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.C deleted file mode 100644 index 83141e27e4b..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.C +++ /dev/null @@ -1,403 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* */ -/* 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. */ -/* */ -/* 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 General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -#include "Client.H" -#include -#include -#include -#include - -#pragma GCC diagnostic ignored "-Wunused-parameter" - -namespace NSM -{ -/************************/ -/* OSC Message Handlers */ -/************************/ - -#undef OSC_REPLY -#undef OSC_REPLY_ERR - -#define OSC_REPLY(value) lo_send_from(((NSM::Client *)user_data)->nsm_addr, \ - ((NSM::Client *)user_data)->_server, \ - LO_TT_IMMEDIATE, \ - "/reply", \ - "ss", \ - path, \ - value) - -#define OSC_REPLY_ERR(errcode, value) lo_send_from( \ - ((NSM::Client *)user_data)->nsm_addr, \ - ((NSM::Client *)user_data)->_server, \ - LO_TT_IMMEDIATE, \ - "/error", \ - "sis", \ - path, \ - errcode, \ - value) - - Client::Client() - { - nsm_addr = 0; - nsm_client_id = 0; - _session_manager_name = 0; - nsm_is_active = false; - _server = 0; - _st = 0; - } - - Client::~Client() - { - if(_st) - stop(); - - if(_st) - lo_server_thread_free(_st); - else - lo_server_free(_server); - } - - void - Client::announce(const char *application_name, - const char *capabilities, - const char *process_name) - { - // MESSAGE( "Announcing to NSM" ); - - lo_address to = lo_address_new_from_url(nsm_url); - - if(!to) - // MESSAGE( "Bad address" ); - return; - - int pid = (int)getpid(); - - lo_send_from(to, - _server, - LO_TT_IMMEDIATE, - "/nsm/server/announce", - "sssiii", - application_name, - capabilities, - process_name, - 1, - /* api_major_version */ - 0, - /* api_minor_version */ - pid); - - lo_address_free(to); - } - - void - Client::progress(float p) - { - if(nsm_is_active) - lo_send_from(nsm_addr, - _server, - LO_TT_IMMEDIATE, - "/nsm/client/progress", - "f", - p); - } - - void - Client::is_dirty(void) - { - if(nsm_is_active) - lo_send_from(nsm_addr, - _server, - LO_TT_IMMEDIATE, - "/nsm/client/is_dirty", - ""); - } - - void - Client::is_clean(void) - { - if(nsm_is_active) - lo_send_from(nsm_addr, - _server, - LO_TT_IMMEDIATE, - "/nsm/client/is_clean", - ""); - } - - void - Client::message(int priority, const char *msg) - { - if(nsm_is_active) - lo_send_from(nsm_addr, - _server, - LO_TT_IMMEDIATE, - "/nsm/client/message", - "is", - priority, - msg); - } - - - void - Client::broadcast(lo_message msg) - { - if(nsm_is_active) - lo_send_message_from(nsm_addr, - _server, - "/nsm/server/broadcast", - msg); - } - - void - Client::check(int timeout) - { - if(lo_server_wait(_server, timeout)) - while(lo_server_recv_noblock(_server, 0)) {} - } - - void - Client::start() - { - lo_server_thread_start(_st); - } - - void - Client::stop() - { - lo_server_thread_stop(_st); - } - - int - Client::init(const char *nsm_url) - { - this->nsm_url = nsm_url; - - lo_address addr = lo_address_new_from_url(nsm_url); - int proto = lo_address_get_protocol(addr); - lo_address_free(addr); - - _server = lo_server_new_with_proto(NULL, proto, NULL); - - if(!_server) - return -1; - - lo_server_add_method(_server, "/error", "sis", &Client::osc_error, this); - lo_server_add_method(_server, - "/reply", - "ssss", - &Client::osc_announce_reply, - this); - lo_server_add_method(_server, - "/nsm/client/open", - "sss", - &Client::osc_open, - this); - lo_server_add_method(_server, - "/nsm/client/save", - "", - &Client::osc_save, - this); - lo_server_add_method(_server, - "/nsm/client/session_is_loaded", - "", - &Client::osc_session_is_loaded, - this); - lo_server_add_method(_server, NULL, NULL, &Client::osc_broadcast, this); - - return 0; - } - - int - Client::init_thread(const char *nsm_url) - { - this->nsm_url = nsm_url; - - lo_address addr = lo_address_new_from_url(nsm_url); - int proto = lo_address_get_protocol(addr); - lo_address_free(addr); - - _st = lo_server_thread_new_with_proto(NULL, proto, NULL); - _server = lo_server_thread_get_server(_st); - - if(!_server || !_st) - return -1; - - lo_server_thread_add_method(_st, - "/error", - "sis", - &Client::osc_error, - this); - lo_server_thread_add_method(_st, - "/reply", - "ssss", - &Client::osc_announce_reply, - this); - lo_server_thread_add_method(_st, - "/nsm/client/open", - "sss", - &Client::osc_open, - this); - lo_server_thread_add_method(_st, - "/nsm/client/save", - "", - &Client::osc_save, - this); - lo_server_thread_add_method(_st, - "/nsm/client/session_is_loaded", - "", - &Client::osc_session_is_loaded, - this); - lo_server_thread_add_method(_st, - NULL, - NULL, - &Client::osc_broadcast, - this); - - return 0; - } - -/************************/ -/* OSC Message Handlers */ -/************************/ - - int - Client::osc_broadcast(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - return ((NSM::Client *)user_data)->command_broadcast(path, msg); - } - - int - Client::osc_save(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - char *out_msg = NULL; - - int r = ((NSM::Client *)user_data)->command_save(&out_msg); - - if(r) - OSC_REPLY_ERR(r, (out_msg ? out_msg : "")); - else - OSC_REPLY("OK"); - - if(out_msg) - free(out_msg); - - return 0; - } - - int - Client::osc_open(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - char *out_msg = NULL; - - NSM::Client *nsm = (NSM::Client *)user_data; - - nsm->nsm_client_id = strdup(&argv[2]->s); - - int r = ((NSM::Client *)user_data)->command_open(&argv[0]->s, - &argv[1]->s, - &argv[2]->s, - &out_msg); - - if(r) - OSC_REPLY_ERR(r, (out_msg ? out_msg : "")); - else - OSC_REPLY("OK"); - - if(out_msg) - free(out_msg); - - return 0; - } - - int - Client::osc_session_is_loaded(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - NSM::Client *nsm = (NSM::Client *)user_data; - - nsm->command_session_is_loaded(); - - return 0; - } - - int - Client::osc_error(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - if(strcmp(&argv[0]->s, "/nsm/server/announce")) - return -1; - - NSM::Client *nsm = (NSM::Client *)user_data; - - -// WARNING( "Failed to register with NSM: %s", &argv[2]->s ); - nsm->nsm_is_active = false; - - nsm->command_active(nsm->nsm_is_active); - - return 0; - } - - int - Client::osc_announce_reply(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data) - { - if(strcmp(&argv[0]->s, "/nsm/server/announce")) - return -1; - - NSM::Client *nsm = (NSM::Client *)user_data; - -// MESSAGE( "Successfully registered. NSM says: %s", &argv[1]->s ); - nsm->nsm_is_active = true; - nsm->_session_manager_name = strdup(&argv[2]->s); - nsm->nsm_addr = - lo_address_new_from_url(lo_address_get_url(lo_message_get_source( - msg))); - - nsm->command_active(nsm->nsm_is_active); - - return 0; - } -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.H b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.H deleted file mode 100644 index e515c717eec..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NSM/Client.H +++ /dev/null @@ -1,143 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* */ -/* 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. */ -/* */ -/* 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 General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -#pragma once - -#include - -namespace NSM -{ - class Client - { - private: - - const char *nsm_url; - - lo_server _server; - lo_server_thread _st; - lo_address nsm_addr; - - bool nsm_is_active; - char *nsm_client_id; - char *_session_manager_name; - - public: - - enum { - ERR_OK = 0, - ERR_GENERAL = -1, - ERR_INCOMPATIBLE_API = -2, - ERR_BLACKLISTED = -3, - ERR_LAUNCH_FAILED = -4, - ERR_NO_SUCH_FILE = -5, - ERR_NO_SESSION_OPEN = -6, - ERR_UNSAVED_CHANGES = -7, - ERR_NOT_NOW = -8 - }; - - Client(); - virtual ~Client(); - - bool is_active(void) { return nsm_is_active; } - - const char *session_manager_name(void) { - return - _session_manager_name; - } - - /* Client->Server methods */ - void is_dirty(void); - void is_clean(void); - void progress(float f); - void message(int priority, const char *msg); - void announce(const char *appliction_name, - const char *capabilities, - const char *process_name); - - void broadcast(lo_message msg); - - /* init without threading */ - int init(const char *nsm_url); - /* init with threading */ - int init_thread(const char *nsm_url); - - /* call this periodically to check for new messages */ - void check(int timeout = 0); - - /* or call these to start and stop a thread (must do your own locking in handler!) */ - void start(void); - void stop(void); - - protected: - - /* Server->Client methods */ - virtual int command_open(const char *name, - const char *display_name, - const char *client_id, - char **out_msg) = 0; - virtual int command_save(char **out_msg) = 0; - - virtual void command_active(bool) { } - - virtual void command_session_is_loaded(void) { } - - /* invoked when an unrecognized message is received. Should return 0 if you handled it, -1 otherwise. */ - virtual int command_broadcast(const char *, lo_message) { return -1; } - - private: - - /* osc handlers */ - static int osc_open(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - static int osc_save(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - static int osc_announce_reply(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - static int osc_error(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - static int osc_session_is_loaded(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - static int osc_broadcast(const char *path, - const char *types, - lo_arg **argv, - int argc, - lo_message msg, - void *user_data); - }; -}; diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.cpp deleted file mode 100644 index 8e253b395f0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "NioUI.h" -#include "../Nio/Nio.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -NioUI::NioUI() - :Fl_Window(200, 100, 400, 400, "New IO Controls") -{ - //hm, I appear to be leaking memory - Fl_Group *settings = new Fl_Group(0, 20, 400, 400 - 35, "Settings"); - { - audio = new Fl_Choice(60, 80, 100, 25, "Audio"); - audio->callback(audioCallback); - midi = new Fl_Choice(60, 100, 100, 25, "Midi"); - midi->callback(midiCallback); - } - settings->end(); - - //initialize midi list - { - set midiList = Nio::getSources(); - string source = Nio::getSource(); - int midival = 0; - for(set::iterator itr = midiList.begin(); - itr != midiList.end(); ++itr) { - midi->add(itr->c_str()); - if(*itr == source) - midival = midi->size() - 2; - } - midi->value(midival); - } - - //initialize audio list - { - set audioList = Nio::getSinks(); - string sink = Nio::getSink(); - int audioval = 0; - for(set::iterator itr = audioList.begin(); - itr != audioList.end(); ++itr) { - audio->add(itr->c_str()); - if(*itr == sink) - audioval = audio->size() - 2; - } - audio->value(audioval); - } - resizable(this); - size_range(400, 300); -} - -NioUI::~NioUI() -{} - -void NioUI::refresh() -{} - -void NioUI::midiCallback(Fl_Widget *c) -{ - bool good = Nio::setSource(static_cast(c)->text()); - static_cast(c)->textcolor(fl_rgb_color(255 * !good, 0, 0)); -} - -void NioUI::audioCallback(Fl_Widget *c) -{ - bool good = Nio::setSink(static_cast(c)->text()); - static_cast(c)->textcolor(fl_rgb_color(255 * !good, 0, 0)); -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.h b/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.h deleted file mode 100644 index 242a49b9098..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/NioUI.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef NIOUI_H -#define NIOUI_H - -#include -#include - -class NioUI:public Fl_Window -{ - public: - NioUI(); - ~NioUI(); - void refresh(); - private: - class Fl_Choice * midi; - class Fl_Choice * audio; - static void midiCallback(Fl_Widget *c); - static void audioCallback(Fl_Widget *c); -}; - -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/OscilGenUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/OscilGenUI.fl deleted file mode 100644 index 54329db5275..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/OscilGenUI.fl +++ /dev/null @@ -1,1148 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include "../Synth/OscilGen.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -decl {\#include } {public -} - -class OscilSpectrum {: {public Fl_Box} -} { - Function {OscilSpectrum(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {oscil=NULL;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i; -const int maxdb=60;//must be multiple of 10 -int GX=2; -int n=lx/GX-1; -if (n>synth->oscilsize/2) n=synth->oscilsize/2; - -float x; -float* spc=new float[n]; -for (i=0;imutex); -if (oscbase==0) oscil->getspectrum(n,spc,0); - else oscil->getspectrum(n,spc,1); -pthread_mutex_unlock(&master->mutex); - -//normalize -float max=0; -for (i=0;iactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->color()); -fl_line_style(FL_DOT); - -for (i=1;iactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -fl_line_style(0); - -//draws the spectrum -for (i=0;idB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else x=0; - - int val=(int) ((ly-2)*x); - if (val>0) fl_line(ox+tmp,oy+ly-2-val,ox+tmp,oy+ly-2); -} -delete [] spc;} {} - } - decl {OscilGen *oscil;} {} - decl {int oscbase;} {} - decl {Master *master;} {} -} - -class PSlider {: {public Fl_Slider} -} { - Function {PSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label)} {} { - code {;} {} - } - Function {handle(int event)} {return_type int - } { - code {int X=x(),Y=y(),W=w(),H=h(); - -if ((!Fl::event_buttons())|| (event==0)||(Fl::event_shift()==0)) return(Fl_Slider::handle(event)); - -if (!Fl::event_inside(X,Y,W,H)) { - if (event==FL_DRAG){ - Fl_Slider::handle(FL_RELEASE); - Fl_Slider::handle(FL_LEAVE); - deactivate(); - activate(); - return(1); - }else{ - return(Fl_Slider::handle(event)); - }; -} else { - //Fl_Slider::handle(FL_FOCUS); - Fl_Slider::handle(FL_PUSH); -}; - -return(1);} {} - } -} - -class Oscilloscope {open : {public Fl_Box} -} { - Function {Oscilloscope(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {open - } { - code {oscil=NULL; -phase=64; -oscbase=0; -box(FL_FLAT_BOX);} {} - } - Function {init(OscilGen *oscil_,Master *master_)} {} { - code {oscil=oscil_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -master=master_;} {} - } - Function {init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_)} {} { - code {oscil=oscil_; -oscbase=oscbase_; -phase=phase_; -master=master_;} {} - } - Function {draw()} {open - } { - code {int ox=x(),oy=y(),lx=w(),ly=h()-1,i; -float smps[synth->oscilsize]; -pthread_mutex_lock(&master->mutex); -if (oscbase==0) oscil->get(smps,-1.0); - else oscil->getcurrentbasefunction(smps); -pthread_mutex_unlock(&master->mutex); - -if (damage()!=1){ - fl_color( fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR, 0.5 )); - fl_rectf(ox,oy,lx,ly); -}; - -//normalize -float max=0; -for (i=0;ioscilsize;i++) - if (maxactive_r()) fl_color(this->parent()->labelcolor()); - else fl_color(this->parent()->color()); -int GX=16;if (lxactive_r()) fl_color(this->parent()->selection_color()); - else fl_color(this->parent()->labelcolor()); - -int lw=2; -//if ((lx<135)||(ly<135)) lw=1; -fl_line_style(FL_SOLID,lw); -fl_begin_line(); -double ph=((phase-64.0)/128.0*synth->oscilsize+synth->oscilsize); -for (i=1;ioscilsize*i/lx)+ph; - double y2=smps[k2%synth->oscilsize]/max; - fl_vertex(i+ox,y2*ly/2.0+oy+ly/2); -}; -fl_end_line(); - -fl_line_style(FL_SOLID,0);} {} - } - decl {OscilGen *oscil;} {} - decl {int oscbase;} {} - decl {int phase;} {public - } - decl {Master *master;} {} -} - -class Oscilharmonic {: {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window harmonic {open - private xywh {338 259 100 225} type Double box FLAT_BOX - class Fl_Group visible - } { - Fl_Slider mag { - callback {int x=64; -if (Fl::event_button3()) o->value(x); - else x=127-(int)o->value(); -if (x==64) o->selection_color(0); - else o->selection_color(222); - -pthread_mutex_lock(&master->mutex); - oscil->Phmag[n]=x; - if (x==64) { - oscil->Phphase[n]=64; - phase->value(64); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} - xywh {0 15 15 115} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(127-oscil->Phmag[n]);} - code1 {if (oscil->Phmag[n]==64) o->selection_color(0);} - class PSlider - } - Fl_Slider phase { - callback {int x=64; -if (Fl::event_button3()) o->value(x); - else x=(int)o->value(); - -pthread_mutex_lock(&master->mutex); - oscil->Phphase[n]=x; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -display->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} - xywh {0 135 15 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(oscil->Phphase[n]);} - class PSlider - } - Fl_Box {} { - xywh {15 70 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - xywh {15 170 5 5} box FLAT_BOX color 45 - } - Fl_Box {} { - label 01 - xywh {0 210 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - Fl_Box {} { - label 01 - xywh {0 0 20 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - } - } - Function {Oscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0; -oscil=NULL; -display=NULL; -applybutton=NULL; -cbwidget=NULL;} {} - } - Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, Master *master_)} {} { - code {oscil=oscil_; -n=n_; -display=display_; -master=master_; -oldosc=oldosc_; -cbwidget=cbwidget_; -applybutton=applybutton_; -make_window(); -end(); -harmonic->show();} {} - } - Function {refresh()} {} { - code {mag->value(127-oscil->Phmag[n]); -phase->value(oscil->Phphase[n]); - -if (oscil->Phmag[n]==64) mag->selection_color(0); - else mag->selection_color(222);} {} - } - Function {~Oscilharmonic()} {} { - code {harmonic->hide(); -//delete(harmonic);} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Group *display;} {} - decl {int n;} {} - decl {Fl_Widget *oldosc,*cbwidget,*applybutton;} {} - decl {Master *master;} {} -} - -class OscilEditor {open : {public PresetsUI_} -} { - Function {make_window()} {open - } { - Fl_Window osceditUI { - label {ADsynth Oscillator Editor} open - xywh {542 193 735 595} type Double - code0 {if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible - } { - Fl_Button applybutton { - label Apply - callback {applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -};} - xywh {300 280 60 20} box THIN_UP_BOX labelfont 1 - code0 {if (!oscil->ADvsPAD) o->hide();} - } - Fl_Group oscildisplaygroup { - xywh {5 5 360 300} box UP_FRAME - } { - Fl_Group {} {open - xywh {10 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,master);} - } {} - Fl_Box {} { - label Oscillator - xywh {120 10 110 20} labelfont 1 - } - Fl_Value_Slider rndslider { - label rnd - callback {oscil->Prand=(int)o->value()+64; -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {140 285 100 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {if (oscil->ADvsPAD) o->hide();} - } - Fl_Group {} {open - xywh {10 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {OscilSpectrum *spc=new OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,0,master);} - } {} - Fl_Group {} { - xywh {246 277 115 25} box UP_FRAME - code0 {if (oscil->ADvsPAD) o->hide();} - } { - Fl_Choice hrndtype { - label {H.rnd} - callback {oscil->Pamprandtype=(int) o->value();} - tooltip {Harmonic Amplitude Randomness} xywh {281 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sin - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hrnddial { - callback {oscil->Pamprandpower=(int) o->value();} - tooltip {Oscillator's spectrum adjust parameter} xywh {338 280 18 18} maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Group basefuncdisplaygroup {open selected - xywh {365 5 360 300} box UP_FRAME - } { - Fl_Group {} { - xywh {370 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 - code0 {Oscilloscope *osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(oscil,1,master);} - } {} - Fl_Dial bfslider { - callback {oscil->Pbasefuncpar=(int)o->value()+64; -basefuncdisplaygroup->redraw(); -bfparval->value(oscil->Pbasefuncpar-64); - -redrawoscil();} - tooltip {Base Function Parameter} xywh {520 280 20 20} minimum -64 maximum 63 step 1 - class WidgetPDial - } - Fl_Choice bftype { - label {Base.F..} - callback {oscil->Pcurrentbasefunc=(int) o->value(); - -basefuncdisplaygroup->redraw(); -redrawoscil(); - -if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); - else basefuncmodulation->activate();} - xywh {370 285 90 15} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - } { - MenuItem {} { - label Sine - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Triangle - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Pulse - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Saw - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Power - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Gauss - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Diode - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label AbsSine - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PulseSine - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label StrchSine - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Chirp - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label AbsStrSine - xywh {102 102 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Chebyshev - xywh {112 112 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Sqr - xywh {122 122 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Spike - xywh {122 122 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Circle - xywh {122 122 100 20} labelfont 1 labelsize 11 - } - } - Fl_Box {} { - label {Base Func.} - xywh {480 10 110 20} labelfont 1 - } - Fl_Group {} {open - xywh {370 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 - code0 {OscilSpectrum *spc=new OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");} - code1 {spc->init(oscil,1,master);} - } {} - Fl_Value_Output bfparval { - label {Par.} - xywh {490 285 25 15} labelsize 12 minimum -63 maximum 63 step 1 - } - Fl_Group basefuncmodulation { - xywh {550 276 169 25} box UP_FRAME - code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();} - } { - Fl_Choice bfmodtype { - label {B.F.Mod.} - callback {oscil->Pbasefuncmodulation=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Base function modulation} xywh {601 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Rev - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial bfmodpar1 { - callback {oscil->Pbasefuncmodulationpar1=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 1} xywh {659 281 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial bfmodpar2 { - callback {oscil->Pbasefuncmodulationpar2=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 2} xywh {679 281 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial bfmodpar3 { - callback {oscil->Pbasefuncmodulationpar3=(int)o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 3} xywh {699 281 15 15} maximum 127 step 1 - class WidgetPDial - } - } - } - Fl_Choice magtype { - label {Mag.Type} - callback {oscil->Phmagtype=(int) o->value(); -basefuncdisplaygroup->redraw(); - -redrawoscil();} - xywh {70 280 65 20} down_box BORDER_BOX labelsize 11 textsize 11 - } { - MenuItem {} { - label Linear - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-40dB} - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-60dB} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-80dB} - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-100dB} - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - } - Fl_Button {} { - label {Use as base} - callback {oscil->useasbase(); -if (autoclearbutton->value()){ - for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; - }; - oscil->Phmag[0]=127; - - oscil->Pharmonicshift=0; - harmonicshiftcounter->value(0); - - h[0]->mag->value(0); - wshbutton->value(0); - wshbutton->do_callback(); - fltbutton->value(0); - fltbutton->do_callback(); - sabutton->value(0); - sabutton->do_callback(); -}; - -pthread_mutex_lock(&master->mutex); - for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); - }; - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -basefuncdisplaygroup->redraw(); -redrawoscil();} - tooltip {Use this Oscillator as base function} xywh {5 313 85 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label Close - callback {osceditUI->hide();} - xywh {668 565 62 25} box THIN_UP_BOX - } - Fl_Button {} { - label Clear - callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return; - -for (int i=0;imag->value(64); - oscil->Phmag[i]=64; - h[i]->phase->value(64); - oscil->Phphase[i]=64; -}; -oscil->Phmag[0]=127; -h[0]->mag->value(0); - -for (int i=0;iPhmag[i]==64) h[i]->mag->selection_color(0); - else h[i]->mag->selection_color(222); -}; - -//harmonics->redraw(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -redrawoscil();} - xywh {670 505 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group {} { - xywh {136 308 150 30} box UP_FRAME - } { - Fl_Choice wshbutton { - label {Wsh.} - callback {oscil->Pwaveshapingfunction=(int) o->value(); -basefuncdisplaygroup->redraw(); -redrawoscil();} open - tooltip {Waveshaping function} xywh {166 313 55 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Atan - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Qnts - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Zigzg - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Lmt - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtU - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LmtL - xywh {115 115 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ILmt - xywh {127 127 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Clip - xywh {137 137 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Asym2 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow2 - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sgm - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial wshpar { - callback {oscil->Pwaveshaping=(int)o->value()+64; -wsparval->value(oscil->Pwaveshaping-64); -redrawoscil();} - tooltip {Waveshaping Parameter} xywh {261 313 20 20} minimum -64 maximum 63 step 1 - class WidgetPDial - } - Fl_Value_Output wsparval { - xywh {229 316 25 15} labelsize 12 minimum -63 maximum 63 step 1 - } - } - Fl_Check_Button autoclearbutton { - label {Clr.} - tooltip {Auto clear when using the oscillator as base function} xywh {94 313 38 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 - } - Fl_Group {} { - xywh {287 308 155 30} box UP_FRAME - } { - Fl_Choice fltbutton { - label Filter - callback {oscil->Pfiltertype=(int) o->value(); - -redrawoscil();} - tooltip {Oscillator's filter type} xywh {317 313 50 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LP1 - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP1a - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP1b - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BP1 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BS1 - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LP2 - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label HP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BP2 - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label BS2 - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Cos - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sin - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label LSh - xywh {95 95 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label S - xywh {105 105 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial filtervalue1 { - callback {oscil->Pfilterpar1=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's filter parameter1} xywh {369 313 20 20} maximum 127 step 1 - class WidgetPDial - } - Fl_Check_Button filterpref { - label p - callback {oscil->Pfilterbeforews=(int)o->value(); - -redrawoscil();} - tooltip {Apply the filter before the waveshaping} xywh {417 313 20 20} down_box DOWN_BOX labelsize 10 align 24 - } - Fl_Dial filtervalue2 { - callback {oscil->Pfilterpar2=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's filter parameter2} xywh {394 313 20 20} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Group {} { - xywh {594 308 135 30} box UP_FRAME - } { - Fl_Choice sabutton { - label {Sp.adj.} - callback {oscil->Psatype=(int) o->value(); -redrawoscil();} - tooltip {Oscillator's spectrum adjust} xywh {635 313 60 20} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ThrsD - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ThrsU - xywh {85 85 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial sadjpar { - callback {oscil->Psapar=(int)o->value(); -redrawoscil();} - tooltip {Oscillator's spectrum adjust parameter} xywh {702 313 20 20} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Group {} { - xywh {665 340 65 65} box UP_FRAME - } { - Fl_Counter harmonicshiftcounter { - label {Harmonic Shift} - callback {oscil->Pharmonicshift=(int)o->value(); -redrawoscil();} - xywh {670 365 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10 - } - Fl_Check_Button harmonicshiftpre { - label preH - callback {oscil->Pharmonicshiftfirst=(int)o->value(); -redrawoscil();} - tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {690 385 34 15} down_box DOWN_BOX labelsize 10 align 24 - } - Fl_Button {} { - label R - callback {oscil->Pharmonicshift=0; -harmonicshiftcounter->value(0); -redrawoscil();} - xywh {670 385 20 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - } - Fl_Group {} {open - xywh {665 410 65 90} box UP_FRAME - } { - Fl_Choice adhrtype { - label {Adpt.Harm.} - callback {oscil->Padaptiveharmonics=(int) o->value(); -redrawoscil();} - tooltip {The type of the addaptive harmonics} xywh {670 425 55 15} down_box BORDER_BOX labelsize 10 align 129 when 6 textsize 10 - } { - MenuItem {} { - label OFF - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label ON - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Square - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 2xSub - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 2xAdd - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 3xSub - xywh {120 120 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 3xAdd - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 4xSub - xywh {130 130 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label 4xAdd - xywh {140 140 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial adhrpow { - label pow - callback {oscil->Padaptiveharmonicspower=(int)o->value(); -redrawoscil();} - tooltip {Adaptive harmonics power} xywh {700 460 25 25} labelsize 10 maximum 200 step 1 - class WidgetPDial - } - Fl_Dial adhrbf { - label baseF - callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value(); -redrawoscil();} - tooltip {Adaptive harmonics base frequency} xywh {670 460 25 25} labelsize 10 maximum 255 step 1 - class WidgetPDial - } - Fl_Slider adhrpar { - callback {oscil->Padaptiveharmonicspar=(int)o->value(); -redrawoscil();} - xywh {670 445 55 10} type {Horz Knob} box FLAT_BOX maximum 100 step 1 value 50 - } - } - Fl_Group {} { - xywh {443 308 150 30} box UP_FRAME - } { - Fl_Choice modtype { - label {Mod.} - callback {oscil->Pmodulation=(int) o->value(); - -redrawoscil();} - tooltip modulation xywh {476 315 50 15} down_box BORDER_BOX labelsize 10 textsize 10 - } { - MenuItem {} { - label None - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Rev - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Pow - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial modpar1 { - callback {oscil->Pmodulationpar1=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's modulation parameter 1} xywh {534 315 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial modpar2 { - callback {oscil->Pmodulationpar2=(int)o->value(); - -redrawoscil();} - tooltip {Oscillator's modulation parameter 2} xywh {554 315 15 15} maximum 127 step 1 - class WidgetPDial - } - Fl_Dial modpar3 { - callback {oscil->Pmodulationpar3=(int)o->value(); -redrawoscil();} - tooltip {Oscillator's modulation parameter 3} xywh {574 315 15 15} maximum 127 step 1 - class WidgetPDial - } - } - Fl_Button {} { - label Sine - callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return; - -pthread_mutex_lock(&master->mutex); - oscil->convert2sine(); -pthread_mutex_unlock(&master->mutex); - -redrawoscil(); -refresh();} - xywh {670 525 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Button {} { - label C - callback {presetsui->copy(oscil);} - xywh {670 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(oscil,this);} - xywh {700 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Scroll _this_has_to_be_the_last { - xywh {5 340 660 250} type HORIZONTAL box FLAT_BOX - } { - Fl_Pack harmonics {open - xywh {10 345 650 225} type HORIZONTAL - code0 {for (int i=0;ih(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,cbwidget,applybutton,master);}} - } {} - } - } - } - Function {OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_,Master *master_)} {} { - code {oscil=oscil_; -oldosc=oldosc_; -cbwidget=cbwidget_; -cbapplywidget=cbapplywidget_; -master=master_; - -make_window(); - -refresh(); -osceditUI->show();} {} - } - Function {~OscilEditor()} {} { - code {osceditUI->hide(); -//for (int i=0;ivalue(oscil->Phmagtype); -rndslider->value(oscil->Prand-64); - -hrndtype->value(oscil->Pamprandtype); -hrnddial->value(oscil->Pamprandpower); - -bftype->value(oscil->Pcurrentbasefunc); -bfparval->value(oscil->Pbasefuncpar-64); -bfslider->value(oscil->Pbasefuncpar-64); - -bfmodtype->value(oscil->Pbasefuncmodulation); -bfmodpar1->value(oscil->Pbasefuncmodulationpar1); -bfmodpar2->value(oscil->Pbasefuncmodulationpar2); -bfmodpar3->value(oscil->Pbasefuncmodulationpar3); - -wshbutton->value(oscil->Pwaveshapingfunction); -wsparval->value(oscil->Pwaveshaping-64); -wshpar->value(oscil->Pwaveshaping-64); - -fltbutton->value(oscil->Pfiltertype); -filtervalue1->value(oscil->Pfilterpar1); -filtervalue2->value(oscil->Pfilterpar2); -filterpref->value(oscil->Pfilterbeforews); - -modtype->value(oscil->Pmodulation); -modpar1->value(oscil->Pmodulationpar1); -modpar2->value(oscil->Pmodulationpar2); -modpar3->value(oscil->Pmodulationpar3); - -sabutton->value(oscil->Psatype); -sadjpar->value(oscil->Psapar); - -harmonicshiftcounter->value(oscil->Pharmonicshift); -harmonicshiftpre->value(oscil->Pharmonicshiftfirst); - -adhrtype->value(oscil->Padaptiveharmonics); -adhrbf->value(oscil->Padaptiveharmonicsbasefreq); -adhrpow->value(oscil->Padaptiveharmonicspower); -adhrtype->value(oscil->Padaptiveharmonicspar); - -for (int i=0;irefresh(); - -pthread_mutex_lock(&master->mutex); - oscil->prepare(); -pthread_mutex_unlock(&master->mutex); - -basefuncdisplaygroup->redraw(); -redrawoscil();} {} - } - Function {redrawoscil()} {} { - code {oscildisplaygroup->redraw(); -oldosc->redraw(); -if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} {} - } - decl {OscilGen *oscil;} {} - decl {Fl_Widget *oldosc,*cbwidget,*cbapplywidget;} {} - decl {Oscilharmonic *h[MAX_AD_HARMONICS];} {} - decl {Master *master;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PADnoteUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/PADnoteUI.fl deleted file mode 100644 index 33a071341dd..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PADnoteUI.fl +++ /dev/null @@ -1,1118 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {\#include "../Params/PADnoteParameters.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "ResonanceUI.h"} {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "LFOUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "OscilGenUI.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class PADnoteHarmonicProfile {: {public Fl_Box} -} { - Function {PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {init(PADnoteParameters *pars,Master *master_)} {} { - code {master=master_; -this->pars=pars;} {} - } - Function {draw()} {} { - code {int ox=x(),oy=y(),lx=w(),ly=h(); -if (!visible()) return; -float smps[lx]; - -float realbw=pars->getprofile(smps,lx); -bool active=active_r(); - -//draw the equivalent bandwidth -if (active) fl_color(220,220,220); - else fl_color(160,165,165); -fl_line_style(FL_DASH); -int rbw=(int)(realbw*(lx-1.0)/2.0); -fl_begin_line(); -for (int i=lx/2-rbw;i<(lx/2+rbw);i++) { fl_vertex(ox+i,oy); } -fl_end_line(); - -fl_line_style(FL_DASH); -if (active) fl_color(200,200,200); - else fl_color(160,160,160); -for (int i=1;i<10;i++){ - int kx=(int)(lx/10.0*i); - fl_line( ox + kx, oy, ox + kx, oy + ly - 1 ); -}; -for (int i=1;i<5;i++){ - int ky=(int)(ly/5.0*i); - fl_line(ox,oy+ly-ky,ox+lx,oy+ly-ky-1); -}; - - -fl_color(120,120,120); -fl_line_style(FL_DASH); -fl_line(ox+lx/2,oy,ox+lx/2,oy+ly); - -//draw the graph -fl_line_style(FL_SOLID); - if (active) fl_color(180,210,240); - else fl_color(150,150,155); - -fl_begin_polygon(); -fl_vertex( ox, oy + h() ); -for (int i=0;i0) -// { -// fl_vertex(ox+i-1,oy+ly-2-old); -// fl_vertex(ox+i,oy+ly-2-val); -// } -}; -fl_vertex( ox + w(), oy + h() ); -fl_end_polygon(); - - -fl_line_style(FL_DASH); -if (active) fl_color(0,100,220); - else fl_color(150,160,170); -fl_line(ox+lx/2-rbw,oy,ox+lx/2-rbw,oy+ly-1); -fl_line(ox+lx/2+rbw,oy,ox+lx/2+rbw,oy+ly-1); - -fl_line_style(0);} {} - } - decl {Master *master;} {} - decl {PADnoteParameters *pars;} {public - } -} - -class PADnoteOvertonePosition {: {public Fl_Box} -} { - Function {PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {pars=NULL;} {} - } - Function {init(PADnoteParameters *pars,Master *master_)} {} { - code {master=master_; -this->pars=pars;} {} - } - Function {draw()} {} { - code {if (!visible()) return; -const int maxdb=60; - -int ox=x(),oy=y(),lx=w(),ly=h(); -const int maxharmonic=64; - - -for (int i=1;ioscilsize/2; -float spc[n]; -for (int i=0;imutex); -pars->oscilgen->getspectrum(n,spc,0); -pthread_mutex_unlock(&master->mutex); - - -//normalize -float max=0; -for (int i=0;igetNhr(i); - int kx=(int)(lx/(float)maxharmonic*nhr); - if ((kx<0)||(kx>lx)) continue; - - spectrum[kx]=spc[i-1]/max+1e-9; - -}; - -fl_color(180,0,0); -fl_line_style(0); - -if (pars->Pmode==2){ - int old=0; - for (int i=1;i1e-10)||(i==(lx-1))){ - int delta=i-old; - float val1=spectrum[old]; - float val2=spectrum[i]; - - float idelta=1.0/delta; - for (int j=0;jdB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; - else continue; - int yy=(int)(x*ly); - fl_line(ox+i,oy+ly-1-yy,ox+i,oy+ly-1); - -};} {} - } - decl {Master *master;} {} - decl {PADnoteParameters *pars;} {public - } -} - -class PADnoteUI {open : {public PresetsUI_} -} { - Function {PADnoteUI(PADnoteParameters *parameters,Master *master_)} {open - } { - code {pars=parameters; -master=master_; -oscui=NULL; -resui=new ResonanceUI(pars->resonance); -make_window();} {} - } - Function {make_window()} {open - } { - Fl_Window padnotewindow { - label {PAD synth Parameters} open - xywh {288 386 535 435} type Double visible - } { - Fl_Tabs {} { - callback {if (o->value()!=harmonicstructuregroup) applybutton->hide(); - else applybutton->show();} open - xywh {0 0 535 395} box UP_FRAME - } { - Fl_Group harmonicstructuregroup { - label {Harmonic Structure} open selected - xywh {0 20 535 375} box UP_FRAME - } { - Fl_Group bwprofilegroup { - xywh {5 30 90 260} box UP_FRAME - code0 {if (pars->Pmode!=0) o->deactivate();} - } { - Fl_Dial hpbasepar1 { - label Width - callback {pars->Php.base.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.base.par1);} - class WidgetPDial - } - Fl_Choice hpbasetype { - label {Base Type} - callback {pars->Php.base.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.base.type);} - } { - MenuItem {} { - label Gauss - xywh {15 15 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Square - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DoubleExp - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpfreqmult { - label FreqMlt - callback {pars->Php.freqmult=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {55 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.freqmult);} - class WidgetPDial - } - Fl_Dial hpmpar1 { - label Str - callback {pars->Php.modulator.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.modulator.par1);} - class WidgetPDial - } - Fl_Dial hpmfreq { - label SFreq - callback {pars->Php.modulator.freq=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {40 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.modulator.freq);} - class WidgetPDial - } - Fl_Group {} { - xywh {10 160 80 105} box BORDER_BOX - } { - Fl_Choice hpamptype { - label AmpMultiplier - callback {pars->Php.amp.type=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.amp.type);} - } { - MenuItem {} { - label OFF - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Gauss - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Sine - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Flat - xywh {75 75 100 20} labelfont 1 labelsize 10 - } - } - Fl_Choice hpampmode { - label AmpMode - callback {pars->Php.amp.mode=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.amp.mode);} - } { - MenuItem {} { - label Sum - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Mult - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Div1 - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Div2 - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpamppar1 { - label Par1 - callback {pars->Php.amp.par1=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {15 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.amp.par1);} - class WidgetPDial - } - Fl_Dial hpamppar2 { - label Par2 - callback {pars->Php.amp.par2=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {55 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.amp.par2);} - class WidgetPDial - } - } - Fl_Check_Button hpautoscale { - label autoscale - callback {pars->Php.autoscale=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {10 270 60 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(pars->Php.autoscale);} - } - Fl_Choice hponehalf { - callback {pars->Php.onehalf=o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->Php.onehalf);} - } { - MenuItem {} { - label Full - xywh {25 25 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Upper Half} - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Lower Half} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - } - Fl_Dial hpwidth { - label Size - callback {pars->Php.width=(int) o->value(); -hprofile->redraw(); -cbwidget->do_callback();} - xywh {65 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Php.width);} - class WidgetPDial - } - } - Fl_Group {} { - xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6 - code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} - code1 {osc->init(pars->oscilgen,master);} - } {} - Fl_Button {} { - label Change - callback {if (oscui!=NULL) delete (oscui); -oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,applybutton,master);} - xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Box cbwidget { - label {Harmonic Content} - callback {overtonepos->redraw(); -applybutton->color(FL_RED); -applybutton->redraw();} - xywh {125 135 205 20} align 16 - } - Fl_Button {} { - label Resonance - callback {resui->resonancewindow->redraw(); -resui->resonancewindow->show(); -resui->setcbwidget(cbwidget,applybutton);} - xywh {375 225 80 20} box THIN_UP_BOX - } - Fl_Dial bwdial { - label BandWidth - callback {bwcents->value(pars->setPbandwidth((int) o->value())); -cbwidget->do_callback();} - xywh {15 295 35 35} box ROUND_UP_BOX labelsize 10 maximum 1000 step 1 - code0 {o->value(pars->Pbandwidth);} - code1 {if (pars->Pmode!=0) o->deactivate();} - class WidgetPDial - } - Fl_Value_Output bwcents { - label cents - xywh {55 305 55 15} labelsize 10 align 6 maximum 10000 step 0.1 - code0 {o->value(pars->setPbandwidth(pars->Pbandwidth));} - code1 {if (pars->Pmode!=0) o->deactivate();} - } - Fl_Group {} { - xywh {315 295 215 45} box UP_FRAME - } { - Fl_Choice hrpostype { - label OvertonesPosition - callback {pars->Phrpos.type=o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Phrpos.type);} - } { - MenuItem {} { - label Harmonic - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftU - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftL - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerU - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerL - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Sine - xywh {110 110 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Power - xywh {120 120 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Shift selected - xywh {130 130 100 20} labelfont 1 labelsize 11 - } - } - Fl_Dial hrpospar1 { - label Par1 - callback {pars->Phrpos.par1=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par1);} - class WidgetPDial - } - Fl_Dial hrpospar2 { - label Par2 - callback {pars->Phrpos.par2=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par2);} - class WidgetPDial - } - Fl_Dial hrpospar3 { - label ForceH - callback {pars->Phrpos.par3=(int) o->value(); -overtonepos->redraw(); -cbwidget->do_callback();} - xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1 - code0 {o->value(pars->Phrpos.par3);} - class WidgetPDial - } - } - Fl_Choice bwscale { - label {Bandwidth Scale} - callback {pars->Pbwscale=(int) o->value(); -cbwidget->do_callback();} - xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pbwscale);} - code1 {if (pars->Pmode!=0) o->deactivate();} - } { - MenuItem {} { - label Normal - xywh {95 95 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label EqualHz - xywh {105 105 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Quater - xywh {115 115 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Half - xywh {125 125 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {75%} - xywh {135 135 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {150%} - xywh {145 145 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Double - xywh {145 145 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Inv.Half} - xywh {155 155 100 20} labelfont 1 labelsize 11 - } - } - Fl_Group overtonepos { - xywh {5 345 525 45} box FLAT_BOX color 51 selection_color 218 labelcolor 63 - code0 {PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");} - code1 {opui->init(pars,master);} - } {} - Fl_Choice qsamplesize { - label {Sample Size} - callback {pars->Pquality.samplesize=(int) o->value(); -cbwidget->do_callback();} - xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pquality.samplesize);} - } { - MenuItem {} { - label {16k (Tiny)} - xywh {155 155 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 32k - xywh {165 165 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {64k (Small)} - xywh {175 175 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 128k - xywh {185 185 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {256k (Normal)} - xywh {205 205 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 512k - xywh {200 200 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {1M (Big)} - xywh {205 205 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qsmpoct { - label {smp/oct} - callback {pars->Pquality.smpoct=(int) o->value(); -cbwidget->do_callback();} - xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.smpoct);} - } { - MenuItem {} { - label {0.5} - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 1 - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 2 - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 3 - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 4 - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 6 - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 12 - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qoct { - label {no.oct} - callback {pars->Pquality.oct=(int) o->value(); -cbwidget->do_callback();} - xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.oct);} - } { - MenuItem {} { - label 1 - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 2 - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 3 - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 4 - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 5 - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 6 - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 7 - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label 8 - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice qbasenote { - label base - callback {pars->Pquality.basenote=(int) o->value(); -cbwidget->do_callback();} - xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - code0 {o->value(pars->Pquality.basenote);} - } { - MenuItem {} { - label {C-2} - xywh {10 10 100 20} labelfont 1 - } - MenuItem {} { - label {G-2} - xywh {20 20 100 20} labelfont 1 - } - MenuItem {} { - label {C-3} - xywh {20 20 100 20} labelfont 1 - } - MenuItem {} { - label {G-3} - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label {C-4} - xywh {30 30 100 20} labelfont 1 - } - MenuItem {} { - label {G-4} - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label {C-5} - xywh {40 40 100 20} labelfont 1 - } - MenuItem {} { - label {G-5} - xywh {50 50 100 20} labelfont 1 - } - MenuItem {} { - label {G-6} - xywh {60 60 100 20} labelfont 1 - } - } - Fl_Group hprofile { - xywh {100 45 430 90} box FLAT_BOX color 51 selection_color 218 labelcolor 63 - code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");} - code1 {hpui->init(pars,master);} - code2 {if (pars->Pmode!=0) { o->deactivate(); o->color(48);};} - } {} - Fl_Box {} { - label {Profile of One Harmonic (Frequency Distribution)} - xywh {160 25 315 20} - } - Fl_Choice spectrummode { - label {Spectrum Mode} - callback {pars->Pmode=(int) o->value(); - -if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(51); - bwscale->activate(); -} else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->deactivate(); -}; - -cbwidget->do_callback();} - xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 11 - code0 {o->value(pars->Pmode);} - } { - MenuItem {} { - label Bandwidth - xywh {105 105 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Discrete - xywh {125 125 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Continous - xywh {115 115 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Group {} { - label {Envelopes&LFOs} open - xywh {0 20 535 375} box UP_FRAME hide - } { - Fl_Group {} { - label FREQUENCY - xywh {5 275 525 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group freqenv { - label {PADSynth - Frequency Envelope} open - xywh {10 315 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FreqEnvelope);} - class EnvelopeUI - } {} - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024;} - tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {455 365 70 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Group freqlfo { - label {Frequency LFO } open - xywh {215 315 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->FreqLfo);} - class LFOUI - } {} - Fl_Slider detune { - callback {pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {450 330 75 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->PDetuneType-1);} - } {} - Fl_Check_Button hz440 { - label 440Hz - callback {int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->PfixedfreqET);} - code1 {if (pars->Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - } - Fl_Group {} { - label AMPLITUDE - xywh {5 25 240 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Value_Slider volume { - label Vol - callback {pars->PVolume=(int)o->value();} - tooltip Volume xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->PPanning);} - class WidgetPDial - } - Fl_Dial pstr { - label {P.Str.} - callback {pars->PPunchStrength=(int) o->value();} - tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchStrength);} - class WidgetPDial - } - Fl_Dial pt { - label {P.t.} - callback {pars->PPunchTime=(int) o->value();} - tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchTime);} - class WidgetPDial - } - Fl_Dial pstc { - label {P.Stc.} - callback {pars->PPunchStretch=(int) o->value();} - tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchStretch);} - class WidgetPDial - } - Fl_Dial pvel { - label {P.Vel.} - callback {pars->PPunchVelocitySensing=(int) o->value();} - tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->PPunchVelocitySensing);} - class WidgetPDial - } - Fl_Group ampenv { - label {PADSynth - Amplitude Envelope} open - xywh {10 95 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->AmpEnvelope);} - class EnvelopeUI - } {} - Fl_Group amplfo { - label {Amplitude LFO } open - xywh {10 165 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->AmpLfo);} - class LFOUI - } {} - Fl_Check_Button stereo { - label Stereo - callback {pars->PStereo=(int) o->value(); -hprofile->redraw();} - xywh {15 245 70 25} down_box DOWN_BOX - code0 {o->value(pars->PStereo);} - } - } - Fl_Group {} { - label FILTER - xywh {245 25 285 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 - } { - Fl_Group filterenv { - label {PADSynth - Filter Envelope} open - xywh {250 130 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterlfo { - label {Filter LFO } open - xywh {250 200 230 70} box FLAT_BOX color 47 align 144 - code0 {o->init(pars->FilterLfo);} - class LFOUI - } {} - Fl_Group filterui { - label {PADsynth - Filter} open - xywh {250 55 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction);} - class FilterUI - } {} - } - } - } - Fl_Button applybutton { - label {Apply Changes} - callback {pars->applyparameters(true); -o->color(FL_GRAY); -if (oscui!=NULL) { - oscui->applybutton->color(FL_GRAY); - oscui->applybutton->redraw(); -}; -if (resui!=NULL) { - resui->applybutton->color(FL_GRAY); - resui->applybutton->redraw(); -};} - xywh {300 400 135 30} box THIN_UP_BOX - code0 {o->color(FL_RED);} - } - Fl_Button {} { - label Close - callback {padnotewindow->hide();} - xywh {440 400 90 30} box THIN_UP_BOX - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label export - callback {char *filename; -filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0); -if (filename==NULL) return; -fl_filename_setext(filename,""); - - - -pars->export2wav(filename);} - tooltip {export samples as wav file} xywh {5 400 55 30} box THIN_UP_BOX color 51 labelsize 11 align 128 - } - } - } - Function {refresh()} {} { - code {volume->value(pars->PVolume); -vsns->value(pars->PAmpVelocityScaleFunction); -pan->value(pars->PPanning); - -stereo->value(pars->PStereo); - - -pstr->value(pars->PPunchStrength); -pt->value(pars->PPunchTime); -pstc->value(pars->PPunchStretch); -pvel->value(pars->PPunchVelocitySensing); - -detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -detune->value(pars->PDetune-8192); - -int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->PDetuneType-1); -k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); - -hz440->value(pars->Pfixedfreq); -fixedfreqetdial->value(pars->PfixedfreqET); - -amplfo->refresh(); -freqlfo->refresh(); -filterlfo->refresh(); - -ampenv->refresh(); -freqenv->refresh(); -filterenv->refresh(); -filterui->refresh(); - - -/* harmonic structure parametrs */ - -resui->refresh(); -if (oscui!=NULL) oscui->refresh(); - -hpbasetype->value(pars->Php.base.type); -hpbasepar1->value(pars->Php.base.par1); -hpfreqmult->value(pars->Php.freqmult); - -hpmpar1->value(pars->Php.modulator.par1); -hpmfreq->value(pars->Php.modulator.freq); -hpwidth->value(pars->Php.width); - -hponehalf->value(pars->Php.onehalf); -hpamptype->value(pars->Php.amp.type); -hpampmode->value(pars->Php.amp.mode); -hpamppar1->value(pars->Php.amp.par1); -hpamppar2->value(pars->Php.amp.par2); -hpautoscale->value(pars->Php.autoscale); - -bwdial->value(pars->Pbandwidth); -if (pars->Pmode==0){ - bwprofilegroup->activate(); - bwdial->activate(); - bwcents->activate(); - hprofile->activate(); - hprofile->color(51); - bwscale->activate(); -} else { - bwprofilegroup->deactivate(); - bwdial->deactivate(); - bwcents->deactivate(); - hprofile->deactivate(); - hprofile->color(48); - bwscale->activate(); -}; - -spectrummode->value(pars->Pmode); - -qbasenote->value(pars->Pquality.basenote); -qsmpoct->value(pars->Pquality.smpoct); -qoct->value(pars->Pquality.oct); -qsamplesize->value(pars->Pquality.samplesize); - -hrpostype->value(pars->Phrpos.type); -hrpospar1->value(pars->Phrpos.par1); -hrpospar2->value(pars->Phrpos.par2); -hrpospar3->value(pars->Phrpos.par3); - -hprofile->redraw(); -overtonepos->redraw(); - -osc->redraw(); -pars->applyparameters(true); -applybutton->color(FL_GRAY); -applybutton->parent()->redraw();} {} - } - Function {~PADnoteUI()} {} { - code {delete(oscui); -delete(resui); - -padnotewindow->hide(); -delete(padnotewindow);} {} - } - decl {PADnoteParameters *pars;} {public - } - decl {Master *master;} {public - } - decl {OscilEditor *oscui;} {public - } - decl {Oscilloscope *osc;} {public - } - decl {ResonanceUI *resui;} {public - } -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PartUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/PartUI.fl deleted file mode 100644 index 0040bbf8796..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PartUI.fl +++ /dev/null @@ -1,1125 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EffUI.h"} {public -} - -decl {\#include "BankUI.h"} {public -} - -decl {\#include "ADnoteUI.h"} {public -} - -decl {\#include "SUBnoteUI.h"} {public -} - -decl {\#include "PADnoteUI.h"} {public -} - -decl {\#include "../Misc/Config.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Part.h"} {public -} - -class PartSysEffSend {open : {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window syseffsend { - private xywh {589 129 100 100} type Double box FLAT_BOX - class Fl_Group visible - } { - Fl_Dial {} { - label 01 - callback {master->setPsysefxvol(npart,neff,(int) o->value());} - xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1 - code0 {o->size(25,25);} - code1 {o->value(master->Psysefxvol[neff][npart]);} - code2 {char tmp[10];snprintf(tmp,10,"%d",neff+1);o->copy_label(tmp);} - class WidgetPDial - } - } - } - Function {PartSysEffSend(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {master=NULL; -neff=0; -npart=0;} {} - } - Function {init(Master *master_,int npart_,int neff_)} {} { - code {npart=npart_; -neff=neff_; -master=master_; -make_window(); -syseffsend->show(); -end();} {} - } - Function {~PartSysEffSend()} {} { - code {syseffsend->hide(); -//delete(syseffsend);} {} - } - decl {Master *master;} {} - decl {int neff;} {} - decl {int npart;} {} -} - -class PartKitItem {open : {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window partkititem { - private xywh {473 406 670 100} type Double box FLAT_BOX - class Fl_Group visible - } { - Fl_Group partkititemgroup { - private xywh {55 0 605 20} - code0 {if (part->kit[n].Penabled==0) o->deactivate();} - } { - Fl_Counter minkcounter { - callback {part->kit[n].Pminkey=(int)o->value();} - xywh {225 0 55 15} type Simple minimum 0 maximum 128 step 1 - code0 {o->value(part->kit[n].Pminkey);} - } - Fl_Button {} { - label m - callback {if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {285 3 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {315 3 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {300 3 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button adeditbutton { - label edit - callback {partui->showparameters(n,0);} - xywh {420 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Padenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Button subeditbutton { - label edit - callback {partui->showparameters(n,1);} - xywh {490 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Psubenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button mutedcheck { - callback {part->kit[n].Pmuted=(int)o->value();} - private xywh {60 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Pmuted);} - } - Fl_Counter maxkcounter { - callback {part->kit[n].Pmaxkey=(int)o->value();} - xywh {335 0 55 15} type Simple minimum 0 maximum 128 step 1 - code0 {o->value(part->kit[n].Pmaxkey);} - } - Fl_Button labelbutton { - label {Bass Drum} - callback {const char *tmp=fl_input("Kit item name:",(const char *)part->kit[n].Pname); -if (tmp!=NULL) snprintf((char *)part->kit[n].Pname,PART_MAX_NAME_LEN,"%s",tmp);} - xywh {90 0 130 15} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 20 - code0 {o->label((char *)part->kit[n].Pname);} - } - Fl_Check_Button adcheck { - callback {part->kit[n].Padenabled=(int)o->value(); -if (part->kit[n].Padenabled!=0) adeditbutton->activate(); - else adeditbutton->deactivate();} - private xywh {400 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Padenabled);} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button subcheck { - callback {part->kit[n].Psubenabled=(int)o->value(); -if (part->kit[n].Psubenabled!=0) subeditbutton->activate(); - else subeditbutton->deactivate();} - private xywh {470 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Psubenabled);} - code1 {if (n==0) o->hide();} - } - Fl_Choice sendtoeffect { - callback {if (o->value()!=0) part->kit[n].Psendtoparteffect=(int)o->value()-1; - else part->kit[n].Psendtoparteffect=127;} open - xywh {615 0 45 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("OFF");char nrstr[10]; for(int i=0;iadd(nrstr);};} - code1 {o->value(part->kit[n].Psendtoparteffect+1);if (part->kit[n].Psendtoparteffect==127) o->value(0);} - } {} - Fl_Button padeditbutton { - label edit - callback {partui->showparameters(n,2);} - xywh {560 0 40 15} box THIN_UP_BOX labelsize 11 - code0 {if (part->kit[n].Ppadenabled==0) o->deactivate();} - code1 {if (n==0) o->hide();} - } - Fl_Check_Button padcheck { - callback {part->kit[n].Ppadenabled=(int)o->value(); -if (part->kit[n].Ppadenabled!=0) padeditbutton->activate(); - else padeditbutton->deactivate();} - private xywh {540 0 20 15} down_box DOWN_BOX labelfont 1 labelsize 11 align 4 - code0 {o->value(part->kit[n].Ppadenabled);} - code1 {if (n==0) o->hide();} - } - } - Fl_Check_Button enabledcheck { - label 01 - callback {int answer=1; -if (o->value()==0) answer=fl_choice("Delete the item?","No","Yes",NULL); -if (answer!=0){ -pthread_mutex_lock(&master->mutex); - part->setkititemstatus(n,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if (o->value()==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); -o->redraw(); -partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0 -} else o->value(1);} - private xywh {30 0 20 15} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 4 - code0 {snprintf(label,10,"%d",n+1);o->label(label);} - code1 {o->value(part->kit[n].Penabled);} - code2 {if (n==0) o->deactivate();} - } - } - } - Function {PartKitItem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0; -part=NULL;} {} - } - Function {refresh()} {} { - code {enabledcheck->value(part->kit[n].Penabled); -if (part->kit[n].Penabled==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); - -mutedcheck->value(part->kit[n].Pmuted); -labelbutton->label((char *)part->kit[n].Pname); -minkcounter->value(part->kit[n].Pminkey); -maxkcounter->value(part->kit[n].Pmaxkey); -adcheck->value(part->kit[n].Padenabled); -adcheck->do_callback(); -subcheck->value(part->kit[n].Psubenabled); -subcheck->do_callback(); - -sendtoeffect->value(part->kit[n].Psendtoparteffect+1); -if (part->kit[n].Psendtoparteffect==127) sendtoeffect->value(0); - -this->redraw();} { - callback {int answer=1; -if (o->value()==0) answer=fl_choice("Delete the item?","No","Yes",NULL); -if (answer!=0){ -pthread_mutex_lock(&master->mutex); - part->setkititemstatus(n,(int) o->value()); -pthread_mutex_unlock(&master->mutex); - -if (o->value()==0) partkititemgroup->deactivate(); -else partkititemgroup->activate(); -o->redraw(); -partui->showparameters(n,-1);//use to delete the ui, if it is not to item 0 -} else o->value(1);} - } - } - Function {init(Part *part_,int n_,Master *master_,class PartUI *partui_)} {} { - code {part=part_; -n=n_; -partui=partui_; -master=master_; -make_window(); -//partkititem->show(); -end();} {} - } - Function {~PartKitItem()} {} { - code {partkititem->hide(); -//delete(partkititem);} {} - } - decl {Part *part;} {} - decl {int n;} {} - decl {Master *master;} {} - decl {char label[10];} {} - decl {class PartUI *partui;} {} -} - -class PartUI {open : {public Fl_Group} -} { - Function {make_window()} {open private - } { - Fl_Window partgroup {open - private xywh {688 264 385 180} type Double box FLAT_BOX - class Fl_Group visible - } { - Fl_Group partgroupui {open - xywh {0 0 385 180} - code0 {if (part->Penabled==0) o->deactivate();} - } { - Fl_Dial {} { - label Pan - callback {part->setPpanning((int) o->value());} - xywh {50 40 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(part->Ppanning);} - class WidgetPDial - } - Fl_Counter {} { - label KeyShift - callback {part->Pkeyshift=(int) o->value()+64;} - xywh {195 45 90 20} labelsize 11 align 1 minimum -64 maximum 64 step 1 - code0 {o->lstep(12);} - code1 {o->value(part->Pkeyshift-64);} - } - Fl_Scroll {} {open - xywh {166 91 125 49} box UP_BOX labelfont 1 labelsize 10 align 21 - } { - Fl_Pack {} {open - xywh {171 96 115 35} type HORIZONTAL - code0 {o->spacing(5);} - code1 {for (int i=0;iinit(master,npart,i);}} - } {} - } - Fl_Button {} { - label {Grand Piano} - callback {int event=Fl::event_button(); -if (event==FL_RIGHT_MOUSE){ - const char *tmp=fl_input("Instrument name:",(const char *)part->Pname); - if (tmp!=NULL) snprintf((char *)part->Pname,PART_MAX_NAME_LEN,"%s",tmp); -} else { - if (event==FL_LEFT_MOUSE) bankui->show(); - else instrumenteditwindow->show(); -};} - tooltip {left mousebutton - to choose/save/.. from/to bank or right mousebutton to change the name or middle button to change the instrument information} xywh {195 5 185 20} box UP_FRAME down_box DOWN_FRAME labelfont 1 labelsize 11 align 84 - code0 {o->label((char *)part->Pname);} - } - Fl_Box {} { - label {To Sys.Efx.} - xywh {166 81 95 10} labelfont 1 labelsize 10 - } - Fl_Check_Button {} { - label NoteOn - callback {part->Pnoteon=(int) o->value();} - tooltip {set if the part receives NoteOn messages} xywh {10 155 65 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->Pnoteon);} - } - Fl_Counter minkcounter { - label {Min.k} - callback {part->Pminkey=(int) o->value(); -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Minimum key (that the part receives NoteOn messages)} xywh {295 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(part->Pminkey);} - } - Fl_Counter maxkcounter { - label {Max.k} - callback {part->Pmaxkey=(int) o->value(); - -if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); - else o->textcolor(FL_BLACK);} - tooltip {Maximum key (that the part receives NoteOn messages)} xywh {340 125 40 15} type Simple labelfont 1 labelsize 10 minimum 0 maximum 127 step 1 textsize 10 - code0 {o->value(part->Pmaxkey);} - } - Fl_Dial {} { - label Volume - callback {part->setPvolume((int) o->value());} - tooltip {Part Volume} xywh {10 35 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(part->Pvolume);} - class WidgetPDial - } - Fl_Dial {} { - label {Vel.Ofs.} - callback {part->Pveloffs=(int) o->value();} - tooltip {Velocity Offset} xywh {135 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(part->Pveloffs);} - class WidgetPDial - } - Fl_Dial {} { - label {Vel.Sns.} - callback {part->Pvelsns=(int) o->value();} - tooltip {Velocity Sensing Function} xywh {95 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(part->Pvelsns);} - class WidgetPDial - } - Fl_Button {} { - label Controllers - callback {ctlwindow->show();} - xywh {295 90 85 30} labelfont 1 labelsize 11 - } - Fl_Check_Button {} { - label Portamento - callback {part->ctl.portamento.portamento=(int) o->value();} - tooltip {Enable/Disable the portamento} xywh {95 155 88 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->ctl.portamento.portamento);} - } - Fl_Button {} { - label {Edit instrument} - callback {instrumenteditwindow->show();} - xywh {15 90 130 30} color 52 labelfont 1 labelsize 13 - } - Fl_Button {} { - label m - callback {if (part->lastnote>=0) minkcounter->value(part->lastnote); -minkcounter->do_callback(); -maxkcounter->do_callback();} - tooltip {set the minimum key to the last pressed key} xywh {315 155 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label M - callback {if (part->lastnote>=0) maxkcounter->value(part->lastnote); -maxkcounter->do_callback(); -minkcounter->do_callback();} - tooltip {set the maximum key to the last pressed key} xywh {345 155 15 12} box THIN_UP_BOX labelsize 10 - } - Fl_Button {} { - label R - callback {minkcounter->value(0); -minkcounter->do_callback(); -maxkcounter->value(127); -maxkcounter->do_callback();} - tooltip {reset the minimum key to 0 and maximum key to 127} xywh {330 155 15 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Choice {} { - label {MIDI Chn.Rcv.} - callback {part->Prcvchn=(int) o->value();} open - tooltip {receive from Midi channel} xywh {310 45 70 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drms10");};} - code1 {o->value(part->Prcvchn);} - } {} - Fl_Choice keylimitlist { - label KLmt - callback {int val=0; -val=atoi(o->text()); -part->setkeylimit(val);} open - tooltip {Key Limit} xywh {215 155 50 20} down_box BORDER_BOX labelsize 10 align 8 textfont 1 textsize 10 - } {} - Fl_Choice {} { - label {Mode :} - callback {if ((int) o->value()==0){ /* Poly (implies no legato) */ - part->Ppolymode=1; - part->Plegatomode=0; -} else { - if ((int) o->value()==1){ /* Mono (implies no legato) */ - part->Ppolymode=0; - part->Plegatomode=0; - } else { - if ((int) o->value()==2){ /* Legato (implies mono) */ - part->Ppolymode=0; - part->Plegatomode=1; - }; - }; -};} open - tooltip {Poly, Mono or Legato mode} xywh {80 130 64 18} down_box BORDER_BOX labelfont 1 labelsize 11 textfont 1 textsize 10 - code0 {o->add("Poly"); o->add("Mono"); o->add("Legato");} - code1 {if (part->Ppolymode!=0) o->value(0); else o->value(1);} - code2 {if (part->Ppolymode==0 && part->Plegatomode!=0) o->value(2);} - } {} - } - Fl_Check_Button {} { - label Enabled - callback {pthread_mutex_lock(&master->mutex); -master->partonoff(npart,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -if (part->Penabled==0) partgroupui->deactivate(); - else partgroupui->activate();} - xywh {90 5 75 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(part->Penabled);} - } - } - Fl_Window ctlwindow { - label Controllers open - private xywh {777 261 500 130} type Double box FLAT_BOX visible - } { - Fl_Check_Button {} { - label Expr - callback {part->ctl.expression.receive=(int) o->value();} - tooltip {Expression enable} xywh {155 55 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.expression.receive);} - } - Fl_Dial {} { - label PanDpth - callback {part->ctl.panning.depth=(int) o->value();} - tooltip {Panning Depth} xywh {10 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.panning.depth);} - class WidgetPDial - } - Fl_Dial {} { - label FltCut - callback {part->ctl.filtercutoff.depth=(int) o->value();} - tooltip {Filter Cutoff depth} xywh {90 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.filtercutoff.depth);} - class WidgetPDial - } - Fl_Dial {} { - label FltQ - callback {part->ctl.filterq.depth=(int) o->value();} - tooltip {Filter Q depth} xywh {50 55 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.filterq.depth);} - class WidgetPDial - } - Fl_Dial {} { - label BwDpth - callback {part->ctl.bandwidth.depth=(int) o->value();} - tooltip {BandWidth depth} xywh {125 10 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.bandwidth.depth);} - class WidgetPDial - } - Fl_Dial {} { - label ModWh - callback {part->ctl.modwheel.depth=(int) o->value();} - tooltip {Modulation Wheel depth} xywh {50 10 30 30} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.modwheel.depth);} - class WidgetPDial - } - Fl_Counter {} { - label {PWheelB.Rng (cents)} - callback {part->ctl.pitchwheel.bendrange=(int) o->value();} - tooltip {Pitch Wheel Bend Range (cents)} xywh {165 15 110 20} labelsize 10 align 1 minimum -6400 maximum 6400 step 1 - code0 {o->value(part->ctl.pitchwheel.bendrange);} - code1 {o->lstep(100);} - } - Fl_Check_Button {} { - label FMamp - callback {part->ctl.fmamp.receive=(int) o->value();} - tooltip {FM amplitude enable} xywh {205 55 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.fmamp.receive);} - } - Fl_Check_Button {} { - label Vol - callback {part->ctl.volume.receive=(int) o->value();} - tooltip {Volume enable} xywh {155 80 45 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.volume.receive);} - } - Fl_Check_Button {} { - label Sustain - callback {part->ctl.sustain.receive=(int) o->value(); -if (part->ctl.sustain.receive==0) { - part->RelaseSustainedKeys(); - part->ctl.setsustain(0); -};} - tooltip {Sustain pedal enable} xywh {205 80 60 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.sustain.receive);} - } - Fl_Button {} { - label Close - callback {ctlwindow->hide();} - xywh {400 107 95 20} box THIN_UP_BOX - } - Fl_Button {} { - label {Reset all controllers} - callback {part->SetController(C_resetallcontrollers,0);} - xywh {5 107 210 20} box THIN_UP_BOX - } - Fl_Group {} { - label Portamento - xywh {280 15 160 90} box UP_FRAME labelsize 10 - } { - Fl_Check_Button {} { - label Rcv - callback {part->ctl.portamento.receive=(int) o->value();} - tooltip {Receive Portamento Controllers} xywh {285 20 40 20} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(part->ctl.portamento.receive);} - } - Fl_Dial {} { - label time - callback {part->ctl.portamento.time=(int) o->value();} - tooltip {Portamento time} xywh {285 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.time);} - class WidgetPDial - } - Fl_Counter {} { - label thresh - callback {part->ctl.portamento.pitchthresh=(int) o->value();} - tooltip {Minimum or max. difference of the notes in order to do the portamento (x 100 cents)} xywh {340 20 50 20} type Simple labelsize 10 minimum 0 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.pitchthresh);} - } - Fl_Check_Button {} { - label {th.type} - callback {part->ctl.portamento.pitchthreshtype=(int) o->value();} - tooltip {Threshold type (min/max)} xywh {365 70 15 15} down_box DOWN_BOX labelsize 10 align 2 - code0 {o->value(part->ctl.portamento.pitchthreshtype);} - } - Fl_Box {} { - label {x100 cnt.} - xywh {340 50 55 15} labelsize 10 align 16 - } - Fl_Dial {} { - label {t.dn/up} - callback {int x=(int) o->value(); - -part->ctl.portamento.updowntimestretch=x;} - tooltip {Portamento time stretch (up/down)} xywh {315 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.updowntimestretch);} - class WidgetPDial - } - Fl_Dial propta { - label {Prp.Rate} - callback {part->ctl.portamento.propRate=(int) o->value();} - tooltip {Distance required to double change from nonpropotinal portamento time} xywh {405 20 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.propRate);} - class WidgetPDial - } - Fl_Dial proptb { - label {Prp.Dpth} - callback {part->ctl.portamento.propDepth=(int) o->value();} - tooltip {The difference from nonproportinal portamento} xywh {405 60 25 25} labelsize 9 maximum 127 step 1 - code0 {o->value(part->ctl.portamento.propDepth);} - class WidgetPDial - } - Fl_Check_Button {} { - label {Proprt.} - callback {part->ctl.portamento.proportional=(int) o->value(); -if(o->value()){propta->activate();proptb->activate();} -else {propta->deactivate();proptb->deactivate();}} - tooltip {Enable Proportinal Portamento (over fixed Portamento)} xywh {285 40 50 15} box THIN_UP_BOX down_box DOWN_BOX labelsize 9 - code0 {o->value(part->ctl.portamento.proportional);} - code1 {if(o->value()){propta->activate();proptb->activate();}} - code2 {else {propta->deactivate();proptb->deactivate();}} - } - } - Fl_Group {} { - label Resonance - xywh {445 15 50 90} box UP_FRAME labelsize 10 - } { - Fl_Dial {} { - label BWdpth - callback {part->ctl.resonancebandwidth.depth=(int) o->value();} - tooltip {BandWidth controller depth} xywh {455 60 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.resonancebandwidth.depth);} - class WidgetPDial - } - Fl_Dial {} { - label CFdpth - callback {part->ctl.resonancecenter.depth=(int) o->value();} - tooltip {Center Frequency controller Depth} xywh {455 20 25 25} labelsize 10 maximum 127 step 1 - code0 {o->value(part->ctl.resonancecenter.depth);} - class WidgetPDial - } - } - Fl_Check_Button {} { - label {Exp MWh} - callback {part->ctl.modwheel.exponential=(int) o->value();} - tooltip {Exponential modulation wheel} xywh {10 15 40 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(part->ctl.modwheel.exponential);} - } - Fl_Check_Button {} { - label {Exp BW} - callback {part->ctl.bandwidth.exponential=(int) o->value();} - tooltip {Exponential BandWidth Controller} xywh {85 15 35 25} down_box DOWN_BOX labelsize 10 align 148 - code0 {o->value(part->ctl.bandwidth.exponential);} - } - } - Fl_Window partfx { - label {Part's Insert Effects} selected - private xywh {554 660 390 145} type Double box FLAT_BOX visible - } { - Fl_Counter inseffnocounter { - label {FX No.} - callback {ninseff=(int) o->value()-1; -insefftype->value(part->partefx[ninseff]->geteffect()); -//insefftype->do_callback(); -inseffectui->refresh(part->partefx[ninseff]); -int x=part->Pefxroute[ninseff]; -if (x==127) x=1; -bypasseff->value(part->Pefxbypass[ninseff]); - -sendtochoice->value(x);} - xywh {5 110 80 20} type Simple labelfont 1 align 6 minimum 1 maximum 127 step 1 textfont 1 - code0 {o->bounds(1,NUM_PART_EFX);} - code1 {o->value(ninseff+1);} - } - Fl_Choice insefftype { - label EffType - callback {pthread_mutex_lock(part->mutex); -part->partefx[ninseff]->changeeffect((int) o->value()); -pthread_mutex_unlock(part->mutex); -inseffectui->refresh(part->partefx[ninseff]);} - xywh {155 110 70 15} down_box BORDER_BOX labelsize 10 align 6 - code0 {o->value(part->partefx[ninseff]->geteffect());} - } { - MenuItem {} { - label {No Effect} - xywh {35 35 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Reverb - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Echo - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Chorus - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Phaser - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label AlienWah - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label Distortion - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label EQ - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label DynFilter - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Group inseffectuigroup { - xywh {5 5 380 100} box FLAT_BOX color 48 - } { - Fl_Group inseffectui { - xywh {5 5 380 95} - code0 {o->init(part->partefx[ninseff]);} - class EffUI - } {} - } - Fl_Button {} { - label Close - callback {partfx->hide();} - xywh {325 115 60 20} box THIN_UP_BOX - } - Fl_Choice sendtochoice { - label {Send To.} - callback {int x=(int) o->value(); -part->Pefxroute[ninseff]=x; -if (x==2) part->partefx[ninseff]->setdryonly(true); - else part->partefx[ninseff]->setdryonly(false);} - xywh {235 110 80 15} down_box BORDER_BOX labelsize 10 align 6 - code0 {int x=part->Pefxroute[ninseff]; if (x==127) x=1;} - code1 {o->value(x);} - } { - MenuItem {} { - label {Next Effect} - xywh {45 45 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Part Out} - xywh {55 55 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {Dry Out} - xywh {65 65 100 20} labelfont 1 labelsize 10 - } - } - Fl_Check_Button bypasseff { - label bypass - callback {part->Pefxbypass[ninseff]=(((int)o->value())!=0);} - tooltip {if the effect is not used (is bypassed)} xywh {90 110 60 15} down_box DOWN_BOX labelsize 11 - code0 {int x=part->Pefxbypass[ninseff];o->value(x);} - } - Fl_Button {} { - label C - callback {presetsui->copy(part->partefx[ninseff]);} - xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {pthread_mutex_lock(&master->mutex); -presetsui->paste(part->partefx[ninseff],inseffectui); -pthread_mutex_unlock(&master->mutex);} - xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - } - Fl_Window instrumentkitlist { - label {Instrument Kit} open - xywh {586 566 670 370} type Double box FLAT_BOX visible - } { - Fl_Button {} { - label {Close Window} - callback {instrumentkitlist->hide();} - xywh {375 350 160 20} box THIN_UP_BOX - } - Fl_Scroll kitlist {open - xywh {0 15 670 330} type VERTICAL box UP_FRAME - code0 {if (part->Pkitmode==0) o->deactivate();} - } { - Fl_Pack {} { - xywh {0 20 670 320} - code0 {for (int i=0;iinit(part,i,master,this);}} - } {} - } - Fl_Box {} { - label {No.} - xywh {5 0 25 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {M.} - xywh {55 0 25 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {Min.k} - xywh {235 0 40 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label {Max.k} - xywh {345 0 40 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label ADsynth - xywh {405 0 50 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label SUBsynth - xywh {470 0 60 15} labelfont 1 labelsize 11 align 18 - } - Fl_Choice {} { - label Mode - callback {part->Pkitmode=(int) o->value(); -if (part->Pkitmode==0) { - kitlist->deactivate(); - } else { - kitlist->activate(); -};} - xywh {35 350 70 15} down_box BORDER_BOX labelsize 11 textfont 1 textsize 11 - code0 {o->value(part->Pkitmode);} - } { - MenuItem {} { - label OFF - xywh {0 0 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label MULTI - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label SINGLE - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - } - Fl_Check_Button {} { - label {Drum mode} - callback {part->Pdrummode=(int) o->value();} - xywh {285 350 70 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(part->Pdrummode);} - } - Fl_Box {} { - label {FX.r.} - xywh {620 0 30 15} labelfont 1 labelsize 11 align 18 - } - Fl_Box {} { - label PADsynth - xywh {540 0 60 15} labelfont 1 labelsize 11 align 18 - } - } - Fl_Window instrumenteditwindow { - label {Instrument Edit} open - xywh {247 621 395 360} type Double box FLAT_BOX visible - } { - Fl_Group {} { - xywh {0 220 395 110} box UP_FRAME - } { - Fl_Group {} { - label PADsynth - xywh {205 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Button padeditbutton { - label Edit - callback {showparameters(0,2);} - xywh {215 280 80 35} color 51 selection_color 51 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Ppadenabled==0) o->deactivate();} - } - Fl_Check_Button padsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Ppadenabled=x; -if (x==0) padeditbutton->deactivate(); - else padeditbutton->activate();} - tooltip {enable/disable PADsynth} xywh {215 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Ppadenabled);} - } - } - Fl_Group {} { - label ADsynth - xywh {5 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Check_Button adsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Padenabled=x; -if (x==0) adeditbutton->deactivate(); - else adeditbutton->activate();} - tooltip {enable/disable ADsynth} xywh {15 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Padenabled);} - } - Fl_Button adeditbutton { - label Edit - callback {showparameters(0,0);} - xywh {15 281 80 34} color 51 selection_color 51 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Padenabled==0) o->deactivate();} - } - } - Fl_Group {} { - label SUBsynth - xywh {105 245 100 80} box ENGRAVED_FRAME labelfont 1 - } { - Fl_Check_Button subsynenabledcheck { - label Enabled - callback {int x=(int) o->value(); -part->kit[0].Psubenabled=x; -if (x==0) subeditbutton->deactivate(); - else subeditbutton->activate();} - tooltip {enable/disable SUBsynth} xywh {115 255 80 20} box UP_BOX down_box DOWN_BOX color 51 selection_color 0 labelfont 1 labelsize 11 - code1 {o->value(part->kit[0].Psubenabled);} - } - Fl_Button subeditbutton { - label Edit - callback {showparameters(0,1);} - xywh {115 280 80 35} color 51 selection_color 51 labelfont 1 labelsize 13 align 128 - code0 {if (part->kit[0].Psubenabled==0) o->deactivate();} - } - } - Fl_Button {} { - label {Kit Edit} - callback {instrumentkitlist->show();} - xywh {310 245 80 35} color 51 selection_color 51 labelfont 1 align 128 - } - Fl_Button {} { - label Effects - callback {partfx->show();} - xywh {310 290 80 35} color 51 selection_color 51 labelfont 1 labelsize 13 - } - } - Fl_Group {} { - xywh {0 5 395 215} box UP_FRAME - } { - Fl_Input {} { - label {Author and Copyright} - callback {snprintf((char *)part->info.Pauthor,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 60 385 50} type Multiline color 124 labelsize 10 align 5 - code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} - code1 {o->value((char *) &part->info.Pauthor);} - } - Fl_Input {} { - label Comments - callback {snprintf((char *)part->info.Pcomments,MAX_INFO_TEXT_SIZE,"%s",o->value());} - xywh {5 125 385 90} type Multiline color 124 labelsize 11 align 5 - code0 {o->maximum_size(MAX_INFO_TEXT_SIZE);} - code1 {o->value((char *) &part->info.Pcomments);} - } - Fl_Choice {} { - label {Type:} - callback {part->info.Ptype=o->value();} - xywh {5 25 155 20} down_box BORDER_BOX labelfont 1 labelsize 11 align 5 textsize 10 - code0 {o->value(part->info.Ptype);} - } { - MenuItem {} { - label {--------------------------} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Piano - xywh {10 10 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Chromatic Percussion} - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Organ - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Guitar - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Bass - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Solo Strings} - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Ensemble - xywh {70 70 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Brass - xywh {80 80 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Reed - xywh {90 90 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Pipe - xywh {100 100 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Lead} - xywh {110 110 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Pad} - xywh {120 120 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Synth Effects} - xywh {130 130 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Ethnic - xywh {140 140 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Percussive - xywh {150 150 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Sound Effects} - xywh {160 160 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Button {} { - label Close - callback {instrumenteditwindow->hide();} - xywh {150 335 95 25} box THIN_UP_BOX - } - } - } - Function {PartUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {part=NULL; -adnoteui=NULL; -subnoteui=NULL; -padnoteui=NULL; -lastkititem=-1;} {} - } - Function {init(Part *part_,Master *master_,int npart_,BankUI *bankui_)} {} { - code {bankui=bankui_; -part=part_; -npart=npart_; -master=master_; -ninseff=0; - -make_window(); -\#ifdef NTK_GUI -adsynenabledcheck->selection_color(55); -subsynenabledcheck->selection_color(55); -padsynenabledcheck->selection_color(55); -\#endif -partgroup->position(this->parent()->x()+2,this->parent()->y()+2); -partgroup->show(); -end(); - - -//if (config.ui.showinstrumentinfo!=0) instrumenteditwindow->show(); - -int klimits[]={1,2,3,4,5,6,7,8,9,10,15,20,30,50,100,0}; - -keylimitlist->add("OFF"); -int k=0; -int val=-1; -char tmp[10]; -while (klimits[k]!=0){ - sprintf(tmp,"%d",klimits[k]); - keylimitlist->add(tmp); - if (val==-1){ - if (klimits[k]>part->Pkeylimit) val=k; - }; - k++; -}; - -if (val==-1) val=k; -keylimitlist->value(val);} {} - } - Function {showparameters(int kititem,int engine)} {} { - code {if (engine==-1){//this is used if I want to clear the engine from the part - if (kititem==lastkititem) kititem=-1; - else kititem=lastkititem; -}; - -if (kititem!=lastkititem){ - if (adnoteui!=NULL) delete (adnoteui); - if (subnoteui!=NULL) delete (subnoteui); - if (padnoteui!=NULL) delete (padnoteui); - adnoteui=NULL;subnoteui=NULL;padnoteui=NULL; - lastkititem=kititem; - - if (kititem>=NUM_KIT_ITEMS) return;//bad kit item - if (kititem<0) return; - - if (part->kit[kititem].adpars!=NULL) - adnoteui=new ADnoteUI(part->kit[kititem].adpars,master); - - if (part->kit[kititem].subpars!=NULL) - subnoteui=new SUBnoteUI(part->kit[kititem].subpars); - - if (part->kit[kititem].padpars!=NULL) - padnoteui=new PADnoteUI(part->kit[kititem].padpars,master); - -}; - - - -if ((engine==0)&&(adnoteui!=NULL)) adnoteui->ADnoteGlobalParameters->show(); -if ((engine==1)&&(subnoteui!=NULL)) subnoteui->SUBparameters->show(); -if ((engine==2)&&(adnoteui!=NULL)) padnoteui->padnotewindow->show();} {} - } - Function {~PartUI()} {} { - code {if (adnoteui!=NULL) delete (adnoteui); -if (subnoteui!=NULL) delete (subnoteui); -if (padnoteui!=NULL) delete (padnoteui); - -partgroup->hide(); -//delete(partgroup); - -ctlwindow->hide(); -delete(ctlwindow); - -partfx->hide(); -delete(partfx); - -instrumentkitlist->hide(); -delete(instrumentkitlist); - -instrumenteditwindow->hide(); -delete(instrumenteditwindow);} {} - } - decl {Part *part;} {} - decl {Master *master;} {} - decl {BankUI *bankui;} {} - decl {ADnoteUI *adnoteui;} {} - decl {SUBnoteUI *subnoteui;} {} - decl {PADnoteUI *padnoteui;} {} - decl {PartSysEffSend *psyef[NUM_SYS_EFX];} {} - decl {int npart;} {} - decl {int ninseff;} {} - decl {int lastkititem;} {} - decl {PartKitItem *partkititem[NUM_KIT_ITEMS];} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PresetsUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/PresetsUI.fl deleted file mode 100644 index 5eafc4723be..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/PresetsUI.fl +++ /dev/null @@ -1,278 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {\#include } {selected public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../Params/PresetsArray.h"} {} - -decl {\#include "../Params/Presets.h"} {public -} - -class PresetsUI_ {} { - Function {refresh()} {open return_type {virtual void} - } { - code {;} {} - } - Function {~PresetsUI_()} {open return_type virtual - } { - code {;} {} - } -} - -class PresetsUI {} { - Function {PresetsUI()} {} { - code {p=NULL; -make_window();} {} - } - Function {~PresetsUI()} {} { - code {copywin->hide();delete(copywin); -pastewin->hide();delete(pastewin);} {} - } - Function {make_window()} {} { - Fl_Window copywin { - label {Copy to Clipboard/Preset} - xywh {190 173 265 430} type Double box THIN_UP_BOX color 238 hide modal - } { - Fl_Browser copybrowse { - callback {int val=o->value(); -if (val!=0){ - presetname->cut(0,presetname->maximum_size()); - presetname->insert(o->text(val)); -};} - xywh {10 25 245 320} type Select - } - Fl_Button copypbutton { - label {Copy to Preset} - callback {const char *tmp=presetname->value(); -if (tmp!=NULL) { - if (strlen(tmp)>0){ - p->copy(tmp); - copywin->hide(); - }; -};} - xywh {145 355 110 20} box THIN_UP_BOX - } - Fl_Button copybutton { - label {Copy to Clipboard} - callback {p->copy(NULL); -copywin->hide();} - xywh {25 385 90 35} box THIN_UP_BOX align 192 - } - Fl_Button {} { - label Cancel - callback {copywin->hide();} - xywh {160 385 80 35} box THIN_UP_BOX align 192 - } - Fl_Box {} { - label {Type:} - xywh {10 5 40 15} labelsize 11 align 20 - } - Fl_Box copytypetext { - xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20 - } - Fl_Input presetname { - callback {const char *tmp=o->value(); -if (tmp==NULL) tmp=""; -if (strlen(tmp)>0) { - copybutton->deactivate(); - copypbutton->activate(); -} else { - copybutton->activate(); - copypbutton->deactivate(); -};} - xywh {10 355 130 20} when 1 - } - } - Fl_Window pastewin { - label {Paste from Clipboard/Preset} - xywh {463 173 265 430} type Double box THIN_UP_BOX color 238 hide modal - } { - Fl_Browser pastebrowse { - callback {if (o->value()==0) { - pastepbutton->deactivate(); - deletepbutton->deactivate(); -}else{ - pastepbutton->activate(); - deletepbutton->activate(); -};} - xywh {10 25 245 320} type Hold - } - Fl_Button pastepbutton { - label {Paste from Preset} - callback {int n=pastebrowse->value(); -if (n!=0) p->paste(n); -pastewin->hide(); -pui->refresh();} - xywh {10 355 160 20} box THIN_UP_BOX - } - Fl_Button pastebutton { - label {Paste from Clipboard} - callback {p->paste(0); -pastewin->hide(); -pui->refresh();} - xywh {25 385 90 35} box THIN_UP_BOX align 192 - } - Fl_Button {} { - label Cancel - callback {pastewin->hide();} - xywh {160 385 80 35} box THIN_UP_BOX align 192 - } - Fl_Box pastetypetext { - xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 11 align 20 - } - Fl_Box {} { - label {Type:} - xywh {15 5 40 15} labelsize 11 align 20 - } - Fl_Button deletepbutton { - label Delete - callback {int n=pastebrowse->value(); - -if (this->p_is_PresetArray) { - PresetsArray *pre = dynamic_cast(p); - if (n!=0) pre->deletepreset(n); - rescanArray(); -} else { - if (n!=0) p->deletepreset(n); - rescan(); -}} selected - xywh {180 355 75 20} box THIN_UP_BOX - } - } - } - Function {copy(Presets *p)} {} { - code {copybutton->activate(); -copypbutton->deactivate(); - - -this->p=p; -this->pui=NULL; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -presetname->cut(0,presetname->maximum_size()); - -if (but) p->copy(NULL); - else { - rescan(); - copytypetext->label(&p->type[1]); - copywin->show(); - };} {} - } - Function {paste(Presets *p,PresetsUI_ *pui)} {} { - code {this->p=p; -this->pui=pui; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -pastepbutton->deactivate(); -deletepbutton->deactivate(); - -if (but) { - p->paste(0); - pui->refresh(); -} else { - rescan(); - pastetypetext->label(&p->type[1]); - if (p->checkclipboardtype()) pastebutton->activate(); - else pastebutton->deactivate(); - this->p_is_PresetArray = false; - pastewin->show(); - };} {} - } - Function {copy(Presets *p,int n)} {} { - code {PresetsArray *pre = dynamic_cast(p); -if(pre) - pre->setelement(n); -copyArray(p);} {} - } - Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} { - code {PresetsArray *pre = dynamic_cast(p); -if(pre) - pre->setelement(n); -pasteArray(p,pui);} {} - } - Function {rescan()} {} { - code {copybrowse->clear(); -pastebrowse->clear(); -p->rescanforpresets(); - -for (unsigned int i=0;iadd(name.c_str()); - pastebrowse->add(name.c_str()); -};} {} - } - decl {Presets *p;} {public local - } - decl {PresetsUI_ *pui;} {public local - } - Function {copyArray(Presets *p)} {open - } { - code {PresetsArray *pre = dynamic_cast(p); - -copybutton->activate(); -copypbutton->deactivate(); - -this->p=p; -this->pui=NULL; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -presetname->cut(0,presetname->maximum_size()); - -if (but) pre->copy(NULL); - else { - rescanArray(); - copytypetext->label(&pre->type[1]); - copywin->show(); - };} {} - } - Function {pasteArray(Presets *p,PresetsUI_ *pui)} {open - } { - code {PresetsArray *pre = dynamic_cast(p); - -this->p=p; -this->pui=pui; -bool but=(Fl::event_button()!=FL_LEFT_MOUSE); -pastepbutton->deactivate(); -deletepbutton->deactivate(); - -if (but) { - pre->paste(0); - pui->refresh(); -} else { - rescanArray(); - pastetypetext->label(&pre->type[1]); - if (pre->checkclipboardtype()) pastebutton->activate(); - else pastebutton->deactivate(); - this->p_is_PresetArray = true; - pastewin->show(); - };} {} - } - Function {rescanArray()} {open - } { - code {PresetsArray *pre = dynamic_cast(p); - -copybrowse->clear(); -pastebrowse->clear(); -pre->rescanforpresets(); - -for (unsigned int i=0;iadd(name.c_str()); - pastebrowse->add(name.c_str()); -};} {} - } - decl {bool p_is_PresetArray;} {public - } -} - -decl {PresetsUI *presetsui;} {public -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ResonanceUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/ResonanceUI.fl deleted file mode 100644 index f1b887cd55d..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/ResonanceUI.fl +++ /dev/null @@ -1,398 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include } {} - -decl {\#include "../Synth/Resonance.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class ResonanceGraph {open : {public Fl_Box} -} { - Function {ResonanceGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {respar=NULL; -cbwidget=NULL; -applybutton=NULL;} {} - } - Function {init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_)} {} { - code {respar=respar_; -khzvalue=khzvalue_; -dbvalue=dbvalue_; -oldx=-1; -khzval=-1;} {} - } - Function {draw_freq_line(float freq,int type)} {open - } { - code {float freqx=respar->getfreqpos(freq); -switch(type){ - case 0:fl_line_style(FL_SOLID);break; - case 1:fl_line_style(FL_DOT);break; - case 2:fl_line_style(FL_DASH);break; -}; - - -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(x()+(int) (freqx*w()),y(), - x()+(int) (freqx*w()),y()+h());} {} - } - Function {draw()} {open - } { - code {int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; -float freqx; - -fl_color(FL_DARK1); -fl_rectf(ox,oy,lx,ly); - - -//draw the lines -fl_color(FL_GRAY); - -fl_line_style(FL_SOLID); -fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); - -freqx=respar->getfreqpos(1000.0); -if ((freqx>0.0)&&(freqx<1.0)) - fl_line(ox+(int) (freqx*lx),oy, - ox+(int) (freqx*lx),oy+ly); - -for (i=1;i<10;i++){ - if(i==1){ - draw_freq_line(i*100.0,0); - draw_freq_line(i*1000.0,0); - }else - if (i==5){ - draw_freq_line(i*100.0,2); - draw_freq_line(i*1000.0,2); - }else{ - draw_freq_line(i*100.0,1); - draw_freq_line(i*1000.0,1); - }; -}; - -draw_freq_line(10000.0,0); -draw_freq_line(20000.0,1); - -fl_line_style(FL_DOT); -int GY=10;if (lyPrespoints[0]/128.0*ly); -for (i=1;iPrespoints[i]/128.0*ly); - fl_vertex(ox+ix,oy+ly-oiy); - oiy=iy; -}; -fl_end_line(); -fl_line_style(FL_SOLID,0);} {selected - } - } - Function {handle(int event)} {return_type int - } { - code {int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); -if ( (x_>=0)&&(x_=0)&&(y_value(respar->getfreqx(x_*1.0/w())/1000.0); - dbvalue->value((1.0-y_*2.0/h())*respar->PmaxdB); -}; - -if ((event==FL_PUSH)||(event==FL_DRAG)){ - int leftbutton=1; - if (Fl::event_button()==FL_RIGHT_MOUSE) leftbutton=0; - if (x_<0) x_=0;if (y_<0) y_=0; - if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; - - if ((oldx<0)||(oldx==x_)){ - int sn=(int)(x_*1.0/w()*N_RES_POINTS); - int sp=127-(int)(y_*1.0/h()*127); - if (leftbutton!=0) respar->setpoint(sn,sp); - else respar->setpoint(sn,64); - } else { - int x1=oldx; - int x2=x_; - int y1=oldy; - int y2=y_; - if (oldx>x_){ - x1=x_;y1=y_; - x2=oldx;y2=oldy; - }; - for (int i=0;isetpoint(sn,sp); - else respar->setpoint(sn,64); - }; - }; - - oldx=x_;oldy=y_; - redraw(); -}; - -if (event==FL_RELEASE) { - oldx=-1; - if (cbwidget!=NULL) { - cbwidget->do_callback(); - if (applybutton!=NULL) { - applybutton->color(FL_RED); - applybutton->redraw(); - - }; - }; -}; - -return(1);} {} - } - Function {setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton)} {} { - code {this->cbwidget=cbwidget; -this->applybutton=applybutton;} {} - } - decl {Fl_Value_Output *khzvalue;} {} - decl {Fl_Value_Output *dbvalue;} {} - decl {Resonance *respar;} {} - decl {int oldx,oldy;} {} - decl {float khzval;} {public - } - decl {Fl_Widget *cbwidget,*applybutton;} {} -} - -class ResonanceUI {open : PresetsUI_ -} { - Function {make_window()} {open - } { - Fl_Window resonancewindow { - label Resonance open - xywh {120 70 780 305} type Double hide - } { - Fl_Value_Output khzvalue { - label kHz - xywh {415 264 45 18} labelsize 12 align 8 minimum 0.001 maximum 48 step 0.01 textfont 1 textsize 12 - code0 {//this widget must be before the calling widgets} - } - Fl_Value_Output dbvalue { - label dB - xywh {415 282 45 18} labelsize 12 align 8 minimum -150 maximum 150 step 0.1 textfont 1 textsize 12 - code0 {//this widget must be before the calling widgets} - } - Fl_Group {} { - xywh {6 5 768 256} box BORDER_BOX - code0 {rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),"");} - code1 {rg->init(respar,khzvalue,dbvalue);} - code2 {rg->show();} - } {} - Fl_Button {} { - label Close - callback {resonancewindow->hide();} - xywh {690 283 84 17} box THIN_UP_BOX - } - Fl_Button {} { - label Zero - callback {for (int i=0;isetpoint(i,64); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Clear the resonance function} xywh {491 264 66 15} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Button {} { - label Smooth - callback {respar->smooth(); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Smooth the resonance function} xywh {491 282 66 18} box THIN_UP_BOX labelfont 1 labelsize 12 - } - Fl_Check_Button enabled { - label Enable - callback {respar->Penabled=(int) o->value(); -redrawPADnoteApply();} - xywh {6 270 78 27} box THIN_UP_BOX down_box DOWN_BOX - code0 {o->value(respar->Penabled);} - } - Fl_Roller maxdb { - callback {maxdbvo->value(o->value()); -respar->PmaxdB=(int) o->value(); -redrawPADnoteApply();} - xywh {90 282 84 15} type Horizontal minimum 1 maximum 90 step 1 value 30 - } - Fl_Value_Output maxdbvo { - label {Max.} - callback {o->value(respar->PmaxdB);} - tooltip {The Maximum amplitude (dB)} xywh {126 264 24 18} labelsize 12 minimum 1 maximum 127 step 1 value 30 textfont 1 textsize 12 - code0 {o->value(respar->PmaxdB);} - } - Fl_Box {} { - label dB - xywh {150 264 24 18} - } - Fl_Value_Output centerfreqvo { - label {C.f.} - callback {o->value(respar->getcenterfreq()/1000.0);} - tooltip {Center Frequency (kHz)} xywh {210 264 33 18} labelsize 12 when 3 minimum 1 maximum 10 step 0.01 value 1 textfont 1 textsize 12 - code0 {o->value(respar->getcenterfreq()/1000.0);} - } - Fl_Value_Output octavesfreqvo { - label {Oct.} - callback {o->value(respar->getoctavesfreq());} - tooltip {No. of octaves} xywh {210 282 33 18} labelsize 12 when 3 minimum 1 maximum 127 step 1 value 30 textfont 1 textsize 12 - code0 {o->value(respar->getoctavesfreq());} - } - Fl_Button {} { - label RND2 - callback {respar->randomize(1); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 276 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label RND1 - callback {respar->randomize(0); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 264 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Button {} { - label RND3 - callback {respar->randomize(2); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {566 288 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Check_Button p1st { - label {P.1st} - callback {respar->Pprotectthefundamental=(int) o->value(); -redrawPADnoteApply();} - tooltip {Protect the fundamental frequency (do not damp the first harmonic)} xywh {365 285 45 15} down_box DOWN_BOX labelsize 10 - code0 {o->value(respar->Pprotectthefundamental);} - } - Fl_Button {} { - label InterpP - callback {int type; -if (Fl::event_button()==FL_LEFT_MOUSE) type=0; - else type=1; -respar->interpolatepeaks(type); -resonancewindow->redraw(); -redrawPADnoteApply();} - tooltip {Interpolate the peaks} xywh {365 265 46 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } - Fl_Dial centerfreq { - label {C.f.} - callback {respar->Pcenterfreq=(int)o->value(); -centerfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply();} - xywh {245 265 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(respar->Pcenterfreq);} - class WidgetPDial - } - Fl_Dial octavesfreq { - label {Oct.} - callback {respar->Poctavesfreq=(int)o->value(); -octavesfreqvo->do_callback(); -rg->redraw(); -redrawPADnoteApply();} - xywh {280 265 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(respar->Poctavesfreq);} - class WidgetPDial - } - Fl_Button {} { - label C - callback {presetsui->copy(respar);} - xywh {625 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(respar,this);} - xywh {655 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button applybutton { - label Apply - callback {applybutton->color(FL_GRAY); -applybutton->redraw(); -if (cbapplywidget!=NULL) { - cbapplywidget->do_callback(); - cbapplywidget->color(FL_GRAY); - cbapplywidget->redraw(); -};} - xywh {690 265 85 15} box THIN_UP_BOX labelfont 1 labelsize 11 - } - } - } - Function {ResonanceUI(Resonance *respar_)} {} { - code {respar=respar_; -cbwidget=NULL; -cbapplywidget=NULL; -make_window(); -applybutton->hide();} {} - } - Function {~ResonanceUI()} {} { - code {resonancewindow->hide();} {} - } - Function {redrawPADnoteApply()} {} { - code {if (cbwidget!=NULL) { - cbwidget->do_callback(); - applybutton->color(FL_RED); - applybutton->redraw(); -};} {} - } - Function {setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget)} {} { - code {this->cbwidget=cbwidget; -this->cbapplywidget=cbapplywidget; -rg->setcbwidget(cbwidget,applybutton); -applybutton->show();} {} - } - Function {refresh()} {} { - code {redrawPADnoteApply(); - -enabled->value(respar->Penabled); - -maxdb->value(respar->PmaxdB); -maxdbvo->value(respar->PmaxdB); - -centerfreqvo->value(respar->getcenterfreq()/1000.0); -octavesfreqvo->value(respar->getoctavesfreq()); - -centerfreq->value(respar->Pcenterfreq); -octavesfreq->value(respar->Poctavesfreq); - -p1st->value(respar->Pprotectthefundamental); - -rg->redraw();} {} - } - decl {Resonance *respar;} {public - } - decl {ResonanceGraph *rg;} {} - decl {Fl_Widget *cbwidget,*cbapplywidget;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/SUBnoteUI.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/SUBnoteUI.fl deleted file mode 100644 index f77beef6cb0..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/SUBnoteUI.fl +++ /dev/null @@ -1,524 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "EnvelopeUI.h"} {public -} - -decl {\#include "FilterUI.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "../Params/SUBnoteParameters.h"} {public -} - -decl {\#include "PresetsUI.h"} {public -} - -class SUBnoteharmonic {: {public Fl_Group} -} { - Function {make_window()} {private - } { - Fl_Window harmonic { - xywh {1257 22 90 305} type Double hide - class Fl_Group - } { - Fl_Slider mag { - callback {int x=0; -if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); - else o->value(127-x); -pars->Phmag[n]=x; -if (pars->Phmag[n]==0) o->selection_color(0); - else o->selection_color(222);} - tooltip {harmonic's magnitude} xywh {0 15 10 135} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127 - code0 {o->value(127-pars->Phmag[n]);} - code1 {if (pars->Phmag[n]==0) o->selection_color(0);} - } - Fl_Slider bw { - callback {int x=64; -if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value(); - else o->value(x); -pars->Phrelbw[n]=x;} - tooltip {harmonic's bandwidth} xywh {0 157 10 130} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64 - code0 {o->value(127-pars->Phrelbw[n]);} - } - Fl_Box {} { - xywh {10 219 5 5} box FLAT_BOX color 45 - code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();} - } - Fl_Box {} { - label 01 - xywh {0 288 10 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - Fl_Box {} { - label 01 - xywh {0 0 10 15} labelfont 1 labelsize 9 align 20 - code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));} - } - } - } - Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { - code {n=0;} {} - } - Function {init(SUBnoteParameters *pars_,int n_)} {} { - code {pars=pars_; -n=n_; -make_window(); -harmonic->show(); -end();} {} - } - Function {refresh()} {} { - code {mag->value(127-pars->Phmag[n]); -if (pars->Phmag[n]==0) mag->selection_color(0); -bw->value(127-pars->Phrelbw[n]);} {} - } - Function {~SUBnoteharmonic()} {} { - code {harmonic->hide(); -hide(); -//delete(harmonic);} {} - } - decl {SUBnoteParameters *pars;} {} - decl {int n;} {} -} - -class SUBnoteUI {open : {public PresetsUI_} -} { - Function {make_window()} {open - } { - Fl_Window SUBparameters { - label {SUBsynth Parameters} open - xywh {213 147 735 470} type Double visible - } { - Fl_Scroll {} { - label scroll open - xywh {5 140 434 325} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL - } { - Fl_Pack harmonics { - xywh {5 145 430 325} type HORIZONTAL - code0 {for (int i=0;ih(),"");h[i]->init(pars,i);}} - } {} - } - Fl_Button {} { - label Close - callback {SUBparameters->hide();} - xywh {625 446 105 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group {} { - label AMPLITUDE open - xywh {5 5 215 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Value_Slider vol { - label Vol - callback {pars->PVolume=(int)o->value();} - tooltip Volume xywh {10 25 140 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PVolume);} - } - Fl_Value_Slider vsns { - label {V.Sns} - callback {pars->PAmpVelocityScaleFunction=(int) o->value();} - tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box FLAT_BOX labelsize 11 align 8 maximum 127 step 1 - code0 {o->value(pars->PAmpVelocityScaleFunction);} - } - Fl_Dial pan { - label Pan - callback {pars->PPanning=(int) o->value();} - tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->PPanning);} - class WidgetPDial - } - Fl_Group ampenv { - label {SUBsynth - Amplitude Envelope} open - xywh {10 65 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->AmpEnvelope);} - class EnvelopeUI - } {} - } - Fl_Group {} { - xywh {495 406 235 35} box UP_FRAME - } { - Fl_Counter filterstages { - label {Filter Stages} - callback {pars->Pnumstages=(int) o->value();} - tooltip {How many times the noise is filtered} xywh {515 421 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10 - code0 {o->value(pars->Pnumstages);} - } - Fl_Choice magtype { - label {Mag.Type} - callback {pars->Phmagtype=(int) o->value();} - xywh {585 421 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 - code0 {o->value(pars->Phmagtype);} - } { - MenuItem {} { - label Linear - xywh {20 20 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-40dB} - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-60dB} - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-80dB} - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {-100dB} - xywh {60 60 100 20} labelfont 1 labelsize 11 - } - } - Fl_Choice start { - label Start - callback {pars->Pstart=(int) o->value();} open - xywh {670 421 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11 - code0 {o->value(pars->Pstart);} - } { - MenuItem {} { - label Zero - xywh {30 30 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label RND - xywh {40 40 100 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label {Max.} - xywh {50 50 100 20} labelfont 1 labelsize 11 - } - } - } - Fl_Group freqsettingsui { - label FREQUENCY open - xywh {440 5 295 146} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Group freqenvelopegroup { - label {SUBsynth - Frequency Envelope} open - xywh {445 75 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->FreqEnvelope);} - code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button freqee { - label Enabled - callback {pars->PFreqEnvelopeEnabled=o->value(); -if (o->value()==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); -o->show(); -freqsettingsui->redraw();} - xywh {445 77 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->PFreqEnvelopeEnabled);} - } - Fl_Counter octave { - label Octave - callback {int k=(int) o->value(); -if (k<0) k+=16; -pars->PCoarseDetune = k*1024+ - pars->PCoarseDetune%1024;} - tooltip Octave xywh {670 58 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;} - code2 {o->value(k);} - } - Fl_Counter coarsedet { - label {Coarse Det.} - callback {int k=(int) o->value(); -if (k<0) k+=1024; -pars->PCoarseDetune = k+ - (pars->PCoarseDetune/1024)*1024;} - tooltip {Coarse Detune} xywh {655 125 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 - code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;} - code2 {o->value(k);} - code3 {o->lstep(10);} - } - Fl_Slider detune { - callback {pars->PDetune=(int)o->value()+8192; -detunevalueoutput->do_callback();} - tooltip {Fine Detune (cents)} xywh {495 27 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 - code0 {o->value(pars->PDetune-8192);} - } - Fl_Value_Output detunevalueoutput { - label Detune - callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - xywh {448 27 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 - code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));} - } - Fl_Check_Button hz440 { - label 440Hz - callback {int x=(int) o->value(); -pars->Pfixedfreq=x; -if (x==0) fixedfreqetdial->deactivate(); - else fixedfreqetdial->activate();} - tooltip {set the base frequency to 440Hz} xywh {555 53 50 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->Pfixedfreq);} - } - Fl_Dial fixedfreqetdial { - label {Eq.T.} - callback {pars->PfixedfreqET=(int) o->value();} - tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 - code0 {o->value(pars->PfixedfreqET);} - code1 {if (pars->Pfixedfreq==0) o->deactivate();} - class WidgetPDial - } - Fl_Choice detunetype { - label {Detune Type} - callback {pars->PDetuneType=(int) o->value()+1; -detunevalueoutput->do_callback();} open - xywh {655 94 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} - code1 {o->value(pars->PDetuneType-1);} - } {} - } - Fl_Check_Button stereo { - label Stereo - callback {pars->Pstereo=(int) o->value();} - xywh {440 406 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10 - code0 {o->value(pars->Pstereo);} - } - Fl_Button {} { - label Clear - callback {for (int i=0;imag->value(127); - pars->Phmag[i]=0; - h[i]->bw->value(64); - pars->Phrelbw[i]=64; -}; -pars->Phmag[0]=127; -h[0]->mag->value(0); -SUBparameters->redraw();} - tooltip {Clear the harmonics} xywh {445 446 70 20} box THIN_UP_BOX labelfont 1 labelsize 11 - } - Fl_Group bandwidthsettingsui { - label BANDWIDTH - xywh {220 5 220 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Group bandwidthenvelopegroup { - label {SUBsynth - BandWidth Envelope} open - xywh {225 65 205 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->BandWidthEnvelope);} - code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();} - class EnvelopeUI - } {} - Fl_Check_Button bwee { - label Enabled - callback {pars->PBandWidthEnvelopeEnabled=o->value(); -if (o->value()==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); -o->show(); -bandwidthsettingsui->redraw();} - xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10 - code0 {o->value(pars->PBandWidthEnvelopeEnabled);} - } - Fl_Value_Slider bandwidth { - label {Band Width} - callback {pars->Pbandwidth=(int) o->value();} - xywh {225 40 115 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 maximum 127 step 1 - code0 {o->value(pars->Pbandwidth);} - } - Fl_Value_Slider bwidthscale { - label {B.Width Scale} - callback {pars->Pbwscale=(int) o->value()+64;} - tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1 - code0 {o->value(pars->Pbwscale-64);} - } - } - Fl_Group globalfiltergroup { - label FILTER - xywh {440 221 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();} - } { - Fl_Group filterenv { - label {SUBsynth - Filter Envelope} open - xywh {445 331 275 70} box FLAT_BOX color 51 align 144 - code0 {o->init(pars->GlobalFilterEnvelope);} - class EnvelopeUI - } {} - Fl_Group filterui { - label {SUBsynthl - Filter} open - xywh {445 246 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);} - class FilterUI - } {} - } - Fl_Check_Button filtere { - label Enabled - callback {pars->PGlobalFilterEnabled=o->value(); -if (o->value()==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); -o->show(); -globalfiltergroup->redraw();} - xywh {445 226 85 20} down_box DOWN_BOX labelfont 1 labelsize 11 - code0 {o->value(pars->PGlobalFilterEnabled);} - } - Fl_Button {} { - label C - callback {presetsui->copy(pars);} - xywh {540 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Button {} { - label P - callback {presetsui->paste(pars,this);} - xywh {570 451 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55 - } - Fl_Group {} { - label OVERTONES open - xywh {440 151 220 70} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17 - } { - Fl_Choice spreadtype { - label OvertonesPosition - callback {pars->POvertoneSpread.type = (int)o->value(); -pars->updateFrequencyMultipliers();} open - xywh {450 190 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10 - code0 {o->value(pars->POvertoneSpread.type);} - } { - MenuItem {} { - label Harmonic - xywh {0 0 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftU - xywh {10 10 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label ShiftL - xywh {20 20 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerU - xywh {20 20 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label PowerL - xywh {30 30 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Sine - xywh {40 40 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Power - xywh {50 50 34 20} labelfont 1 labelsize 11 - } - MenuItem {} { - label Shift selected - xywh {20 20 34 20} labelfont 1 labelsize 11 - } - } - Fl_Dial spreadpar1 { - label Par1 - callback {pars->POvertoneSpread.par1 = o->value(); -pars->updateFrequencyMultipliers();} - xywh {548 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 - code0 {o->value(pars->POvertoneSpread.par1);} - class WidgetPDial - } - Fl_Dial spreadpar2 { - label Par2 - callback {pars->POvertoneSpread.par2 = o->value(); -pars->updateFrequencyMultipliers();} - xywh {583 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 - code0 {o->value(pars->POvertoneSpread.par2);} - class WidgetPDial - } - Fl_Dial spreadpar3 { - label ForceH - callback {pars->POvertoneSpread.par3 = o->value(); -pars->updateFrequencyMultipliers();} - xywh {618 173 30 30} box ROUND_UP_BOX labelsize 10 maximum 255 step 1 - code0 {o->value(pars->POvertoneSpread.par3);} - class WidgetPDial - } - } - } - } - Function {refresh()} {} { - code {for (int i=0;irefresh(); -vol->value(pars->PVolume); -vsns->value(pars->PAmpVelocityScaleFunction); -pan->value(pars->PPanning); - - -bandwidth->value(pars->Pbandwidth); -bwidthscale->value(pars->Pbwscale-64); -bwee->value(pars->PBandWidthEnvelopeEnabled); -if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate(); - else bandwidthenvelopegroup->activate(); -bwee->show(); -bandwidthsettingsui->redraw(); - -detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); -spreadtype->value(pars->POvertoneSpread.type); -spreadpar1->value(pars->POvertoneSpread.par1); -spreadpar2->value(pars->POvertoneSpread.par2); -spreadpar3->value(pars->POvertoneSpread.par3); - -freqee->value(pars->PFreqEnvelopeEnabled); -if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate(); - else freqenvelopegroup->activate(); -freqee->show(); -freqsettingsui->redraw(); - -detune->value(pars->PDetune-8192); -hz440->value(pars->Pfixedfreq); - -fixedfreqetdial->value(pars->PfixedfreqET); - -int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; -octave->value(k); - -detunetype->value(pars->PDetuneType-1); - -k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; -coarsedet->value(k); - -filtere->value(pars->PGlobalFilterEnabled); -if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate(); - else globalfiltergroup->activate(); -filtere->show(); -globalfiltergroup->redraw(); - -stereo->value(pars->Pstereo); -filterstages->value(pars->Pnumstages); -magtype->value(pars->Phmagtype); -start->value(pars->Pstart); - -ampenv->refresh(); -bandwidthenvelopegroup->refresh(); -freqenvelopegroup->refresh(); -filterui->refresh(); -filterenv->refresh();} {} - } - Function {SUBnoteUI(SUBnoteParameters *parameters)} {} { - code {pars=parameters; -make_window();} {} - } - Function {~SUBnoteUI()} {} { - code {//for (int i=0;ihide(); -delete(SUBparameters);} {} - } - decl {SUBnoteParameters *pars;} {} - decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/VirKeyboard.fl b/plugins/zynaddsubfx/zynaddsubfx/src/UI/VirKeyboard.fl deleted file mode 100644 index 805e00cfc2e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/VirKeyboard.fl +++ /dev/null @@ -1,487 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0110 -header_name {.h} -code_name {.cc} -decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {} - -decl {//License: GNU GPL version 2 or later} {} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include } {public -} - -decl {\#include "../globals.h"} {public -} - -decl {\#include "../Misc/Master.h"} {public -} - -decl {\#include "../Misc/Util.h"} {public -} - -decl {\#include "WidgetPDial.h"} {public -} - -decl {\#include "common.H"} {public -} - -decl {\#ifdef NTK_GUI - \#include "FL/Fl_Shared_Image.H" - \#endif} {public -} - -decl {const int keyspos[12]={0,-1,1,-2,2,3,-4,4,-5,5,-6,6};} {} - -decl {const int keysoct1qwerty[]={'q','2','w','3','e','r','5','t','6','y','7','u','i','9','o','0','p','[','=',']','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2qwerty[]={'z','s','x','d','c','v','g','b','h','n','j','m',',','l','.',';','/',0};} {} - -decl {const int keysoct1dw[]={'\\'','2',',','3','.','p','5','y','6','f','7','g','c','9','r','0','l','/',']','=','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2dw[]={';','o','q','e','j','k','i','x','d','b','h','m','w','n','v','s','z',0};} {} - -decl {const int keysoct1qwertz[]={'q','2','w','3','e','r','5','t','6','z','7','u','i','9','o','0','p',252,'\\'','+','\\\\',FL_Enter,0};} {} - -decl {const int keysoct2qwertz[]={'y','s','x','d','c','v','g','b','h','n','j','m',',','l','.',246,'-',0};} {} - -decl {const int keysoct1az[]={'a',233,'z','\\"','e','r','(','t','-','y',232,'u','i',231,'o',224,'p',65106,'=','$',0};} {} - -decl {const int keysoct2az[]={'w','s','x','d','c','v','g','b','h','n','j',',',';','l',':','m','!',0};} {} - -class VirKeys {: {public Fl_Box} -} { - decl {static const int N_OCT=6;} {} - decl {static const int SIZE_WHITE=14;} {} - decl {static const int SIZE_BLACK=8;} {} - Function {VirKeys(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { - code {master=NULL;} {} - } - Function {init(Master *master_)} {} { - code {master=master_; -for (int i=0;i=0){//white keys - if (pressed[i]==0) - key = white_up; - else - key = white_down; - - key->draw( ox + (kv + 7 * noct ) * white_up->w() + 3, oy ); - } -} - -for (i=0;idraw( ox + (kv + 7 * noct ) * white_up->w() - black_up->w() / 2 + 2, oy ); - } -} -\#else -if (damage()!=1){ - fl_color(250,240,230); - fl_rectf(ox,oy,lx,ly); - - fl_color(FL_BLACK); - fl_line(ox,oy,ox+lx,oy); - fl_line(ox,oy+ly,ox+lx,oy+ly); - for (i=0;i=0){//white keys - if (pressed[i]==0) fl_color(250,240,230); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE+3,oy+ly*3/5+2, - SIZE_WHITE-4,ly*2/5-3); - } else {//black keys - kv=keyspos[(i+1)%12]; - if (pressed[i]==0) fl_color(FL_BLACK); - else fl_color(FL_BLUE); - fl_rectf(ox+(kv+7*noct)*SIZE_WHITE-SIZE_BLACK/2+2,oy+2, - SIZE_BLACK-3,ly*3/5-5); - } -} -\#endif} {} - } - Function {handle(int event)} {return_type int - } { - code {int i; -int ly=h(); -int x_=Fl::event_x()-x(); -int y_=Fl::event_y()-y(); -if ( (x_<0)&&(x_>w()) && (y_<0)&&(y_>h())){ - return(0); -}; - - -if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ - int kpos=-1; - - if (y_>ly*3/5){//white keys - int pos=x_/SIZE_WHITE; - if (pos<0) return(1); - for (i=0;i<12;i++) { - if (pos%7==keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - } else {//black keys - int pos=(x_+SIZE_WHITE/2)/SIZE_WHITE; - if (pos<0) return(1); - for (i=1;i<12;i++) { - if (pos%7==-keyspos[i]) { - kpos=pos/7*12+i; - break; - }; - }; - }; - - if ((kpos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& - (Fl::event_shift()==0)) { - presskey(kpos,1,1); - }; - - if ((event==FL_PUSH)&&(Fl::event_shift()!=0)) { - if (pressed[kpos]==0) presskey(kpos,0,1); - else relasekey(kpos,1); - }; - if ((event==FL_RELEASE)&&(Fl::event_shift()==0)) - relaseallkeys(1); - take_focus(); -}; - - -const int *keysoct1=keysoct1qwerty; -const int *keysoct2=keysoct2qwerty; - -if (config.cfg.VirKeybLayout==2) { - keysoct1=keysoct1dw; - keysoct2=keysoct2dw; -}else if (config.cfg.VirKeybLayout==3) { - keysoct1=keysoct1qwertz; - keysoct2=keysoct2qwertz; -}else if (config.cfg.VirKeybLayout==4) { - keysoct1=keysoct1az; - keysoct2=keysoct2az; -}; - -if ((event==FL_KEYDOWN)||(event==FL_KEYUP)){ - int key=Fl::event_key(); - int kpos=-1; - for (i=0;keysoct1[i]!=0;i++) if (key==keysoct1[i]) kpos=i+12*keyoct1; - for (i=0;keysoct2[i]!=0;i++) if (key==keysoct2[i]) kpos=i+12*keyoct2; - - - - - if (kpos==-1) return(0); - if ((event==FL_KEYUP) && (Fl::event_key(key)==0) && (Fl::get_key(key)!=0)) return(0); - if (event==FL_KEYDOWN) presskey(kpos,0,2); - else relasekey(kpos,2); -}; - -return(1);} {} - } - Function {presskey(int nk,int exclusive,int type)} {} { - code {//Exclusive means that multiple keys can be pressed at once -//when the user uses the shift key -if (nk>=N_OCT*12) return; -if ((nk<0)&&(exclusive==0)) { - relaseallkeys(type); - return; -}; -if (nk<0) return; -if (pressed[nk]!=0) return;//the key is already pressed - -if (exclusive!=0) relaseallkeys(type); -pressed[nk]=type; - -damage(1); -float vel=midivel; -if (rndvelocity!=0){ - vel=midivel*(127.0-rndvelocity)/127.0+RND*rndvelocity; -}; - -pthread_mutex_lock(&master->mutex); -master->noteOn(midich,nk+midioct*12,(int)vel); -pthread_mutex_unlock(&master->mutex);} {} - } - Function {relasekey(int nk,int type)} {} { - code {if ((nk<0)||(nk>=N_OCT*12)) return; -if (pressed[nk]==0) return;//the key is not pressed -if ((type!=0)&&(pressed[nk]!=type)) return; - -pressed[nk]=0; - - -damage(1); - -pthread_mutex_lock(&master->mutex); -master->noteOff(midich,nk+12*midioct); -pthread_mutex_unlock(&master->mutex);} {} - } - Function {relaseallkeys(int type)} {} { - code {for (int i=0;ihide();} open - xywh {100 597 650 130} type Double visible - } { - Fl_Box virkeys { - label Keyboard - xywh {10 10 590 80} box FLAT_BOX color 17 - code0 {o->init(master);} - class VirKeys - } - Fl_Counter {} { - label {"qwer.." Oct} - callback {relaseallkeys(); -virkeys->keyoct1=(int) o->value(); -virkeys->take_focus();} - tooltip {keys "q2w3er5t6y..." octave} xywh {380 95 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 - code0 {o->value(virkeys->keyoct1);} - } - Fl_Counter {} { - label {"zxcv.." Oct} - callback {relaseallkeys(); -virkeys->keyoct2=(int) o->value(); -virkeys->take_focus();} - tooltip {keys "zsxdcvgbh..." octave} xywh {380 110 45 15} type Simple labelsize 10 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 10 - code0 {o->value(virkeys->keyoct2);} - } - Fl_Value_Slider {} { - label Vel - callback {virkeys->midivel=(int) o->value(); -virkeys->take_focus();} selected - tooltip Velocity xywh {95 105 100 15} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum 1 maximum 127 step 1 - code0 {o->value(virkeys->midivel);} - } - Fl_Counter {} { - label {Oct.} - callback {relaseallkeys(); -virkeys->midioct=(int) o->value(); -virkeys->take_focus();} - tooltip {Midi Octave} xywh {255 100 55 20} type Simple labelsize 11 align 4 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 11 - code0 {o->value(virkeys->midioct);} - } - Fl_Button {} { - label Close - callback {relaseallkeys(); -virkeyboardwindow->hide();} - xywh {545 105 55 20} box THIN_UP_BOX - } - Fl_Value_Slider {} { - label Cval - callback {int ctl=midictl; - -pthread_mutex_lock(&master->mutex); -master->setController(virkeys->midich,ctl,(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus();} - tooltip {Controller value} xywh {605 10 15 115} type {Vert Fill} box ENGRAVED_BOX selection_color 229 labelsize 8 align 5 minimum 127 maximum 0 step 1 value 64 textsize 7 - } - Fl_Choice {} { - label Controller - callback {switch((int) o->value()+1){ - case 1: midictl=C_modwheel; break; - case 2: midictl=C_volume; break; - case 3: midictl=C_panning; break; - case 4: midictl=C_expression; break; - case 5: midictl=C_sustain; break; - case 6: midictl=C_portamento; break; - case 7: midictl=C_filterq; break; - case 8: midictl=C_filtercutoff; break; - case 9: midictl=C_bandwidth; break; - case 10: midictl=C_fmamp; break; - case 11: midictl=C_resonance_center; break; - case 12: midictl=C_resonance_bandwidth; break; - default: midictl=C_NULL; break; - -}; - - - -virkeys->take_focus();} - xywh {435 105 100 15} down_box BORDER_BOX labelsize 10 align 5 when 6 textfont 1 textsize 10 - code0 {midictl=C_filtercutoff;o->value(7);} - } { - MenuItem {} { - label {01: Mod.Wheel} - xywh {0 0 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {07: Volume} - xywh {10 10 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {10: Panning} - xywh {20 20 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {11: Expression} - xywh {30 30 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {64: Sustain} - xywh {40 40 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {65: Portamento} - xywh {50 50 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {71: Filter Q} - xywh {60 60 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {74: Filter Freq.} - xywh {70 70 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {75: Bandwidth} - xywh {80 80 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {76: FM Gain} - xywh {90 90 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {77: Res. c. freq} - xywh {100 100 100 20} labelfont 1 labelsize 10 - } - MenuItem {} { - label {78: Res. bw.} - xywh {110 110 100 20} labelfont 1 labelsize 10 - } - } - Fl_Roller pitchwheelroller { - label Pwh - callback {pthread_mutex_lock(&master->mutex); -master->setController(virkeys->midich,C_pitchwheel,-(int) o->value()); -pthread_mutex_unlock(&master->mutex); -virkeys->take_focus();} - tooltip {Pitch Wheel} xywh {625 10 20 95} labelsize 8 align 1 when 3 minimum -8192 maximum 8192 step 64 - } - Fl_Button {} { - label R - callback {pitchwheelroller->value(0); -pitchwheelroller->do_callback();} - tooltip {Reset Pitch Bend} xywh {625 110 20 15} box THIN_UP_BOX labelfont 1 - } - Fl_Dial {} { - label Vrnd - callback {virkeys->rndvelocity=(int) o->value();} - tooltip {Velocity Randomness} xywh {205 105 20 20} box ROUND_UP_BOX labelsize 10 align 129 maximum 127 step 1 - code0 {o->value(virkeys->rndvelocity);} - class WidgetPDial - } - Fl_Choice partrcv { - label {MIDI Ch.} - callback {relaseallkeys(); -virkeys->midich=(int) o->value(); -virkeys->take_focus();} open - tooltip {Send to Midi Channel} xywh {20 105 65 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 - code0 {char nrstr[10]; for(int i=0;iadd(nrstr); else o->add("Drum10");};} - code1 {o->value(virkeys->midich);} - } {} - } - } - Function {VirKeyboard(Master *master_)} {} { - code {master=master_; -midictl=75; -make_window();} {} - } - Function {~VirKeyboard()} {} { - code {delete virkeyboardwindow;} {} - } - Function {show()} {} { - code {virkeyboardwindow->show();} {} - } - Function {relaseallkeys()} {} { - code {virkeys->relaseallkeys(0);} {} - } - decl {Master *master;} {} - decl {int midictl;} {} -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.cpp deleted file mode 100644 index ef752ce7073..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.cpp +++ /dev/null @@ -1,264 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0107f - -#include "WidgetPDial.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "../Misc/Util.h" -//Copyright (c) 2003-2005 Nasca Octavian Paul -//License: GNU GPL version 2 or later - -using namespace std; - -class TipWin:public Fl_Menu_Window -{ - public: - TipWin(); - void draw(); - void showValue(float f); - void setText(const char *c); - void showText(); - private: - void redraw(); - const char *getStr() const; - string tip; - string text; - bool textmode; -}; - -TipWin::TipWin():Fl_Menu_Window(1, 1) -{ - set_override(); - end(); -} - -void TipWin::draw() -{ - //setup window - draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175)); - fl_color(Fl_Tooltip::textcolor()); - fl_font(labelfont(), labelsize()); - - //Draw the current string - fl_draw(getStr(), 3, 3, w() - 6, h() - 6, - Fl_Align(FL_ALIGN_LEFT | FL_ALIGN_WRAP)); -} - -void TipWin::showValue(float f) -{ - //convert the value to a string - char tmp[10]; - snprintf(tmp, 9, "%.2f", f); - tip = tmp; - - textmode = false; - redraw(); - show(); -} - -void TipWin::setText(const char *c) -{ - text = c; - textmode = true; - redraw(); -} - -void TipWin::showText() -{ - if(!text.empty()) { - textmode = true; - redraw(); - show(); - } -} - -void TipWin::redraw() -{ - // Recalc size of window - fl_font(labelfont(), labelsize()); - int W = 0, H = 0; - fl_measure(getStr(), W, H, 0); - //provide a bit of extra space - W += 8; - H += 4; - size(W, H); - Fl_Menu_Window::redraw(); -} - -const char *TipWin::getStr() const -{ - return (textmode ? text : tip).c_str(); -} - -//static int numobj = 0; - -WidgetPDial::WidgetPDial(int x, int y, int w, int h, const char *label) - :Fl_Dial(x, y, w, h, label), oldvalue(0.0f), pos(false), textset(false) -{ - //cout << "[" << label << "] There are now " << ++numobj << endl; - Fl_Group *save = Fl_Group::current(); - tipwin = new TipWin(); - tipwin->hide(); - Fl_Group::current(save); -} - -WidgetPDial::~WidgetPDial() -{ - //cout << "There are now " << --numobj << endl; - delete tipwin; -} - -int WidgetPDial::handle(int event) -{ -//#ifdef NTK_GUI -// return Fl_Dial::handle( event ); -//#else - double dragsize, min = minimum(), max = maximum(); - int my; - - switch(event) { - case FL_PUSH: - oldvalue = value(); - case FL_DRAG: - getPos(); - my = -(Fl::event_y() - y() - h() / 2); - - dragsize = 200.0f; - if(Fl::event_state(FL_BUTTON1) == 0) - dragsize *= 10; - - value(limit(oldvalue + my / dragsize * (max - min), min, max)); - tipwin->showValue(value()); - value_damage(); - if(this->when() != 0) - do_callback(); - return 1; - case FL_MOUSEWHEEL: - if (Fl::belowmouse() != this) - return 1; - my = - Fl::event_dy(); - - dragsize = 200.0f; - if(Fl::event_state(FL_CTRL) != 0) - dragsize *= 10; - - value(limit(value() + my / dragsize * (max - min), min, max)); - tipwin->showValue(value()); - value_damage(); - if(this->when() != 0) - do_callback(); - return 1; - case FL_ENTER: - getPos(); - tipwin->showText(); - return 1; - case FL_HIDE: - case FL_LEAVE: - tipwin->hide(); - resetPos(); - break; - case FL_RELEASE: - tipwin->hide(); - resetPos(); - if(this->when() == 0) - do_callback(); - return 1; - break; - } - return 0; -//#endif -} - -void WidgetPDial::draw() -{ -#ifdef NTK_GUI - box( FL_NO_BOX ); - - Fl_Dial::draw(); - - return; -#else - const int cx = x(), cy = y(), sx = w(), sy = h(); - const double a1 = angle1(), a2 = angle2(); - const double val = (value() - minimum()) / (maximum() - minimum()); - // even radius produces less artifacts if no antialiasing is avail - const int rad = (sx > sy ? sy : sx) &~1; - - /* clears the button background */ - pdialcolor(160, 160, 160); - fl_pie(cx - 2, cy - 2, rad + 4, rad + 4, 0, 360); - - /* dark outline */ - fl_color(60, 60, 60); - fl_pie(cx - 1, cy - 1, rad + 2, rad + 2, 0, 360); - - /* Draws the button faceplate, min/max */ - pdialcolor(110, 110, 115); - fl_pie(cx, cy, rad, rad, 270 - a2, 270 - a1); - - /* knob center */ - if (rad > 8) { - pdialcolor(140, 140, 145); - fl_pie(cx + 4, cy + 4, rad - 8, rad - 8, 0, 360); - } - - /* value circle */ - double a = -(a2 - a1) * val - a1; - fl_line_style(0, 2, 0); - pdialcolor(0, 200, 0); - fl_arc(cx + 1, cy + 1, rad - 2, rad - 2, a - 90, a1 - 180); - fl_line_style(0); - - /* draw value line */ - int ll = rad/4; - if (ll < 2) ll = 2; - - fl_push_matrix(); - - fl_translate(cx + rad / 2, cy + rad / 2); - fl_rotate(a - 90.0f); - - fl_translate(rad / 2, 0); - - fl_begin_polygon(); - pdialcolor(0, 0, 0); - fl_vertex(-ll, 0); - fl_vertex(0, 0); - fl_end_polygon(); - - fl_pop_matrix(); - -#endif -} - -void WidgetPDial::pdialcolor(int r, int g, int b) -{ - if(active_r()) - fl_color(r, g, b); - else - fl_color(160 - (160 - r) / 3, 160 - (160 - b) / 3, 160 - (160 - b) / 3); -} - -void WidgetPDial::tooltip(const char *c) -{ - tipwin->setText(c); - textset = true; -} - -void WidgetPDial::getPos() -{ - if(!pos) { - tipwin->position(Fl::event_x_root(), Fl::event_y_root() + 20); - pos = true; - } -} - -void WidgetPDial::resetPos() -{ - pos = false; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.h b/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.h deleted file mode 100644 index b386b542e6c..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/WidgetPDial.h +++ /dev/null @@ -1,25 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0107f - -#ifndef WIDGETPDIAL_h -#define WIDGETPDIAL_h -#include - - -class WidgetPDial:public Fl_Dial -{ - public: - WidgetPDial(int x, int y, int w, int h, const char *label = 0); - ~WidgetPDial(); - int handle(int event); - void draw(); - void pdialcolor(int r, int g, int b); - void tooltip(const char *c); - private: - void getPos(); - void resetPos(); - double oldvalue; - bool pos; - bool textset; - class TipWin * tipwin; -}; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/UI/common.H b/plugins/zynaddsubfx/zynaddsubfx/src/UI/common.H deleted file mode 100644 index 4a077e32b51..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/UI/common.H +++ /dev/null @@ -1,29 +0,0 @@ - -/*******************************************************************************/ -/* Copyright (C) 2012 Jonathan Moore Liles */ -/* */ -/* 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. */ -/* */ -/* 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 General Public License for */ -/* more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along */ -/* with This program; see the file COPYING. If not,write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*******************************************************************************/ - -class Fl_Widget; -extern void set_module_parameters ( Fl_Widget * ); - -#ifdef FLTK_GUI -#define fl_color_add_alpha( x,y ) x -#undef FL_NO_BOX -#undef FL_UP_FRAME -#define FL_NO_BOX FL_FLAT_BOX -#define FL_UP_FRAME FL_UP_BOX -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/globals.h b/plugins/zynaddsubfx/zynaddsubfx/src/globals.h deleted file mode 100644 index d98e8babdf4..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/globals.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - globals.h - it contains program settings and the program capabilities - like number of parts, of effects - 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 version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#ifndef GLOBALS_H -#define GLOBALS_H -#include - - -/** - * The number of harmonics of additive synth - * This must be smaller than OSCIL_SIZE/2 - */ -#define MAX_AD_HARMONICS 128 - - -/** - * The number of harmonics of substractive - */ -#define MAX_SUB_HARMONICS 64 - - -/* - * The maximum number of samples that are used for 1 PADsynth instrument(or item) - */ -#define PAD_MAX_SAMPLES 64 - - -/* - * Number of parts - */ -#define NUM_MIDI_PARTS 16 - -/* - * Number of Midi channes - */ -#define NUM_MIDI_CHANNELS 16 - -/* - * The number of voices of additive synth for a single note - */ -#define NUM_VOICES 8 - -/* - * The poliphony (notes) - */ -#define POLIPHONY 128 - -/* - * Number of system effects - */ -#define NUM_SYS_EFX 4 - - -/* - * Number of insertion effects - */ -#define NUM_INS_EFX 8 - -/* - * Number of part's insertion effects - */ -#define NUM_PART_EFX 3 - -/* - * Maximum number of the instrument on a part - */ -#define NUM_KIT_ITEMS 16 - - -/* - * How is applied the velocity sensing - */ -#define VELOCITY_MAX_SCALE 8.0f - -/* - * The maximum length of instrument's name - */ -#define PART_MAX_NAME_LEN 30 - -/* - * The maximum number of bands of the equaliser - */ -#define MAX_EQ_BANDS 8 -#if (MAX_EQ_BANDS >= 20) -#error "Too many EQ bands in globals.h" -#endif - - -/* - * Maximum filter stages - */ -#define MAX_FILTER_STAGES 5 - -/* - * Formant filter (FF) limits - */ -#define FF_MAX_VOWELS 6 -#define FF_MAX_FORMANTS 12 -#define FF_MAX_SEQUENCE 8 - -#define LOG_2 0.693147181f -#define PI 3.1415926536f -#define LOG_10 2.302585093f - -/* - * The threshold for the amplitude interpolation used if the amplitude - * is changed (by LFO's or Envelope's). If the change of the amplitude - * is below this, the amplitude is not interpolated - */ -#define AMPLITUDE_INTERPOLATION_THRESHOLD 0.0001f - -/* - * How the amplitude threshold is computed - */ -#define ABOVE_AMPLITUDE_THRESHOLD(a, b) ((2.0f * fabs((b) - (a)) \ - / (fabs((b) + (a) \ - + 0.0000000001f))) > \ - AMPLITUDE_INTERPOLATION_THRESHOLD) - -/* - * Interpolate Amplitude - */ -#define INTERPOLATE_AMPLITUDE(a, b, x, size) ((a) \ - + ((b) \ - - (a)) * (float)(x) \ - / (float) (size)) - - -/* - * dB - */ -#define dB2rap(dB) ((expf((dB) * LOG_10 / 20.0f))) -#define rap2dB(rap) ((20 * logf(rap) / LOG_10)) - -#define ZERO(data, size) {char *data_ = (char *) data; for(int i = 0; \ - i < size; \ - i++) \ - data_[i] = 0; } -#define ZERO_float(data, size) {float *data_ = (float *) data; \ - for(int i = 0; \ - i < size; \ - i++) \ - data_[i] = 0.0f; } - -enum ONOFFTYPE { - OFF = 0, ON = 1 -}; - -enum MidiControllers { - C_bankselectmsb = 0, C_pitchwheel = 1000, C_NULL = 1001, - C_expression = 11, C_panning = 10, C_bankselectlsb = 32, - C_filtercutoff = 74, C_filterq = 71, C_bandwidth = 75, C_modwheel = 1, - C_fmamp = 76, - C_volume = 7, C_sustain = 64, C_allnotesoff = 123, C_allsoundsoff = 120, - C_resetallcontrollers = 121, - C_portamento = 65, C_resonance_center = 77, C_resonance_bandwidth = 78, - - C_dataentryhi = 0x06, C_dataentrylo = 0x26, C_nrpnhi = 99, C_nrpnlo = 98 -}; - -enum LegatoMsg { - LM_Norm, LM_FadeIn, LM_FadeOut, LM_CatchUp, LM_ToNorm -}; - -//is like i=(int)(floor(f)) -#ifdef ASM_F2I_YES -#define F2I(f, \ - i) __asm__ __volatile__ ("fistpl %0" : "=m" (i) : "t" (f \ - - \ - 0.49999999f) \ - : "st"); -#else -#define F2I(f, i) (i) = ((f > 0) ? ((int)(f)) : ((int)(f - 1.0f))); -#endif - - - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -//temporary include for synth->{samplerate/buffersize} members -struct SYNTH_T { - SYNTH_T(void) - :samplerate(44100), buffersize(256), oscilsize(1024) - { - alias(); - } - - /**Sampling rate*/ - unsigned int samplerate; - - /** - * The size of a sound buffer (or the granularity) - * All internal transfer of sound data use buffer of this size - * All parameters are constant during this period of time, exception - * some parameters(like amplitudes) which are linear interpolated. - * If you increase this you'll ecounter big latencies, but if you - * decrease this the CPU requirements gets high. - */ - int buffersize; - - /** - * The size of ADnote Oscillator - * Decrease this => poor quality - * Increase this => CPU requirements gets high (only at start of the note) - */ - int oscilsize; - - //Alias for above terms - float samplerate_f; - float halfsamplerate_f; - float buffersize_f; - int bufferbytes; - float oscilsize_f; - - inline void alias(void) - { - halfsamplerate_f = (samplerate_f = samplerate) / 2.0f; - buffersize_f = buffersize; - bufferbytes = buffersize * sizeof(float); - oscilsize_f = oscilsize; - } - static float numRandom(void); //defined in Util.cpp for now -}; - -extern SYNTH_T *synth; -#endif diff --git a/plugins/zynaddsubfx/zynaddsubfx/src/main.cpp b/plugins/zynaddsubfx/zynaddsubfx/src/main.cpp deleted file mode 100644 index 555b1b4291a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/src/main.cpp +++ /dev/null @@ -1,554 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - main.cpp - Main file of the synthesizer - Copyright (C) 2002-2005 Nasca Octavian Paul - Copyright (C) 2012-2014 Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - 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 General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include - -#include "UI/common.H" - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "DSP/FFTwrapper.h" -#include "Misc/Master.h" -#include "Misc/Part.h" -#include "Misc/Util.h" -#include "Misc/Dump.h" -extern Dump dump; - - -//Nio System -#include "Nio/Nio.h" - -#ifndef DISABLE_GUI -#ifdef QT_GUI - -#include -#include "masterui.h" -QApplication *app; - -#elif defined FLTK_GUI -#include "UI/MasterUI.h" -#elif defined NTK_GUI -#include "UI/MasterUI.h" -#include -#include -#include -#include -#endif // FLTK_GUI - -MasterUI *ui; - -#endif //DISABLE_GUI - -using namespace std; - -pthread_t thr4; -Master *master; -SYNTH_T *synth; -int swaplr = 0; //1 for left-right swapping - -int Pexitprogram = 0; //if the UI set this to 1, the program will exit - -#if LASH -#include "Misc/LASHClient.h" -LASHClient *lash = NULL; -#endif - -#if USE_NSM -#include "UI/NSM.H" - -NSM_Client *nsm = 0; -#endif - -char *instance_name = 0; - -void exitprogram(); - -//cleanup on signaled exit -void sigterm_exit(int /*sig*/) -{ - Pexitprogram = 1; -} - - -#ifndef DISABLE_GUI - -#ifdef NTK_GUI -static Fl_Tiled_Image *module_backdrop; -#endif - -void -set_module_parameters ( Fl_Widget *o ) -{ -#ifdef NTK_GUI - o->box( FL_DOWN_FRAME ); - o->align( o->align() | FL_ALIGN_IMAGE_BACKDROP ); - o->color( FL_BLACK ); - o->image( module_backdrop ); - o->labeltype( FL_SHADOW_LABEL ); -#else - o->box( FL_PLASTIC_UP_BOX ); - o->color( FL_CYAN ); - o->labeltype( FL_EMBOSSED_LABEL ); -#endif -} -#endif - -/* - * Program initialisation - */ -void initprogram(void) -{ - cerr.precision(1); - cerr << std::fixed; - cerr << "\nSample Rate = \t\t" << synth->samplerate << endl; - cerr << "Sound Buffer Size = \t" << synth->buffersize << " samples" << endl; - cerr << "Internal latency = \t" << synth->buffersize_f * 1000.0f - / synth->samplerate_f << " ms" << endl; - cerr << "ADsynth Oscil.Size = \t" << synth->oscilsize << " samples" << endl; - - - master = &Master::getInstance(); - master->swaplr = swaplr; - - signal(SIGINT, sigterm_exit); - signal(SIGTERM, sigterm_exit); -} - -/* - * Program exit - */ -void exitprogram() -{ - //ensure that everything has stopped with the mutex wait - pthread_mutex_lock(&master->mutex); - pthread_mutex_unlock(&master->mutex); - - Nio::stop(); - -#ifndef DISABLE_GUI - delete ui; -#endif -#if LASH - if(lash) - delete lash; -#endif -#if USE_NSM - if(nsm) - delete nsm; -#endif - - delete [] denormalkillbuf; - FFT_cleanup(); - Master::deleteInstance(); -} - -int main(int argc, char *argv[]) -{ - synth = new SYNTH_T; - config.init(); - dump.startnow(); - int noui = 0; - cerr - << "\nZynAddSubFX - Copyright (c) 2002-2011 Nasca Octavian Paul and others" - << endl; - cerr - << " Copyright (c) 2009-2014 Mark McCurry [active maintainer]" - << endl; - cerr << "Compiled: " << __DATE__ << " " << __TIME__ << endl; - cerr << "This program is free software (GNU GPL v.2 or later) and \n"; - cerr << "it comes with ABSOLUTELY NO WARRANTY.\n" << endl; - if(argc == 1) - cerr << "Try 'zynaddsubfx --help' for command-line options." << endl; - - /* Get the settings from the Config*/ - synth->samplerate = config.cfg.SampleRate; - synth->buffersize = config.cfg.SoundBufferSize; - synth->oscilsize = config.cfg.OscilSize; - swaplr = config.cfg.SwapStereo; - - Nio::preferedSampleRate(synth->samplerate); - - synth->alias(); //build aliases - - sprng(time(NULL)); - - /* Parse command-line options */ - struct option opts[] = { - { - "load", 2, NULL, 'l' - }, - { - "load-instrument", 2, NULL, 'L' - }, - { - "sample-rate", 2, NULL, 'r' - }, - { - "buffer-size", 2, NULL, 'b' - }, - { - "oscil-size", 2, NULL, 'o' - }, - { - "dump", 2, NULL, 'D' - }, - { - "swap", 2, NULL, 'S' - }, - { - "no-gui", 2, NULL, 'U' - }, - { - "dummy", 2, NULL, 'Y' - }, - { - "help", 2, NULL, 'h' - }, - { - "version", 2, NULL, 'v' - }, - { - "named", 1, NULL, 'N' - }, - { - "auto-connect", 0, NULL, 'a' - }, - { - "output", 1, NULL, 'O' - }, - { - "input", 1, NULL, 'I' - }, - { - "exec-after-init", 1, NULL, 'e' - }, - { - 0, 0, 0, 0 - } - }; - opterr = 0; - int option_index = 0, opt, exitwithhelp = 0, exitwithversion = 0; - - string loadfile, loadinstrument, execAfterInit; - - while(1) { - int tmp = 0; - - /**\todo check this process for a small memory leak*/ - opt = getopt_long(argc, - argv, - "l:L:r:b:o:I:O:N:e:hvaSDUY", - opts, - &option_index); - char *optarguments = optarg; - -#define GETOP(x) if(optarguments) \ - x = optarguments -#define GETOPNUM(x) if(optarguments) \ - x = atoi(optarguments) - - - if(opt == -1) - break; - - switch(opt) { - case 'h': - exitwithhelp = 1; - break; - case 'v': - exitwithversion = 1; - break; - case 'Y': /* this command a dummy command (has NO effect) - and is used because I need for NSIS installer - (NSIS sometimes forces a command line for a - program, even if I don't need that; eg. when - I want to add a icon to a shortcut. - */ - break; - case 'U': - noui = 1; - break; - case 'l': - GETOP(loadfile); - break; - case 'L': - GETOP(loadinstrument); - break; - case 'r': - GETOPNUM(synth->samplerate); - if(synth->samplerate < 4000) { - cerr << "ERROR:Incorrect sample rate: " << optarguments - << endl; - exit(1); - } - break; - case 'b': - GETOPNUM(synth->buffersize); - if(synth->buffersize < 2) { - cerr << "ERROR:Incorrect buffer size: " << optarguments - << endl; - exit(1); - } - break; - case 'o': - if(optarguments) - synth->oscilsize = tmp = atoi(optarguments); - if(synth->oscilsize < MAX_AD_HARMONICS * 2) - synth->oscilsize = MAX_AD_HARMONICS * 2; - synth->oscilsize = - (int) powf(2, - ceil(logf(synth->oscilsize - 1.0f) / logf(2.0f))); - if(tmp != synth->oscilsize) - cerr - << - "synth->oscilsize is wrong (must be 2^n) or too small. Adjusting to " - << synth->oscilsize << "." << endl; - break; - case 'S': - swaplr = 1; - break; - case 'D': - dump.startnow(); - break; - case 'N': - Nio::setPostfix(optarguments); - break; - case 'I': - if(optarguments) - Nio::setDefaultSource(optarguments); - break; - case 'O': - if(optarguments) - Nio::setDefaultSink(optarguments); - break; - case 'a': - Nio::autoConnect = true; - break; - case 'e': - GETOP(execAfterInit); - break; - case '?': - cerr << "ERROR:Bad option or parameter.\n" << endl; - exitwithhelp = 1; - break; - } - } - - synth->alias(); - - if(exitwithversion) { - cout << "Version: " << VERSION << endl; - return 0; - } - if(exitwithhelp != 0) { - cout << "Usage: zynaddsubfx [OPTION]\n\n" - << " -h , --help \t\t\t\t Display command-line help and exit\n" - << " -v , --version \t\t\t Display version and exit\n" - << " -l file, --load=FILE\t\t\t Loads a .xmz file\n" - << " -L file, --load-instrument=FILE\t Loads a .xiz file\n" - << " -r SR, --sample-rate=SR\t\t Set the sample rate SR\n" - << - " -b BS, --buffer-size=SR\t\t Set the buffer size (granularity)\n" - << " -o OS, --oscil-size=OS\t\t Set the ADsynth oscil. size\n" - << " -S , --swap\t\t\t\t Swap Left <--> Right\n" - << " -D , --dump\t\t\t\t Dumps midi note ON/OFF commands\n" - << - " -U , --no-gui\t\t\t\t Run ZynAddSubFX without user interface\n" - << " -N , --named\t\t\t\t Postfix IO Name when possible\n" - << " -a , --auto-connect\t\t\t AutoConnect when using JACK\n" - << " -O , --output\t\t\t\t Set Output Engine\n" - << " -I , --input\t\t\t\t Set Input Engine\n" - << " -e , --exec-after-init\t\t Run post-initialization script\n" - << endl; - - return 0; - } - - //produce denormal buf - denormalkillbuf = new float [synth->buffersize]; - for(int i = 0; i < synth->buffersize; ++i) - denormalkillbuf[i] = (RND - 0.5f) * 1e-16; - - initprogram(); - - if(!loadfile.empty()) { - int tmp = master->loadXML(loadfile.c_str()); - if(tmp < 0) { - cerr << "ERROR: Could not load master file " << loadfile - << "." << endl; - exit(1); - } - else { - master->applyparameters(); - cout << "Master file loaded." << endl; - } - } - - if(!loadinstrument.empty()) { - int loadtopart = 0; - int tmp = master->part[loadtopart]->loadXMLinstrument( - loadinstrument.c_str()); - if(tmp < 0) { - cerr << "ERROR: Could not load instrument file " - << loadinstrument << '.' << endl; - exit(1); - } - else { - master->part[loadtopart]->applyparameters(); - cout << "Instrument file loaded." << endl; - } - } - - //Run the Nio system - bool ioGood = Nio::start(); - - if(!execAfterInit.empty()) { - cout << "Executing user supplied command: " << execAfterInit << endl; - if(system(execAfterInit.c_str()) == -1) - cerr << "Command Failed..." << endl; - } - - -#ifndef DISABLE_GUI - -#ifdef NTK_GUI - fl_register_images(); - - Fl_Tooltip::textcolor(0x0); - - Fl_Dial::default_style(Fl_Dial::PIXMAP_DIAL); - - if(Fl_Shared_Image *img = Fl_Shared_Image::get(PIXMAP_PATH "/knob.png")) - Fl_Dial::default_image(img); - else - Fl_Dial::default_image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/knob.png")); - - if(Fl_Shared_Image *img = Fl_Shared_Image::get(PIXMAP_PATH "/window_backdrop.png")) - Fl::scheme_bg(new Fl_Tiled_Image(img)); - else - Fl::scheme_bg(new Fl_Tiled_Image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/window_backdrop.png"))); - - if(Fl_Shared_Image *img = Fl_Shared_Image::get(PIXMAP_PATH "/module_backdrop.png")) - module_backdrop = new Fl_Tiled_Image(img); - else - module_backdrop = new Fl_Tiled_Image(Fl_Shared_Image::get(SOURCE_DIR "/../pixmaps/module_backdrop.png")); - - Fl::background( 50, 50, 50 ); - Fl::background2( 70, 70, 70 ); - Fl::foreground( 255,255,255 ); -#endif - - ui = new MasterUI(master, &Pexitprogram); - - if ( !noui) - { - ui->showUI(); - - if(!ioGood) - fl_alert( - "Default IO did not initialize.\nDefaulting to NULL backend."); - } - -#endif - -#ifndef DISABLE_GUI -#if USE_NSM - char *nsm_url = getenv("NSM_URL"); - - if(nsm_url) { - nsm = new NSM_Client; - - if(!nsm->init(nsm_url)) - nsm->announce("ZynAddSubFX", ":switch:", argv[0]); - else { - delete nsm; - nsm = NULL; - } - } -#endif -#endif - -#if USE_NSM - if(!nsm) -#endif - { -#if LASH - lash = new LASHClient(&argc, &argv); -#ifndef DISABLE_GUI - ui->sm_indicator1->value(1); - ui->sm_indicator2->value(1); - ui->sm_indicator1->tooltip("LASH"); - ui->sm_indicator2->tooltip("LASH"); -#endif -#endif - } - - while(Pexitprogram == 0) { -#ifndef DISABLE_GUI -#if USE_NSM - if(nsm) { - nsm->check(); - goto done; - } -#endif -#if LASH - { - string filename; - switch(lash->checkevents(filename)) { - case LASHClient::Save: - ui->do_save_master(filename.c_str()); - lash->confirmevent(LASHClient::Save); - break; - case LASHClient::Restore: - ui->do_load_master(filename.c_str()); - lash->confirmevent(LASHClient::Restore); - break; - case LASHClient::Quit: - Pexitprogram = 1; - default: - break; - } - } -#endif //LASH - -#if USE_NSM -done: -#endif - - Fl::wait(0.02f); -#else - usleep(100000); -#endif - } - - exitprogram(); - return 0; -} diff --git a/plugins/zynaddsubfx/zynaddsubfx/style.cfg b/plugins/zynaddsubfx/zynaddsubfx/style.cfg deleted file mode 100644 index ba66d990d05..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/style.cfg +++ /dev/null @@ -1,1218 +0,0 @@ -# Uncrustify 0.53 - -# -# General options -# - -# The type of line endings -newlines = lf # auto/lf/crlf/cr - -# The original size of tabs in the input -input_tab_size = 4 # number - -# The size of tabs in the output (only used if align_with_tabs=true) -output_tab_size = 4 # number - -# The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) -string_escape_char = 92 # number - -# Alternate string escape char for Pawn. Only works right before the quote char. -string_escape_char2 = 0 # number - -# -# Indenting -# - -# The number of columns to indent per level. -# Usually 2, 3, 4, or 8. -indent_columns = 4 # number - -# How to use tabs when indenting code -# 0=spaces only -# 1=indent with tabs, align with spaces -# 2=indent and align with tabs -indent_with_tabs = 0 # number - -# Whether to indent strings broken by '\' so that they line up -indent_align_string = true # false/true - -# The number of spaces to indent multi-line XML strings. -# Requires indent_align_string=True -indent_xml_string = 0 # number - -# Spaces to indent '{' from level -indent_brace = 0 # number - -# Whether braces are indented to the body level -indent_braces = false # false/true - -# Disabled indenting function braces if indent_braces is true -indent_braces_no_func = false # false/true - -# Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. -indent_brace_parent = false # false/true - -# Whether the 'namespace' body is indented -indent_namespace = true # false/true - -# Whether the 'extern "C"' body is indented -indent_extern = true # false/true - -# Whether the 'class' body is indented -indent_class = true # false/true - -# Whether to indent the stuff after a leading class colon -indent_class_colon = true # false/true - -# False=treat 'else\nif' as 'else if' for indenting purposes -# True=indent the 'if' one level -indent_else_if = false # false/true - -# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute -indent_var_def_blk = 0 # number - -# True: indent continued function call parameters one indent level -# False: align parameters under the open paren -indent_func_call_param = false # false/true - -# Same as indent_func_call_param, but for function defs -indent_func_def_param = false # false/true - -# Same as indent_func_call_param, but for function protos -indent_func_proto_param = false # false/true - -# Same as indent_func_call_param, but for class declarations -indent_func_class_param = false # false/true - -# Same as indent_func_call_param, but for class variable constructors -indent_func_ctor_var_param = false # false/true - -# Same as indent_func_call_param, but for templates -indent_template_param = false # false/true - -# Double the indent for indent_func_xxx_param options -indent_func_param_double = false # false/true - -# Indentation column for standalone 'const' function decl/proto qualifier -indent_func_const = 0 # number - -# Indentation column for standalone 'throw' function decl/proto qualifier -indent_func_throw = 0 # number - -# The number of spaces to indent a continued '->' or '.' -# Usually set to 0, 1, or indent_columns. -indent_member = 0 # number - -# Spaces to indent single line ('//') comments on lines before code -indent_sing_line_comments = 0 # number - -# If set, will indent trailing single line ('//') comments relative -# to the code instead of trying to keep the same absolute column -indent_relative_single_line_comments = false # false/true - -# Spaces to indent 'case' from 'switch' -# Usually 0 or indent_columns. -indent_switch_case = 4 # number - -# Spaces to shift the 'case' line, without affecting any other lines -# Usually 0. -indent_case_shift = 0 # number - -# Spaces to indent '{' from 'case'. -# By default, the brace will appear under the 'c' in case. -# Usually set to 0 or indent_columns. -indent_case_brace = 0 # number - -# Whether to indent comments found in first column -indent_col1_comment = false # false/true - -# How to indent goto labels -# >0 : absolute column where 1 is the leftmost column -# <=0 : subtract from brace indent -indent_label = 1 # number - -# Same as indent_label, but for access specifiers that are followed by a colon -indent_access_spec = 1 # number - -# Indent the code after an access specifier by one level. -# If set, this option forces 'indent_access_spec=0' -indent_access_spec_body = true # false/true - -# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) -indent_paren_nl = false # false/true - -# Controls the indent of a close paren after a newline. -# 0: Indent to body level -# 1: Align under the open paren -# 2: Indent to the brace level -indent_paren_close = 1 # number - -# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren -indent_comma_paren = false # false/true - -# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren -indent_bool_paren = false # false/true - -# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) -indent_square_nl = false # false/true - -# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies -indent_preserve_sql = false # false/true - -# Align continued statements at the '='. Default=True -# If FALSE or the '=' is followed by a newline, the next line is indent one tab. -indent_align_assign = true # false/true - -# -# Spacing options -# - -# Add or remove space around arithmetic operator '+', '-', '/', '*', etc -sp_arith = force # ignore/add/remove/force - -# Add or remove space around assignment operator '=', '+=', etc -sp_assign = force # ignore/add/remove/force - -# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. -sp_before_assign = ignore # ignore/add/remove/force - -# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. -sp_after_assign = ignore # ignore/add/remove/force - -# Add or remove space around assignment '=' in enum -sp_enum_assign = force # ignore/add/remove/force - -# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. -sp_enum_before_assign = ignore # ignore/add/remove/force - -# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. -sp_enum_after_assign = ignore # ignore/add/remove/force - -# Add or remove space around preprocessor '##' concatenation operator -sp_pp_concat = add # ignore/add/remove/force - -# Add or remove space after preprocessor '#' stringify operator -sp_pp_stringify = add # ignore/add/remove/force - -# Add or remove space around boolean operators '&&' and '||' -sp_bool = force # ignore/add/remove/force - -# Add or remove space around compare operator '<', '>', '==', etc -sp_compare = force # ignore/add/remove/force - -# Add or remove space inside '(' and ')' -sp_inside_paren = remove # ignore/add/remove/force - -# Add or remove space between nested parens -sp_paren_paren = remove # ignore/add/remove/force - -# Whether to balance spaces inside nested parens -sp_balance_nested_parens = false # false/true - -# Add or remove space between ')' and '{' -sp_paren_brace = force # ignore/add/remove/force - -# Add or remove space before pointer star '*' -sp_before_ptr_star = force # ignore/add/remove/force - -# Add or remove space before pointer star '*' that isn't followed by a variable name -# If set to 'ignore', sp_before_ptr_star is used instead. -sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force - -# Add or remove space between pointer stars '*' -sp_between_ptr_star = remove # ignore/add/remove/force - -# Add or remove space after pointer star '*', if followed by a word. -sp_after_ptr_star = remove # ignore/add/remove/force - -# Add or remove space after a pointer star '*', if followed by a func proto/def. -sp_after_ptr_star_func = remove # ignore/add/remove/force - -# Add or remove space before a pointer star '*', if followed by a func proto/def. -sp_before_ptr_star_func = force # ignore/add/remove/force - -# Add or remove space before a reference sign '&' -sp_before_byref = force # ignore/add/remove/force - -# Add or remove space before a reference sign '&' that isn't followed by a variable name -# If set to 'ignore', sp_before_byref is used instead. -sp_before_unnamed_byref = ignore # ignore/add/remove/force - -# Add or remove space after reference sign '&', if followed by a word. -sp_after_byref = remove # ignore/add/remove/force - -# Add or remove space after a reference sign '&', if followed by a func proto/def. -sp_after_byref_func = ignore # ignore/add/remove/force - -# Add or remove space before a reference sign '&', if followed by a func proto/def. -sp_before_byref_func = ignore # ignore/add/remove/force - -# Add or remove space between type and word -sp_after_type = remove # ignore/add/remove/force - -# Add or remove space in 'template <' vs 'template<'. -# If set to ignore, sp_before_angle is used. -sp_template_angle = ignore # ignore/add/remove/force - -# Add or remove space before '<>' -sp_before_angle = remove # ignore/add/remove/force - -# Add or remove space inside '<' and '>' -sp_inside_angle = remove # ignore/add/remove/force - -# Add or remove space after '<>' -sp_after_angle = ignore # ignore/add/remove/force - -# Add or remove space between '<>' and '(' as found in 'new List();' -sp_angle_paren = remove # ignore/add/remove/force - -# Add or remove space between '<>' and a word as in 'List m;' -sp_angle_word = ignore # ignore/add/remove/force - -# Add or remove space before '(' of 'if', 'for', 'switch', and 'while' -sp_before_sparen = remove # ignore/add/remove/force - -# Add or remove space inside if-condition '(' and ')' -sp_inside_sparen = remove # ignore/add/remove/force - -# Add or remove space before if-condition ')'. Overrides sp_inside_sparen. -sp_inside_sparen_close = remove # ignore/add/remove/force - -# Add or remove space after ')' of 'if', 'for', 'switch', and 'while' -sp_after_sparen = remove # ignore/add/remove/force - -# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' -sp_sparen_brace = force # ignore/add/remove/force - -# Add or remove space between 'invariant' and '(' in the D language. -sp_invariant_paren = ignore # ignore/add/remove/force - -# Add or remove space after the ')' in 'invariant (C) c' in the D language. -sp_after_invariant_paren = ignore # ignore/add/remove/force - -# Add or remove space before empty statement ';' on 'if', 'for' and 'while' -sp_special_semi = ignore # ignore/add/remove/force - -# Add or remove space before ';' -sp_before_semi = remove # ignore/add/remove/force - -# Add or remove space before ';' in non-empty 'for' statements -sp_before_semi_for = remove # ignore/add/remove/force - -# Add or remove space before a semicolon of an empty part of a for statment. -sp_before_semi_for_empty = remove # ignore/add/remove/force - -# Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). -sp_after_semi_for_empty = remove # ignore/add/remove/force - -# Add or remove space before '[' (except '[]') -sp_before_square = ignore # ignore/add/remove/force - -# Add or remove space before '[]' -sp_before_squares = ignore # ignore/add/remove/force - -# Add or remove space inside '[' and ']' -sp_inside_square = remove # ignore/add/remove/force - -# Add or remove space after ',' -sp_after_comma = force # ignore/add/remove/force - -# Add or remove space before ',' -sp_before_comma = remove # ignore/add/remove/force - -# Add or remove space after class ':' -sp_after_class_colon = remove # ignore/add/remove/force - -# Add or remove space before class ':' -sp_before_class_colon = remove # ignore/add/remove/force - -# Add or remove space before case ':' -sp_before_case_colon = remove # ignore/add/remove/force - -# Add or remove space between 'operator' and operator sign -sp_after_operator = ignore # ignore/add/remove/force - -# Add or remove space between the operator symbol and the open paren, as in 'operator ++(' -sp_after_operator_sym = ignore # ignore/add/remove/force - -# Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' -sp_after_cast = ignore # ignore/add/remove/force - -# Add or remove spaces inside cast parens -sp_inside_paren_cast = remove # ignore/add/remove/force - -# Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' -sp_cpp_cast_paren = remove # ignore/add/remove/force - -# Add or remove space between 'sizeof' and '(' -sp_sizeof_paren = remove # ignore/add/remove/force - -# Add or remove space after the tag keyword (Pawn) -sp_after_tag = ignore # ignore/add/remove/force - -# Add or remove space inside enum '{' and '}' -sp_inside_braces_enum = ignore # ignore/add/remove/force - -# Add or remove space inside struct/union '{' and '}' -sp_inside_braces_struct = remove # ignore/add/remove/force - -# Add or remove space inside '{' and '}' -sp_inside_braces = ignore # ignore/add/remove/force - -# Add or remove space inside '{}' -sp_inside_braces_empty = ignore # ignore/add/remove/force - -# Add or remove space between return type and function name -# A minimum of 1 is forced except for pointer return types. -sp_type_func = ignore # ignore/add/remove/force - -# Add or remove space between function name and '(' on function declaration -sp_func_proto_paren = remove # ignore/add/remove/force - -# Add or remove space between function name and '(' on function definition -sp_func_def_paren = remove # ignore/add/remove/force - -# Add or remove space inside empty function '()' -sp_inside_fparens = remove # ignore/add/remove/force - -# Add or remove space inside function '(' and ')' -sp_inside_fparen = remove # ignore/add/remove/force - -# Add or remove space between ']' and '(' when part of a function call. -sp_square_fparen = ignore # ignore/add/remove/force - -# Add or remove space between ')' and '{' of function -sp_fparen_brace = force # ignore/add/remove/force - -# Add or remove space between function name and '(' on function calls -sp_func_call_paren = remove # ignore/add/remove/force - -# Add or remove space between the user function name and '(' on function calls -# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. -sp_func_call_user_paren = ignore # ignore/add/remove/force - -# Add or remove space between a constructor/destructor and the open paren -sp_func_class_paren = remove # ignore/add/remove/force - -# Add or remove space between 'return' and '(' -sp_return_paren = remove # ignore/add/remove/force - -# Add or remove space between '__attribute__' and '(' -sp_attribute_paren = ignore # ignore/add/remove/force - -# Add or remove space between 'defined' and '(' in '#if defined (FOO)' -sp_defined_paren = ignore # ignore/add/remove/force - -# Add or remove space between 'throw' and '(' in 'throw (something)' -sp_throw_paren = ignore # ignore/add/remove/force - -# Add or remove space between macro and value -sp_macro = ignore # ignore/add/remove/force - -# Add or remove space between macro function ')' and value -sp_macro_func = ignore # ignore/add/remove/force - -# Add or remove space between 'else' and '{' if on the same line -sp_else_brace = force # ignore/add/remove/force - -# Add or remove space between '}' and 'else' if on the same line -sp_brace_else = ignore # ignore/add/remove/force - -# Add or remove space between '}' and the name of a typedef on the same line -sp_brace_typedef = ignore # ignore/add/remove/force - -# Add or remove space between 'catch' and '{' if on the same line -sp_catch_brace = ignore # ignore/add/remove/force - -# Add or remove space between '}' and 'catch' if on the same line -sp_brace_catch = ignore # ignore/add/remove/force - -# Add or remove space between 'finally' and '{' if on the same line -sp_finally_brace = ignore # ignore/add/remove/force - -# Add or remove space between '}' and 'finally' if on the same line -sp_brace_finally = ignore # ignore/add/remove/force - -# Add or remove space between 'try' and '{' if on the same line -sp_try_brace = ignore # ignore/add/remove/force - -# Add or remove space between get/set and '{' if on the same line -sp_getset_brace = ignore # ignore/add/remove/force - -# Add or remove space before the '::' operator -sp_before_dc = remove # ignore/add/remove/force - -# Add or remove space after the '::' operator -sp_after_dc = remove # ignore/add/remove/force - -# Add or remove around the D named array initializer ':' operator -sp_d_array_colon = ignore # ignore/add/remove/force - -# Add or remove space after the '!' (not) operator. -sp_not = remove # ignore/add/remove/force - -# Add or remove space after the '~' (invert) operator. -sp_inv = remove # ignore/add/remove/force - -# Add or remove space after the '&' (address-of) operator. -# This does not affect the spacing after a '&' that is part of a type. -sp_addr = remove # ignore/add/remove/force - -# Add or remove space around the '.' or '->' operators -sp_member = remove # ignore/add/remove/force - -# Add or remove space after the '*' (dereference) operator. -# This does not affect the spacing after a '*' that is part of a type. -sp_deref = remove # ignore/add/remove/force - -# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' -sp_sign = remove # ignore/add/remove/force - -# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' -sp_incdec = remove # ignore/add/remove/force - -# Add or remove space before a backslash-newline at the end of a line -sp_before_nl_cont = force # ignore/add/remove/force - -# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' -sp_after_oc_scope = ignore # ignore/add/remove/force - -# Add or remove space after the colon in message specs -# '-(int) f:(int) x;' vs '-(int) f: (int) x;' -sp_after_oc_colon = ignore # ignore/add/remove/force - -# Add or remove space before the colon in message specs -# '-(int) f: (int) x;' vs '-(int) f : (int) x;' -sp_before_oc_colon = ignore # ignore/add/remove/force - -# Add or remove space after the colon in message specs -# '[object setValue:1];' vs '[object setValue: 1];' -sp_after_send_oc_colon = ignore # ignore/add/remove/force - -# Add or remove space before the colon in message specs -# '[object setValue:1];' vs '[object setValue :1];' -sp_before_send_oc_colon = ignore # ignore/add/remove/force - -# Add or remove space after the (type) in message specs -# '-(int) f: (int) x;' vs '-(int) f: (int)x;' -sp_after_oc_type = ignore # ignore/add/remove/force - -# Add or remove space around the ':' in 'b ? t : f' -sp_cond_colon = ignore # ignore/add/remove/force - -# Add or remove space around the '?' in 'b ? t : f' -sp_cond_question = ignore # ignore/add/remove/force - -# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. -sp_case_label = ignore # ignore/add/remove/force - -# Control the space around the D '..' operator. -sp_range = ignore # ignore/add/remove/force - -# Control the space after the opening of a C++ comment '// A' vs '//A' -sp_cmt_cpp_start = ignore # ignore/add/remove/force - -# -# Code alignment (not left column spaces/tabs) -# - -# Whether to keep non-indenting tabs -align_keep_tabs = false # false/true - -# Whether to use tabs for alinging -align_with_tabs = false # false/true - -# Whether to bump out to the next tab when aligning -align_on_tabstop = false # false/true - -# Whether to left-align numbers -align_number_left = false # false/true - -# Align variable definitions in prototypes and functions -align_func_params = false # false/true - -# Align parameters in single-line functions that have the same name. -# The function names must already be aligned with each other. -align_same_func_call_params = false # false/true - -# The span for aligning variable definitions (0=don't align) -align_var_def_span = 1 # number - -# How to align the star in variable definitions. -# 0=Part of the type 'void * foo;' -# 1=Part of the variable 'void *foo;' -# 2=Dangling 'void *foo;' -align_var_def_star_style = 2 # number - -# How to align the '&' in variable definitions. -# 0=Part of the type -# 1=Part of the variable -# 2=Dangling -align_var_def_amp_style = 2 # number - -# The threshold for aligning variable definitions (0=no limit) -align_var_def_thresh = 5 # number - -# The gap for aligning variable definitions -align_var_def_gap = 1 # number - -# Whether to align the colon in struct bit fields -align_var_def_colon = false # false/true - -# Whether to align any attribute after the variable name -align_var_def_attribute = false # false/true - -# Whether to align inline struct/enum/union variable definitions -align_var_def_inline = false # false/true - -# The span for aligning on '=' in assignments (0=don't align) -align_assign_span = 1 # number - -# The threshold for aligning on '=' in assignments (0=no limit) -align_assign_thresh = 5 # number - -# The span for aligning on '=' in enums (0=don't align) -align_enum_equ_span = 1 # number - -# The threshold for aligning on '=' in enums (0=no limit) -align_enum_equ_thresh = 5 # number - -# The span for aligning struct/union (0=don't align) -align_var_struct_span = 1 # number - -# The threshold for aligning struct/union member definitions (0=no limit) -align_var_struct_thresh = 5 # number - -# The gap for aligning struct/union member definitions -align_var_struct_gap = 0 # number - -# The span for aligning struct initializer values (0=don't align) -align_struct_init_span = 1 # number - -# The minimum space between the type and the synonym of a typedef -align_typedef_gap = 0 # number - -# The span for aligning single-line typedefs (0=don't align) -align_typedef_span = 1 # number - -# How to align typedef'd functions with other typedefs -# 0: Don't mix them at all -# 1: align the open paren with the types -# 2: align the function type name with the other type names -align_typedef_func = 0 # number - -# Controls the positioning of the '*' in typedefs. Just try it. -# 0: Align on typdef type, ignore '*' -# 1: The '*' is part of type name: typedef int *pint; -# 2: The '*' is part of the type, but dangling: typedef int *pint; -align_typedef_star_style = 0 # number - -# Controls the positioning of the '&' in typedefs. Just try it. -# 0: Align on typdef type, ignore '&' -# 1: The '&' is part of type name: typedef int &pint; -# 2: The '&' is part of the type, but dangling: typedef int &pint; -align_typedef_amp_style = 0 # number - -# The span for aligning comments that end lines (0=don't align) -align_right_cmt_span = 0 # number - -# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment -align_right_cmt_mix = false # false/true - -# If a trailing comment is more than this number of columns away from the text it follows, -# it will qualify for being aligned. -align_right_cmt_gap = 0 # number - -# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) -align_right_cmt_at_col = 0 # number - -# The span for aligning function prototypes (0=don't align) -align_func_proto_span = 0 # number - -# Minimum gap between the return type and the function name. -align_func_proto_gap = 0 # number - -# Align function protos on the 'operator' keyword instead of what follows -align_on_operator = false # false/true - -# Whether to mix aligning prototype and variable declarations. -# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. -align_mix_var_proto = false # false/true - -# Align single-line functions with function prototypes, uses align_func_proto_span -align_single_line_func = false # false/true - -# Aligning the open brace of single-line functions. -# Requires align_single_line_func=true, uses align_func_proto_span -align_single_line_brace = false # false/true - -# Gap for align_single_line_brace. -align_single_line_brace_gap = 0 # number - -# The span for aligning ObjC msg spec (0=don't align) -align_oc_msg_spec_span = 0 # number - -# Whether to align macros wrapped with a backslash and a newline. -# This will not work right if the macro contains a multi-line comment. -align_nl_cont = false # false/true - -# The minimum space between label and value of a preprocessor define -align_pp_define_gap = 0 # number - -# The span for aligning on '#define' bodies (0=don't align) -align_pp_define_span = 0 # number - -# Align lines that start with '<<' with previous '<<'. Default=true -align_left_shift = true # false/true - -# -# Newline adding and removing options -# - -# Whether to collapse empty blocks between '{' and '}' -nl_collapse_empty_body = true # false/true - -# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' -nl_assign_leave_one_liners = true # false/true - -# Don't split one-line braced statements inside a class xx { } body -nl_class_leave_one_liners = false # false/true - -# Don't split one-line enums: 'enum foo { BAR = 15 };' -nl_enum_leave_one_liners = false # false/true - -# Don't split one-line get or set functions -nl_getset_leave_one_liners = true # false/true - -# Don't split one-line function definitions - 'int foo() { return 0; }' -nl_func_leave_one_liners = true # false/true - -# Don't split one-line if/else statements - 'if(a) b++;' -nl_if_leave_one_liners = false # false/true - -# Add or remove newlines at the start of the file -nl_start_of_file = ignore # ignore/add/remove/force - -# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' -nl_start_of_file_min = 0 # number - -# Add or remove newline at the end of the file -nl_end_of_file = force # ignore/add/remove/force - -# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') -nl_end_of_file_min = 1 # number - -# Add or remove newline between '=' and '{' -nl_assign_brace = ignore # ignore/add/remove/force - -# Add or remove newline between '=' and '[' (D only) -nl_assign_square = ignore # ignore/add/remove/force - -# Add or remove newline after '= [' (D only). Will also affect the newline before the ']' -nl_after_square_assign = ignore # ignore/add/remove/force - -# The number of newlines after a block of variable definitions -nl_func_var_def_blk = 0 # number - -# Add or remove newline between a function call's ')' and '{', as in: -# list_for_each(item, &list) { } -nl_fcall_brace = force # ignore/add/remove/force - -# Add or remove newline between 'enum' and '{' -nl_enum_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'struct and '{' -nl_struct_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'union' and '{' -nl_union_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'if' and '{' -nl_if_brace = remove # ignore/add/remove/force - -# Add or remove newline between '}' and 'else' -nl_brace_else = force # ignore/add/remove/force - -# Add or remove newline between 'else if' and '{' -# If set to ignore, nl_if_brace is used instead -nl_elseif_brace = ignore # ignore/add/remove/force - -# Add or remove newline between 'else' and '{' -nl_else_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'else' and 'if' -nl_else_if = add # ignore/add/remove/force - -# Add or remove newline between '}' and 'finally' -nl_brace_finally = force # ignore/add/remove/force - -# Add or remove newline between 'finally' and '{' -nl_finally_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'try' and '{' -nl_try_brace = remove # ignore/add/remove/force - -# Add or remove newline between get/set and '{' -nl_getset_brace = ignore # ignore/add/remove/force - -# Add or remove newline between 'for' and '{' -nl_for_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'catch' and '{' -nl_catch_brace = remove # ignore/add/remove/force - -# Add or remove newline between '}' and 'catch' -nl_brace_catch = force # ignore/add/remove/force - -# Add or remove newline between 'while' and '{' -nl_while_brace = remove # ignore/add/remove/force - -# Add or remove newline between 'do' and '{' -nl_do_brace = remove # ignore/add/remove/force - -# Add or remove newline between '}' and 'while' of 'do' statement -nl_brace_while = remove # ignore/add/remove/force - -# Add or remove newline between 'switch' and '{' -nl_switch_brace = remove # ignore/add/remove/force - -# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. -# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. -nl_multi_line_cond = false # false/true - -# Force a newline in a define after the macro name for multi-line defines. -nl_multi_line_define = false # false/true - -# Whether to put a newline before 'case' statement -nl_before_case = false # false/true - -# Add or remove newline between ')' and 'throw' -nl_before_throw = ignore # ignore/add/remove/force - -# Whether to put a newline after 'case' statement -nl_after_case = false # false/true - -# Newline between namespace and { -nl_namespace_brace = ignore # ignore/add/remove/force - -# Add or remove newline between 'template<>' and whatever follows. -nl_template_class = ignore # ignore/add/remove/force - -# Add or remove newline between 'class' and '{' -nl_class_brace = force # ignore/add/remove/force - -# Add or remove newline after each ',' in the constructor member initialization -nl_class_init_args = ignore # ignore/add/remove/force - -# Add or remove newline between return type and function name in definition -nl_func_type_name = ignore # ignore/add/remove/force - -# Add or remove newline between function scope and name in a definition -# Controls the newline after '::' in 'void A::f() { }' -nl_func_scope_name = ignore # ignore/add/remove/force - -# Add or remove newline between return type and function name in a prototype -nl_func_proto_type_name = ignore # ignore/add/remove/force - -# Add or remove newline between a function name and the opening '(' -nl_func_paren = remove # ignore/add/remove/force - -# Add or remove newline after '(' in a function declaration -nl_func_decl_start = ignore # ignore/add/remove/force - -# Add or remove newline after each ',' in a function declaration -nl_func_decl_args = ignore # ignore/add/remove/force - -# Add or remove newline before the ')' in a function declaration -nl_func_decl_end = ignore # ignore/add/remove/force - -# Add or remove newline between function signature and '{' -nl_fdef_brace = ignore # ignore/add/remove/force - -# Whether to put a newline after 'return' statement -nl_after_return = false # false/true - -# Add or remove a newline between the return keyword and return expression. -nl_return_expr = ignore # ignore/add/remove/force - -# Whether to put a newline after semicolons, except in 'for' statements -nl_after_semicolon = false # false/true - -# Whether to put a newline after brace open. -# This also adds a newline before the matching brace close. -nl_after_brace_open = true # false/true - -# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is -# placed between the open brace and a trailing single-line comment. -nl_after_brace_open_cmt = false # false/true - -# Whether to put a newline after a virtual brace open. -# These occur in un-braced if/while/do/for statement bodies. -nl_after_vbrace_open = true # false/true - -# Whether to put a newline after a brace close. -# Does not apply if followed by a necessary ';'. -nl_after_brace_close = false # false/true - -# Whether to alter newlines in '#define' macros -nl_define_macro = false # false/true - -# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' -nl_squeeze_ifdef = false # false/true - -# Add or remove newline before 'if' -nl_before_if = ignore # ignore/add/remove/force - -# Add or remove newline after 'if' -nl_after_if = ignore # ignore/add/remove/force - -# Add or remove newline before 'for' -nl_before_for = ignore # ignore/add/remove/force - -# Add or remove newline after 'for' -nl_after_for = ignore # ignore/add/remove/force - -# Add or remove newline before 'while' -nl_before_while = ignore # ignore/add/remove/force - -# Add or remove newline after 'while' -nl_after_while = ignore # ignore/add/remove/force - -# Add or remove newline before 'switch' -nl_before_switch = ignore # ignore/add/remove/force - -# Add or remove newline after 'switch' -nl_after_switch = ignore # ignore/add/remove/force - -# Add or remove newline before 'do' -nl_before_do = ignore # ignore/add/remove/force - -# Add or remove newline after 'do' -nl_after_do = ignore # ignore/add/remove/force - -# Whether to double-space commented-entries in struct/enum -nl_ds_struct_enum_cmt = false # false/true - -# Whether to double-space before the close brace of a struct/union/enum -nl_ds_struct_enum_close_brace = false # false/true - -# Add or remove a newline around a class colon. -# Related to pos_class_colon, nl_class_init_args, and pos_comma. -nl_class_colon = ignore # ignore/add/remove/force - -# Change simple unbraced if statements into a one-liner -# 'if(b)\n i++;' => 'if(b) i++;' -nl_create_if_one_liner = false # false/true - -# Change simple unbraced for statements into a one-liner -# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' -nl_create_for_one_liner = false # false/true - -# Change simple unbraced while statements into a one-liner -# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' -nl_create_while_one_liner = false # false/true - -# -# Positioning options -# - -# The position of arithmetic operators in wrapped expressions -pos_arith = lead # ignore/lead/trail - -# The position of assignment in wrapped expressions -pos_assign = trail # ignore/lead/trail - -# The position of boolean operators in wrapped expressions -pos_bool = lead # ignore/lead/trail - -# The position of the comma in wrapped expressions -pos_comma = trail # ignore/lead/trail - -# The position of the comma in the constructor initialization list -pos_class_comma = trail # ignore/lead/trail - -# The position of colons between constructor and member initialization -pos_class_colon = lead # ignore/lead/trail - -# -# Line Splitting options -# - -# Try to limit code width to N number of columns -code_width = 80 # number - -# Whether to fully split long 'for' statements at semi-colons -ls_for_split_full = true # false/true - -# Whether to fully split long function protos/calls at commas -ls_func_split_full = true # false/true - -# -# Blank line options -# - -# The maximum consecutive newlines -nl_max = 0 # number - -# The number of newlines after a function prototype, if followed by another function prototype -nl_after_func_proto = 0 # number - -# The number of newlines after a function prototype, if not followed by another function prototype -nl_after_func_proto_group = 0 # number - -# The number of newlines after '}' of a multi-line function body -nl_after_func_body = 0 # number - -# The number of newlines after '}' of a single line function body -nl_after_func_body_one_liner = 0 # number - -# The minimum number of newlines before a multi-line comment. -# Doesn't apply if after a brace open or another multi-line comment. -nl_before_block_comment = 0 # number - -# The minimum number of newlines before a single-line C comment. -# Doesn't apply if after a brace open or other single-line C comments. -nl_before_c_comment = 0 # number - -# The minimum number of newlines before a CPP comment. -# Doesn't apply if after a brace open or other CPP comments. -nl_before_cpp_comment = 0 # number - -# Whether to force a newline after a mulit-line comment. -nl_after_multiline_comment = false # false/true - -# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. -# Will not change the newline count if after a brace open. -# 0 = No change. -nl_before_access_spec = 0 # number - -# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. -# 0 = No change. -nl_after_access_spec = 0 # number - -# The number of newlines between a function def and the function comment. -# 0 = No change. -nl_comment_func_def = 0 # number - -# The number of newlines after a try-catch-finally block that isn't followed by a brace close. -# 0 = No change. -nl_after_try_catch_finally = 0 # number - -# The number of newlines before and after a property, indexer or event decl. -# 0 = No change. -nl_around_cs_property = 0 # number - -# The number of newlines between the get/set/add/remove handlers in C#. -# 0 = No change. -nl_between_get_set = 0 # number - -# Whether to remove blank lines after '{' -eat_blanks_after_open_brace = true # false/true - -# Whether to remove blank lines before '}' -eat_blanks_before_close_brace = true # false/true - -# -# Code modifying options (non-whitespace) -# - -# Add or remove braces on single-line 'do' statement -mod_full_brace_do = ignore # ignore/add/remove/force - -# Add or remove braces on single-line 'for' statement -mod_full_brace_for = remove # ignore/add/remove/force - -# Add or remove braces on single-line function defintions. (Pawn) -mod_full_brace_function = ignore # ignore/add/remove/force - -# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. -mod_full_brace_if = remove # ignore/add/remove/force - -# Don't remove braces around statements that span N newlines -mod_full_brace_nl = 0 # number - -# Add or remove braces on single-line 'while' statement -mod_full_brace_while = ignore # ignore/add/remove/force - -# Add or remove unnecessary paren on 'return' statement -mod_paren_on_return = remove # ignore/add/remove/force - -# Whether to change optional semicolons to real semicolons -mod_pawn_semicolon = false # false/true - -# Add parens on 'while' and 'if' statement around bools -mod_full_paren_if_bool = true # false/true - -# Whether to remove superfluous semicolons -mod_remove_extra_semicolon = true # false/true - -# If a function body exceeds the specified number of newlines and doesn't have a comment after -# the close brace, a comment will be added. -mod_add_long_function_closebrace_comment = 0 # number - -# If a switch body exceeds the specified number of newlines and doesn't have a comment after -# the close brace, a comment will be added. -mod_add_long_switch_closebrace_comment = 0 # number - -# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after -# the #else, a comment will be added. -mod_add_long_ifdef_endif_comment = 0 # number - -# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after -# the #endif, a comment will be added. -mod_add_long_ifdef_else_comment = 0 # number - -# If TRUE, will sort consecutive single-line 'import' statements [Java, D] -mod_sort_import = false # false/true - -# If TRUE, will sort consecutive single-line 'using' statements [C#] -mod_sort_using = false # false/true - -# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] -# This is generally a bad idea, as it may break your code. -mod_sort_include = false # false/true - -# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. -mod_move_case_break = false # false/true - -# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. -mod_remove_empty_return = false # false/true - -# -# Comment modifications -# - -# Try to wrap comments at cmt_width columns -cmt_width = 0 # number - -# If false, disable all multi-line comment changes, including cmt_width and leading chars. -# Default is true. -cmt_indent_multi = false # false/true - -# Whether to group c-comments that look like they are in a block -cmt_c_group = false # false/true - -# Whether to put an empty '/*' on the first line of the combined c-comment -cmt_c_nl_start = false # false/true - -# Whether to put a newline before the closing '*/' of the combined c-comment -cmt_c_nl_end = false # false/true - -# Whether to group cpp-comments that look like they are in a block -cmt_cpp_group = false # false/true - -# Whether to put an empty '/*' on the first line of the combined cpp-comment -cmt_cpp_nl_start = false # false/true - -# Whether to put a newline before the closing '*/' of the combined cpp-comment -cmt_cpp_nl_end = false # false/true - -# Whether to change cpp-comments into c-comments -cmt_cpp_to_c = false # false/true - -# Whether to put a star on subsequent comment lines -cmt_star_cont = false # false/true - -# The number of spaces to insert at the start of subsequent comment lines -cmt_sp_before_star_cont = 0 # number - -# The number of spaces to insert after the star on subsequent comment lines -cmt_sp_after_star_cont = 1 # number - -# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of -# the comment are the same length. Default=True -cmt_multi_check_last = true # false/true - -# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. -# Will substitue $(filename) with the current file's name. -cmt_insert_file_header = "" # string - -# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. -# Will substitue $(filename) with the current file's name. -cmt_insert_file_footer = "" # string - -# The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. -# Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. -# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } -cmt_insert_func_header = "" # string - -# The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. -# Will substitue $(class) with the class name. -cmt_insert_class_header = "" # string - -# If a preprocessor is encountered when stepping backwards from a function name, then -# this option decides whether the comment should be inserted. -# Affects cmt_insert_func_header and cmt_insert_class_header. -cmt_insert_before_preproc = false # false/true - -# -# Preprocessor options -# - -# Control indent of preprocessors inside #if blocks at brace level 0 -pp_indent = ignore # ignore/add/remove/force - -# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) -pp_indent_at_level = false # false/true - -# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. -pp_indent_count = 1 # number - -# Add or remove space after # based on pp_level of #if blocks -pp_space = ignore # ignore/add/remove/force - -# Sets the number of spaces added with pp_space -pp_space_count = 0 # number - -# The indent for #region and #endregion in C# and '#pragma region' in C/C++ -pp_indent_region = 0 # number - -# Whether to indent the code between #region and #endregion -pp_region_indent_code = false # false/true - -# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level -pp_indent_if = 0 # number - -# Control whether to indent the code between #if, #else and #endif when not at file-level -pp_if_indent_code = false # false/true - -# Whether to indent '#define' at the brace level (true) or from column 1 (false) -pp_define_at_level = false # false/true - -# You can force a token to be a type with the 'type' option. -# Example: -# type myfoo1 myfoo2 -# -# You can create custom macro-based indentation using macro-open, -# macro-else and macro-close. -# Example: -# macro-open BEGIN_TEMPLATE_MESSAGE_MAP -# macro-open BEGIN_MESSAGE_MAP -# macro-close END_MESSAGE_MAP -# -# You can assign any keyword to any type with the set option. -# set func_call_user _ N_ -# -# The full syntax description of all custom definition config entries -# is shown below: -# -# define custom tokens as: -# - embed whitespace in token using '' escape character, or -# put token in quotes -# - these: ' " and ` are recognized as quote delimiters -# -# type token1 token2 token3 ... -# ^ optionally specify multiple tokens on a single line -# define def_token output_token -# ^ output_token is optional, then NULL is assumed -# macro-open token -# macro-close token -# macro-else token -# set id token1 token2 ... -# ^ optionally specify multiple tokens on a single line -# ^ id is one of the names in token_enum.h sans the CT_ prefix, -# e.g. PP_PRAGMA -# -# all tokens are separated by any mix of ',' commas, '=' equal signs -# and whitespace (space, tab) -# diff --git a/plugins/zynaddsubfx/zynaddsubfx/style.sh b/plugins/zynaddsubfx/zynaddsubfx/style.sh deleted file mode 100755 index 08d93ee2efa..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/style.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.h$"` -uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.cpp$"` -#cover nsm code -uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.H$"` -uncrustify -c style.cfg --no-backup -l CPP `find . | grep -e "\.C$"` diff --git a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-alsa.desktop b/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-alsa.desktop deleted file mode 100644 index 1a63e9d9e3a..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-alsa.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=ZynAddSubFX - Alsa -Comment=A powerful realtime software synthesizer -Exec=zynaddsubfx -I alsa -O alsa -Icon=zynaddsubfx -Terminal=false -Type=Application -Categories=AudioVideo;Audio; diff --git a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-jack.desktop b/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-jack.desktop deleted file mode 100644 index a16a2e7fd46..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx-jack.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=ZynAddSubFX - Jack -Comment=A powerful realtime software synthesizer -Exec=zynaddsubfx -I jack -O jack -Icon=zynaddsubfx -Terminal=false -Type=Application -Categories=AudioVideo;Audio; diff --git a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.ico b/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.ico deleted file mode 100644 index 80f0519d3e4..00000000000 Binary files a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.ico and /dev/null differ diff --git a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.svg b/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.svg deleted file mode 100644 index d81c651ad7e..00000000000 --- a/plugins/zynaddsubfx/zynaddsubfx/zynaddsubfx.svg +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -