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.

76 lines
2.9KB

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