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.

116 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. class SUBnoteParameters:public Presets
  17. {
  18. public:
  19. SUBnoteParameters(const AbsTime *time_ = nullptr);
  20. ~SUBnoteParameters();
  21. //Identify active harmonic positions
  22. // - pos : int[MAX_SUB_HARMONICS] offsets of active harmonics
  23. // - harmonics : number of active harmonics
  24. void activeHarmonics(int *pos, int &harmonics) const;
  25. static float convertBandwidth(int bw, int stages, float freq,
  26. int scale, int relbw);
  27. static float convertHarmonicMag(int mag, int type);
  28. void add2XML(XMLwrapper& xml);
  29. void defaults();
  30. void getfromXML(XMLwrapper& xml);
  31. void updateFrequencyMultipliers(void);
  32. void paste(SUBnoteParameters &sub);
  33. //Parameters
  34. //AMPLITUDE PARAMETERS
  35. unsigned char Pstereo; //0 for mono,1 for stereo
  36. unsigned char PVolume;
  37. unsigned char PPanning;
  38. unsigned char PAmpVelocityScaleFunction;
  39. EnvelopeParams *AmpEnvelope;
  40. //Frequency Parameters
  41. unsigned short int PDetune;
  42. unsigned short int PCoarseDetune;
  43. unsigned char PDetuneType;
  44. unsigned char PFreqEnvelopeEnabled;
  45. EnvelopeParams *FreqEnvelope;
  46. unsigned char PBandWidthEnvelopeEnabled;
  47. EnvelopeParams *BandWidthEnvelope;
  48. unsigned char PBendAdjust;
  49. unsigned char POffsetHz;
  50. //Filter Parameters (Global)
  51. unsigned char PGlobalFilterEnabled;
  52. FilterParams *GlobalFilter;
  53. unsigned char PGlobalFilterVelocityScale;
  54. unsigned char PGlobalFilterVelocityScaleFunction;
  55. EnvelopeParams *GlobalFilterEnvelope;
  56. //Other Parameters
  57. //If the base frequency is fixed to 440 Hz
  58. unsigned char Pfixedfreq;
  59. /* Equal temperate (this is used only if the Pfixedfreq is enabled)
  60. If this parameter is 0, the frequency is fixed (to 440 Hz);
  61. if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
  62. unsigned char PfixedfreqET;
  63. // Overtone spread parameters
  64. struct {
  65. unsigned char type;
  66. unsigned char par1;
  67. unsigned char par2;
  68. unsigned char par3;
  69. } POvertoneSpread;
  70. float POvertoneFreqMult[MAX_SUB_HARMONICS];
  71. //how many times the filters are applied
  72. unsigned char Pnumstages;
  73. //bandwidth
  74. unsigned char Pbandwidth;
  75. //How the magnitudes are computed (0=linear,1=-60dB,2=-60dB)
  76. unsigned char Phmagtype;
  77. //Magnitudes
  78. unsigned char Phmag[MAX_SUB_HARMONICS];
  79. //Relative BandWidth ("64"=1.0f)
  80. unsigned char Phrelbw[MAX_SUB_HARMONICS];
  81. //how much the bandwidth is increased according to lower/higher frequency; 64-default
  82. unsigned char Pbwscale;
  83. //how the harmonics start("0"=0,"1"=random,"2"=1)
  84. unsigned char Pstart;
  85. const AbsTime *time;
  86. int64_t last_update_timestamp;
  87. static const rtosc::Ports &ports;
  88. };
  89. #endif