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.

80 lines
2.6KB

  1. /* Copyright 2013-2019 Matt Tytel
  2. *
  3. * vital is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * vital is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with vital. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include "JuceHeader.h"
  18. #include "synth_base.h"
  19. #if HEADLESS
  20. class FullInterface { };
  21. class AudioDeviceManager { };
  22. #endif
  23. class FullInterface;
  24. class Authentication;
  25. struct SynthGuiData {
  26. SynthGuiData(SynthBase* synth_base);
  27. vital::control_map controls;
  28. vital::output_map mono_modulations;
  29. vital::output_map poly_modulations;
  30. vital::output_map modulation_sources;
  31. WavetableCreator* wavetable_creators[vital::kNumOscillators];
  32. SynthBase* synth;
  33. };
  34. class SynthGuiInterface {
  35. public:
  36. SynthGuiInterface(SynthBase* synth, bool use_gui = true);
  37. virtual ~SynthGuiInterface();
  38. virtual AudioDeviceManager* getAudioDeviceManager() { return nullptr; }
  39. SynthBase* getSynth() { return synth_; }
  40. virtual void updateFullGui();
  41. virtual void updateGuiControl(const std::string& name, vital::mono_float value);
  42. vital::mono_float getControlValue(const std::string& name);
  43. void notifyModulationsChanged();
  44. void notifyModulationValueChanged(int index);
  45. void connectModulation(std::string source, std::string destination);
  46. void connectModulation(vital::ModulationConnection* connection);
  47. void setModulationValues(const std::string& source, const std::string& destination,
  48. vital::mono_float amount, bool bipolar, bool stereo, bool bypass);
  49. void initModulationValues(const std::string& source, const std::string& destination);
  50. void disconnectModulation(std::string source, std::string destination);
  51. void disconnectModulation(vital::ModulationConnection* connection);
  52. void setFocus();
  53. void notifyChange();
  54. void notifyFresh();
  55. void openSaveDialog();
  56. void externalPresetLoaded(File preset);
  57. void setGuiSize(float scale);
  58. FullInterface* getGui() { return gui_.get(); }
  59. protected:
  60. SynthBase* synth_;
  61. std::unique_ptr<FullInterface> gui_;
  62. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthGuiInterface)
  63. };