Refactoring our code
Friday 31 July 2020
Code refactoring is the process of restructuring existing computer code — changing the factoring — without changing its external behaviour.
At the moment, we have too many things in the same class. We will refactor the code in order to split it into two classes DeckGUI and DjAudioPlayer which are respectively concerned with the GUI controls and Audio Player functionality.
The DjAudioPlayer class will have a public API that allows a user to tell it to load a track, change the gain, speed, and position and also start and stop playback.
The DeckGUI will be a GUI component which, itself, contains other components.
Ultimately, what we want to be able to do is instantiating two or more copies of each class so we can control two or more audio tracks.
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