The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

103 lines
3.6KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. ==============================================================================
  5. */
  6. #pragma once
  7. %%include_juce%%
  8. //==============================================================================
  9. /*
  10. This component lives inside our window, and this is where you should put all
  11. your controls and content.
  12. */
  13. class %%content_component_class%% : public AudioAppComponent
  14. {
  15. public:
  16. //==============================================================================
  17. %%content_component_class%%()
  18. {
  19. // Make sure you set the size of the component after
  20. // you add any child components.
  21. setSize (800, 600);
  22. // Some platforms require permissions to open input channels so request that here
  23. if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)
  24. && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))
  25. {
  26. RuntimePermissions::request (RuntimePermissions::recordAudio,
  27. [&] (bool granted) { setAudioChannels (granted ? 2 : 0, 2); });
  28. }
  29. else
  30. {
  31. // Specify the number of input and output channels that we want to open
  32. setAudioChannels (2, 2);
  33. }
  34. }
  35. ~%%content_component_class%%() override
  36. {
  37. // This shuts down the audio device and clears the audio source.
  38. shutdownAudio();
  39. }
  40. //==============================================================================
  41. void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
  42. {
  43. // This function will be called when the audio device is started, or when
  44. // its settings (i.e. sample rate, block size, etc) are changed.
  45. // You can use this function to initialise any resources you might need,
  46. // but be careful - it will be called on the audio thread, not the GUI thread.
  47. // For more details, see the help for AudioProcessor::prepareToPlay()
  48. }
  49. void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
  50. {
  51. // Your audio-processing code goes here!
  52. // For more details, see the help for AudioProcessor::getNextAudioBlock()
  53. // Right now we are not producing any data, in which case we need to clear the buffer
  54. // (to prevent the output of random noise)
  55. bufferToFill.clearActiveBufferRegion();
  56. }
  57. void releaseResources() override
  58. {
  59. // This will be called when the audio device stops, or when it is being
  60. // restarted due to a setting change.
  61. // For more details, see the help for AudioProcessor::releaseResources()
  62. }
  63. //==============================================================================
  64. void paint (Graphics& g) override
  65. {
  66. // (Our component is opaque, so we must completely fill the background with a solid colour)
  67. g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
  68. // You can add your drawing code here!
  69. }
  70. void resized() override
  71. {
  72. // This is called when the MainContentComponent is resized.
  73. // If you add any child components, this is where you should
  74. // update their positions.
  75. }
  76. private:
  77. //==============================================================================
  78. // Your private member variables go here...
  79. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%content_component_class%%)
  80. };