Add stop, start and volume functionality
Thursday 30 July 2020
We've already created these buttons and sliders but here we're going to make them a bit more useful.
1. Go to MainComponent::buttonClicked in MainComponent.cpp - this is the button event listener.
We're going to take transportSource.start(); out of the loadURL function and paste it in here.
2. In the if statement for the stopButton we can add transportSource.stop();
If we now build and compile we can load up an audio file and use PLAY and STOP to start and stop the audio.
3. We can now go into the slider listener. We had previously turned this into a frequency control! So we can remove the comment and the dphase = volSlider.getValue() * 0.001; in there and add this instead:
The slider was previously set between 0 and 10 but we want this volume to be between 0 and 1.
We configure the GUI in the constructor so we need to go back to MainComponent::MainComponent() and underneath volSlider.addListener(this); we can add
And that's how you activate these buttons!
More posts in cpp
- Add a component ID and converting between ints and strings
- Implement a play button and add a listener
- Implement paintRowBackground and paintCell
- Add a vector to store a list of files
- Add a TableListBox
- Create a PlaylistComponent in the Projucer project
- Implement a timer
- Add getPosition and setPosition functions
- Refactor DJAudioPlayer to use app-scope formatManager
- Draw the thumbnail
- Hook up the load button to trigger the AudioThumbnail load
- The AudioThumbnail class in the API
- Creating a new component - WaveformDisplay
- Implementing drag and drop triggers
- Use a MixerAudioSource to play more than one file at a time
- Implement the listener interfaces to DeckGUI
- Creating a DeckGUI class
- setPosition control
- Implementing setGain and setSpeed
- Add audio playback functionality
- Writing the DJAudioPlayer class
- Creating a new JUCE class with Projucer
- Refactoring our code
- Using ResamplingAudioPlayer to implement variable speed playback
- Add stop, start and volume functionality
- Add a file chooser
- Audio file playback in JUCE
- Realtime sound synthesis in JUCE
- Adding a slider listener
- Introduction to event listeners
- Adding a GUI widget to the JUCE app
- Introduction to JUCE