Package ca.corbett.extras.demo.panels
Class AudioDemoPanel
java.lang.Object
ca.corbett.extras.demo.panels.PanelBuilder
ca.corbett.extras.demo.panels.AudioDemoPanel
- All Implemented Interfaces:
AudioPanelListener
Provides a way to test out the AudioUtils, and more specifically, the AudioWaveformPanel.
Apologies: this code predates swing-forms and is therefore a little ugly. One day I'll
sit down and rewrite it to get rid of all the GridBagLayout stuff.
- Since:
- 2018-01-04
- Author:
- scorbo2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaudioLoaded(AudioWaveformPanel sourcePanel) Indicates that an audio clip has been loaded into the panel.voidaudioStopped(PlaybackThread.StopReason stopReason) In addition to stateChanged, this message will also be triggered when audio stops playing, to provide information about why the audio stopped.build()Builds and returns the FormPanel (or technically any JPanel) for this builder.voidThis is invoked whenever we need to redraw the audio waveform image.getTitle()Returns a name for this PanelBuilder.voidrecordingComplete(AudioWaveformPanel sourcePanel) Invoked when the user has recorded a clip in the audio panel.voidstateChanged(AudioWaveformPanel sourcePanel, AudioWaveformPanel.PanelState state) Indicates a state change within the panel.Methods inherited from class ca.corbett.extras.demo.panels.PanelBuilder
buildFormPanel, buildFormPanel, buildHighlightedHeaderLabel, createSnippetLabel, createSnippetLabel
-
Constructor Details
-
AudioDemoPanel
public AudioDemoPanel()
-
-
Method Details
-
getTitle
Description copied from class:PanelBuilderReturns a name for this PanelBuilder.- Specified by:
getTitlein classPanelBuilder- Returns:
- A hopefully descriptive name.
-
build
Description copied from class:PanelBuilderBuilds and returns the FormPanel (or technically any JPanel) for this builder.- Specified by:
buildin classPanelBuilder- Returns:
- A populated JPanel (or FormPanel).
-
generateWaveform
public void generateWaveform()This is invoked whenever we need to redraw the audio waveform image. For example, when a new audio sample is loaded, or when the cosmetic properties of the waveform image generator are modified. -
stateChanged
Description copied from interface:AudioPanelListenerIndicates a state change within the panel.- IDLE - the panel is neither playing nor recording.
- PLAYING - the panel is playing audio.
- RECORDING - the panel is recording audio.
- Specified by:
stateChangedin interfaceAudioPanelListener- Parameters:
sourcePanel- The AudioWaveformPanel that triggered this event.state- The new state of the panel.
-
recordingComplete
Invoked when the user has recorded a clip in the audio panel. We can add the resulting clip as an option in the audio source combo.- Specified by:
recordingCompletein interfaceAudioPanelListener- Parameters:
sourcePanel- The AudioWaveformPanel that triggered this event.
-
audioLoaded
Description copied from interface:AudioPanelListenerIndicates that an audio clip has been loaded into the panel. This event is also triggered after recording a clip, as the newly recorded clip is loaded into the panel.- Specified by:
audioLoadedin interfaceAudioPanelListener- Parameters:
sourcePanel- The AudioWaveformPanel that triggered this event.
-
audioStopped
Description copied from interface:AudioPanelListenerIn addition to stateChanged, this message will also be triggered when audio stops playing, to provide information about why the audio stopped.- Specified by:
audioStoppedin interfaceAudioPanelListener- Parameters:
stopReason- Indicates whether the audio was interrupted, hit its limit, or exhausted itself.
-