commit a1db18606638789f715d0d431587a0f8ac31d7ec parent 42689c439a61fb599ac435a0c87389d15bf8a8d8 Author: paulnasca <paulnasca> Date: Sat, 17 Jul 2004 13:24:59 +0000 *** empty log message *** Diffstat:
305 files changed, 2804 insertions(+), 632 deletions(-)
diff --git a/ChangeLog b/ChangeLog @@ -607,5 +607,48 @@ 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); + - 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 + diff --git a/HISTORY.txt b/HISTORY.txt @@ -1,13 +1,23 @@ - - started to write an integrated sequencer; I don't have to replace Rosengarden, Muse, etc. I want to make possible to store melodies directly into mas_zyn files, play them, convert to/from midi files - - speedups (on some portions, like FM, Chorus, etc. is 10-50%) - - added the posibility to use comments/copyritht text to instruments; in order to encourage the sharing of them - - you can make zynaddsubfx to load a file when it starts (with "-l") and you can disable the user interface ("-U") - - added dump of the events (it writes to a file all notes) - - added linear modulation whell controller and made default - - added FFTW3 support (but you can choose to user FFTW2) in the Makefile.inc - - added the possibility to make "up" portamentos shorter or longer than "down" portamentos - - bugfixes and other minor improvements - - added the full changelog (since I started to write zynaddsubfx), most is in Romanian +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 diff --git a/README.txt b/README.txt @@ -1,7 +1,7 @@ ZynAddSubFX ----------- It is a realtime software synthesizer for Linux and Windows with many features. Please see the docs for details. -Copyright (c) 2002-2003 Nasca Octavian Paul +Copyright (c) 2002-2004 Nasca Octavian Paul e-mail: zynaddsubfx AT yahoo D0T com ZynAddSubFX is free program and is distribuited WITH NO WARRANTY. It is licensed under GNU General Public License version 2 (and only version 2) - see the file COPYING. diff --git a/ZynAddSubFX.lsm b/ZynAddSubFX.lsm @@ -1,7 +1,7 @@ Begin4 Title: ZynAddSubFX -Version: 1.4.3 -Entered-date: 31-08-2003 +Version: 2.0.0pre1 +Entered-date: 17-07-2004 Description: A real-time software synthesizer for Linux and Windows with many features, including polyphony, multi-timbral and microtonal capabilities. It includes randomness of some parameters,which @@ -14,7 +14,7 @@ Author: [email protected] (Nasca Paul) Maintained-by: [email protected] (Nasca Paul) Primary-site: zynaddsubfx.sourceforge.net sourceforge.net/projects/zynaddsubfx - 189k ZynAddSubFX-1.4.3.tar.gz (source code) + 640k ZynAddSubFX-2.0.0pre1.tar.gz (source code) Alternate-site: Original-site: Platforms: Linux with X11 or Windows diff --git a/banks/Misc/0001-Plucked 1.xiz b/banks/Misc/0001-Plucked 1.xiz Binary files differ. diff --git a/banks/Misc/0002-Plucked 2.xiz b/banks/Misc/0002-Plucked 2.xiz Binary files differ. diff --git a/banks/Misc/0003-Plucked 3.xiz b/banks/Misc/0003-Plucked 3.xiz Binary files differ. diff --git a/banks/Misc/0004-Plucked 4.xiz b/banks/Misc/0004-Plucked 4.xiz Binary files differ. diff --git a/banks/Misc/0005-Synth Piano 2.xiz b/banks/Misc/0005-Synth Piano 2.xiz Binary files differ. diff --git a/banks/Misc/0006-Synth Rhodes.xiz b/banks/Misc/0006-Synth Rhodes.xiz Binary files differ. diff --git a/banks/Misc/0007-Synth Rhodes.xiz b/banks/Misc/0007-Synth Rhodes.xiz Binary files differ. diff --git a/banks/Misc/0008-Soft Rhodes.xiz b/banks/Misc/0008-Soft Rhodes.xiz Binary files differ. diff --git a/banks/Misc/0009-Synth Piano1.xiz b/banks/Misc/0009-Synth Piano1.xiz Binary files differ. diff --git a/banks/Misc/0010-Drop.xiz b/banks/Misc/0010-Drop.xiz Binary files differ. diff --git a/banks/Misc/0011-Termollo Piano1.xiz b/banks/Misc/0011-Termollo Piano1.xiz Binary files differ. diff --git a/banks/Misc/0012-Termollo Piano2.xiz b/banks/Misc/0012-Termollo Piano2.xiz Binary files differ. diff --git a/banks/Misc/0013-Termollo Piano3.xiz b/banks/Misc/0013-Termollo Piano3.xiz Binary files differ. diff --git a/banks/Misc/0021-Synth Accordion.xiz b/banks/Misc/0021-Synth Accordion.xiz Binary files differ. diff --git a/banks/Misc/0022-Voice OOH.xiz b/banks/Misc/0022-Voice OOH.xiz Binary files differ. diff --git a/banks/Misc/0033-Organ 11.xiz b/banks/Misc/0033-Organ 11.xiz Binary files differ. diff --git a/banks/Misc/0034-Soft Synth 1.xiz b/banks/Misc/0034-Soft Synth 1.xiz Binary files differ. diff --git a/banks/Misc/0035-Soft Synth 2.xiz b/banks/Misc/0035-Soft Synth 2.xiz Binary files differ. diff --git a/banks/Misc/0038-Saw Strings 1.xiz b/banks/Misc/0038-Saw Strings 1.xiz Binary files differ. diff --git a/banks/Misc/0039-Saw Strings 2.xiz b/banks/Misc/0039-Saw Strings 2.xiz Binary files differ. diff --git a/banks/Misc/0040-Saw Strings 3.xiz b/banks/Misc/0040-Saw Strings 3.xiz Binary files differ. diff --git a/banks/Misc/0041-Saw Strings 4.xiz b/banks/Misc/0041-Saw Strings 4.xiz Binary files differ. diff --git a/banks/Misc/0042-Saw 1.xiz b/banks/Misc/0042-Saw 1.xiz Binary files differ. diff --git a/banks/Misc/0043-Saw 2.xiz b/banks/Misc/0043-Saw 2.xiz Binary files differ. diff --git a/banks/Misc/0044-Echoed Saw.xiz b/banks/Misc/0044-Echoed Saw.xiz Binary files differ. diff --git a/banks/Misc/0045-Faaaaaaaaat.xiz b/banks/Misc/0045-Faaaaaaaaat.xiz Binary files differ. diff --git a/banks/Misc/0046-Vibratto Saw1.xiz b/banks/Misc/0046-Vibratto Saw1.xiz Binary files differ. diff --git a/banks/Misc/0047-Brazz.xiz b/banks/Misc/0047-Brazz.xiz Binary files differ. diff --git a/banks/Misc/0053-Flute 1.xiz b/banks/Misc/0053-Flute 1.xiz Binary files differ. diff --git a/banks/Misc/0054-Reed 5.xiz b/banks/Misc/0054-Reed 5.xiz Binary files differ. diff --git a/banks/Misc/0055-Reed 6.xiz b/banks/Misc/0055-Reed 6.xiz Binary files differ. diff --git a/banks/Misc/0056-Synth Reeeeed.xiz b/banks/Misc/0056-Synth Reeeeed.xiz Binary files differ. diff --git a/banks/Misc/0072-Trash Guitar 1.xiz b/banks/Misc/0072-Trash Guitar 1.xiz Binary files differ. diff --git a/banks/Misc/0073-Trash Guitar 2.xiz b/banks/Misc/0073-Trash Guitar 2.xiz Binary files differ. diff --git a/banks/Misc/0074-Thrashed Synth.xiz b/banks/Misc/0074-Thrashed Synth.xiz Binary files differ. diff --git a/banks/Misc/0077-Arpeggio1.xiz b/banks/Misc/0077-Arpeggio1.xiz Binary files differ. diff --git a/banks/Misc/0078-Arpeggio2.xiz b/banks/Misc/0078-Arpeggio2.xiz Binary files differ. diff --git a/banks/Misc/0079-Arpeggio3.xiz b/banks/Misc/0079-Arpeggio3.xiz Binary files differ. diff --git a/banks/Misc/0080-Arpeggio4.xiz b/banks/Misc/0080-Arpeggio4.xiz Binary files differ. diff --git a/banks/Misc/0081-Arpeggio5.xiz b/banks/Misc/0081-Arpeggio5.xiz Binary files differ. diff --git a/banks/Misc/0082-Aporggio6.xiz b/banks/Misc/0082-Aporggio6.xiz Binary files differ. diff --git a/banks/Misc/0083-Echoed Synth.xiz b/banks/Misc/0083-Echoed Synth.xiz Binary files differ. diff --git a/banks/Misc/0087-ImpossibleDream1.xiz b/banks/Misc/0087-ImpossibleDream1.xiz Binary files differ. diff --git a/banks/Misc/0088-ImpossibleDream2.xiz b/banks/Misc/0088-ImpossibleDream2.xiz Binary files differ. diff --git a/banks/Misc/0089-Emptyness.xiz b/banks/Misc/0089-Emptyness.xiz Binary files differ. diff --git a/banks/Misc/0090-Space SynthBrass.xiz b/banks/Misc/0090-Space SynthBrass.xiz Binary files differ. diff --git a/banks/Misc/0091-Space Voice1.xiz b/banks/Misc/0091-Space Voice1.xiz Binary files differ. diff --git a/banks/Misc/0092-Space Voice2.xiz b/banks/Misc/0092-Space Voice2.xiz Binary files differ. diff --git a/banks/Misc/0093-Space Synth.xiz b/banks/Misc/0093-Space Synth.xiz Binary files differ. diff --git a/banks/Pads/0016-Sweep Pad 1.xiz b/banks/Pads/0016-Sweep Pad 1.xiz Binary files differ. diff --git a/banks/Pads/0017-Sweep Pad 1 Fat.xiz b/banks/Pads/0017-Sweep Pad 1 Fat.xiz Binary files differ. diff --git a/banks/Pads/0018-Sweep Pad 2.xiz b/banks/Pads/0018-Sweep Pad 2.xiz Binary files differ. diff --git a/banks/Pads/0019-Sweep Pad 3.xiz b/banks/Pads/0019-Sweep Pad 3.xiz Binary files differ. diff --git a/banks/Pads/0033-Synth Piano 1.xiz b/banks/Pads/0033-Synth Piano 1.xiz Binary files differ. diff --git a/banks/Pads/0048-Choir Pad1.xiz b/banks/Pads/0048-Choir Pad1.xiz Binary files differ. diff --git a/banks/Pads/0065-Dream of the Saw.xiz b/banks/Pads/0065-Dream of the Saw.xiz Binary files differ. diff --git a/banks/Pads/0129-Metal Sound 1.xiz b/banks/Pads/0129-Metal Sound 1.xiz Binary files differ. diff --git a/banks/Pads/0130-Metal Sound 2.xiz b/banks/Pads/0130-Metal Sound 2.xiz Binary files differ. diff --git a/banks/default_bank/0001-DX Rhodes 1.xiz b/banks/default_bank/0001-DX Rhodes 1.xiz Binary files differ. diff --git a/banks/default_bank/0002-DX Rhodes 2.xiz b/banks/default_bank/0002-DX Rhodes 2.xiz Binary files differ. diff --git a/banks/default_bank/0003-DX Rhodes 3.xiz b/banks/default_bank/0003-DX Rhodes 3.xiz Binary files differ. diff --git a/banks/default_bank/0004-FM Rhodes 1.xiz b/banks/default_bank/0004-FM Rhodes 1.xiz Binary files differ. diff --git a/banks/default_bank/0005-FM Rhodes 2.xiz b/banks/default_bank/0005-FM Rhodes 2.xiz Binary files differ. diff --git a/banks/default_bank/0006-FM Rhodes 3.xiz b/banks/default_bank/0006-FM Rhodes 3.xiz Binary files differ. diff --git a/banks/default_bank/0007-Synth Rhodes.xiz b/banks/default_bank/0007-Synth Rhodes.xiz Binary files differ. diff --git a/banks/default_bank/0008-DX Rhodes 4.xiz b/banks/default_bank/0008-DX Rhodes 4.xiz Binary files differ. diff --git a/banks/default_bank/0009-DX Rhodes 5.xiz b/banks/default_bank/0009-DX Rhodes 5.xiz Binary files differ. diff --git a/banks/default_bank/0010-Organ 1.xiz b/banks/default_bank/0010-Organ 1.xiz Binary files differ. diff --git a/banks/default_bank/0011-Organ 2.xiz b/banks/default_bank/0011-Organ 2.xiz Binary files differ. diff --git a/banks/default_bank/0012-Organ 3.xiz b/banks/default_bank/0012-Organ 3.xiz Binary files differ. diff --git a/banks/default_bank/0013-Organ 4.xiz b/banks/default_bank/0013-Organ 4.xiz Binary files differ. diff --git a/banks/default_bank/0014-Organ 5.xiz b/banks/default_bank/0014-Organ 5.xiz Binary files differ. diff --git a/banks/default_bank/0015-Organ 6.xiz b/banks/default_bank/0015-Organ 6.xiz Binary files differ. diff --git a/banks/default_bank/0016-Organ 7.xiz b/banks/default_bank/0016-Organ 7.xiz Binary files differ. diff --git a/banks/default_bank/0017-Organ 8.xiz b/banks/default_bank/0017-Organ 8.xiz Binary files differ. diff --git a/banks/default_bank/0018-Organ 9.xiz b/banks/default_bank/0018-Organ 9.xiz Binary files differ. diff --git a/banks/default_bank/0019-Organ 10.xiz b/banks/default_bank/0019-Organ 10.xiz Binary files differ. diff --git a/banks/default_bank/0020-Soft Organ 1.xiz b/banks/default_bank/0020-Soft Organ 1.xiz Binary files differ. diff --git a/banks/default_bank/0021-Soft Organ 2.xiz b/banks/default_bank/0021-Soft Organ 2.xiz Binary files differ. diff --git a/banks/default_bank/0022-Cathedral Organ1.xiz b/banks/default_bank/0022-Cathedral Organ1.xiz Binary files differ. diff --git a/banks/default_bank/0023-Cathedral Organ2.xiz b/banks/default_bank/0023-Cathedral Organ2.xiz Binary files differ. diff --git a/banks/default_bank/0024-Cathedral Organ3.xiz b/banks/default_bank/0024-Cathedral Organ3.xiz Binary files differ. diff --git a/banks/default_bank/0025-Square Organ.xiz b/banks/default_bank/0025-Square Organ.xiz Binary files differ. diff --git a/banks/default_bank/0026-Nice Organ 1.xiz b/banks/default_bank/0026-Nice Organ 1.xiz Binary files differ. diff --git a/banks/default_bank/0027-Nice Organ 2.xiz b/banks/default_bank/0027-Nice Organ 2.xiz Binary files differ. diff --git a/banks/default_bank/0028-Sub_Organ.xiz b/banks/default_bank/0028-Sub_Organ.xiz Binary files differ. diff --git a/banks/default_bank/0033-Analog Brass 1.xiz b/banks/default_bank/0033-Analog Brass 1.xiz Binary files differ. diff --git a/banks/default_bank/0034-Analog Brass 2.xiz b/banks/default_bank/0034-Analog Brass 2.xiz Binary files differ. diff --git a/banks/default_bank/0035-Synth Brazz 1.xiz b/banks/default_bank/0035-Synth Brazz 1.xiz Binary files differ. diff --git a/banks/default_bank/0036-Synth Brazz 2.xiz b/banks/default_bank/0036-Synth Brazz 2.xiz Binary files differ. diff --git a/banks/default_bank/0037-Brass Pad.xiz b/banks/default_bank/0037-Brass Pad.xiz Binary files differ. diff --git a/banks/default_bank/0038-Wah Brass.xiz b/banks/default_bank/0038-Wah Brass.xiz Binary files differ. diff --git a/banks/default_bank/0039-Wah1.xiz b/banks/default_bank/0039-Wah1.xiz Binary files differ. diff --git a/banks/default_bank/0040-Bass 1.xiz b/banks/default_bank/0040-Bass 1.xiz Binary files differ. diff --git a/banks/default_bank/0041-Bass 2.xiz b/banks/default_bank/0041-Bass 2.xiz Binary files differ. diff --git a/banks/default_bank/0042-Bass 3 (analog).xiz b/banks/default_bank/0042-Bass 3 (analog).xiz Binary files differ. diff --git a/banks/default_bank/0043-Bass 4.xiz b/banks/default_bank/0043-Bass 4.xiz Binary files differ. diff --git a/banks/default_bank/0044-Bass 5.xiz b/banks/default_bank/0044-Bass 5.xiz Binary files differ. diff --git a/banks/default_bank/0045-Wah Bass.xiz b/banks/default_bank/0045-Wah Bass.xiz Binary files differ. diff --git a/banks/default_bank/0046-FM Bass 1.xiz b/banks/default_bank/0046-FM Bass 1.xiz Binary files differ. diff --git a/banks/default_bank/0047-FM Bass 2.xiz b/banks/default_bank/0047-FM Bass 2.xiz Binary files differ. diff --git a/banks/default_bank/0048-Analogue Bass.xiz b/banks/default_bank/0048-Analogue Bass.xiz Binary files differ. diff --git a/banks/default_bank/0049-Solo Synth1.xiz b/banks/default_bank/0049-Solo Synth1.xiz Binary files differ. diff --git a/banks/default_bank/0051-Synth Saw 1.xiz b/banks/default_bank/0051-Synth Saw 1.xiz Binary files differ. diff --git a/banks/default_bank/0052-Synth Saw 2.xiz b/banks/default_bank/0052-Synth Saw 2.xiz Binary files differ. diff --git a/banks/default_bank/0053-Synth Saw 3.xiz b/banks/default_bank/0053-Synth Saw 3.xiz Binary files differ. diff --git a/banks/default_bank/0054-Saw Pad.xiz b/banks/default_bank/0054-Saw Pad.xiz Binary files differ. diff --git a/banks/default_bank/0055-Organ and Saw.xiz b/banks/default_bank/0055-Organ and Saw.xiz Binary files differ. diff --git a/banks/default_bank/0056-Synth Saw 4.xiz b/banks/default_bank/0056-Synth Saw 4.xiz Binary files differ. diff --git a/banks/default_bank/0057-Dark Synth Saw.xiz b/banks/default_bank/0057-Dark Synth Saw.xiz Binary files differ. diff --git a/banks/default_bank/0058-Strings1.xiz b/banks/default_bank/0058-Strings1.xiz Binary files differ. diff --git a/banks/default_bank/0060-Choir.xiz b/banks/default_bank/0060-Choir.xiz Binary files differ. diff --git a/banks/default_bank/0061-Slow Morph.Choir.xiz b/banks/default_bank/0061-Slow Morph.Choir.xiz Binary files differ. diff --git a/banks/default_bank/0062-Wah Choir.xiz b/banks/default_bank/0062-Wah Choir.xiz Binary files differ. diff --git a/banks/default_bank/0063-AHH Choir 1.xiz b/banks/default_bank/0063-AHH Choir 1.xiz Binary files differ. diff --git a/banks/default_bank/0064-AHH Choir 2.xiz b/banks/default_bank/0064-AHH Choir 2.xiz Binary files differ. diff --git a/banks/default_bank/0065-EHH Choir 1.xiz b/banks/default_bank/0065-EHH Choir 1.xiz Binary files differ. diff --git a/banks/default_bank/0070-Reed 1.xiz b/banks/default_bank/0070-Reed 1.xiz Binary files differ. diff --git a/banks/default_bank/0071-Clarinet.xiz b/banks/default_bank/0071-Clarinet.xiz Binary files differ. diff --git a/banks/default_bank/0072-FM Thrumpet.xiz b/banks/default_bank/0072-FM Thrumpet.xiz Binary files differ. diff --git a/banks/default_bank/0073-FM Reed.xiz b/banks/default_bank/0073-FM Reed.xiz Binary files differ. diff --git a/banks/default_bank/0074-Reed 2.xiz b/banks/default_bank/0074-Reed 2.xiz Binary files differ. diff --git a/banks/default_bank/0075-Reed 3.xiz b/banks/default_bank/0075-Reed 3.xiz Binary files differ. diff --git a/banks/default_bank/0076-Reed 4.xiz b/banks/default_bank/0076-Reed 4.xiz Binary files differ. diff --git a/banks/default_bank/0077-Fat Reed.xiz b/banks/default_bank/0077-Fat Reed.xiz Binary files differ. diff --git a/banks/default_bank/0080-Accordion Pad 1.xiz b/banks/default_bank/0080-Accordion Pad 1.xiz Binary files differ. diff --git a/banks/default_bank/0081-Square Pad 1.xiz b/banks/default_bank/0081-Square Pad 1.xiz Binary files differ. diff --git a/banks/default_bank/0082-Sine Pad.xiz b/banks/default_bank/0082-Sine Pad.xiz Binary files differ. diff --git a/banks/default_bank/0083-Noise Pad.xiz b/banks/default_bank/0083-Noise Pad.xiz Binary files differ. diff --git a/banks/default_bank/0084-Phased Pad 1.xiz b/banks/default_bank/0084-Phased Pad 1.xiz Binary files differ. diff --git a/banks/default_bank/0085-Analog Piano 1.xiz b/banks/default_bank/0085-Analog Piano 1.xiz Binary files differ. diff --git a/banks/default_bank/0086-Analog Piano 2.xiz b/banks/default_bank/0086-Analog Piano 2.xiz Binary files differ. diff --git a/banks/default_bank/0087-Soft Piano 1.xiz b/banks/default_bank/0087-Soft Piano 1.xiz Binary files differ. diff --git a/banks/default_bank/0088-Soft Piano 2.xiz b/banks/default_bank/0088-Soft Piano 2.xiz Binary files differ. diff --git a/banks/default_bank/0089-Analog Pad.xiz b/banks/default_bank/0089-Analog Pad.xiz Binary files differ. diff --git a/banks/default_bank/0090-FM Synth1.xiz b/banks/default_bank/0090-FM Synth1.xiz Binary files differ. diff --git a/banks/default_bank/0091-Accordion Pad 2.xiz b/banks/default_bank/0091-Accordion Pad 2.xiz Binary files differ. diff --git a/banks/default_bank/0092-Fantasy Bell.xiz b/banks/default_bank/0092-Fantasy Bell.xiz Binary files differ. diff --git a/banks/default_bank/0093-Square Pad 2.xiz b/banks/default_bank/0093-Square Pad 2.xiz Binary files differ. diff --git a/banks/default_bank/0094-Analog Piano 3.xiz b/banks/default_bank/0094-Analog Piano 3.xiz Binary files differ. diff --git a/banks/default_bank/0095-Phased Pad 2.xiz b/banks/default_bank/0095-Phased Pad 2.xiz Binary files differ. diff --git a/banks/default_bank/0096-Phased Pad 3.xiz b/banks/default_bank/0096-Phased Pad 3.xiz Binary files differ. diff --git a/banks/default_bank/0097-Multi-phase synth.xiz b/banks/default_bank/0097-Multi-phase synth.xiz Binary files differ. diff --git a/banks/default_bank/0098-Sequence.xiz b/banks/default_bank/0098-Sequence.xiz Binary files differ. diff --git a/banks/default_bank/0099-Analog Filter.xiz b/banks/default_bank/0099-Analog Filter.xiz Binary files differ. diff --git a/banks/default_bank/0100-Drums Kit.xiz b/banks/default_bank/0100-Drums Kit.xiz Binary files differ. diff --git a/banks/default_bank/0101-Pulse Pad 1.xiz b/banks/default_bank/0101-Pulse Pad 1.xiz Binary files differ. diff --git a/banks/default_bank/0102-Pulse Pad 2.xiz b/banks/default_bank/0102-Pulse Pad 2.xiz Binary files differ. diff --git a/banks/default_bank/0103-Octave Pad.xiz b/banks/default_bank/0103-Octave Pad.xiz Binary files differ. diff --git a/banks/default_bank/0104-Soft Saw Pad.xiz b/banks/default_bank/0104-Soft Saw Pad.xiz Binary files differ. diff --git a/banks/default_bank/0105-Weird Pad.xiz b/banks/default_bank/0105-Weird Pad.xiz Binary files differ. diff --git a/banks/default_bank/0106-Resonance Pad.xiz b/banks/default_bank/0106-Resonance Pad.xiz Binary files differ. diff --git a/banks/default_bank/0107-Analog Pad 2.xiz b/banks/default_bank/0107-Analog Pad 2.xiz Binary files differ. diff --git a/banks/default_bank/0108-Resonance Pad2.xiz b/banks/default_bank/0108-Resonance Pad2.xiz Binary files differ. diff --git a/banks/default_bank/0110-Plucked String1.xiz b/banks/default_bank/0110-Plucked String1.xiz Binary files differ. diff --git a/banks/default_bank/0111-Synth Violin.xiz b/banks/default_bank/0111-Synth Violin.xiz Binary files differ. diff --git a/banks/default_bank/0112-Vocal Morph 1.xiz b/banks/default_bank/0112-Vocal Morph 1.xiz Binary files differ. diff --git a/banks/default_bank/0113-Vocal Morph 2.xiz b/banks/default_bank/0113-Vocal Morph 2.xiz Binary files differ. diff --git a/banks/default_bank/0114-Vocal Morph 3.xiz b/banks/default_bank/0114-Vocal Morph 3.xiz Binary files differ. diff --git a/banks/default_bank/0115-Vocal Morph 4.xiz b/banks/default_bank/0115-Vocal Morph 4.xiz Binary files differ. diff --git a/banks/default_bank/0116-Vocal Morph 5.xiz b/banks/default_bank/0116-Vocal Morph 5.xiz Binary files differ. diff --git a/banks/default_bank/0117-Vocal Morph 6.xiz b/banks/default_bank/0117-Vocal Morph 6.xiz Binary files differ. diff --git a/banks/default_bank/0118-Plucked String 2.xiz b/banks/default_bank/0118-Plucked String 2.xiz Binary files differ. diff --git a/banks/default_bank/0119-Vocal Morph 7.xiz b/banks/default_bank/0119-Vocal Morph 7.xiz Binary files differ. diff --git a/banks/default_bank/0120-Synth Effect.xiz b/banks/default_bank/0120-Synth Effect.xiz Binary files differ. diff --git a/banks/default_bank/0121-Special FX1.xiz b/banks/default_bank/0121-Special FX1.xiz Binary files differ. diff --git a/banks/default_bank/0122-Special FX2.xiz b/banks/default_bank/0122-Special FX2.xiz Binary files differ. diff --git a/banks/default_bank/0123-Echo FX.xiz b/banks/default_bank/0123-Echo FX.xiz Binary files differ. diff --git a/banks/default_bank/0125-Layered.xiz b/banks/default_bank/0125-Layered.xiz Binary files differ. diff --git a/banks/default_bank/0126-Strings and Reed.xiz b/banks/default_bank/0126-Strings and Reed.xiz Binary files differ. diff --git a/banks/default_bank/0127-Choir and Reed.xiz b/banks/default_bank/0127-Choir and Reed.xiz Binary files differ. diff --git a/banks/default_bank/0128-Layered2.xiz b/banks/default_bank/0128-Layered2.xiz Binary files differ. diff --git a/banks/default_bank/0129-Strings and Ree2.xiz b/banks/default_bank/0129-Strings and Ree2.xiz Binary files differ. diff --git a/examples/Big_Pad.mas_zyn b/examples/Big_Pad.mas_zyn Binary files differ. diff --git a/examples/Big_Pad_2.mas_zyn b/examples/Big_Pad_2.mas_zyn Binary files differ. diff --git a/examples/Big_Pad_2resonance.mas_zyn b/examples/Big_Pad_2resonance.mas_zyn Binary files differ. diff --git a/examples/Instruments/accomp00.ins_zyn b/examples/Instruments/accomp00.ins_zyn Binary files differ. diff --git a/examples/Instruments/accomp01.ins_zyn b/examples/Instruments/accomp01.ins_zyn Binary files differ. diff --git a/examples/Instruments/bpsaw.ins_zyn b/examples/Instruments/bpsaw.ins_zyn Binary files differ. diff --git a/examples/Instruments/choir01.ins_zyn b/examples/Instruments/choir01.ins_zyn Binary files differ. diff --git a/examples/Instruments/fmthrumpet.ins_zyn b/examples/Instruments/fmthrumpet.ins_zyn Binary files differ. diff --git a/examples/Instruments/organ00.ins_zyn b/examples/Instruments/organ00.ins_zyn Binary files differ. diff --git a/examples/Instruments/organ01.ins_zyn b/examples/Instruments/organ01.ins_zyn Binary files differ. diff --git a/examples/Instruments/organ02.ins_zyn b/examples/Instruments/organ02.ins_zyn Binary files differ. diff --git a/examples/Instruments/organ03.ins_zyn b/examples/Instruments/organ03.ins_zyn Binary files differ. diff --git a/examples/Instruments/organ04.ins_zyn b/examples/Instruments/organ04.ins_zyn Binary files differ. diff --git a/examples/Instruments/res01.ins_zyn b/examples/Instruments/res01.ins_zyn Binary files differ. diff --git a/examples/Instruments/res02.ins_zyn b/examples/Instruments/res02.ins_zyn Binary files differ. diff --git a/examples/Instruments/res03.ins_zyn b/examples/Instruments/res03.ins_zyn Binary files differ. diff --git a/examples/Instruments/rhodes00.ins_zyn b/examples/Instruments/rhodes00.ins_zyn Binary files differ. diff --git a/examples/Instruments/rhodes01.ins_zyn b/examples/Instruments/rhodes01.ins_zyn Binary files differ. diff --git a/examples/Instruments/rhodes02.ins_zyn b/examples/Instruments/rhodes02.ins_zyn Binary files differ. diff --git a/examples/Instruments/soft_organ.ins_zyn b/examples/Instruments/soft_organ.ins_zyn Binary files differ. diff --git a/examples/Instruments/synth_brazz.ins_zyn b/examples/Instruments/synth_brazz.ins_zyn Binary files differ. diff --git a/examples/Rhodes_chorus.mas_zyn b/examples/Rhodes_chorus.mas_zyn Binary files differ. diff --git a/examples/Rhodes_chorus2.mas_zyn b/examples/Rhodes_chorus2.mas_zyn Binary files differ. diff --git a/examples/Scales/5-24.scl_zyn b/examples/Scales/5-24.scl_zyn Binary files differ. diff --git a/examples/Scales/8-11.scl_zyn b/examples/Scales/8-11.scl_zyn Binary files differ. diff --git a/examples/Scales/IntenseDiatonic_mapped.scl_zyn b/examples/Scales/IntenseDiatonic_mapped.scl_zyn Binary files differ. diff --git a/examples/Scales/Just Intonation.scl_zyn b/examples/Scales/Just Intonation.scl_zyn Binary files differ. diff --git a/examples/Scales/harrison.scl_zyn b/examples/Scales/harrison.scl_zyn Binary files differ. diff --git a/examples/Scales/pyth.scl_zyn b/examples/Scales/pyth.scl_zyn Binary files differ. diff --git a/examples/Split_keyboard.mas_zyn b/examples/Split_keyboard.mas_zyn Binary files differ. diff --git a/examples/Wednesday.mas_zyn b/examples/Wednesday.mas_zyn Binary files differ. diff --git a/examples/analogpiano.mas_zyn b/examples/analogpiano.mas_zyn Binary files differ. diff --git a/examples/brazz.mas_zyn b/examples/brazz.mas_zyn Binary files differ. diff --git a/examples/brazz2.mas_zyn b/examples/brazz2.mas_zyn Binary files differ. diff --git a/examples/brazz3.mas_zyn b/examples/brazz3.mas_zyn Binary files differ. diff --git a/examples/brazz4.mas_zyn b/examples/brazz4.mas_zyn Binary files differ. diff --git a/examples/dec10.mas_zyn b/examples/dec10.mas_zyn Binary files differ. diff --git a/examples/distortion_and_strings.mas_zyn b/examples/distortion_and_strings.mas_zyn Binary files differ. diff --git a/examples/distortion_and_strings2.mas_zyn b/examples/distortion_and_strings2.mas_zyn Binary files differ. diff --git a/examples/dream_piano.mas_zyn b/examples/dream_piano.mas_zyn Binary files differ. diff --git a/examples/dream_piano2.mas_zyn b/examples/dream_piano2.mas_zyn Binary files differ. diff --git a/examples/empty.mas_zyn b/examples/empty.mas_zyn Binary files differ. diff --git a/examples/examples.mas_zyn b/examples/examples.mas_zyn Binary files differ. diff --git a/examples/far_away.mas_zyn b/examples/far_away.mas_zyn Binary files differ. diff --git a/examples/flanged_guitar.mas_zyn b/examples/flanged_guitar.mas_zyn Binary files differ. diff --git a/examples/hypersaw1.mas_zyn b/examples/hypersaw1.mas_zyn Binary files differ. diff --git a/examples/hypersaw2.mas_zyn b/examples/hypersaw2.mas_zyn Binary files differ. diff --git a/examples/hypersaw3.mas_zyn b/examples/hypersaw3.mas_zyn Binary files differ. diff --git a/examples/ins01.mas_zyn b/examples/ins01.mas_zyn Binary files differ. diff --git a/examples/ins02.mas_zyn b/examples/ins02.mas_zyn Binary files differ. diff --git a/examples/ins03.mas_zyn b/examples/ins03.mas_zyn Binary files differ. diff --git a/examples/ins04.mas_zyn b/examples/ins04.mas_zyn Binary files differ. diff --git a/examples/ins05.mas_zyn b/examples/ins05.mas_zyn Binary files differ. diff --git a/examples/ins06.mas_zyn b/examples/ins06.mas_zyn Binary files differ. diff --git a/examples/ins07.mas_zyn b/examples/ins07.mas_zyn Binary files differ. diff --git a/examples/ins08.mas_zyn b/examples/ins08.mas_zyn Binary files differ. diff --git a/examples/november.mas_zyn b/examples/november.mas_zyn Binary files differ. diff --git a/examples/oops.mas_zyn b/examples/oops.mas_zyn Binary files differ. diff --git a/examples/organ1.mas_zyn b/examples/organ1.mas_zyn Binary files differ. diff --git a/examples/organ_pad.mas_zyn b/examples/organ_pad.mas_zyn Binary files differ. diff --git a/examples/organ_pad2.mas_zyn b/examples/organ_pad2.mas_zyn Binary files differ. diff --git a/examples/rezzy_synth_reverberated.mas_zyn b/examples/rezzy_synth_reverberated.mas_zyn Binary files differ. diff --git a/examples/string_and_rhodes.mas_zyn b/examples/string_and_rhodes.mas_zyn Binary files differ. diff --git a/examples/synth_reverberated.mas_zyn b/examples/synth_reverberated.mas_zyn Binary files differ. diff --git a/examples/synth_reverberated2.mas_zyn b/examples/synth_reverberated2.mas_zyn Binary files differ. diff --git a/src/DSP/Filter.C b/src/DSP/Filter.C @@ -31,7 +31,6 @@ Filter::Filter(FilterParams *pars){ category=pars->Pcategory; - switch (category) { case 1:filter=new FormantFilter(pars); break; diff --git a/src/DSP/Filter.h b/src/DSP/Filter.h @@ -44,7 +44,6 @@ class Filter{ private: Filter_ *filter; unsigned char category; - }; diff --git a/src/Effects/Alienwah.C b/src/Effects/Alienwah.C @@ -94,30 +94,6 @@ void Alienwah::out(REALTYPE *smpsl,REALTYPE *smpsr){ oldclfol.a=clfol.a;oldclfol.b=clfol.b; oldclfor.a=clfor.a;oldclfor.b=clfor.b; - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume; - efxoutr[i]*=2.0*volume; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - - }; /* diff --git a/src/Effects/Alienwah.h b/src/Effects/Alienwah.h @@ -67,7 +67,7 @@ class Alienwah:public Effect { //Valorile interne int insertion; - REALTYPE volume,panning,fb,depth,lrcross,phase; + REALTYPE panning,fb,depth,lrcross,phase; COMPLEXTYPE *oldl,*oldr; COMPLEXTYPE oldclfol,oldclfor; int oldk; diff --git a/src/Effects/Chorus.C b/src/Effects/Chorus.C @@ -123,27 +123,10 @@ void Chorus::out(REALTYPE *smpsl,REALTYPE *smpsr){ efxoutr[i] *= -1.0; }; - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*panning*v2*2.0; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*(1.0-panning)*v2*2.0; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume*panning; - efxoutr[i]*=2.0*volume*(1.0-panning); - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; + + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + efxoutl[i]*=panning; + efxoutr[i]*=(1.0-panning); }; }; diff --git a/src/Effects/Chorus.h b/src/Effects/Chorus.h @@ -60,7 +60,7 @@ class Chorus:public Effect { void setlrcross(unsigned char Plrcross); //Valorile interne - REALTYPE depth,delay,fb,lrcross,volume,panning; + REALTYPE depth,delay,fb,lrcross,panning; REALTYPE dl1,dl2,dr1,dr2,lfol,lfor; int insertion,maxdelay; REALTYPE *delayl,*delayr; diff --git a/src/Effects/Distorsion.C b/src/Effects/Distorsion.C @@ -133,30 +133,6 @@ void Distorsion::out(REALTYPE *smpsl,REALTYPE *smpsr){ }; - - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume; - efxoutr[i]*=2.0*volume; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - }; diff --git a/src/Effects/Distorsion.h b/src/Effects/Distorsion.h @@ -37,6 +37,7 @@ class Distorsion:public Effect{ unsigned char getpar(int npar); void cleanup(); void applyfilters(REALTYPE *efxoutl,REALTYPE *efxoutr); + private: //Parametrii unsigned char Pvolume; //Volumul or E/R @@ -58,7 +59,7 @@ class Distorsion:public Effect{ void sethpf(unsigned char Phpf); //Parametrii reali - REALTYPE volume,panning,lrcross; + REALTYPE panning,lrcross; AnalogFilter *lpfl,*lpfr,*hpfl,*hpfr; }; diff --git a/src/Effects/DynamicFilter.C b/src/Effects/DynamicFilter.C @@ -91,31 +91,6 @@ void DynamicFilter::out(REALTYPE *smpsl,REALTYPE *smpsr){ efxoutl[i]*=panning; efxoutr[i]*=(1.0-panning); }; - - - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume; - efxoutr[i]*=2.0*volume; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - }; diff --git a/src/Effects/DynamicFilter.h b/src/Effects/DynamicFilter.h @@ -38,6 +38,8 @@ class DynamicFilter:public Effect { void changepar(int npar,unsigned char value); unsigned char getpar(int npar); void cleanup(); + +// void setdryonly(); private: //Parametrii DynamicFilter @@ -59,7 +61,7 @@ class DynamicFilter:public Effect { //Valorile interne int insertion; - REALTYPE volume,panning,depth,ampsns,ampsmooth; + REALTYPE panning,depth,ampsns,ampsmooth; Filter *filterl,*filterr; diff --git a/src/Effects/EQ.C b/src/Effects/EQ.C @@ -79,22 +79,6 @@ void EQ::out(REALTYPE *smpsl,REALTYPE *smpsr){ filter[i].l->filterout(efxoutl); filter[i].r->filterout(efxoutr); }; - - //Insertion effect - if (insertion!=0) { - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume; - efxoutr[i]*=2.0*volume; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - }; diff --git a/src/Effects/EQ.h b/src/Effects/EQ.h @@ -50,7 +50,6 @@ class EQ:public Effect{ AnalogFilter *l,*r; }filter[MAX_EQ_BANDS]; - REALTYPE volume; }; diff --git a/src/Effects/Echo.C b/src/Effects/Echo.C @@ -111,30 +111,6 @@ void Echo::out(REALTYPE *smpsl,REALTYPE *smpsr){ if (++kr>=dr) kr=0; }; - - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0*volume; - efxoutr[i]*=2.0*volume; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - }; diff --git a/src/Effects/Echo.h b/src/Effects/Echo.h @@ -36,6 +36,7 @@ class Echo:public Effect{ unsigned char getpar(int npar); void cleanup(); + void setdryonly(); private: //Parametrii unsigned char Pvolume;//Volumul or E/R @@ -55,7 +56,7 @@ class Echo:public Effect{ void sethidamp(unsigned char Phidamp); //Parametrii reali - REALTYPE volume,panning,lrcross,fb,hidamp; + REALTYPE panning,lrcross,fb,hidamp; int dl,dr,delay,lrdelay; void initdelays(); diff --git a/src/Effects/Effect.h b/src/Effects/Effect.h @@ -46,10 +46,12 @@ class Effect{ REALTYPE outvolume;//this is the volume of effect and is public because need it in system effect. The out volume of such effects are always 1.0, so this setting tells me how is the volume to the Master Output only. + REALTYPE volume; + FilterParams *filterpars; protected: - int insertion;//1 for insertion effect + int insertion;//1 for insertion effect }; #endif diff --git a/src/Effects/EffectMgr.C b/src/Effects/EffectMgr.C @@ -36,6 +36,7 @@ EffectMgr::EffectMgr(int insertion_,pthread_mutex_t *mutex_){ efxoutr[i]=0.0; }; filterpars=NULL; + dryonly=false; defaults(); }; @@ -48,6 +49,7 @@ EffectMgr::~EffectMgr(){ void EffectMgr::defaults(){ changeeffect(0); + setdryonly(false); }; /* @@ -159,15 +161,61 @@ void EffectMgr::out(REALTYPE *smpsl,REALTYPE *smpsr){ if (insertion==0) for (i=0;i<SOUND_BUFFER_SIZE;i++){ smpsl[i]=0.0;smpsr[i]=0.0; + efxoutl[i]=0.0;efxoutr[i]=0.0; }; return; }; for (i=0;i<SOUND_BUFFER_SIZE;i++){ smpsl[i]+=denormalkillbuf[i]; smpsr[i]+=denormalkillbuf[i]; + efxoutl[i]=0.0; + efxoutr[i]=0.0; }; efx->out(smpsl,smpsr); + REALTYPE volume=efx->volume; + + if (nefx==7){//this is need only for the EQ effect + for (i=0;i<SOUND_BUFFER_SIZE;i++){ + smpsl[i]=efxoutl[i]; + smpsr[i]=efxoutr[i]; + }; + }; + + //Insertion effect + if (insertion!=0) { + REALTYPE v1,v2; + if (volume<0.5) { + v1=1.0; + v2=volume*2.0; + } else { + v1=(1.0-volume)*2.0; + v2=1.0; + }; + 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 (i=0;i<SOUND_BUFFER_SIZE;i++){ + smpsl[i]*=v1; + smpsr[i]*=v1; + efxoutl[i]*=v2; + efxoutr[i]*=v2; + }; + }else{//normal instrument/insertion effect + for (i=0;i<SOUND_BUFFER_SIZE;i++){ + smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2; + smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2; + }; + }; + } else {//System effect + for (i=0;i<SOUND_BUFFER_SIZE;i++){ + efxoutl[i]*=2.0*volume; + efxoutr[i]*=2.0*volume; + smpsl[i]=efxoutl[i]; + smpsr[i]=efxoutr[i]; + }; + }; + }; /* @@ -188,6 +236,10 @@ REALTYPE EffectMgr::getEQfreqresponse(REALTYPE freq){ }; +void EffectMgr::setdryonly(bool value){ + dryonly=value; +}; + /* * Save or load the parameters to/from the buffer diff --git a/src/Effects/EffectMgr.h b/src/Effects/EffectMgr.h @@ -52,10 +52,12 @@ class EffectMgr{ void out(REALTYPE *smpsl,REALTYPE *smpsr); + void setdryonly(bool value); + //get the output(to speakers) volume of the systemeffect REALTYPE sysefxgetvolume(); - void cleanup();//cleanup the effec5 + void cleanup();//cleanup the effect void changeeffect(int nefx_); int geteffect(); @@ -77,6 +79,7 @@ class EffectMgr{ int nefx; Effect *efx; pthread_mutex_t *mutex; + bool dryonly; }; #endif diff --git a/src/Effects/Phaser.C b/src/Effects/Phaser.C @@ -106,30 +106,6 @@ void Phaser::out(REALTYPE *smpsl,REALTYPE *smpsr){ efxoutr[i]*= -1.0; }; - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smpsl[i]=smpsl[i]*v1+efxoutl[i]*v2*2.0; - smpsr[i]=smpsr[i]*v1+efxoutr[i]*v2*2.0; - }; - } else {//System effect - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=2.0; - efxoutr[i]*=2.0; - smpsl[i]=efxoutl[i]; - smpsr[i]=efxoutr[i]; - }; - }; - - }; /* diff --git a/src/Effects/Phaser.h b/src/Effects/Phaser.h @@ -36,6 +36,7 @@ class Phaser:public Effect { void changepar(int npar,unsigned char value); unsigned char getpar(int npar); void cleanup(); + void setdryonly(); private: //Parametrii Phaser @@ -60,7 +61,7 @@ class Phaser:public Effect { //Valorile interne int insertion; - REALTYPE volume,panning,fb,depth,lrcross,fbl,fbr,phase; + REALTYPE panning,fb,depth,lrcross,fbl,fbr,phase; REALTYPE *oldl,*oldr; REALTYPE oldlgain,oldrgain; }; diff --git a/src/Effects/Reverb.C b/src/Effects/Reverb.C @@ -167,39 +167,18 @@ void Reverb::out(REALTYPE *smps_l, REALTYPE *smps_r){ if (lpf!=NULL) lpf->filterout(inputbuf); if (hpf!=NULL) hpf->filterout(inputbuf); - for (int i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]=0.0; - efxoutr[i]=0.0; - }; - processmono(0,efxoutl);//left processmono(1,efxoutr);//right - //Insertion effect - if (insertion!=0) { - REALTYPE v1,v2; - if (volume<0.5) { - v1=1.0; - v2=volume*2.0; - } else { - v1=(1.0-volume)*2.0; - v2=1.0; - }; - v2*=rs/REV_COMBS*2.0; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - smps_l[i]=smps_l[i]*v1+efxoutl[i]*v2*pan; - smps_r[i]=smps_r[i]*v1+efxoutr[i]*v2*(1.0-pan); - }; - } else {//System effect - REALTYPE vol=rs*2.0/REV_COMBS; - for (i=0;i<SOUND_BUFFER_SIZE;i++){ - efxoutl[i]*=vol*pan; - efxoutr[i]*=vol*(1.0-pan); - smps_l[i]=efxoutl[i]; - smps_r[i]=efxoutr[i]; - }; + REALTYPE lvol=rs/REV_COMBS*pan; + REALTYPE rvol=rs/REV_COMBS*(1.0-pan); + if (insertion!=0){ + lvol*=2;rvol*=2; + }; + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + efxoutl[i]*=lvol; + efxoutr[i]*=rvol; }; - }; diff --git a/src/Effects/Reverb.h b/src/Effects/Reverb.h @@ -41,7 +41,7 @@ class Reverb:public Effect { void setpreset(unsigned char npreset); void changepar(int npar,unsigned char value); unsigned char getpar(int npar); - + private: //Parametrii //Amount of the reverb, @@ -92,7 +92,7 @@ class Reverb:public Effect { void settype(unsigned char Ptype); void setroomsize(unsigned char Proomsize); - REALTYPE volume,pan,erbalance; + REALTYPE pan,erbalance; //Parametrii 2 int lohidamptype;//0=disable,1=highdamp(lowpass),2=lowdamp(highpass) int idelaylen,rdelaylen; diff --git a/src/Makefile b/src/Makefile @@ -27,15 +27,15 @@ ifeq ($(MIDIIN),ALSA) LIBS+= -lasound endif -ifeq ($(MIDIIN),WIN) -LIBS+= -lwinmm -endif - - ifeq ($(AUDIOOUT),PA) LIBS+= -lportaudio endif +ifeq ($(OS_PORT),WINDOWS) +LIBS+= -lwinmm +endif + + ifeq ($(AUDIOOUT),JACK) CXXFLAGS += `pkg-config --cflags jack` LIBS+= `pkg-config --libs jack` diff --git a/src/Misc/Bank.C b/src/Misc/Bank.C @@ -34,14 +34,13 @@ #include "Config.h" -#define INSTRUMENT_EXTENSION ".xml" -//.xzz +#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" Bank::Bank(){ - memset(defaultinsname,0,PART_MAX_NAME_LEN); + ZERO(defaultinsname,PART_MAX_NAME_LEN); snprintf(defaultinsname,PART_MAX_NAME_LEN,"%s"," "); for (int i=0;i<BANK_SIZE;i++){ @@ -101,8 +100,8 @@ void Bank::setname(unsigned int ninstrument,const char *newname,int newslot){ char newfilename[1000+1],tmpfilename[100+1]; - memset(newfilename,0,1001); - memset(tmpfilename,0,101); + ZERO(newfilename,1001); + ZERO(tmpfilename,101); if (newslot>=0) snprintf(tmpfilename,100,"%4d-%s",newslot+1,newname); else snprintf(tmpfilename,100,"%4d-%s",ninstrument+1,newname); @@ -120,7 +119,7 @@ void Bank::setname(unsigned int ninstrument,const char *newname,int newslot){ tmpfilename[i]='_'; }; - snprintf(newfilename,1000,"%s/%s.xmlz",dirname,tmpfilename); + snprintf(newfilename,1000,"%s/%s.xiz",dirname,tmpfilename); rename(ins[ninstrument].filename,newfilename); snprintf(ins[ninstrument].filename,1000,"%s",newfilename); @@ -156,7 +155,7 @@ void Bank::savetoslot(unsigned int ninstrument,Part *part){ const int maxfilename=200; char tmpfilename[maxfilename+20]; - memset(tmpfilename,0,maxfilename+20); + ZERO(tmpfilename,maxfilename+20); snprintf(tmpfilename,maxfilename,"%4d-%s",ninstrument+1,(char *)part->Pname); @@ -174,16 +173,12 @@ void Bank::savetoslot(unsigned int ninstrument,Part *part){ tmpfilename[i]='_'; }; - strncat(tmpfilename,".xml",maxfilename+10); + strncat(tmpfilename,".xiz",maxfilename+10); int fnsize=strlen(dirname)+strlen(tmpfilename)+10; - char *filename=new char[fnsize+1]; - memset(filename,0,fnsize+2); + char *filename=new char[fnsize+4]; + ZERO(filename,fnsize+2); - if (config.cfg.GzipCompression) { - tmpfilename[strlen(tmpfilename)]='z'; - tmpfilename[strlen(tmpfilename)+1]=0; - }; snprintf(filename,fnsize,"%s/%s",dirname,tmpfilename); remove(filename); @@ -230,6 +225,7 @@ int Bank::loadbank(const char *bankdirname){ const char *filename= fn->d_name; //sa verific daca e si extensia dorita + if (strstr(filename,INSTRUMENT_EXTENSION)==NULL) continue; //verify if the name is like this NNNN-name (where N is a digit) int no=0; @@ -248,7 +244,7 @@ int Bank::loadbank(const char *bankdirname){ if ((startname+1)<strlen(filename)) startname++;//to take out the "-" char name[PART_MAX_NAME_LEN+1]; - memset(name,0,PART_MAX_NAME_LEN+1); + ZERO(name,PART_MAX_NAME_LEN+1); snprintf(name,PART_MAX_NAME_LEN,"%s",filename); //remove the file extension @@ -502,13 +498,13 @@ int Bank::addtobank(int pos, const char *filename, const char* name){ void Bank::deletefrombank(int pos){ if ((pos<0)||(pos>=BANK_SIZE)) return; ins[pos].used=false; - memset(ins[pos].name,0,PART_MAX_NAME_LEN+1); + ZERO(ins[pos].name,PART_MAX_NAME_LEN+1); if (ins[pos].filename!=NULL) { delete (ins[pos].filename); ins[pos].filename=NULL; }; - memset(tmpinsname[pos],0,PART_MAX_NAME_LEN+20); + ZERO(tmpinsname[pos],PART_MAX_NAME_LEN+20); }; diff --git a/src/Misc/Config.C b/src/Misc/Config.C @@ -57,7 +57,7 @@ Config::Config(){ cfg.GzipCompression=3; -// cfg.Interpolation=0; + cfg.Interpolation=0; winwavemax=1;winmidimax=1; //try to find out how many input midi devices are there @@ -82,7 +82,7 @@ Config::Config(){ cfg.bankRootDirList=new char[MAX_STRING_SIZE]; #if defined(OS_LINUX) - sprintf(cfg.bankRootDirList,"~/banks\n./\n/usr/share/zynaddsubfx/banks\n/usr/local/share/zynaddsubfx/banks\n"); + sprintf(cfg.bankRootDirList,"~/banks\n./\n/usr/share/zynaddsubfx/banks\n/usr/local/share/zynaddsubfx/banks\n../banks\n"); #else sprintf(cfg.bankRootDirList,"./"); #endif @@ -129,6 +129,7 @@ void Config::readConfig(char *filename){ xmlcfg->getparstr("bank_current",cfg.currentBankDir,MAX_STRING_SIZE); xmlcfg->getparstr("bank_root_list",cfg.bankRootDirList,MAX_STRING_SIZE); + cfg.Interpolation=xmlcfg->getpar("interpolation",cfg.Interpolation,0,1); //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); @@ -165,6 +166,8 @@ void Config::saveConfig(char *filename){ xmlcfg->addparstr("bank_current",cfg.currentBankDir); xmlcfg->addparstr("bank_root_list",cfg.bankRootDirList); + 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); diff --git a/src/Misc/Config.h b/src/Misc/Config.h @@ -37,7 +37,7 @@ class Config{ int BankUIAutoClose; int DumpNotesToFile,DumpAppend; int GzipCompression; -// int Interpolation; + int Interpolation; char *DumpFile; char *bankRootDirList,*currentBankDir; } cfg; diff --git a/src/Misc/Master.C b/src/Misc/Master.C @@ -738,7 +738,7 @@ void Master::exportbankasxmldirectory(const char *bankfilename){ snprintf(nostr,10,"%4d",slot+1); for (int i=0;i<strlen(nostr);i++) if (nostr[i]==' ') nostr[i]='0'; - snprintf(filename,1000,"%s/%s-%s.xml",directory,nostr,oldbank.getname(slot)); + snprintf(filename,1000,"%s/%s-%s.xiz",directory,nostr,oldbank.getname(slot)); printf("%s\n",filename); tmppart->saveXML(filename); }; @@ -807,18 +807,15 @@ void Master::add2XML(XMLwrapper *xml){ int Master::saveXML(char *filename){ - - //sa pun aici un test daca exista fisierul - XMLwrapper *xml=new XMLwrapper(); xml->beginbranch("MASTER"); add2XML(xml); xml->endbranch(); - xml->saveXMLfile(filename); + int result=xml->saveXMLfile(filename); delete (xml); - return(0); + return(result); }; @@ -839,7 +836,6 @@ int Master::loadXML(char *filename){ }; 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); diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -47,7 +47,7 @@ class Master{ void exportbankasxmldirectory(const char *bankfilename); //saves all settings to a XML file - //returns 0 for ok, 1 if there is a existing file or -1 if there is an error + //returns 0 for ok or <0 if there is an error int saveXML(char *filename); //this adds the parameters to the XML data diff --git a/src/Misc/Microtonal.C b/src/Misc/Microtonal.C @@ -662,3 +662,31 @@ void Microtonal::getfromXML(XMLwrapper *xml){ }; +int Microtonal::saveXML(char *filename){ + XMLwrapper *xml=new XMLwrapper(); + + xml->beginbranch("MICROTONAL"); + add2XML(xml); + xml->endbranch(); + + int result=xml->saveXMLfile(filename); + delete (xml); + return(result); +}; + +int Microtonal::loadXML(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/src/Misc/Microtonal.h b/src/Misc/Microtonal.h @@ -90,6 +90,8 @@ class Microtonal{ void add2XML(XMLwrapper *xml); void getfromXML(XMLwrapper *xml); + int saveXML(char *filename); + int loadXML(char *filename); private: int linetotunings(unsigned int nline,const char *line); diff --git a/src/Misc/OldBank.C b/src/Misc/OldBank.C @@ -33,10 +33,10 @@ OldBank::OldBank(){ bankfilename=NULL;bankfiletitle=NULL;lock=1; - memset(&defaultinsname,0,PART_MAX_NAME_LEN); + ZERO(&defaultinsname,PART_MAX_NAME_LEN); snprintf(defaultinsname,PART_MAX_NAME_LEN,"%s"," "); for (int i=0;i<128;i++){ - memset(&ins[i].name[0],0,PART_MAX_NAME_LEN); + ZERO(&ins[i].name[0],PART_MAX_NAME_LEN); ins[i].size=0; ins[i].data=NULL; }; @@ -63,7 +63,7 @@ char *OldBank::getname (unsigned char ninstrument){ */ char *OldBank::getnamenumbered (unsigned char ninstrument){ if (ninstrument>=128) return(&tmpinsname[0][0]); - memset(&tmpinsname[ninstrument][0],0,PART_MAX_NAME_LEN+15); + ZERO(&tmpinsname[ninstrument][0],PART_MAX_NAME_LEN+15); snprintf(&tmpinsname[ninstrument][0],PART_MAX_NAME_LEN,"%d. %s",ninstrument+1,getname(ninstrument)); return(&tmpinsname[ninstrument][0]); }; @@ -172,7 +172,7 @@ int OldBank::loadfile(){ //get the name unsigned char namesize; read (file,&namesize,1); - memset(&ins[ni].name[0],0,PART_MAX_NAME_LEN);//???????? + ZERO(&ins[ni].name[0],PART_MAX_NAME_LEN);//???????? read (file,&ins[ni].name[0],namesize); //get the data unsigned int datasize; diff --git a/src/Misc/Part.C b/src/Misc/Part.C @@ -37,11 +37,12 @@ Part::Part(Microtonal *microtonal_,FFTwrapper *fft_, pthread_mutex_t *mutex_){ 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].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); // ADPartParameters=kit[0].adpars; // SUBPartParameters=kit[0].subpars; @@ -66,6 +67,7 @@ Part::Part(Microtonal *microtonal_,FFTwrapper *fft_, pthread_mutex_t *mutex_){ for (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; }; @@ -98,11 +100,11 @@ void Part::defaults(){ }; void Part::defaultsinstrument(){ - memset(Pname,0,PART_MAX_NAME_LEN); + ZERO(Pname,PART_MAX_NAME_LEN); info.Ptype=0; - memset(info.Pauthor,0,MAX_INFO_TEXT_SIZE+1); - memset(info.Pcomments,0,MAX_INFO_TEXT_SIZE+1); + ZERO(info.Pauthor,MAX_INFO_TEXT_SIZE+1); + ZERO(info.Pcomments,MAX_INFO_TEXT_SIZE+1); Pkitmode=0; Pdrummode=0; @@ -110,8 +112,8 @@ void Part::defaultsinstrument(){ 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; - memset(kit[n].Pname,0,PART_MAX_NAME_LEN); + 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); }; @@ -119,6 +121,7 @@ void Part::defaultsinstrument(){ 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(); @@ -155,7 +158,8 @@ Part::~Part(){ 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); - kit[n].adpars=NULL;kit[n].subpars=NULL; + 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); }; @@ -237,7 +241,8 @@ void Part::NoteOn(unsigned char note,unsigned char velocity,int masterkeyshift){ 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); if (kit[0].Psubenabled!=0) partnote[pos].kititem[0].subnote=new SUBnote(kit[0].subpars,&ctl,notebasefreq,vel,portamento,note); - if ((kit[0].Padenabled!=0)||(kit[0].Psubenabled!=0)) partnote[pos].itemsplaying++; + if (kit[0].Ppadenabled!=0) partnote[pos].kititem[0].padnote=new PADnote(kit[0].padpars,&ctl,notebasefreq,vel,portamento,note); + if ((kit[0].Padenabled!=0)||(kit[0].Psubenabled!=0)||(kit[0].Ppadenabled!=0)) partnote[pos].itemsplaying++; } else {//init the notes for the "kit mode" for (int item=0;item<NUM_KIT_ITEMS;item++){ @@ -255,9 +260,12 @@ void Part::NoteOn(unsigned char note,unsigned char velocity,int masterkeyshift){ if ((kit[item].subpars!=NULL)&&(kit[item].Psubenabled)!=0) partnote[pos].kititem[ci].subnote=new SUBnote(kit[item].subpars,&ctl,notebasefreq,vel,portamento,note); + if ((kit[item].padpars!=NULL)&&(kit[item].Ppadenabled)!=0) + partnote[pos].kititem[ci].padnote=new PADnote(kit[item].padpars,&ctl,notebasefreq,vel,portamento,note); + if ((kit[item].adpars!=NULL)|| (kit[item].subpars!=NULL)) { partnote[pos].itemsplaying++; - if ( ((kit[item].Padenabled!=0)||(kit[item].Psubenabled!=0)) + if ( ((kit[item].Padenabled!=0)||(kit[item].Psubenabled!=0)||(kit[item].Ppadenabled!=0)) && (Pkitmode==2) ) break; }; }; @@ -355,7 +363,7 @@ void Part::SetController(unsigned int type,int par){ void Part::RelaseSustainedKeys(){ for (int i=0;i<POLIPHONY;i++) - if (partnote[i].status==KEY_RELASED_AND_SUSTAINED) RelaseNotePos(i); + if (partnote[i].status==KEY_RELASED_AND_SUSTAINED) RelaseNotePos(i); }; /* @@ -384,6 +392,10 @@ void Part::RelaseNotePos(int pos){ 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; }; @@ -407,6 +419,10 @@ void Part::KillNotePos(int pos){ 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; @@ -478,7 +494,8 @@ void Part::ComputePartSmps(){ ADnote *adnote=partnote[k].kititem[item].adnote; SUBnote *subnote=partnote[k].kititem[item].subnote; - //get from the ADnote + PADnote *padnote=partnote[k].kititem[item].padnote; + //get from the ADnote if (adnote!=NULL) { noteplay++; if (adnote->ready!=0) adnote->noteout(&tmpoutl[0],&tmpoutr[0]); @@ -487,11 +504,11 @@ void Part::ComputePartSmps(){ delete (adnote); partnote[k].kititem[item].adnote=NULL; }; - for (i=0;i<SOUND_BUFFER_SIZE;i++){//add the ADnote to part(mix) - partfxinputl[sendcurrenttofx][i]+=tmpoutl[i]; - partfxinputr[sendcurrenttofx][i]+=tmpoutr[i]; + for (i=0;i<SOUND_BUFFER_SIZE;i++){//add the ADnote to part(mix) + partfxinputl[sendcurrenttofx][i]+=tmpoutl[i]; + partfxinputr[sendcurrenttofx][i]+=tmpoutr[i]; + }; }; - }; //get from the SUBnote if (subnote!=NULL) { noteplay++; @@ -507,6 +524,20 @@ void Part::ComputePartSmps(){ partnote[k].kititem[item].subnote=NULL; }; }; + //get from the PADnote + if (padnote!=NULL) { + noteplay++; + if (padnote->ready!=0) padnote->noteout(&tmpoutl[0],&tmpoutr[0]); + else for (i=0;i<SOUND_BUFFER_SIZE;i++){tmpoutl[i]=0.0;tmpoutr[i]=0.0;}; + if (padnote->finished()!=0){ + delete (padnote); + partnote[k].kititem[item].padnote=NULL; + }; + for (i=0;i<SOUND_BUFFER_SIZE;i++){//add the PADnote to part(mix) + partfxinputl[sendcurrenttofx][i]+=tmpoutl[i]; + partfxinputr[sendcurrenttofx][i]+=tmpoutr[i]; + }; + }; }; //Kill note if there is no synth on that note @@ -516,12 +547,21 @@ void Part::ComputePartSmps(){ //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]); - int routeto=(Pefxroute[nefx]==0 ? nefx+1 : NUM_PART_EFX); + if (!Pefxbypass[nefx]) { + partefx[nefx]->out(partfxinputl[nefx],partfxinputr[nefx]); + if (Pefxroute[nefx]==2){ + for (i=0;i<SOUND_BUFFER_SIZE;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 (i=0;i<SOUND_BUFFER_SIZE;i++){ partfxinputl[routeto][i]+=partfxinputl[nefx][i]; partfxinputr[routeto][i]+=partfxinputr[nefx][i]; }; + }; for (i=0;i<SOUND_BUFFER_SIZE;i++){ partoutl[i]=partfxinputl[NUM_PART_EFX][i]; @@ -568,15 +608,23 @@ 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); - kit[kititem].adpars=NULL;kit[kititem].subpars=NULL; + 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); }; @@ -913,8 +961,10 @@ void Part::saveloadbuf(Buffer *buf,int instrumentonly){ } else { unsigned char neffect; buf->rwbyte(&neffect); - if (neffect<NUM_PART_EFX) buf->rwbyte(&Pefxroute[neffect]); - else buf->rwbyte(&neffect);//this line just throw away the byte + if (neffect<NUM_PART_EFX) { + buf->rwbyte(&Pefxroute[neffect]); + if (Pefxroute[neffect]==127) Pefxroute[neffect]=1; + } else buf->rwbyte(&neffect);//this line just throw away the byte }; break; }; @@ -967,6 +1017,13 @@ void Part::add2XMLinstrument(XMLwrapper *xml){ 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(); @@ -981,6 +1038,7 @@ void Part::add2XMLinstrument(XMLwrapper *xml){ xml->endbranch(); xml->addpar("route",Pefxroute[nefx]); + partefx[nefx]->setdryonly(Pefxroute[nefx]==2); xml->addparbool("bypass",Pefxbypass[nefx]); xml->endbranch(); }; @@ -1018,9 +1076,6 @@ void Part::add2XML(XMLwrapper *xml){ }; int Part::saveXML(char *filename){ - - //sa pun aici un test daca exista fisierul - XMLwrapper *xml; xml=new XMLwrapper(); @@ -1028,9 +1083,9 @@ int Part::saveXML(char *filename){ add2XMLinstrument(xml); xml->endbranch(); - xml->saveXMLfile(filename); + int result=xml->saveXMLfile(filename); delete (xml); - return(0); + return(result); }; int Part::loadXMLinstrument(const char *filename){ @@ -1094,6 +1149,13 @@ void Part::getfromXMLinstrument(XMLwrapper *xml){ xml->exitbranch(); }; + kit[i].Ppadenabled=xml->getparbool("pad_enabled",kit[i].Ppadenabled); + if (xml->enterbranch("PAD_SYNTH_PARAMETERS")){ + kit[i].padpars->getfromXML(xml); + if (kit[i].Ppadenabled!=0) kit[i].padpars->applyparameters(false); + xml->exitbranch(); + }; + xml->exitbranch(); }; @@ -1110,11 +1172,13 @@ void Part::getfromXMLinstrument(XMLwrapper *xml){ }; 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){ diff --git a/src/Misc/Part.h b/src/Misc/Part.h @@ -28,8 +28,10 @@ #include "../globals.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 "../Params/Controller.h" #include "../Misc/Microtonal.h" #include "../DSP/FFTwrapper.h" @@ -58,7 +60,7 @@ class Part{ //saves the instrument settings to a XML file - //returns 0 for ok, 1 if there is a existing file or -1 if there is an error + //returns 0 for ok or <0 if there is an error int saveXML(char *filename); int loadXMLinstrument(const char *filename); @@ -84,10 +86,11 @@ class Part{ struct { unsigned char Penabled,Pmuted,Pminkey,Pmaxkey; unsigned char *Pname; - unsigned char Padenabled,Psubenabled; + unsigned char Padenabled,Psubenabled,Ppadenabled; unsigned char Psendtoparteffect; ADnoteParameters *adpars; SUBnoteParameters *subpars; + PADnoteParameters *padpars; } kit[NUM_KIT_ITEMS]; @@ -154,6 +157,7 @@ class Part{ struct { ADnote *adnote; SUBnote *subnote; + PADnote *padnote; int sendtoparteffect; } kititem[NUM_KIT_ITEMS]; int time; diff --git a/src/Misc/Util.C b/src/Misc/Util.C @@ -196,7 +196,7 @@ void waveshapesmps(int n,REALTYPE *smps,unsigned char type,unsigned char drive){ }; break; case 14:ws=pow(ws,5.0)*80.0+0.0001;//sigmoid - if (ws>10) tmpv=1.0; + if (ws>10.0) tmpv=0.5; else tmpv=0.5-1.0/(exp(ws)+1.0); for (i=0;i<n;i++) { REALTYPE tmp=smps[i]*ws; @@ -308,3 +308,12 @@ int loadbufferfile(Buffer *buf,const char *filename,int whatIload){ return(0);//OK }; +bool fileexists(char *filename){ + struct stat tmp; + int result=stat(filename,&tmp); + if (result>=0) return(true); + + return(false); +}; + + diff --git a/src/Misc/Util.h b/src/Misc/Util.h @@ -43,6 +43,8 @@ extern int savebufferfile(Buffer *buf,const char *filename,int overwrite,int wha extern int loadbufferfile(Buffer *buf,const char *filename,int whatIload); //whatIsave and whatIload are 0 for Master,1 Voice,2 for Microtonal... +bool fileexists(char *filename); + //Waveshaping(called by Distorsion effect and waveshape from OscilGen) void waveshapesmps(int n,REALTYPE *smps,unsigned char type,unsigned char drive); diff --git a/src/Misc/XMLwrapper.C b/src/Misc/XMLwrapper.C @@ -40,8 +40,8 @@ int XMLwrapper_whitespace_callback(mxml_node_t *node,int where){ XMLwrapper::XMLwrapper(){ - memset(&parentstack,0,sizeof(parentstack)); - memset(&values,0,sizeof(values)); + ZERO(&parentstack,sizeof(parentstack)); + ZERO(&values,sizeof(values)); stackpos=0; @@ -55,8 +55,8 @@ XMLwrapper::XMLwrapper(){ node=root=mxmlNewElement(tree,"ZynAddSubFX-data"); - mxmlElementSetAttr(root,"version-major","0"); - mxmlElementSetAttr(root,"version-minor","2"); + mxmlElementSetAttr(root,"version-major","1"); + mxmlElementSetAttr(root,"version-minor","0"); //save zynaddsubfx specifications beginbranch("BASE_PARAMETERS"); @@ -87,8 +87,7 @@ int XMLwrapper::saveXMLfile(char *filename){ int fnsize=strlen(filename)+100; char *filenamenew=new char [fnsize]; - if ((compression)&&(filename[strlen(filename)-1]!='z')) snprintf(filenamenew,fnsize,"%sz",filename); - else snprintf(filenamenew,fnsize,"%s",filename); + snprintf(filenamenew,fnsize,"%s",filename); int result=dosavefile(filenamenew,compression,xmldata); @@ -164,8 +163,8 @@ int XMLwrapper::loadXMLfile(const char *filename){ if (tree!=NULL) mxmlDelete(tree); tree=NULL; - memset(&parentstack,0,sizeof(parentstack)); - memset(&values,0,sizeof(values)); + ZERO(&parentstack,sizeof(parentstack)); + ZERO(&values,sizeof(values)); stackpos=0; @@ -205,7 +204,7 @@ char *XMLwrapper::doloadfile(const char *filename){ //rewind the file and load the data xmldata=new char[filesize+1]; - memset(xmldata,0,filesize+1); + ZERO(xmldata,filesize+1); gzrewind(gzfile); gzread(gzfile,xmldata,filesize); @@ -220,7 +219,7 @@ char *XMLwrapper::doloadfile(const char *filename){ filesize=ftell(file); xmldata=new char [filesize+1]; - memset(xmldata,0,filesize+1); + ZERO(xmldata,filesize+1); rewind(file); fread(xmldata,filesize,1,file); @@ -296,7 +295,7 @@ int XMLwrapper::getparbool(char *name,int defaultpar){ }; void XMLwrapper::getparstr(char *name,char *par,int maxstrlen){ - memset(par,0,maxstrlen); + ZERO(par,maxstrlen); node=mxmlFindElement(peek(),peek(),"string","name",name,MXML_DESCEND_FIRST); if (node==NULL) return; diff --git a/src/Output/JACK_RTaudiooutput.C b/src/Output/JACK_RTaudiooutput.C @@ -61,7 +61,7 @@ void JACKaudiooutputinit(Master *master_){ int rbbufsize=SOUND_BUFFER_SIZE*sizeof (REALTYPE)*2*2; printf("%d\n",rbbufsize); rb=jack_ringbuffer_create(rbbufsize); - memset(rb->buf,rbbufsize,0); + for (int i=0;i<rbuffersize) rb->buf[i]=0.0; for (int i=0;i<15;i++){ diff --git a/src/Params/ADnoteParameters.C b/src/Params/ADnoteParameters.C @@ -436,6 +436,7 @@ void ADnoteParameters::saveloadbuf(Buffer *buf){ break; //Amplitude Global Parameters case 0x90: buf->rwbytepar(n,&GlobalPar.PVolume); + if (buf->getmode()==0) GlobalPar.PVolume=(int) (GlobalPar.PVolume*0.85); break; case 0x91: buf->rwbytepar(n,&GlobalPar.PAmpVelocityScaleFunction); break; diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h @@ -260,9 +260,8 @@ class ADnoteParameters{ ADnoteGlobalParam GlobalPar; ADnoteVoiceParam VoicePar[NUM_VOICES]; - void add2XML(XMLwrapper *xml); void defaults(); - + void add2XML(XMLwrapper *xml); void getfromXML(XMLwrapper *xml); void saveloadbuf(Buffer *buf); diff --git a/src/Params/PADnoteParameters.C b/src/Params/PADnoteParameters.C @@ -19,11 +19,609 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <math.h> #include "PADnoteParameters.h" -PADnoteParameters::PADnoteParameters(){ +PADnoteParameters::PADnoteParameters(FFTwrapper *fft_,pthread_mutex_t *mutex_){ + 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(){ + Php.base.type=0; + Php.base.par1=80; + Php.modulator.par1=0; + Php.modulator.freq=30; + Php.freqmult=0; + 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.0; +}; + +void PADnoteParameters::deletesamples(){ + for (int i=0;i<PAD_MAX_SAMPLES;i++) deletesample(i); +}; + + +REALTYPE PADnoteParameters::getprofile(REALTYPE *smp,int size){ + for (int i=0;i<size;i++) smp[i]=0.0; + const int supersample=16; + REALTYPE basepar=pow(2.0,(1.0-Php.base.par1/127.0)*12.0); + REALTYPE freqmult=floor(pow(2.0,Php.freqmult/127.0*5.0)+0.000001); + + REALTYPE modfreq=floor(pow(2.0,Php.modulator.freq/127.0*5.0)+0.000001); + REALTYPE modpar1=pow(Php.modulator.par1/127.0,4.0)*5.0/sqrt(modfreq); + REALTYPE amppar1=pow(2.0,pow(Php.amp.par1/127.0,2.0)*10.0)-0.999; + REALTYPE amppar2=(1.0-Php.amp.par2/127.0)*0.998+0.001; + + for (int i=0;i<size*supersample;i++){ + REALTYPE x=i*1.0/(size*(REALTYPE) supersample); + + REALTYPE origx=x; + + switch(Php.onehalf){ + case 1:x=x*0.5+0.5; + break; + case 2:x=x*0.5; + break; + }; + + REALTYPE x_before_freq_mult=x; + + x*=freqmult; + + x+=sin(x_before_freq_mult*3.1415926*modfreq)*modpar1; + x=fmod(x+1000.0,1.0)*2.0-1.0; + + + REALTYPE f; + switch (Php.base.type){ + case 1:f=exp(-(x*x)*basepar);if (f<0.4) f=0.0; else f=1.0; + break; + case 2:f=exp(-(fabs(x))*sqrt(basepar)); + break; + default:f=exp(-(x*x)*basepar); + break; + }; + + REALTYPE amp=1.0; + origx=origx*2.0-1.0; + switch(Php.amp.type){ + case 1:amp=exp(-(origx*origx)*10.0*amppar1); + break; + case 2:amp=0.5*(1.0+cos(3.1415926*origx*sqrt(amppar1*4.0+1.0))); + break; + case 3:amp=1.0/(pow(origx*(amppar1*2.0+0.8),14.0)+1.0); + break; + }; + + REALTYPE finalsmp=f; + if (Php.amp.type!=0){ + switch(Php.amp.mode){ + case 0:finalsmp=amp*(1.0-amppar2)+finalsmp*amppar2; + break; + case 1:finalsmp*=amp*(1.0-amppar2)+amppar2; + break; + case 2:finalsmp=finalsmp/(amp+pow(amppar2,4.0)*20.0+0.0001); + break; + case 3:finalsmp=amp/(finalsmp+pow(amppar2,4.0)*20.0+0.0001); + break; + }; + }; + + smp[i/supersample]+=finalsmp/supersample; + }; + + //normalize + REALTYPE max=0.0; + for (int i=0;i<size;i++) { + if (smp[i]<0.0) smp[i]=0.0; + if (smp[i]>max) max=smp[i]; + }; + if (max<0.00001) max=1.0; + for (int i=0;i<size;i++) smp[i]/=max; + + if (!Php.autoscale) return(0.5); + + //compute the estimated perceived bandwidth + REALTYPE sum=0.0; + 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.0) break; + }; + + REALTYPE result=1.0-2.0*i/(REALTYPE) size; + return(result); +}; + +REALTYPE PADnoteParameters::setPbandwidth(int Pbandwidth){ + this->Pbandwidth=Pbandwidth; + REALTYPE result=pow(Pbandwidth/1000.0,1.1); + result=pow(10.0,result*4.0)*0.25; + return(result); }; +REALTYPE PADnoteParameters::getNhr(int n){ + REALTYPE result=1.0; + REALTYPE par1=pow(10.0,-(1.0-Phrpos.par1/255.0)*3.0); + REALTYPE par2=Phrpos.par2/255.0; + + REALTYPE n0=n-1.0; + REALTYPE tmp=0.0; + int thresh=0; + switch(Phrpos.type){ + case 1: + thresh=(int)(par2*par2*100.0)+1; + if (n<thresh) result=n; + else result=1.0+n0+(n0-thresh+1.0)*par1*8.0; + break; + case 2: + thresh=(int)(par2*par2*100.0)+1; + if (n<thresh) result=n; + else result=1.0+n0-(n0-thresh+1.0)*par1*0.90; + break; + case 3: + tmp=par1*100.0+1.0; + result=pow(n0/tmp,1.0-par2*0.8)*tmp+1.0; + break; + case 4: + result=n0*(1.0-par1)+pow(n0*0.1,par2*3.0+1.0)*par1*10.0+1.0; + break; + case 5: + result=n0+sin(n0*par2*par2*PI*0.999)*sqrt(par1)*2.0+1.0; + break; + default: + result=n; + break; + }; + + REALTYPE par3=Phrpos.par3/255.0; + + REALTYPE iresult=floor(result+0.5); + REALTYPE dresult=result-iresult; + + result=iresult+(1.0-par3)*dresult; + + return(result); +}; + +void PADnoteParameters::generatespectrum(REALTYPE *spectrum, int size,REALTYPE basefreq,REALTYPE *profile,int profilesize,REALTYPE bwadjust){ + for (int i=0;i<size;i++) spectrum[i]=0.0; + + REALTYPE harmonics[OSCIL_SIZE/2]; + for (int i=0;i<OSCIL_SIZE/2;i++) harmonics[i]=0.0; + oscilgen->get(harmonics,basefreq,false); + + //normalize + REALTYPE max=0.0; + for (int i=0;i<OSCIL_SIZE/2;i++) if (harmonics[i]>max) max=harmonics[i]; + if (max<0.000001) max=1; + for (int i=0;i<OSCIL_SIZE/2;i++) harmonics[i]/=max; + + for (int nh=1;nh<OSCIL_SIZE/2;nh++){ + REALTYPE realfreq=getNhr(nh)*basefreq; + if (realfreq>SAMPLE_RATE*0.49999) break; + if (realfreq<20.0) break; + if (harmonics[nh-1]<1e-4) continue; + + REALTYPE bandwidthcents=setPbandwidth(Pbandwidth); + REALTYPE bw=(pow(2.0,bandwidthcents/1200.0)-1.0)*basefreq/bwadjust; + REALTYPE power=1.0; + switch (Pbwscale){ + case 0: power=1.0;break; + case 1: power=0.0;break; + case 2: power=0.25;break; + case 3: power=0.5;break; + case 4: power=0.75;break; + case 5: power=1.5;break; + case 6: power=2.0;break; + case 7: power=-0.5;break; + }; + bw=bw*pow(realfreq/basefreq,power); + int ibw=(int)((bw/(SAMPLE_RATE*0.5)*size))+1; + + REALTYPE amp=harmonics[nh-1]; + if (resonance->Penabled) amp*=resonance->getfreqresponse(realfreq); + + if (ibw>profilesize){ + REALTYPE rap=sqrt((REALTYPE)profilesize/(REALTYPE)ibw); + int cfreq=(int) (realfreq/(SAMPLE_RATE*0.5)*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{ + + REALTYPE rap=sqrt((REALTYPE)ibw/(REALTYPE)profilesize); + REALTYPE ibasefreq=realfreq/(SAMPLE_RATE*0.5)*size; + for (int i=0;i<profilesize;i++){ + REALTYPE idfreq=i/(REALTYPE)profilesize-0.5; + idfreq*=ibw; + int spfreq=(int) (idfreq+ibasefreq); + if (spfreq<=0) continue; + if (spfreq>=size) break; + spectrum[spfreq]+=amp*profile[i]*rap; + }; + }; + }; + +//for (int i=0;i<size;i++) printf("%d %g\n",i,spectrum[i]); +}; + +void PADnoteParameters::applyparameters(bool lockmutex){ + const int samplesize=(((int) 1)<<(Pquality.samplesize+14)); + int spectrumsize=samplesize/2; + REALTYPE spectrum[spectrumsize]; + int profilesize=512; + REALTYPE profile[profilesize]; + + + REALTYPE bwadjust=getprofile(profile,profilesize); +// for (int i=0;i<profilesize;i++) profile[i]*=profile[i]; + REALTYPE basefreq=65.406*pow(2.0,Pquality.basenote/2); + if (Pquality.basenote%2==1) basefreq*=1.5; + + int samplemax=Pquality.oct+1; + int smpoct=Pquality.smpoct; + if (Pquality.smpoct==5) smpoct=6; + if (Pquality.smpoct==6) smpoct=12; + if (smpoct!=0) samplemax*=smpoct; + else samplemax=samplemax/2+1; + if (samplemax==0) samplemax=1; + +// printf("samplemax=%d\n",samplemax); + + FFTwrapper *fft=new FFTwrapper(samplesize); + + REALTYPE adj[samplemax]; + for (int nsample=0;nsample<samplemax;nsample++) adj[nsample]=(Pquality.oct+1.0)*(REALTYPE)nsample/samplemax; + for (int nsample=0;nsample<samplemax;nsample++){ + REALTYPE tmp=adj[nsample]-adj[samplemax-1]*0.5; + REALTYPE basefreqadjust=pow(2.0,tmp); +// printf("%g\n",basefreqadjust*basefreq); + generatespectrum(spectrum,spectrumsize,basefreq*basefreqadjust,profile,profilesize,bwadjust); + + const int extra_samples=3;//the last samples contains the first samples (used for interpolation) + newsample.smp=new REALTYPE[samplesize+extra_samples]; + + for (int i=0;i<spectrumsize;i++){ + REALTYPE phase=RND*6.29; + newsample.smp[i]=spectrum[i]*cos(phase); + newsample.smp[samplesize-1-i]=spectrum[i]*sin(phase); + }; + fft->freqs2smps(newsample.smp,newsample.smp); + + + //normalize + REALTYPE rms=0.0; + for (int i=0;i<samplesize;i++) rms+=newsample.smp[i]*newsample.smp[i]; + rms=sqrt(rms); + if (rms<0.000001) rms=1.0; + rms*=sqrt(262144.0/samplesize); + for (int i=0;i<samplesize;i++) newsample.smp[i]*=1.0/rms*100.0; + + //prepare extra samples + for (int i=0;i<extra_samples;i++) newsample.smp[i+samplesize]=newsample.smp[i]; + + 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); + + for (int i=samplemax;i<PAD_MAX_SAMPLES;i++) deletesample(i); + +// for (int i=0;i<samplesize;i++) printf("%3f \n",sample.smp[i]); + +}; + + +void PADnoteParameters::add2XML(XMLwrapper *xml){ + xml->addparbool("stereo",PStereo); + 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("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); + 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.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/src/Params/PADnoteParameters.h b/src/Params/PADnoteParameters.h @@ -23,13 +23,135 @@ #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" + + class PADnoteParameters{ public: - PADnoteParameters(); + PADnoteParameters(FFTwrapper *fft_,pthread_mutex_t *mutex_); ~PADnoteParameters(); + + void defaults(); + void add2XML(XMLwrapper *xml); + void getfromXML(XMLwrapper *xml); + + //returns a value between 0.0-1.0 that represents the estimation perceived bandwidth + REALTYPE getprofile(REALTYPE *smp,int size); + + //parameters + struct { + struct{ + unsigned char type; + unsigned char par1; + }base; + unsigned char freqmult; + struct{ + unsigned char par1; + unsigned char freq; + }modulator; + struct{ + unsigned char mode; + unsigned char type; + unsigned char par1; + unsigned char par2; + }amp; + bool autoscale; + unsigned char onehalf; + }Php; + + + unsigned int Pbandwidth;//the values are from 0 to 1000 + unsigned char Pbwscale; + + struct{ + unsigned char type; + unsigned char par1,par2,par3;//0..255 + }Phrpos; + + + struct { + 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; + + + + + REALTYPE setPbandwidth(int Pbandwidth);//returns the BandWidth in cents + REALTYPE getNhr(int n);//gets the n-th overtone position relatively to N harmonic + + void applyparameters(bool lockmutex); + + OscilGen *oscilgen; + Resonance *resonance; + + struct{ + int size; + REALTYPE basefreq; + REALTYPE *smp; + }sample[PAD_MAX_SAMPLES],newsample; + private: + void generatespectrum(REALTYPE *spectrum, int size,REALTYPE basefreq,REALTYPE *profile,int profilesize,REALTYPE bwadjust); + void deletesamples(); + void deletesample(int n); + + FFTwrapper *fft; + pthread_mutex_t *mutex; }; diff --git a/src/Seq/MIDIFile.C b/src/Seq/MIDIFile.C @@ -44,7 +44,7 @@ int MIDIFile::loadfile(char *filename){ if (file==NULL) return(-1); char header[4]; - memset(header,0,4); + ZERO(header,4); fread(header,4,1,file); //test to see if this a midi file @@ -59,7 +59,7 @@ int MIDIFile::loadfile(char *filename){ rewind(file); midifile=new unsigned char[midifilesize]; - memset(midifile,0,midifilesize); + ZERO(midifile,midifilesize); fread(midifile,midifilesize,1,file); fclose(file); diff --git a/src/Seq/Sequencer.C b/src/Seq/Sequencer.C @@ -135,18 +135,23 @@ void Sequencer::resettime(timestruct *t){ t->rel=0.0; timeval tval; - + + t->last=0.0; + #ifndef windows if (gettimeofday(&tval,NULL)==0) t->last=tval.tv_sec+tval.tv_usec*0.000001; else t->last=0.0; + #endif }; void Sequencer::updatecounter(timestruct *t){ timeval tval; - double current; + double current=0.0; + #ifndef OS_WINDOWS if (gettimeofday(&tval,NULL)==0) current=tval.tv_sec+tval.tv_usec*0.000001; + #endif else current=0.0; t->rel=current - t->last; diff --git a/src/Synth/ADnote.C b/src/Synth/ADnote.C @@ -48,7 +48,7 @@ ADnote::ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE ve stereo=pars->GlobalPar.PStereo; NoteGlobalPar.Detune=getdetune(pars->GlobalPar.PDetuneType - ,pars->GlobalPar.PCoarseDetune,pars->GlobalPar.PDetune);; + ,pars->GlobalPar.PCoarseDetune,pars->GlobalPar.PDetune); if (pars->GlobalPar.PPanning==0) NoteGlobalPar.Panning=RND; else NoteGlobalPar.Panning=pars->GlobalPar.PPanning/128.0; @@ -335,17 +335,16 @@ void ADnote::initparameters(){ NoteVoicePar[nvoice].FMSmp=new REALTYPE[OSCIL_SIZE+OSCIL_SMP_EXTRA_SAMPLES]; //Perform Anti-aliasing only on MORPH or RING MODULATION - REALTYPE tmp=1.0; - switch(NoteVoicePar[nvoice].FMEnabled){ - case MORPH: - case RING_MOD:tmp=getFMvoicebasefreq(nvoice); - break; - default: break; - }; int vc=nvoice; if (partparams->VoicePar[nvoice].PextFMoscil!=-1) vc=partparams->VoicePar[nvoice].PextFMoscil; + REALTYPE tmp=1.0; + if ((partparams->VoicePar[vc].FMSmp->Padaptiveharmonics!=0)|| + (NoteVoicePar[nvoice].FMEnabled==MORPH)|| + (NoteVoicePar[nvoice].FMEnabled==RING_MOD)){ + tmp=getFMvoicebasefreq(nvoice); + }; if (!partparams->GlobalPar.Hrandgrouping) partparams->VoicePar[vc].FMSmp->newrandseed(rand()); oscposhiFM[nvoice]=(oscposhi[nvoice]+partparams->VoicePar[vc].FMSmp->get(NoteVoicePar[nvoice].FMSmp,tmp)) % OSCIL_SIZE; @@ -550,7 +549,7 @@ inline void ADnote::fadein(REALTYPE *smps){ int n; F2I(tmp,n);//how many samples is the fade-in if (n>SOUND_BUFFER_SIZE) n=SOUND_BUFFER_SIZE; - for (int i=0;i<n;i++) {//fade-out + for (int i=0;i<n;i++) {//fade-in REALTYPE tmp=0.5-cos((REALTYPE)i/(REALTYPE) n*PI)*0.5; smps[i]*=tmp; }; diff --git a/src/Synth/LFO.C b/src/Synth/LFO.C @@ -65,9 +65,9 @@ LFO::LFO(LFOParams *lfopars,REALTYPE basefreq){ lfotype=lfopars->PLFOtype; lfodelay=lfopars->Pdelay/127.0*4.0;//0..4 sec incrnd=nextincrnd=1.0; + freqrndenabled=(lfopars->Pfreqrand!=0); computenextincrnd(); computenextincrnd();//twice because I want incrnd & nextincrnd to be random - freqrndenabled=(lfopars->Pfreqrand!=0); }; LFO::~LFO(){ diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C @@ -37,6 +37,7 @@ OscilGen::OscilGen(FFTwrapper *fft_,Resonance *res_){ basefuncFFTfreqs=NULL; outoscilFFTfreqs=NULL; randseed=1; + ADvsPAD=false; defaults(); }; @@ -78,7 +79,8 @@ void OscilGen::defaults(){ Pwaveshapingfunction=0; Pwaveshaping=64; Pfiltertype=0; - Pfilterpar=64; + Pfilterpar1=64; + Pfilterpar2=64; Pfilterbeforews=0; Psatype=0; Psapar=64; @@ -328,48 +330,72 @@ void OscilGen::getbasefunction(REALTYPE *smps){ */ void OscilGen::oscilfilter(){ if (Pfiltertype==0) return; - REALTYPE par=1.0-Pfilterpar/128.0; - REALTYPE max=0.0; + REALTYPE par=1.0-Pfilterpar1/128.0; + REALTYPE par2=Pfilterpar2/127.0; + REALTYPE max=0.0,tmp=0.0,p2,x; for (int i=1;i<OSCIL_SIZE/2;i++){ REALTYPE gain=1.0; switch(Pfiltertype){ case 1: gain=pow(1.0-par*par*par*0.99,i);//lp + tmp=par2*par2*par2*par2*0.5+0.0001; + if (gain<tmp) gain=pow(gain,10.0)/pow(tmp,9.0); break; case 2: gain=1.0-pow(1.0-par*par,i+1);//hp1 + gain=pow(gain,par2*2.0+0.1); break; case 3: if (par<0.2) par=par*0.25+0.15; gain=1.0-pow(1.0-par*par*0.999+0.001,i*0.05*i+1.0);//hp1b - gain*=gain*gain; + tmp=pow(5.0,par2*2.0); + gain=pow(gain,tmp); break; case 4: gain=i+1-pow(2,(1.0-par)*7.5);//bp1 gain=1.0/(1.0+gain*gain/(i+1.0)); - gain*=gain; + tmp=pow(5.0,par2*2.0); + gain=pow(gain,tmp); if (gain<1e-5) gain=1e-5; break; case 5: gain=i+1-pow(2,(1.0-par)*7.5);//bs1 gain=pow(atan(gain/(i/10.0+1))/1.57,6); + gain=pow(gain,par2*par2*3.9+0.1); break; - case 6: gain=(i+1>pow(2,(1.0-par)*10)?0.0:1.0);//lp2 + case 6: tmp=pow(par2,0.33); + gain=(i+1>pow(2,(1.0-par)*10)?0.0:1.0)*par2+(1.0-par2);//lp2 break; - case 7: gain=(i+1>pow(2,(1.0-par)*7)?1.0:0.0);//hp2 - if (Pfilterpar==0) gain=1.0; + case 7: tmp=pow(par2,0.33); + //tmp=1.0-(1.0-par2)*(1.0-par2); + gain=(i+1>pow(2,(1.0-par)*7)?1.0:0.0)*par2+(1.0-par2);//hp2 + if (Pfilterpar1==0) gain=1.0; break; - case 8: gain=(fabs(pow(2,(1.0-par)*7)-i)>i/2+1?0.0:1.0);//bp2 + case 8: tmp=pow(par2,0.33); + //tmp=1.0-(1.0-par2)*(1.0-par2); + gain=(fabs(pow(2,(1.0-par)*7)-i)>i/2+1?0.0:1.0)*par2+(1.0-par2);//bp2 break; - - case 9: gain=(fabs(pow(2,(1.0-par)*7)-i)<i/2+1?0.0:1.0);//bs2 + case 9: tmp=pow(par2,0.33); + gain=(fabs(pow(2,(1.0-par)*7)-i)<i/2+1?0.0:1.0)*par2+(1.0-par2);//bs2 break; - case 10:gain=cos(par*par*PI/2.0*i);//cos + case 10:tmp=pow(5.0,par2*2.0-1.0); + tmp=pow(i/32.0,tmp)*32.0; + if (Pfilterpar2==64) tmp=i; + gain=cos(par*par*PI/2.0*tmp);//cos gain*=gain; break; - case 11:gain=sin(par*par*PI/2.0*i);//sin + case 11:tmp=pow(5.0,par2*2.0-1.0); + tmp=pow(i/32.0,tmp)*32.0; + if (Pfilterpar2==64) tmp=i; + gain=sin(par*par*PI/2.0*tmp);//sin gain*=gain; break; - case 12:REALTYPE p2=1.0-par+0.2,x=i/(64.0*p2*p2); + case 12:p2=1.0-par+0.2; + x=i/(64.0*p2*p2); if (x<0.0) x=0.0; else if (x>1.0) x=1.0; - gain=cos(x*PI)+1.5;//low shelf + tmp=pow(1.0-par2,2.0); + gain=cos(x*PI)*(1.0-tmp)+1.01+tmp;//low shelf break; + case 13:tmp=(int) (pow(2.0,(1.0-par)*7.2)); + gain=1.0; + if (i==(int) (tmp)) gain=pow(2.0,par2*par2*8.0); + break; }; @@ -467,14 +493,14 @@ void OscilGen::modulation(){ modulationpar3=Pmodulationpar3/127.0; switch(Pmodulation){ - case 1:modulationpar1=(pow(2,modulationpar1*5.0)-1.0)/100.0; + case 1:modulationpar1=(pow(2,modulationpar1*7.0)-1.0)/100.0; modulationpar3=floor((pow(2,modulationpar3*5.0)-1.0)); if (modulationpar3<0.9999) modulationpar3=-1.0; break; - case 2:modulationpar1=(pow(2,modulationpar1*5.0)-1.0)/100.0; + case 2:modulationpar1=(pow(2,modulationpar1*7.0)-1.0)/100.0; modulationpar3=1.0+floor((pow(2,modulationpar3*5.0)-1.0)); break; - case 3:modulationpar1=(pow(2,modulationpar1*7.0)-1.0)/100.0; + case 3:modulationpar1=(pow(2,modulationpar1*9.0)-1.0)/100.0; modulationpar3=0.01+(pow(2,modulationpar3*16.0)-1.0)/10.0; break; }; @@ -793,9 +819,9 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){ if ((oldbasepar!=Pbasefuncpar)||(oldbasefunc!=Pcurrentbasefunc)||(oldhmagtype!=Phmagtype) ||(oldwaveshaping!=Pwaveshaping)||(oldwaveshapingfunction!=Pwaveshapingfunction)) oscilprepared=0; - if (oldfilterpars!=Pfiltertype*256+Pfilterpar+Pfilterbeforews*65536){ + if (oldfilterpars!=Pfiltertype*256+Pfilterpar1+Pfilterpar2*65536+Pfilterbeforews*16777216){ oscilprepared=0; - oldfilterpars=Pfiltertype*256+Pfilterpar+Pfilterbeforews*65536; + oldfilterpars=Pfiltertype*256+Pfilterpar1+Pfilterpar2*65536+Pfilterbeforews*16777216; }; if (oldsapars!=Psatype*256+Psapar){ oscilprepared=0; @@ -832,7 +858,10 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){ for (i=0;i<OSCIL_SIZE;i++) outoscilFFTfreqs[i]=0.0; nyquist=(int)(0.5*SAMPLE_RATE/fabs(freqHz))+2; + if (ADvsPAD) nyquist=(int)(OSCIL_SIZE/2); if (nyquist>OSCIL_SIZE/2) nyquist=OSCIL_SIZE/2; + + int realnyquist=nyquist; if (Padaptiveharmonics!=0) nyquist=OSCIL_SIZE/2; @@ -911,13 +940,14 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){ sum=sqrt(sum); for (int j=1;j<OSCIL_SIZE;j++) outoscilFFTfreqs[j]/=sum; - - // for (i=0;i<OSCIL_SIZE/2;i++) outoscilFFTfreqs[i+OSCIL_SIZE/2]*=-1.0;//correct the amplitude - fft->freqs2smps(outoscilFFTfreqs,smps); - - for (i=0;i<OSCIL_SIZE;i++) smps[i]*=0.25;//correct the amplitude + if ((ADvsPAD)&&(freqHz>0.1)){ + for (i=1;i<OSCIL_SIZE/2;i++) smps[i-1]=sqrt(outoscilFFTfreqs[i]*outoscilFFTfreqs[i]+outoscilFFTfreqs[OSCIL_SIZE-i]*outoscilFFTfreqs[OSCIL_SIZE-i]); + } else { + fft->freqs2smps(outoscilFFTfreqs,smps); + for (i=0;i<OSCIL_SIZE;i++) smps[i]*=0.25;//correct the amplitude + }; delete(outoscilFFTfreqs); outoscilFFTfreqs=NULL; @@ -1151,7 +1181,7 @@ void OscilGen::saveloadbuf(Buffer *buf){ // break; case 0x89: buf->rwbytepar(n,&Pfiltertype); break; - case 0x8A: buf->rwbytepar(n,&Pfilterpar); + case 0x8A: buf->rwbytepar(n,&Pfilterpar1); break; case 0x8B: buf->rwbytepar(n,&Pfilterbeforews); break; @@ -1198,7 +1228,8 @@ void OscilGen::add2XML(XMLwrapper *xml){ xml->addpar("wave_shaping_function",Pwaveshapingfunction); xml->addpar("filter_type",Pfiltertype); - xml->addpar("filter_par",Pfilterpar); + xml->addpar("filter_par1",Pfilterpar1); + xml->addpar("filter_par2",Pfilterpar2); xml->addpar("filter_before_wave_shaping",Pfilterbeforews); xml->addpar("spectrum_adjust_type",Psatype); @@ -1269,7 +1300,8 @@ void OscilGen::getfromXML(XMLwrapper *xml){ Pwaveshapingfunction=xml->getpar127("wave_shaping_function",Pwaveshapingfunction); Pfiltertype=xml->getpar127("filter_type",Pfiltertype); - Pfilterpar=xml->getpar127("filter_par",Pfilterpar); + Pfilterpar1=xml->getpar127("filter_par1",Pfilterpar1); + Pfilterpar1=xml->getpar127("filter_par2",Pfilterpar2); Pfilterbeforews=xml->getpar127("filter_before_wave_shaping",Pfilterbeforews); Psatype=xml->getpar127("spectrum_adjust_type",Psatype); diff --git a/src/Synth/OscilGen.h b/src/Synth/OscilGen.h @@ -86,7 +86,7 @@ class OscilGen{ 65..127 - each harmonic randomness - 127 is maximum*/ unsigned char Prand; unsigned char Pwaveshaping,Pwaveshapingfunction; - unsigned char Pfiltertype,Pfilterpar; + unsigned char Pfiltertype,Pfilterpar1,Pfilterpar2; unsigned char Pfilterbeforews; unsigned char Psatype,Psapar;//spectrum adjust @@ -105,6 +105,9 @@ class OscilGen{ //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: REALTYPE hmag[MAX_AD_HARMONICS],hphase[MAX_AD_HARMONICS];//the magnituides and the phases of the sine/nonsine harmonics diff --git a/src/Synth/PADnote.C b/src/Synth/PADnote.C @@ -18,12 +18,323 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <math.h> #include "PADnote.h" +#include "../Misc/Config.h" PADnote::PADnote(PADnoteParameters *parameters, Controller *ctl_,REALTYPE freq, REALTYPE velocity, int portamento_, int midinote){ + ready=0; + pars=parameters; + portamento=portamento_; + ctl=ctl_; + this->velocity=velocity; + finished_=false; + + + if (pars->Pfixedfreq==0) basefreq=freq; + else { + basefreq=440.0; + int fixedfreqET=pars->PfixedfreqET; + if (fixedfreqET!=0) {//if the frequency varies according the keyboard note + REALTYPE tmp=(midinote-69.0)/12.0*(pow(2.0,(fixedfreqET-1)/63.0)-1.0); + if (fixedfreqET<=64) basefreq*=pow(2.0,tmp); + else basefreq*=pow(3.0,tmp); + }; + + }; + + firsttime=true; + released=false; + realfreq=basefreq; + //find out the closest note + REALTYPE logfreq=log(freq); + REALTYPE mindist=fabs(logfreq-log(pars->sample[0].basefreq+0.0001)); + nsample=0; + for (int i=1;i<PAD_MAX_SAMPLES;i++){ + if (pars->sample[i].smp==NULL) break; + REALTYPE dist=fabs(logfreq-log(pars->sample[i].basefreq+0.0001)); +// printf("(mindist=%g) %i %g %g\n",mindist,i,dist,pars->sample[i].basefreq); + + if (dist<mindist){ + nsample=i; + mindist=dist; + }; + }; + + int size=pars->sample[nsample].size; + if (size==0) size=1; + + + poshi_l=(int)(RND*(size-1)); + if (pars->PStereo!=0) poshi_r=(poshi_l+size/2)%size; + else poshi_r=poshi_l; + poslo=0.0; + + tmpwave=new REALTYPE [SOUND_BUFFER_SIZE]; + + + NoteGlobalPar.Detune=getdetune(pars->PDetuneType + ,pars->PCoarseDetune,pars->PDetune);; + + if (pars->PPanning==0) NoteGlobalPar.Panning=RND; + else NoteGlobalPar.Panning=pars->PPanning/128.0; + + NoteGlobalPar.FilterCenterPitch=pars->GlobalFilter->getfreq()+//center freq + pars->PFilterVelocityScale/127.0*6.0* //velocity sensing + (VelF(velocity,pars->PFilterVelocityScaleFunction)-1); + + if (pars->PPunchStrength!=0) { + NoteGlobalPar.Punch.Enabled=1; + NoteGlobalPar.Punch.t=1.0;//start from 1.0 and to 0.0 + NoteGlobalPar.Punch.initialvalue=( (pow(10,1.5*pars->PPunchStrength/127.0)-1.0) + *VelF(velocity,pars->PPunchVelocitySensing) ); + REALTYPE time=pow(10,3.0*pars->PPunchTime/127.0)/10000.0;//0.1 .. 100 ms + REALTYPE stretch=pow(440.0/freq,pars->PPunchStretch/64.0); + NoteGlobalPar.Punch.dt=1.0/(time*SAMPLE_RATE*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.0*pow(0.1,3.0*(1.0-pars->PVolume/96.0))//-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(); + + NoteGlobalPar.GlobalFilterL=new Filter(pars->GlobalFilter); + NoteGlobalPar.GlobalFilterR=new Filter(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); + + ready=1;///sa il pun pe asta doar cand e chiar gata + + if (parameters->sample[nsample].smp==NULL){ + finished_=true; + return; + }; }; 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); + delete (tmpwave); }; +inline void PADnote::fadein(REALTYPE *smps){ + int zerocrossings=0; + for (int i=1;i<SOUND_BUFFER_SIZE;i++) + if ((smps[i-1]<0.0) && (smps[i]>0.0)) zerocrossings++;//this is only the possitive crossings + + REALTYPE tmp=(SOUND_BUFFER_SIZE-1.0)/(zerocrossings+1)/3.0; + if (tmp<8.0) tmp=8.0; + + int n; + F2I(tmp,n);//how many samples is the fade-in + if (n>SOUND_BUFFER_SIZE) n=SOUND_BUFFER_SIZE; + for (int i=0;i<n;i++) {//fade-in + REALTYPE tmp=0.5-cos((REALTYPE)i/(REALTYPE) n*PI)*0.5; + smps[i]*=tmp; + }; +}; + + +void PADnote::computecurrentparameters(){ + REALTYPE globalpitch,globalfilterpitch; + globalpitch=0.01*(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; + + REALTYPE tmpfilterfreq=globalfilterpitch+ctl->filtercutoff.relfreq + +NoteGlobalPar.FilterFreqTracking; + + tmpfilterfreq=NoteGlobalPar.GlobalFilterL->getrealfreq(tmpfilterfreq); + + REALTYPE 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 + REALTYPE portamentofreqrap=1.0; + 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*pow(2.0,globalpitch/12.0)*ctl->pitchwheel.relfreq; +}; + + +int PADnote::Compute_Linear(REALTYPE *outl,REALTYPE *outr,int freqhi,REALTYPE freqlo){ + REALTYPE *smps=pars->sample[nsample].smp; + if (smps==NULL){ + finished_=true; + return(1); + }; + int size=pars->sample[nsample].size; + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + poshi_l+=freqhi; + poshi_r+=freqhi; + poslo+=freqlo; + if (poslo>=1.0){ + poshi_l+=1; + poshi_r+=1; + poslo-=1.0; + }; + if (poshi_l>=size) poshi_l%=size; + if (poshi_r>=size) poshi_r%=size; + + outl[i]=smps[poshi_l]*(1.0-poslo)+smps[poshi_l+1]*poslo; + outr[i]=smps[poshi_r]*(1.0-poslo)+smps[poshi_r+1]*poslo; + }; + return(1); +}; +int PADnote::Compute_Cubic(REALTYPE *outl,REALTYPE *outr,int freqhi,REALTYPE freqlo){ + REALTYPE *smps=pars->sample[nsample].smp; + if (smps==NULL){ + finished_=true; + return(1); + }; + int size=pars->sample[nsample].size; + REALTYPE xm1,x0,x1,x2,a,b,c; + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + poshi_l+=freqhi; + poshi_r+=freqhi; + poslo+=freqlo; + if (poslo>=1.0){ + poshi_l+=1; + poshi_r+=1; + poslo-=1.0; + }; + if (poshi_l>=size) poshi_l%=size; + if (poshi_r>=size) poshi_r%=size; + + + //left + xm1=smps[poshi_l - 1]; + x0=smps[poshi_l + 0]; + x1=smps[poshi_l + 1]; + x2=smps[poshi_l + 2]; + a = (3.0 * (x0-x1) - xm1 + x2)*0.5; + b = 2.0*x1 + xm1 - (5.0*x0 + x2)*0.5; + c = (x1 - xm1)*0.5; + outl[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; + //right + xm1=smps[poshi_r - 1]; + x0=smps[poshi_r + 0]; + x1=smps[poshi_r + 1]; + x2=smps[poshi_r + 2]; + a = (3.0 * (x0-x1) - xm1 + x2)*0.5; + b = 2.0*x1 + xm1 - (5.0*x0 + x2)*0.5; + c = (x1 - xm1)*0.5; + outr[i] = (((a * poslo) + b) * poslo + c) * poslo + x0; + }; + return(1); +}; + + +int PADnote::noteout(REALTYPE *outl,REALTYPE *outr){ + computecurrentparameters(); + REALTYPE *smps=pars->sample[nsample].smp; + if (smps==NULL){ + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + outl[i]=0.0; + outr[i]=0.0; + }; + return(1); + }; + REALTYPE smpfreq=pars->sample[nsample].basefreq; + + + REALTYPE freqrap=realfreq/smpfreq; + int freqhi=(int) (floor(freqrap)); + REALTYPE 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<SOUND_BUFFER_SIZE;i++){ + REALTYPE punchamp=NoteGlobalPar.Punch.initialvalue*NoteGlobalPar.Punch.t+1.0; + outl[i]*=punchamp; + outr[i]*=punchamp; + NoteGlobalPar.Punch.t-=NoteGlobalPar.Punch.dt; + if (NoteGlobalPar.Punch.t<0.0) { + NoteGlobalPar.Punch.Enabled=0; + break; + }; + }; + }; + + if (ABOVE_AMPLITUDE_THRESHOLD(globaloldamplitude,globalnewamplitude)){ + // Amplitude Interpolation + for (int i=0;i<SOUND_BUFFER_SIZE;i++){ + REALTYPE tmpvol=INTERPOLATE_AMPLITUDE(globaloldamplitude,globalnewamplitude,i,SOUND_BUFFER_SIZE); + outl[i]*=tmpvol*NoteGlobalPar.Panning; + outr[i]*=tmpvol*(1.0-NoteGlobalPar.Panning); + }; + } else { + for (int i=0;i<SOUND_BUFFER_SIZE;i++) { + outl[i]*=globalnewamplitude*NoteGlobalPar.Panning; + outr[i]*=globalnewamplitude*(1.0-NoteGlobalPar.Panning); + }; + }; + + + // Check if the global amplitude is finished. + // If it does, disable the note + if (NoteGlobalPar.AmpEnvelope->finished()!=0) { + for (int i=0;i<SOUND_BUFFER_SIZE;i++) {//fade-out + REALTYPE tmp=1.0-(REALTYPE)i/(REALTYPE)SOUND_BUFFER_SIZE; + outl[i]*=tmp; + outr[i]*=tmp; + }; + finished_=1; + }; + + return(1); +}; + +int PADnote::finished(){ + return(finished_); +}; + +void PADnote::relasekey(){ + NoteGlobalPar.FreqEnvelope->relasekey(); + NoteGlobalPar.FilterEnvelope->relasekey(); + NoteGlobalPar.AmpEnvelope->relasekey(); +}; + diff --git a/src/Synth/PADnote.h b/src/Synth/PADnote.h @@ -24,13 +24,82 @@ #include "../globals.h" #include "../Params/PADnoteParameters.h" #include "../Params/Controller.h" +#include "Envelope.h" +#include "LFO.h" +#include "../DSP/Filter.h" +#include "../Params/Controller.h" class PADnote{ public: PADnote(PADnoteParameters *parameters, Controller *ctl_,REALTYPE freq, REALTYPE velocity, int portamento_, int midinote); ~PADnote(); + + int noteout(REALTYPE *outl,REALTYPE *outr); + int finished(); + void relasekey(); + + int ready; + private: + void fadein(REALTYPE *smps); + void computecurrentparameters(); + bool finished_; + PADnoteParameters *pars; + + int poshi_l,poshi_r; + REALTYPE poslo; + + REALTYPE basefreq; + bool firsttime,released; + + int nsample,portamento; + + int Compute_Linear(REALTYPE *outl,REALTYPE *outr,int freqhi,REALTYPE freqlo); + int Compute_Cubic(REALTYPE *outl,REALTYPE *outr,int freqhi,REALTYPE freqlo); + + + struct{ + /****************************************** + * FREQUENCY GLOBAL PARAMETERS * + ******************************************/ + REALTYPE Detune;//cents + + Envelope *FreqEnvelope; + LFO *FreqLfo; + + /******************************************** + * AMPLITUDE GLOBAL PARAMETERS * + ********************************************/ + REALTYPE Volume;// [ 0 .. 1 ] + + REALTYPE Panning;// [ 0 .. 1 ] + + Envelope *AmpEnvelope; + LFO *AmpLfo; + + struct { + int Enabled; + REALTYPE initialvalue,dt,t; + } Punch; + + /****************************************** + * FILTER GLOBAL PARAMETERS * + ******************************************/ + Filter *GlobalFilterL,*GlobalFilterR; + + REALTYPE FilterCenterPitch;//octaves + REALTYPE FilterQ; + REALTYPE FilterFreqTracking; + + Envelope *FilterEnvelope; + + LFO *FilterLfo; + } NoteGlobalPar; + + REALTYPE globaloldamplitude,globalnewamplitude,velocity,realfreq; + REALTYPE *tmpwave; + Controller *ctl; }; diff --git a/src/Synth/Resonance.C b/src/Synth/Resonance.C @@ -85,6 +85,29 @@ void Resonance::applyres(int n,REALTYPE *fftdata,REALTYPE freq){ }; /* + * Gets the response at the frequency "freq" + */ + +REALTYPE Resonance::getfreqresponse(REALTYPE freq){ + REALTYPE l1=log(getfreqx(0.0)*ctlcenter), + l2=log(2.0)*getoctavesfreq()*ctlbw,sum=0.0; + + for (int i=0;i<N_RES_POINTS;i++) if (sum<Prespoints[i]) sum=Prespoints[i]; + if (sum<1.0) sum=1.0; + + REALTYPE x=(log(freq)-l1)/l2;//compute where the n-th hamonics fits to the graph + if (x<0.0) x=0.0; + x*=N_RES_POINTS; + REALTYPE 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; + REALTYPE result=(Prespoints[kx1]*(1.0-dx)+Prespoints[kx2]*dx)/127.0-sum/127.0; + result=pow(10.0,result*PmaxdB/20.0); + return(result); +}; + + +/* * Smooth the resonance function */ void Resonance::smooth(){ diff --git a/src/Synth/Resonance.h b/src/Synth/Resonance.h @@ -47,6 +47,7 @@ class Resonance{ REALTYPE getfreqpos(REALTYPE freq); REALTYPE getfreqx(REALTYPE x); + REALTYPE getfreqresponse(REALTYPE freq); REALTYPE getcenterfreq(); REALTYPE getoctavesfreq(); void sendcontroller(MidiControllers ctl,REALTYPE par); diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -312,7 +312,7 @@ o->redraw();} int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil; -oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,master);} +oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,master);} selected xywh {700 370 55 15} box THIN_UP_BOX labelfont 1 labelsize 12 code0 {if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE);} } @@ -351,7 +351,7 @@ if ((int) o->value() != 0) { modoscil->activate(); modfrequency->activate(); }; -voiceFMparametersgroup->redraw();} open selected +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;i<nvoice;i++) {sprintf(tmp,"ExtMod.%2d",i);o->add(tmp);};} @@ -503,7 +503,7 @@ detunevalueoutput->do_callback();} open int nv=nvoice; if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil; -oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,master);} +oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,master);} xywh {5 475 65 20} box THIN_UP_BOX labelfont 1 labelsize 12 code0 {if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE);} } diff --git a/src/UI/BankUI.fl b/src/UI/BankUI.fl @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0200 +version 1.0105 header_name {.h} code_name {.cc} decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} diff --git a/src/UI/ConfigUI.fl b/src/UI/ConfigUI.fl @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0200 +version 1.0105 header_name {.h} code_name {.cc} decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} @@ -153,32 +153,32 @@ config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} } Fl_Box {} { label {Most settings has effect only after ZynAddSubFX is restarted.} - xywh {20 245 235 30} labelfont 1 labelsize 12 align 128 + xywh {15 270 235 30} labelfont 1 labelsize 12 align 128 } Fl_Box {} { label {Read the Readme.txt for other settings} - xywh {15 225 240 20} labelfont 1 labelsize 12 align 128 + xywh {10 250 240 20} labelfont 1 labelsize 12 align 128 } Fl_Group {} { - xywh {15 110 230 85} box ENGRAVED_BOX + xywh {15 130 230 85} box ENGRAVED_BOX } { Fl_File_Input {} { label {Dump File} callback {snprintf(config.cfg.DumpFile,config.maxstringsize,"%s",o->value());} - xywh {20 155 220 35} align 5 + xywh {20 175 220 35} align 5 code0 {o->insert(config.cfg.DumpFile);} } 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 115 100 20} down_box DOWN_BOX + xywh {20 135 100 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 115 80 20} down_box DOWN_BOX + xywh {160 135 80 20} down_box DOWN_BOX code0 {o->value(config.cfg.DumpAppend);} } } @@ -228,12 +228,27 @@ midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name); Fl_Counter {} { label {XML compression level} callback {config.cfg.GzipCompression=(int) o->value();} - tooltip {gzip compression level (0 - uncompressed)} xywh {20 205 65 15} type Simple labelsize 12 align 8 minimum 0 maximum 9 step 1 + tooltip {gzip compression level (0 - uncompressed)} xywh {20 225 65 15} type Simple labelsize 12 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();} selected + xywh {175 105 75 15} down_box BORDER_BOX labelsize 11 textsize 12 + 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_Group {} { - label {Bank root dirs} open + label {Bank root dirs} xywh {5 25 500 285} hide } { Fl_Browser rootsbrowse { diff --git a/src/UI/FilterUI.fl b/src/UI/FilterUI.fl @@ -163,7 +163,7 @@ delete (formantparswindow);} {} } Function {make_window()} {} { Fl_Window filterui { - xywh {303 417 275 75} type Double color 50 labelfont 1 hide + xywh {268 122 275 75} type Double color 50 labelfont 1 hide class Fl_Group } { Fl_Group filterparamswindow { @@ -280,15 +280,6 @@ formantfiltergraph->redraw();} code0 {o->value(pars->Pfreqtrack);} class WidgetPDial } - Fl_Counter stcounter { - label {St.} - callback {pars->Pstages=(int)o->value(); -formantfiltergraph->redraw(); -pars->changed=true;} - tooltip {Additional filter stages (in order to increase dB/oct. value and the order of the filter)} xywh {225 5 40 15} type Simple labelsize 10 align 4 minimum 1 maximum 127 step 1 textfont 1 textsize 12 - code0 {o->bounds(0,MAX_FILTER_STAGES-1);} - code1 {o->value(pars->Pstages);} - } Fl_Dial vsnsadial { label {V.SnsA.} callback {if (velsnsamp!=NULL) *velsnsamp=(int)o->value();} @@ -310,6 +301,15 @@ pars->changed=true;} code0 {o->value(pars->Pgain);} class WidgetPDial } + Fl_Choice stcounter { + label Stages + 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;i<MAX_FILTER_STAGES;i++) {char tmp[10];snprintf(tmp,10,"%dx",i+1);o->add(tmp);};} + code2 {o->value(pars->Pstages);} + } {} } Fl_Button editbutton { label Edit diff --git a/src/UI/Makefile b/src/UI/Makefile @@ -4,7 +4,7 @@ include ../Makefile.inc fluid -c $< objects=WidgetPDial.o EnvelopeUI.o LFOUI.o FilterUI.o VirKeyboard.o ConfigUI.o\ - SUBnoteUI.o ResonanceUI.o OscilGenUI.o ADnoteUI.o EffUI.o BankUI.o \ + SUBnoteUI.o ResonanceUI.o OscilGenUI.o ADnoteUI.o PADnoteUI.o EffUI.o BankUI.o \ PartUI.o MicrotonalUI.o SeqUI.o MasterUI.o @@ -19,6 +19,7 @@ ResonanceUI.o:ResonanceUI.fl ResonanceUI.cc ResonanceUI.h OscilGenUI.o:OscilGenUI.fl OscilGenUI.cc OscilGenUI.h ADnoteUI.o:ADnoteUI.fl ADnoteUI.cc ADnoteUI.h SUBnoteUI.o:SUBnoteUI.fl SUBnoteUI.cc SUBnoteUI.h +PADnoteUI.o:PADnoteUI.fl PADnoteUI.cc PADnoteUI.h EffUI.o: EffUI.fl EffUI.cc EffUI.h BankUI.o: BankUI.fl BankUI.cc BankUI.h diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl @@ -294,7 +294,7 @@ bankui->show();} xywh {15 235 40 20} box PLASTIC_UP_BOX labelsize 10 } Fl_Choice partrcv { - callback {master->part[npart]->Prcvchn=(int) o->value();} open selected + callback {master->part[npart]->Prcvchn=(int) o->value();} open 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;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Ch%d",i+1);if (i!=9) o->add(nrstr); else o->add("Dr10");};} code1 {o->value(master->part[npart]->Prcvchn);} @@ -383,25 +383,32 @@ if (fl_ask("Exit and leave the unsaved data?")) *exitprogram=1; xywh {0 0 100 20} } { menuitem {} { - label {&Save All As XML (EXPERIMENTAL)...} - callback {char *filename; - -filename=fl_file_chooser("Save:","({*.xml,*.xmlz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,".xml"); + label {&New (erase all)...} + callback {if (fl_ask("Clear *ALL* the parameters ?")){ + delete microtonalui; + pthread_mutex_lock(&master->mutex); + master->defaults(); + pthread_mutex_unlock(&master->mutex); -pthread_mutex_lock(&master->mutex); -master->saveXML(filename); -pthread_mutex_unlock(&master->mutex); + 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); + updatesendwindow(); + setfilelabel(NULL); +}; updatepanel();} - xywh {10 10 100 20} + xywh {20 20 100 20} } menuitem {} { - label {&Open XML...} + label {&Open Parameters...} callback {char *filename; -filename=fl_file_chooser("Open:","({*.xml,*.xmlz})",NULL,0); +filename=fl_file_chooser("Open:","({*.xmz})",NULL,0); if (filename==NULL) return; @@ -410,7 +417,7 @@ pthread_mutex_lock(&master->mutex); master->defaults(); //load the data - master->loadXML(filename); + int result=master->loadXML(filename); pthread_mutex_unlock(&master->mutex); npartcounter->do_callback(); @@ -423,34 +430,42 @@ microtonalui=new MicrotonalUI(&master->microtonal); nrpnbutton->value(master->ctl.NRPN.receive); updatesendwindow(); -updatepanel();} - xywh {20 20 100 20} divider +updatepanel(); + + +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.");} + xywh {20 20 100 20} } menuitem {} { - label {&New (erase all)...} - callback {if (fl_ask("Clear *ALL* the parameters ?")){ - delete microtonalui; + label {&Save All Parameters...} + callback {char *filename; +int result=0; - pthread_mutex_lock(&master->mutex); - master->defaults(); - pthread_mutex_unlock(&master->mutex); +filename=fl_file_chooser("Save:","({*.xmz})",NULL,0); +if (filename==NULL) return; +filename=fl_filename_setext(filename,".xmz"); - 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); - updatesendwindow(); - setfilelabel(NULL); +result=fileexists(filename); +if (result) { + result=0; + if (!fl_ask("The file exists. \\nOverwrite it?")) return; + }; + +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."); + + updatepanel();} - xywh {20 20 100 20} + xywh {10 10 100 20} divider } menuitem {} { - label {&Open...} + label {Open MAS_ZYN...} callback {const char *filename; filename=fl_file_chooser("Open:","(*.mas_zyn)",NULL,0); if (filename==NULL) return; @@ -483,36 +498,64 @@ if (result==0) { else fl_alert("Error: Could not load the file."); }; updatepanel();} - xywh {10 10 100 20} + xywh {10 10 100 20} divider } menuitem {} { - label {&Save All As...} + label {&Load Scale Settings...} callback {char *filename; -\#define EXT ".mas_zyn" -filename=fl_file_chooser("Save:","(*"EXT")",NULL,0); +filename=fl_file_chooser("Open:","({*.xsz})",NULL,0); if (filename==NULL) return; -filename=fl_filename_setext(filename,EXT); -\#undef EXT -slbuf.changemode(1); -slbuf.changeminimal(1);//MINIMAL + pthread_mutex_lock(&master->mutex); -master->saveloadbuf(&slbuf); + //clear all parameters + master->microtonal.defaults(); + + //load the data + int result=master->microtonal.loadXML(filename); pthread_mutex_unlock(&master->mutex); -int result=savebufferfile(&slbuf,filename,0,0); -if (result==1) { + + + 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_ask("The file exists. \\nOverwrite it?")) - result=savebufferfile(&slbuf,filename,1,0); + if (!fl_ask("The file exists. \\nOverwrite it?")) return; + }; -if (result!=0) fl_alert("Error: Could not save the file."); - else setfilelabel(filename); + + +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 {&Load Scale Settings...} + label {&Load SCL_ZYN...} callback {const char *filename; filename=fl_file_chooser("Load:","(*.scl_zyn)",NULL,0); if (filename==NULL) return; @@ -532,32 +575,7 @@ if (result==0) { if (result==4) fl_alert("Error: Could not load the file\\nbecause it is not a scale file."); else fl_alert("Error: Could not load the file."); };} - xywh {35 35 100 20} - } - menuitem {} { - label {Save Scale Settings &As...} - callback {char *filename; -\#define EXT ".scl_zyn" -filename=fl_file_chooser("Save:","(*"EXT")",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,EXT); -\#undef EXT -slbuf.changemode(1); -slbuf.changeminimal(1);//MINIMAL -master->microtonal.saveloadbuf(&slbuf); -int result=savebufferfile(&slbuf,filename,0,2); -if (result==1) { - result=0; - if (fl_ask("The file exists. \\nOverwrite it?")) - result=savebufferfile(&slbuf,filename,1,2); -}; -if (result!=0) fl_alert("Error: Could not save the file.");} - xywh {25 25 100 20} - } - menuitem {} { - label {Show Scale Settings...} - callback {microtonalui->show();} - xywh {0 0 100 20} divider + xywh {45 45 100 20} divider } menuitem {} { label {&Settings...} @@ -576,29 +594,27 @@ if (result!=0) fl_alert("Error: Could not save the file.");} } } submenu {} { - label {&Instrument} open + label {&Instrument} xywh {10 10 100 20} } { menuitem {} { - label {&Save As XML (EXPERIMENTAL)...} - callback {char *filename; - -filename=fl_file_chooser("Save:","({*.xml,*.xmlz})",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,"xml"); - + label {&Clear Instrument...} + callback {if (fl_ask("Clear instrument's parameters ?")){ + int npart=(int)npartcounter->value(); + pthread_mutex_lock(&master->mutex); + master->part[npart]->defaultsinstrument(); + pthread_mutex_unlock(&master->mutex); -pthread_mutex_lock(&master->mutex); -master->part[npart]->saveXML(filename); -pthread_mutex_unlock(&master->mutex); + npartcounter->do_callback(); +}; updatepanel();} - xywh {20 20 100 20} + xywh {35 35 100 20} } menuitem {} { - label {&Load XML Instrument...} + label {&Open Instrument...} callback {const char *filename; -filename=fl_file_chooser("Load:","({*.xml,*.xmlz})",NULL,0); +filename=fl_file_chooser("Load:","({*.xiz})",NULL,0); if (filename==NULL) return; @@ -610,30 +626,44 @@ pthread_mutex_lock(&master->mutex); master->part[npart]->defaultsinstrument(); //load the instr. parameters - master->part[npart]->loadXMLinstrument(filename); + int result=master->part[npart]->loadXMLinstrument(filename); pthread_mutex_unlock(&master->mutex); npartcounter->do_callback(); -updatepanel();} - xywh {30 30 100 20} divider +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 {&New Instrument...} - callback {if (fl_ask("Clear instrument's parameters ?")){ - int npart=(int)npartcounter->value(); - pthread_mutex_lock(&master->mutex); - master->part[npart]->defaultsinstrument(); - pthread_mutex_unlock(&master->mutex); + label {&Save Instrument ...} + callback {char *filename; - npartcounter->do_callback(); +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_ask("The file exists. \\nOverwrite it?")) 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 {35 35 100 20} + xywh {20 20 100 20} divider } menuitem {} { - label {&Load Instrument...} + label {Load INS_ZYN Instrument...} callback {const char *filename; filename=fl_file_chooser("Load:","(*.ins_zyn)",NULL,0); if (filename==NULL) return; @@ -659,33 +689,7 @@ updatepanel();} xywh {20 20 100 20} } menuitem {} { - label {&Save Instrument As...} - callback {char *filename; -\#define EXT ".ins_zyn" -filename=fl_file_chooser("Save:","(*"EXT")",NULL,0); -if (filename==NULL) return; -filename=fl_filename_setext(filename,EXT); -\#undef EXT -slbuf.changemode(1); -slbuf.changeminimal(1);//MINIMAL -int npart=(int)npartcounter->value(); -pthread_mutex_lock(&master->mutex); -master->part[npart]->saveloadbuf(&slbuf,1); -pthread_mutex_unlock(&master->mutex); -int result=savebufferfile(&slbuf,filename,0,1); -if (result==1) { - result=0; - if (fl_ask("The file exists. \\nOverwrite it?")) - result=savebufferfile(&slbuf,filename,1,1); -}; -if (result!=0) fl_alert("Error: Could not save the file."); - - -updatepanel();} - xywh {10 10 100 20} divider - } - menuitem {} { - label {Show Instr. &Bank...} + label {Show Instrument &Bank...} callback {bankui->show();} xywh {0 0 100 20} divider } @@ -723,8 +727,8 @@ if (result!=0) fl_alert("Error: Could not save the file.");} } } submenu {} { - label {&Sequencer} - xywh {0 0 100 20} + label {&Sequencer} selected + xywh {0 0 100 20} deactivate } { menuitem {} { label {Show &Sequencer...} @@ -949,7 +953,8 @@ if ((int) o->value()==1){ inseffectuigroup->activate(); insefftype->activate(); inseffectui->activate(); -};} open +}; +master->insefx[ninseff]->cleanup();} open xywh {95 120 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;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i);o->add(tmp);};} diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl @@ -182,6 +182,11 @@ if (oscbase==0) oscil->get(smps,-1.0); else oscil->getcurrentbasefunction(smps); pthread_mutex_unlock(&master->mutex); +if (damage()!=1){ + fl_color(0,0,0); + fl_rectf(ox,oy,lx,ly); +}; + //normalize REALTYPE max=0; for (i=0;i<OSCIL_SIZE;i++) @@ -254,7 +259,8 @@ pthread_mutex_lock(&master->mutex); pthread_mutex_unlock(&master->mutex); display->redraw(); -oldosc->redraw();} +oldosc->redraw(); +if (cbwidget!=NULL) cbwidget->do_callback();} xywh {0 15 15 115} type {Vert Knob} box FLAT_BOX selection_color 222 labelcolor 0 maximum 127 step 1 value 64 code0 {o->value(127-oscil->Phmag[n]);} code1 {if (oscil->Phmag[n]==64) o->selection_color(0);} @@ -271,7 +277,8 @@ pthread_mutex_lock(&master->mutex); pthread_mutex_unlock(&master->mutex); display->redraw(); -oldosc->redraw();} +oldosc->redraw(); +if (cbwidget!=NULL) cbwidget->do_callback();} 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 @@ -299,18 +306,18 @@ oldosc->redraw();} oscil=NULL; display=NULL;} {} } - Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_, Master *master_)} {} { + Function {init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_, Master *master_)} {} { code {oscil=oscil_; n=n_; display=display_; master=master_; oldosc=oldosc_; +cbwidget=cbwidget_; make_window(); end(); harmonic->show();} {} } - Function {refresh()} {open - } { + Function {refresh()} {} { code {mag->value(127-oscil->Phmag[n]); phase->value(oscil->Phphase[n]); @@ -324,7 +331,7 @@ delete(harmonic);} {} decl {OscilGen *oscil;} {} decl {Fl_Group *display;} {} decl {int n;} {} - decl {Fl_Widget *oldosc;} {} + decl {Fl_Widget *oldosc,*cbwidget;} {} decl {Master *master;} {} } @@ -332,7 +339,8 @@ class OscilEditor {} { Function {make_window()} {} { Fl_Window osceditUI { label {ADsynth Oscillator Editor} - xywh {4 91 745 590} type Double hide + xywh {4 91 745 590} type Double + code0 {if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible } { Fl_Group oscildisplaygroup { xywh {15 5 360 300} box ENGRAVED_FRAME @@ -352,7 +360,7 @@ class OscilEditor {} { oscildisplaygroup->redraw(); oldosc->redraw();} tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {150 285 100 10} type {Horz Knob} box FLAT_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1 - code0 {;} + code0 {if (oscil->ADvsPAD) o->hide();} } Fl_Group {} {open xywh {20 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63 @@ -361,6 +369,7 @@ oldosc->redraw();} } {} Fl_Group {} { xywh {256 277 115 25} box ENGRAVED_BOX + code0 {if (oscil->ADvsPAD) o->hide();} } { Fl_Choice hrndtype { label {H.rnd} @@ -402,9 +411,9 @@ oldosc->redraw();} Fl_Dial bfslider { callback {oscil->Pbasefuncpar=(int)o->value()+64; basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw(); -bfparval->value(oscil->Pbasefuncpar-64);} +bfparval->value(oscil->Pbasefuncpar-64); + +redrawoscil();} tooltip {Base Function Parameter} xywh {530 280 20 20} minimum -64 maximum 63 step 1 class WidgetPDial } @@ -413,8 +422,7 @@ bfparval->value(oscil->Pbasefuncpar-64);} callback {oscil->Pcurrentbasefunc=(int) o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw(); +redrawoscil(); if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate(); else basefuncmodulation->activate();} @@ -498,8 +506,7 @@ if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodula label {B.F.Mod.} callback {oscil->Pbasefuncmodulation=(int) o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Base function modulation} xywh {609 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10 } { menuitem {} { @@ -522,24 +529,21 @@ oldosc->redraw();} Fl_Dial bfmodpar1 { callback {oscil->Pbasefuncmodulationpar1=(int)o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's modulation parameter 1} xywh {669 281 15 15} maximum 127 step 1 class WidgetPDial } Fl_Dial bfmodpar2 { callback {oscil->Pbasefuncmodulationpar2=(int)o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's modulation parameter 2} xywh {689 281 15 15} maximum 127 step 1 class WidgetPDial } Fl_Dial bfmodpar3 { callback {oscil->Pbasefuncmodulationpar3=(int)o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's modulation parameter 3} xywh {709 281 15 15} maximum 127 step 1 class WidgetPDial } @@ -549,8 +553,8 @@ oldosc->redraw();} label {Mag.Type} callback {oscil->Phmagtype=(int) o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} + +redrawoscil();} xywh {80 280 65 20} down_box BORDER_BOX labelsize 12 textsize 12 } { menuitem {} { @@ -606,9 +610,8 @@ pthread_mutex_lock(&master->mutex); oscil->prepare(); pthread_mutex_unlock(&master->mutex); -oscildisplaygroup->redraw(); basefuncdisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Use this Oscillator as base function} xywh {15 310 85 20} box THIN_UP_BOX labelfont 1 labelsize 12 } Fl_Button {} { @@ -640,8 +643,7 @@ pthread_mutex_lock(&master->mutex); oscil->prepare(); pthread_mutex_unlock(&master->mutex); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} xywh {680 500 55 20} box THIN_UP_BOX labelfont 1 labelsize 12 } Fl_Group {} { @@ -651,8 +653,7 @@ oldosc->redraw();} label {Wsh.} callback {oscil->Pwaveshapingfunction=(int) o->value(); basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} open +redrawoscil();} open tooltip {Waveshaping function} xywh {175 310 55 20} down_box BORDER_BOX labelsize 10 textsize 10 } { menuitem {} { @@ -718,9 +719,8 @@ oldosc->redraw();} open } Fl_Dial wshpar { callback {oscil->Pwaveshaping=(int)o->value()+64; -oscildisplaygroup->redraw(); -oldosc->redraw(); -wsparval->value(oscil->Pwaveshaping-64);} +wsparval->value(oscil->Pwaveshaping-64); +redrawoscil();} tooltip {Waveshaping Parameter} xywh {270 310 20 20} minimum -64 maximum 63 step 1 class WidgetPDial } @@ -732,14 +732,14 @@ wsparval->value(oscil->Pwaveshaping-64);} label {Clr.} tooltip {Auto clear when using the oscillator as base function} xywh {105 310 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 } - Fl_Group {} {open + Fl_Group {} { xywh {295 305 155 30} box ENGRAVED_BOX } { Fl_Choice fltbutton { label Filter callback {oscil->Pfiltertype=(int) o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} open + +redrawoscil();} tooltip {Oscillator's filter type} xywh {325 310 50 20} down_box BORDER_BOX labelsize 10 textsize 10 } { menuitem {} { @@ -794,20 +794,31 @@ oldosc->redraw();} open label LSh xywh {95 95 100 20} labelfont 1 labelsize 10 } + menuitem {} { + label S selected + xywh {105 105 100 20} labelfont 1 labelsize 10 + } } - Fl_Dial filtervalue { - callback {oscil->Pfilterpar=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Oscillator's filter parameter} xywh {380 310 20 20} maximum 127 step 1 + Fl_Dial filtervalue1 { + callback {oscil->Pfilterpar1=(int)o->value(); + +redrawoscil();} + tooltip {Oscillator's filter parameter1} xywh {377 310 20 20} maximum 127 step 1 class WidgetPDial } Fl_Check_Button filterpref { - label preF + label p callback {oscil->Pfilterbeforews=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} - tooltip {Apply the filter before the waveshaping} xywh {410 310 35 20} down_box DOWN_BOX labelsize 10 align 24 + +redrawoscil();} + tooltip {Apply the filter before the waveshaping} xywh {425 310 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 {402 310 20 20} maximum 127 step 1 + class WidgetPDial } } Fl_Scroll _this_has_to_be_the_last { @@ -815,7 +826,7 @@ oldosc->redraw();} } { Fl_Pack harmonics {open xywh {20 340 650 225} type HORIZONTAL - code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,master);}} + code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,cbwidget,master);}} } {} } Fl_Group {} { @@ -824,8 +835,7 @@ oldosc->redraw();} Fl_Choice sabutton { label {Sp.adj.} callback {oscil->Psatype=(int) o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's spectrum adjust} xywh {640 310 60 20} down_box BORDER_BOX labelsize 10 textsize 10 } { menuitem {} { @@ -847,8 +857,7 @@ oldosc->redraw();} } Fl_Dial sadjpar { callback {oscil->Psapar=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's spectrum adjust parameter} xywh {705 310 20 20} maximum 127 step 1 class WidgetPDial } @@ -859,23 +868,20 @@ oldosc->redraw();} Fl_Counter harmonicshiftcounter { label {Harmonic Shift} callback {oscil->Pharmonicshift=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} xywh {680 360 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(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {700 380 34 15} down_box DOWN_BOX labelsize 10 align 24 } Fl_Button {} { label R callback {oscil->Pharmonicshift=0; harmonicshiftcounter->value(0); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} xywh {680 380 20 15} box THIN_UP_BOX labelfont 1 labelsize 10 } } @@ -918,8 +924,8 @@ oldosc->redraw();} Fl_Choice modtype { label {Mod.} callback {oscil->Pmodulation=(int) o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} + +redrawoscil();} tooltip modulation xywh {480 312 50 15} down_box BORDER_BOX labelsize 10 textsize 10 } { menuitem {} { @@ -941,22 +947,21 @@ oldosc->redraw();} } Fl_Dial modpar1 { callback {oscil->Pmodulationpar1=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} + +redrawoscil();} tooltip {Oscillator's modulation parameter 1} xywh {540 312 15 15} maximum 127 step 1 class WidgetPDial } Fl_Dial modpar2 { callback {oscil->Pmodulationpar2=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} + +redrawoscil();} tooltip {Oscillator's modulation parameter 2} xywh {560 312 15 15} maximum 127 step 1 class WidgetPDial } Fl_Dial modpar3 { callback {oscil->Pmodulationpar3=(int)o->value(); -oscildisplaygroup->redraw(); -oldosc->redraw();} +redrawoscil();} tooltip {Oscillator's modulation parameter 3} xywh {580 312 15 15} maximum 127 step 1 class WidgetPDial } @@ -969,18 +974,18 @@ pthread_mutex_lock(&master->mutex); oscil->convert2sine(0); pthread_mutex_unlock(&master->mutex); -oscildisplaygroup->redraw(); -oldosc->redraw(); - +redrawoscil(); refresh();} xywh {680 530 55 20} box THIN_UP_BOX labelfont 1 labelsize 12 } } } - Function {OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Master *master_)} {} { + Function {OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Master *master_)} {} { code {oscil=oscil_; oldosc=oldosc_; +cbwidget=cbwidget_; master=master_; + make_window(); refresh(); @@ -991,8 +996,7 @@ osceditUI->show();} {} for (int i=0;i<MAX_AD_HARMONICS;i++) delete (h[i]); delete (osceditUI);} {} } - Function {refresh()} {open - } { + Function {refresh()} {} { code {magtype->value(oscil->Phmagtype); rndslider->value(oscil->Prand-64); @@ -1013,7 +1017,8 @@ wsparval->value(oscil->Pwaveshaping-64); wshpar->value(oscil->Pwaveshaping-64); fltbutton->value(oscil->Pfiltertype); -filtervalue->value(oscil->Pfilterpar); +filtervalue1->value(oscil->Pfilterpar1); +filtervalue2->value(oscil->Pfilterpar2); filterpref->value(oscil->Pfilterbeforews); modtype->value(oscil->Pmodulation); @@ -1035,11 +1040,15 @@ for (int i=0;i<MAX_AD_HARMONICS;i++) h[i]->refresh(); basefuncdisplaygroup->redraw(); oscildisplaygroup->redraw(); -oldosc->redraw();} {selected - } +oldosc->redraw();} {} + } + Function {redrawoscil()} {} { + code {oscildisplaygroup->redraw(); +oldosc->redraw(); +if (cbwidget!=NULL) cbwidget->do_callback();} {} } decl {OscilGen *oscil;} {} - decl {Fl_Widget *oldosc;} {} + decl {Fl_Widget *oldosc,*cbwidget;} {} decl {Oscilharmonic *h[MAX_AD_HARMONICS];} {} decl {Master *master;} {} } diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl @@ -0,0 +1,866 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0105 +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 <FL/Fl_Box.H>} {public +} + +decl {\#include <FL/Fl_Group.H>} {public +} + +decl {\#include <math.h>} {} + +decl {\#include <stdio.h>} {} + +decl {\#include <stdlib.h>} {} + +decl {\#include <string.h>} {} + +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 +} + +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; +REALTYPE smps[lx]; + +REALTYPE realbw=pars->getprofile(smps,lx); + +//draw the equivalent bandwidth +fl_color(220,220,220); +fl_line_style(0); +int rbw=(int)(realbw*(lx-1.0)/2.0); +for (int i=lx/2-rbw;i<(lx/2+rbw);i++) fl_line(ox+i,oy,ox+i,oy+ly-1); + +fl_line_style(0); +fl_color(200,200,200); +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_DOT); +fl_line(ox+lx/2,oy,ox+lx/2,oy+ly); + +//draw the graph +fl_line_style(0); +int old=0; +for (int i=0;i<lx;i++){ + int val=(int) ((ly-2)*smps[i]); + fl_color(180,210,240); + fl_line(ox+i,oy+ly-1,ox+i,oy+ly-1-val); + fl_color(0,0,100); + if (i>0) fl_line(ox+i-1,oy+ly-2-old,ox+i,oy+ly-2-val); + old=val; +}; + + + +fl_line_style(FL_DASH); +fl_color(0,100,220); +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);} {} + } + 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;i<maxharmonic;i++){ + fl_color(200,200,200); + fl_line_style(FL_DOT); + if (i%5==0) fl_line_style(0); + if (i%10==0) fl_color(160,160,160); + int kx=(int)(lx/(REALTYPE)maxharmonic*i); + fl_line(ox+kx,oy,ox+kx,oy+ly); +}; + + + +int n=OSCIL_SIZE/2; +REALTYPE spc[n]; +for (int i=0;i<n;i++) spc[i]=0.0; + +pthread_mutex_lock(&master->mutex); +pars->oscilgen->getspectrum(n,spc,0); +pthread_mutex_unlock(&master->mutex); + + +//normalize +REALTYPE max=0; +for (int i=0;i<n;i++){ + REALTYPE x=fabs(spc[i]); + if (max<x) max=x; +} +if (max<0.000001) max=1.0; +max=max*1.05; + + + + +fl_color(180,0,0); +fl_line_style(0); +for (int i=1;i<n;i++){ + REALTYPE nhr=pars->getNhr(i); + int kx=(int)(lx/(REALTYPE)maxharmonic*nhr); + if ((kx<0)||(kx>lx)) continue; + + REALTYPE x=spc[i-1]/max; + if (x>dB2rap(-maxdb)) x=rap2dB(x)/maxdb+1; + else continue; + int yy=(int)(x*ly); + fl_line(ox+kx,oy+ly-1-yy,ox+kx,oy+ly-1); +};} {selected + } + } + decl {Master *master;} {} + decl {PADnoteParameters *pars;} {public + } +} + +class PADnoteUI {} { + Function {make_window()} {} { + Fl_Window padnotewindow { + label {PAD synth Parameters} + xywh {184 106 535 450} type Double hide + } { + Fl_Tabs {} { + xywh {0 0 535 395} + } { + Fl_Group {} { + label {Harmonic Structure} + xywh {0 20 535 375} box ENGRAVED_BOX + } { + Fl_Group {} { + xywh {5 30 90 260} box ENGRAVED_BOX + } { + Fl_Dial {} { + 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 11 align 1 maximum 127 step 1 + code0 {o->value(pars->Php.base.par1);} + class WidgetPDial + } + Fl_Choice {} { + 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 {} { + label FreqMult + callback {pars->Php.freqmult=(int) o->value(); +hprofile->redraw(); +cbwidget->do_callback();} + xywh {55 75 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->Php.freqmult);} + class WidgetPDial + } + Fl_Dial {} { + label Stretch + callback {pars->Php.modulator.par1=(int) o->value(); +hprofile->redraw(); +cbwidget->do_callback();} + xywh {20 115 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->Php.modulator.par1);} + class WidgetPDial + } + Fl_Dial {} { + label SFreq + callback {pars->Php.modulator.freq=(int) o->value(); +hprofile->redraw(); +cbwidget->do_callback();} + xywh {55 115 25 25} box ROUND_UP_BOX labelsize 11 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 {} { + 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 {} { + 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 {} { + 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 11 align 1 maximum 127 step 1 + code0 {o->value(pars->Php.amp.par1);} + class WidgetPDial + } + Fl_Dial {} { + 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 11 align 1 maximum 127 step 1 + code0 {o->value(pars->Php.amp.par2);} + class WidgetPDial + } + } + Fl_Check_Button {} { + 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 {} { + callback {pars->Php.onehalf=o->value(); +hprofile->redraw(); +cbwidget->do_callback();} + xywh {15 143 75 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_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,master);} + xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 12 + } + 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);} + xywh {375 225 80 20} box THIN_UP_BOX + } + Fl_Dial {} { + label BandWidth + callback {bwcents->value(pars->setPbandwidth((int) o->value())); +cbwidget->do_callback();} + xywh {15 295 35 35} box ROUND_UP_BOX labelsize 11 maximum 1000 step 1 + code0 {o->value(pars->Pbandwidth);} + class WidgetPDial + } + Fl_Value_Output bwcents { + label cents + xywh {55 305 55 15} labelsize 10 align 8 maximum 10000 step 0.1 + code0 {o->value(pars->setPbandwidth(pars->Pbandwidth));} + } + Fl_Group {} { + xywh {310 295 220 45} box ENGRAVED_BOX + } { + Fl_Choice {} { + label OvertonesPosition + callback {pars->Phrpos.type=o->value(); +overtonepos->redraw(); +cbwidget->do_callback();} open + xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 12 + code0 {o->value(pars->Phrpos.type);} + } { + menuitem {} { + label Harmonic + xywh {70 70 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label ShiftU + xywh {80 80 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label ShiftL + xywh {90 90 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label PowerU + xywh {90 90 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label PowerL + xywh {100 100 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Sine + xywh {110 110 100 20} labelfont 1 labelsize 12 + } + } + Fl_Dial {} { + label Par1 + callback {pars->Phrpos.par1=(int) o->value(); +overtonepos->redraw(); +cbwidget->do_callback();} + xywh {425 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1 + code0 {o->value(pars->Phrpos.par1);} + class WidgetPDial + } + Fl_Dial {} { + label Par2 + callback {pars->Phrpos.par2=(int) o->value(); +overtonepos->redraw(); +cbwidget->do_callback();} + xywh {460 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1 + code0 {o->value(pars->Phrpos.par2);} + class WidgetPDial + } + Fl_Dial {} { + label ForceH + callback {pars->Phrpos.par3=(int) o->value(); +overtonepos->redraw(); +cbwidget->do_callback();} + xywh {495 310 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 255 step 1 + code0 {o->value(pars->Phrpos.par3);} + class WidgetPDial + } + } + Fl_Choice {} { + label {Bandwidth Scale} + callback {pars->Pbwscale=(int) o->value(); +cbwidget->do_callback();} + xywh {165 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 12 + code0 {o->value(pars->Pbwscale);} + } { + menuitem {} { + label Normal + xywh {95 95 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label EqualHz + xywh {105 105 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Quater + xywh {115 115 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Half + xywh {125 125 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {75%} + xywh {135 135 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {150%} + xywh {145 145 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label Double + xywh {145 145 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {Inv.Half} + xywh {155 155 100 20} labelfont 1 labelsize 12 + } + } + Fl_Group overtonepos { + xywh {5 345 525 45} box FLAT_BOX color 54 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 {} { + 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 12 + code0 {o->value(pars->Pquality.samplesize);} + } { + menuitem {} { + label {16k (Tiny)} + xywh {155 155 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 32k + xywh {165 165 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {64k (Small)} + xywh {175 175 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 128k + xywh {185 185 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {256k (Normal)} + xywh {205 205 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 512k + xywh {200 200 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label {1M (Big)} + xywh {205 205 100 20} labelfont 1 labelsize 12 + } + } + Fl_Choice {} { + label {smp/oct} + callback {pars->Pquality.smpoct=(int) o->value(); +cbwidget->do_callback();} + xywh {430 155 45 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12 + code0 {o->value(pars->Pquality.smpoct);} + } { + menuitem {} { + label {0.5} + xywh {10 10 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 1 + xywh {0 0 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 2 + xywh {10 10 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 3 + xywh {20 20 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 4 + xywh {30 30 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 6 + xywh {40 40 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 12 + xywh {50 50 100 20} labelfont 1 labelsize 12 + } + } + Fl_Choice {} { + label {no.oct} + callback {pars->Pquality.oct=(int) o->value(); +cbwidget->do_callback();} + xywh {480 155 45 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12 + code0 {o->value(pars->Pquality.oct);} + } { + menuitem {} { + label 1 + xywh {10 10 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 2 + xywh {20 20 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 3 + xywh {30 30 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 4 + xywh {40 40 100 20} labelfont 1 labelsize 12 + } + menuitem {} { + label 5 + xywh {50 50 100 20} labelfont 1 labelsize 12 + } + } + Fl_Choice {} { + label base + callback {pars->Pquality.basenote=(int) o->value(); +cbwidget->do_callback();} + xywh {375 155 50 20} down_box BORDER_BOX labelsize 12 align 5 textsize 12 + 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 85} box FLAT_BOX color 54 selection_color 218 labelcolor 63 + code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");} + code1 {hpui->init(pars,master);} + } {} + Fl_Box {} { + label {Profile of One Harmonic (Frequency Distribution)} + xywh {160 25 315 20} + } + } + Fl_Group {} { + label {Envelopes&LFOs} + xywh {0 20 535 375} box ENGRAVED_BOX hide + } { + Fl_Group {} { + label FREQUENCY + xywh {5 275 525 115} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17 + } { + Fl_Group {} { + 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 {} { + 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 12 + code0 {int k=pars->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->PCoarseDetune = k+ + (pars->PCoarseDetune/1024)*1024;} + tooltip {Coarse Detune} xywh {455 365 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 12 + code0 {int k=pars->PCoarseDetune%1024;} + code1 {if (k>=512) k-=1024;} + code2 {o->value(k);} + code3 {o->lstep(10);} + } + Fl_Group {} { + 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 {} { + 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 {} { + label {Detune Type} + callback {pars->PDetuneType=(int) o->value()+1; +detunevalueoutput->do_callback();} open + xywh {450 335 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->PDetuneType-1);} + } {} + Fl_Check_Button {} { + 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 11 + 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 THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17 + } { + Fl_Value_Slider {} { + label Vol + callback {pars->PVolume=(int)o->value();} + tooltip Volume xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1 + code0 {o->value(pars->PVolume);} + } + Fl_Value_Slider {} { + 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 12 align 8 maximum 127 step 1 + code0 {o->value(pars->PAmpVelocityScaleFunction);} + } + Fl_Dial {} { + label Pan + callback {pars->PPanning=(int) o->value();} + tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 + code0 {o->value(pars->PPanning);} + class WidgetPDial + } + Fl_Dial {} { + label {P.Str.} + callback {pars->PPunchStrength=(int) o->value();} + tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->PPunchStrength);} + class WidgetPDial + } + Fl_Dial {} { + label {P.t.} + callback {pars->PPunchTime=(int) o->value();} + tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->PPunchTime);} + class WidgetPDial + } + Fl_Dial {} { + label {P.Stc.} + callback {pars->PPunchStretch=(int) o->value();} + tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->PPunchStretch);} + class WidgetPDial + } + Fl_Dial {} { + label {P.Vel.} + callback {pars->PPunchVelocitySensing=(int) o->value();} + tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 + code0 {o->value(pars->PPunchVelocitySensing);} + class WidgetPDial + } + Fl_Group {} { + 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 {} { + 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 {} { + 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 THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17 + } { + Fl_Group {} { + 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 {} { + 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 {} { + 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);} + xywh {45 405 185 40} box THIN_UP_BOX labelfont 1 labelsize 23 + code0 {o->color(FL_RED);} + } + Fl_Button {} { + label Close + callback {padnotewindow->hide();} + xywh {300 405 195 40} box THIN_UP_BOX + } + } + } + Function {PADnoteUI(PADnoteParameters *parameters,Master *master_)} {} { + code {pars=parameters; +master=master_; +oscui=NULL; +resui=new ResonanceUI(pars->resonance); +make_window();} {} + } + 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/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -30,6 +30,9 @@ decl {\#include "ADnoteUI.h"} {public decl {\#include "SUBnoteUI.h"} {public } +decl {\#include "PADnoteUI.h"} {public +} + decl {\#include "../Misc/Config.h"} {public } @@ -90,11 +93,11 @@ class PartKitItem {: {public Fl_Group} Function {make_window()} {private } { Fl_Window partkititem { - private xywh {4 556 590 27} type Double hide + private xywh {113 271 670 27} type Double hide class Fl_Group } { Fl_Group partkititemgroup { - private xywh {55 0 530 20} box FLAT_BOX + private xywh {55 0 605 20} box FLAT_BOX code0 {if (part->kit[n].Penabled==0) o->deactivate();} } { Fl_Counter minkcounter { @@ -174,10 +177,25 @@ if (part->kit[n].Psubenabled!=0) subeditbutton->activate(); Fl_Choice sendtoeffect { callback {if (o->value()!=0) part->kit[n].Psendtoparteffect=(int)o->value()-1; else part->kit[n].Psendtoparteffect=127;} open - xywh {540 0 45 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 + 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;i<NUM_PART_EFX;i++){sprintf(nrstr,"FX%d",i+1);o->add(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 12 + 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 12 align 4 + code0 {o->value(part->kit[n].Ppadenabled);} + code1 {if (n==0) o->hide();} + } } Fl_Check_Button enabledcheck { label 01 @@ -407,7 +425,7 @@ maxkcounter->do_callback();} label KLmt callback {int val=0; val=atoi(o->text()); -part->setkeylimit(val);} open selected +part->setkeylimit(val);} open tooltip {Key Limit} xywh {210 155 50 20} down_box BORDER_BOX labelsize 10 align 8 textfont 1 textsize 10 } {} } @@ -586,8 +604,8 @@ part->ctl.portamento.updowntimestretch=x;} private xywh {121 424 390 145} type Double hide } { Fl_Counter inseffnocounter { - label {Ins.Effect No.} - callback {ninseff=(int) o->value(); + label {FX No.} + callback {ninseff=(int) o->value()-1; insefftype->value(part->partefx[ninseff]->geteffect()); //insefftype->do_callback(); inseffectui->refresh(part->partefx[ninseff]); @@ -595,10 +613,10 @@ 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 labelsize 11 align 6 minimum 0 maximum 127 step 1 textfont 1 - code0 {o->bounds(0,NUM_PART_EFX-1);} - code1 {o->value(ninseff);} +sendtochoice->value(x);} selected + 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 @@ -658,13 +676,14 @@ inseffectui->refresh(part->partefx[ninseff]);} Fl_Button {} { label Close callback {partfx->hide();} - xywh {320 120 65 20} + xywh {325 115 60 20} box THIN_UP_BOX } Fl_Choice sendtochoice { label {Send To.} callback {int x=(int) o->value(); -if (x==1) x=127; -part->Pefxroute[ninseff]=x;} +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 11 align 6 code0 {int x=part->Pefxroute[ninseff]; if (x==127) x=1;} code1 {o->value(x);} @@ -677,6 +696,10 @@ part->Pefxroute[ninseff]=x;} label {Part Out} xywh {55 55 100 20} labelfont 1 labelsize 11 } + menuitem {} { + label {Dry Out} + xywh {65 65 100 20} labelfont 1 labelsize 11 + } } Fl_Check_Button bypasseff { label bypass @@ -687,7 +710,7 @@ part->Pefxroute[ninseff]=x;} } Fl_Window instrumentkitlist { label {Instrument Kit} - xywh {70 61 590 370} type Double hide + xywh {113 324 670 370} type Double hide } { Fl_Button {} { label {Close Window} @@ -695,12 +718,12 @@ part->Pefxroute[ninseff]=x;} xywh {375 350 160 20} box THIN_UP_BOX } Fl_Scroll kitlist { - xywh {0 15 590 330} type VERTICAL box THIN_UP_BOX + xywh {0 15 670 330} type VERTICAL box THIN_UP_BOX code0 {if (part->Pkitmode==0) o->deactivate();} } { Fl_Pack {} { - xywh {0 20 590 320} - code0 {for (int i=0;i<NUM_KIT_ITEMS;i++){partkititem[i]=new PartKitItem(0,0,590,20,"");partkititem[i]->init(part,i,master,this);}} + xywh {0 20 670 320} + code0 {for (int i=0;i<NUM_KIT_ITEMS;i++){partkititem[i]=new PartKitItem(0,0,670,20,"");partkititem[i]->init(part,i,master,this);}} } {} } Fl_Box {} { @@ -725,7 +748,7 @@ part->Pefxroute[ninseff]=x;} } Fl_Box {} { label SUBsynth - xywh {475 0 60 15} labelfont 1 labelsize 12 align 18 + xywh {470 0 60 15} labelfont 1 labelsize 12 align 18 } Fl_Button swapcopybutton { label {Swap/Copy...} @@ -778,7 +801,11 @@ if (part->Pkitmode==0) { } Fl_Box {} { label {FX.r.} - xywh {545 0 30 15} labelfont 1 labelsize 12 align 18 + xywh {620 0 30 15} labelfont 1 labelsize 12 align 18 + } + Fl_Box {} { + label PADsynth + xywh {540 0 60 15} labelfont 1 labelsize 12 align 18 } } Fl_Window swapwindow { @@ -839,7 +866,7 @@ subsynenabledcheck->value(part->kit[0].Psubenabled);} } Fl_Window instrumenteditwindow { label {Instrument Edit} - xywh {60 156 395 360} type Double hide + xywh {182 214 395 360} type Double hide } { Fl_Group {} { xywh {0 220 395 110} box ENGRAVED_FRAME @@ -850,15 +877,14 @@ subsynenabledcheck->value(part->kit[0].Psubenabled);} } { Fl_Button {} { label Edit - callback {//showparameters(0,1); -fl_alert("Oops... try again...")} + callback {showparameters(0,2);} xywh {215 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128 } Fl_Check_Button padsynenabledcheck { label Enabled - callback {//part->kit[0].Padenabled=(int) o->value();} + callback {part->kit[0].Ppadenabled=(int) o->value();} tooltip {enable/disable PADsynth} xywh {215 255 80 20} box PLASTIC_UP_BOX down_box DOWN_BOX color 222 selection_color 218 labelfont 1 labelsize 12 - code1 {//o->value(part->kit[0].Padenabled);} + code1 {o->value(part->kit[0].Ppadenabled);} } } Fl_Group {} { @@ -1008,6 +1034,7 @@ fl_alert("Oops... try again...")} code {part=NULL; adnoteui=NULL; subnoteui=NULL; +padnoteui=NULL; lastkititem=-1;} {} } Function {init(Part *part_,Master *master_,int npart_,BankUI *bankui_)} {} { @@ -1052,7 +1079,8 @@ keylimitlist->value(val);} {} if (kititem!=lastkititem){ if (adnoteui!=NULL) delete (adnoteui); if (subnoteui!=NULL) delete (subnoteui); - adnoteui=NULL;subnoteui=NULL; + if (padnoteui!=NULL) delete (padnoteui); + adnoteui=NULL;subnoteui=NULL;padnoteui=NULL; lastkititem=kititem; if (kititem>=NUM_KIT_ITEMS) return;//bad kit item @@ -1063,18 +1091,24 @@ if (kititem!=lastkititem){ 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==1)&&(subnoteui!=NULL)) subnoteui->SUBparameters->show(); +if ((engine==2)&&(adnoteui!=NULL)) padnoteui->padnotewindow->show();} {} } Function {~PartUI()} {} { code {config.ui.showinstrumentinfo=instrumenteditwindow->visible(); if (adnoteui!=NULL) delete (adnoteui); if (subnoteui!=NULL) delete (subnoteui); +if (padnoteui!=NULL) delete (padnoteui); partgroup->hide(); delete(partgroup); @@ -1096,6 +1130,7 @@ delete(instrumenteditwindow);} {} decl {BankUI *bankui;} {} decl {ADnoteUI *adnoteui;} {} decl {SUBnoteUI *subnoteui;} {} + decl {PADnoteUI *padnoteui;} {} decl {PartSysEffSend *psyef[NUM_SYS_EFX];} {} decl {int npart;} {} decl {int ninseff;} {} diff --git a/src/UI/ResonanceUI.fl b/src/UI/ResonanceUI.fl @@ -32,7 +32,8 @@ decl {\#include "WidgetPDial.h"} {public class ResonanceGraph {: {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;} {} + code {respar=NULL; +cbwidget=NULL;} {} } Function {init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_)} {} { code {respar=respar_; @@ -152,25 +153,30 @@ if ((event==FL_PUSH)||(event==FL_DRAG)){ redraw(); }; -if (event==FL_RELEASE) oldx=-1; +if (event==FL_RELEASE) { + oldx=-1; + if (cbwidget!=NULL) cbwidget->do_callback(); +}; return(1);} {} } + Function {setcbwidget(Fl_Widget *cbwidget)} {} { + code {this->cbwidget=cbwidget;} {} + } decl {Fl_Value_Output *khzvalue;} {} decl {Fl_Value_Output *dbvalue;} {} decl {Resonance *respar;} {} decl {int oldx,oldy;} {} decl {REALTYPE khzval;} {public } + decl {Fl_Widget *cbwidget;} {} } -class ResonanceUI {open -} { - Function {make_window()} {open - } { +class ResonanceUI {} { + Function {make_window()} {} { Fl_Window resonancewindow { - label Resonance - xywh {32 300 780 305} type Double visible + label Resonance selected + xywh {32 300 780 305} type Double hide } { Fl_Value_Output khzvalue { label kHz @@ -197,24 +203,28 @@ class ResonanceUI {open label Zero callback {for (int i=0;i<N_RES_POINTS;i++) respar->setpoint(i,64); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Clear the resonance function} xywh {556 264 66 15} box THIN_UP_BOX labelfont 1 } Fl_Button {} { label Smooth callback {respar->smooth(); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Smooth the resonance function} xywh {556 282 66 18} box THIN_UP_BOX labelfont 1 } Fl_Check_Button {} { label Enable - callback {respar->Penabled=(int) o->value();} + 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 {} { callback {maxdbvo->value(o->value()); -respar->PmaxdB=(int) 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 { @@ -242,24 +252,28 @@ respar->PmaxdB=(int) o->value();} Fl_Button {} { label RND2 callback {respar->randomize(1); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Randomize the resonance function} xywh {631 276 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Button {} { label RND1 callback {respar->randomize(0); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Randomize the resonance function} xywh {631 264 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Button {} { label RND3 callback {respar->randomize(2); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Randomize the resonance function} xywh {631 288 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Check_Button {} { label {P.1st} - callback {respar->Pprotectthefundamental=(int) o->value();} + callback {respar->Pprotectthefundamental=(int) o->value(); +redrawPADnoteApply();} tooltip {Protect the fundamental frequency (do not damp the first harmonic)} xywh {430 285 45 15} down_box DOWN_BOX labelsize 10 code0 {o->value(respar->Pprotectthefundamental);} } @@ -269,14 +283,16 @@ resonancewindow->redraw();} if (Fl::event_button()==FL_LEFT_MOUSE) type=0; else type=1; respar->interpolatepeaks(type); -resonancewindow->redraw();} +resonancewindow->redraw(); +redrawPADnoteApply();} tooltip {Interpolate the peaks} xywh {430 265 46 15} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Dial {} { label {C.f.} callback {respar->Pcenterfreq=(int)o->value(); centerfreqvo->do_callback(); -rg->redraw();} selected +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 @@ -285,7 +301,8 @@ rg->redraw();} selected label {Oct.} callback {respar->Poctavesfreq=(int)o->value(); octavesfreqvo->do_callback(); -rg->redraw();} +rg->redraw(); +redrawPADnoteApply();} xywh {280 265 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 code0 {o->value(respar->Poctavesfreq);} class WidgetPDial @@ -294,12 +311,21 @@ rg->redraw();} } Function {ResonanceUI(Resonance *respar_)} {} { code {respar=respar_; +cbwidget=NULL; make_window();} {} } Function {~ResonanceUI()} {} { code {resonancewindow->hide();} {} } + Function {redrawPADnoteApply()} {} { + code {if (cbwidget!=NULL) cbwidget->do_callback();} {} + } + Function {setcbwidget(Fl_Widget *cbwidget)} {} { + code {this->cbwidget=cbwidget; +rg->setcbwidget(cbwidget);} {} + } decl {Resonance *respar;} {public } decl {ResonanceGraph *rg;} {} + decl {Fl_Widget *cbwidget;} {} } diff --git a/src/UI/SeqUI.fl b/src/UI/SeqUI.fl @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0200 +version 1.0105 header_name {.h} code_name {.cc} decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} @@ -15,13 +15,11 @@ decl {\#include "../Misc/Master.h"} {public decl {\#include "WidgetPDial.h"} {public } -class SeqUI {open -} { - Function {make_window()} {open - } { +class SeqUI {} { + Function {make_window()} {} { Fl_Window seqwin { label {Sequencer - ZynAddSubFX} - xywh {104 235 235 140} type Double visible + xywh {104 235 280 265} type Double hide } { Fl_Group {} { label Player @@ -51,10 +49,14 @@ master->seq.stopplay();} } Fl_Value_Slider {} { label {Play speed} - callback {master->seq.setplayspeed((int) o->value());} selected + callback {master->seq.setplayspeed((int) o->value());} xywh {15 105 190 20} type {Horz Knob} minimum -128 maximum 128 step 1 code0 {o->value(master->seq.playspeed);} } + Fl_Box {} { + label {This is not finished} selected + xywh {25 155 225 90} labelfont 1 labelsize 30 align 128 + } } } Function {SeqUI(Master *master_)} {open diff --git a/src/globals.h b/src/globals.h @@ -62,6 +62,13 @@ extern int OSCIL_SIZE; */ #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 */ @@ -177,6 +184,8 @@ extern int OSCIL_SIZE; */ #define RND (rand()/(RAND_MAX+1.0)) +#define ZERO(data,size) {char *data_=(char *) data;for (int i=0;i<size;i++) data_[i]=0;}; + enum ONOFFTYPE{OFF=0,ON=1}; enum MidiControllers{C_NULL=0,C_pitchwheel=1000,C_expression=11,C_panning=10, diff --git a/src/main.C b/src/main.C @@ -309,7 +309,8 @@ void exitprogram(){ #ifndef VSTAUDIOOUT int main(int argc, char *argv[]){ - int loadfile=0,noui=0; + int noui=0; + fprintf(stderr,"%s","\nZynAddSubFX - Copyright (c) 2002-2004 Nasca Octavian Paul\n"); fprintf(stderr,"Compiled: %s %s\n",__DATE__,__TIME__); fprintf(stderr,"%s","This program is free software (GNU GPL v.2) and \n it comes with ABSOLUTELY NO WARRANTY.\n\n"); @@ -340,6 +341,9 @@ int main(int argc, char *argv[]){ #endif opterr=0; int option_index=0,opt,exitwithhelp=0; + + char loadfile[1001];ZERO(loadfile,1001); + while (1){ #ifdef OS_LINUX opt=getopt_long(argc,argv,"l:r:b:o:hSDU",opts,&option_index); @@ -359,12 +363,7 @@ int main(int argc, char *argv[]){ break; case 'l':tmp=0; if (optarguments!=NULL) { - tmp=loadbufferfile(&slbuf,optarguments,0); - if (tmp!=0) { - fprintf(stderr,"ERROR:Could not load file %s .\n",optarguments); - exit(1); - }; - loadfile=1; + snprintf(loadfile,1000,"%s",optarguments); }; break; case 'r':tmp=0; @@ -405,7 +404,7 @@ int main(int argc, char *argv[]){ if (exitwithhelp!=0) { fprintf(stderr,"%s","Usage: zynaddsubfx [OPTION]\n\n"); fprintf(stderr,"%s"," -h , --help \t\t\t\t display command-line help and exit\n"); - fprintf(stderr,"%s"," -l file, --load=FILE\t\t\t loads a .mas-zyn file\n"); + fprintf(stderr,"%s"," -l file, --load=FILE\t\t\t loads a .xmz file\n"); fprintf(stderr,"%s"," -r SR, --sample-rate=SR\t\t set the sample rate SR\n"); fprintf(stderr,"%s"," -b BS, --buffer-size=SR\t\t set the buffer size (granularity)\n"); fprintf(stderr,"%s"," -o OS, --oscil-size=OS\t\t set the ADsynth oscil. size\n"); @@ -424,10 +423,12 @@ int main(int argc, char *argv[]){ initprogram(); - if (loadfile!=0){ - slbuf.changemode(0); - master->part[0]->Penabled=0; - master->saveloadbuf(&slbuf); + if (strlen(loadfile)>1){ + int tmp=master->loadXML(loadfile); + if (tmp<0) { + fprintf(stderr,"ERROR:Could not load file %s .\n",loadfile); + exit(1); + }; }; #if !(defined(NONEMIDIIN)||defined(WINMIDIIN)||defined(VSTMIDIIN))