Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.6KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. SUBnoteParameters.h - Parameters for SUBnote (SUBsynth)
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #ifndef SUB_NOTE_PARAMETERS_H
  12. #define SUB_NOTE_PARAMETERS_H
  13. #include <stdint.h>
  14. #include "../globals.h"
  15. #include "Presets.h"
  16. namespace zyncarla {
  17. class SUBnoteParameters:public Presets
  18. {
  19. public:
  20. SUBnoteParameters(const AbsTime *time_ = nullptr);
  21. ~SUBnoteParameters();
  22. //Identify active harmonic positions
  23. // - pos : int[MAX_SUB_HARMONICS] offsets of active harmonics
  24. // - harmonics : number of active harmonics
  25. void activeHarmonics(int *pos, int &harmonics) const;
  26. static float convertBandwidth(int bw, int stages, float freq,
  27. int scale, int relbw);
  28. static float convertHarmonicMag(int mag, int type);
  29. void add2XML(XMLwrapper& xml);
  30. void defaults();
  31. void getfromXML(XMLwrapper& xml);
  32. void updateFrequencyMultipliers(void);
  33. void paste(SUBnoteParameters &sub);
  34. //Parameters
  35. //AMPLITUDE PARAMETERS
  36. unsigned char Pstereo; //0 for mono,1 for stereo
  37. unsigned char PVolume;
  38. unsigned char PPanning;
  39. unsigned char PAmpVelocityScaleFunction;
  40. EnvelopeParams *AmpEnvelope;
  41. //Frequency Parameters
  42. unsigned short int PDetune;
  43. unsigned short int PCoarseDetune;
  44. unsigned char PDetuneType;
  45. unsigned char PFreqEnvelopeEnabled;
  46. EnvelopeParams *FreqEnvelope;
  47. unsigned char PBandWidthEnvelopeEnabled;
  48. EnvelopeParams *BandWidthEnvelope;
  49. unsigned char PBendAdjust;
  50. unsigned char POffsetHz;
  51. //Filter Parameters (Global)
  52. unsigned char PGlobalFilterEnabled;
  53. FilterParams *GlobalFilter;
  54. unsigned char PGlobalFilterVelocityScale;
  55. unsigned char PGlobalFilterVelocityScaleFunction;
  56. EnvelopeParams *GlobalFilterEnvelope;
  57. //Other Parameters
  58. //If the base frequency is fixed to 440 Hz
  59. unsigned char Pfixedfreq;
  60. /* Equal temperate (this is used only if the Pfixedfreq is enabled)
  61. If this parameter is 0, the frequency is fixed (to 440 Hz);
  62. if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
  63. unsigned char PfixedfreqET;
  64. // Overtone spread parameters
  65. struct {
  66. unsigned char type;
  67. unsigned char par1;
  68. unsigned char par2;
  69. unsigned char par3;
  70. } POvertoneSpread;
  71. float POvertoneFreqMult[MAX_SUB_HARMONICS];
  72. //how many times the filters are applied
  73. unsigned char Pnumstages;
  74. //bandwidth
  75. unsigned char Pbandwidth;
  76. //How the magnitudes are computed (0=linear,1=-60dB,2=-60dB)
  77. unsigned char Phmagtype;
  78. //Magnitudes
  79. unsigned char Phmag[MAX_SUB_HARMONICS];
  80. //Relative BandWidth ("64"=1.0f)
  81. unsigned char Phrelbw[MAX_SUB_HARMONICS];
  82. //how much the bandwidth is increased according to lower/higher frequency; 64-default
  83. unsigned char Pbwscale;
  84. //how the harmonics start("0"=0,"1"=random,"2"=1)
  85. unsigned char Pstart;
  86. const AbsTime *time;
  87. int64_t last_update_timestamp;
  88. static const rtosc::Ports &ports;
  89. };
  90. }
  91. #endif