|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.app.sse.WaveTab
A WaveTab represents one open file inside a SampleEditor. It has a TabItem and a source file assigned to it. The WaveTab will handle all things like providing audio data, handling applied effects or edit actions by managing a CutList.
| Nested Class Summary | |
|---|---|
(package private) class |
WaveTab.Analyzer
This class is used for analyzing the WaveTab´s audio data if needed before applying an effect |
class |
WaveTab.DifferentChannelException
This Exception is to be used when sources with different channel count should be merged. |
| Field Summary | |
|---|---|
private AudioFileSource |
afSource
The source of this WaveTab |
private AudioFileWaveForm |
afWF
The AudioFileWaveForm corresponding to the source file |
private boolean |
canRec
Indicates whether this WaveTab is able to record or not |
private int |
channels
Number of channels of this WaveTab |
private CutListSource |
copySource
The CutListSource that was the actual one, when the last copy operation was performed |
protected CutList |
cutList
The CutList containing all modifications made to this WaveTab |
private SimpleSampleEditor |
editor
The SampleEditor to which this WaveTab belongs |
protected javax.sound.sampled.AudioFileFormat |
fileFormat
The AudioFileFormat of the current source file |
protected javax.sound.sampled.AudioFormat |
format
The current AudioFormat of the audio data |
protected boolean |
isNew
Indicates whether this WaveTab contains a new file that has still not been saved |
protected int |
lastStart
Last start position used when providing audio data |
protected WaveForm |
lastWaveForm
The last WaveForm used for providing WaveForm data to the main WaveFormDisplay |
protected int |
lastWaveFormPos
Position in sample frames of the lastWaveForm´s position |
protected WaveForm |
lastZoomWaveForm
The last WaveForm used for providing WaveForm data to the main WaveFormDisplay |
protected int |
lastZoomWaveFormPos
Position in sample frames of the lastWaveForm´s position |
protected boolean |
modified
Indicates whether this WaveTab has been modified since the last new, open or save operation |
protected java.io.OutputStream |
out
OutputStream used for recording |
protected int |
recCount
Counter for redrawing the WaveFormDisplay in constant intervals during recording |
protected boolean |
recording
Indicates whether this Wavetab is currently involved in a recording operation |
protected java.util.ArrayList |
redoElements
CutListElements corresponding to the redoOperations |
protected java.util.ArrayList |
redoOperations
List of redo operations that can be performed |
protected java.lang.Runnable |
redrawWave
Runnable for thread-safe redrawing of the WaveForm |
protected java.io.File |
source
The source file |
protected org.eclipse.swt.widgets.TabItem |
tabItem
The TabItem assigned to this Wavetab |
protected java.util.ArrayList |
undoOperations
List of undo operations that can be performed |
protected WaveFormDisplay |
waveDisplay
The WaveFormDisplay for displaying the WaveForm data |
| Constructor Summary | |
|---|---|
WaveTab(SimpleSampleEditor editor,
org.eclipse.swt.widgets.TabFolder parent,
int style,
int waveStyle,
java.io.File f,
AudioFileWaveForm wf,
javax.sound.sampled.AudioFormat format,
boolean rec)
Create a new WaveTab |
|
| Method Summary | |
|---|---|
void |
applyEffect(Effect effect)
Apply the given effect to this WaveTab´s audio data |
boolean |
canLoop()
Ask this provider, if he can provide audio data in a loop. |
boolean |
canProvide()
Ask this provider, if he is ready for providing playback audio data |
boolean |
canRec()
Ask this provider, if he can process recorded audio data in any way. |
boolean |
canRedo()
Indicates whether this WaveTab can redo the last undone operation |
boolean |
canSave()
Indicates whether this WaveTab can allows performing a Save-operation at the moment (not Save as...) or not. |
boolean |
canUndo()
Indicates whether this WaveTab can undo the last operation |
protected org.eclipse.swt.events.KeyListener |
createKeyListener()
Create the KeyListener to be added to the WaveFormDisplay´s composite |
void |
editAction(int type)
Perform an EditAction of the given type |
javax.sound.sampled.AudioInputStream |
getAudioInputStream()
Get the AudioInputStream for the current selection |
int |
getChannels()
Get the channels of the audio data represented by the provider |
CutListSource |
getCopySource()
Get the clipbaord source |
javax.sound.sampled.AudioFileFormat |
getFileFormat()
Get the audio file format of this WaveTab´s source |
javax.sound.sampled.AudioFormat |
getFormat()
Get the format of the audio data contained in this WaveTab |
org.eclipse.swt.widgets.TabItem |
getItem()
Get the TabItem associated with this WaveTab |
int |
getLastStart()
Get the last start position inside the whole audio source. |
java.lang.String |
getRedoName()
Get the name of the next possible operation to redo |
org.eclipse.swt.widgets.Shell |
getShell()
Get the Shell of the editor this WaveTab is assigned to |
int[][] |
getSlices()
Get the slices contained in this WabeTab |
java.io.File |
getSource()
Get this WaveTab´s source file |
int |
getTotalLength()
Get the total length of the audio data represented by the provider in sample frames |
java.lang.String |
getUndoName()
Get the name of the next possible operation to undo |
WaveFormDisplay |
getWaveDisplay()
Get the WaveFormDisplay used for displaying WaveForm data |
WaveForm |
getWaveForm(AbstractWaveFormDisplay display,
int start,
int length,
int width)
Get a WaveForm for the specified display |
javax.sound.sampled.AudioInputStream |
getWholeAudioInputStream()
Get the whole AudioInputStream from this WaveTab´s audio data independent of its selection |
boolean |
hasBeenModified()
Ask this WaveTab, if it has been modified since the last open, new or save operation |
boolean |
isNew()
Ask this WaveTab, if it contains a new file that has not been saved yet. |
void |
performCopy()
Copy the current selection to the audio editor´s cipboard |
void |
performCut()
Copy the current selection to the audio editor´s cipboard and delete it from this WaveTab´s audio data |
void |
performDelete()
Delete the current selection |
void |
performPaste()
Insert the clipboard content of the editor at the current position |
void |
performRedo()
Redo the last undone operation |
void |
performTrim()
Trim this WaveTab´s data to the current selection |
void |
performUndo()
Undo the last operation |
private void |
prepareClipboard()
Create a clone of the current CutList to be used as clipboard source |
int |
rec(byte[] b,
int offset,
int length)
Process a recorded buffer of audio data. |
protected void |
saveFile(javax.sound.sampled.AudioInputStream in,
java.io.File f,
AudioFileOutputStream out)
Save this WaveTab´s audio data to the given file using the given AudioFileOutputStream |
protected boolean |
savePeak()
Try to save the peak file |
protected void |
setInput(java.io.File f,
AudioFileWaveForm waveForm)
Set the source file for this WaveTab |
javax.sound.sampled.AudioFormat |
startRec()
Start recording of audio data. |
void |
stopRec()
Notification from the AudioPlayer that recording has finished. |
void |
update(CutListElement element)
Notification about the change of a CutListElement |
void |
update(CutListSource source)
Notification about the change of a CutListSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private AudioFileSource afSource
private AudioFileWaveForm afWF
private boolean canRec
private int channels
private CutListSource copySource
protected CutList cutList
private final SimpleSampleEditor editor
protected javax.sound.sampled.AudioFileFormat fileFormat
protected javax.sound.sampled.AudioFormat format
protected boolean isNew
protected int lastStart
protected WaveForm lastWaveForm
protected int lastWaveFormPos
protected WaveForm lastZoomWaveForm
protected int lastZoomWaveFormPos
protected boolean modified
protected java.io.OutputStream out
protected int recCount
protected boolean recording
protected java.util.ArrayList redoElements
protected java.util.ArrayList redoOperations
protected java.lang.Runnable redrawWave
protected java.io.File source
protected org.eclipse.swt.widgets.TabItem tabItem
protected java.util.ArrayList undoOperations
protected WaveFormDisplay waveDisplay
| Constructor Detail |
|---|
WaveTab(SimpleSampleEditor editor,
org.eclipse.swt.widgets.TabFolder parent,
int style,
int waveStyle,
java.io.File f,
AudioFileWaveForm wf,
javax.sound.sampled.AudioFormat format,
boolean rec)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
editor - The SampleEditor to which the WaveTab belongsparent - The TabFolder to be used as parent for the TabItem that
will be createdstyle - The style to be used for the TabItemwaveStyle - The style to be used for the WaveFormDisplayf - The source filewf - The WaveForm corresponding to the fileformat - The AudioFormat to be used for recording or
null, if not recordingrec - true, if recording should be possible for this WaveTab, false
otherwise
javax.sound.sampled.UnsupportedAudioFileException - If the AudioFileFormat of the given
file can not be detected (only in case of not recording)
java.io.IOException - If an I/O error occured| Method Detail |
|---|
public void applyEffect(Effect effect)
effect - The effect to applypublic boolean canLoop()
AudioPlayerProvider
canLoop in interface AudioPlayerProviderAudioPlayerProvider.canLoop()public boolean canProvide()
AudioPlayerProvider
canProvide in interface AudioPlayerProviderAudioPlayerProvider.canProvide()public boolean canRec()
AudioPlayerProvider
canRec in interface AudioPlayerProviderAudioPlayerProvider.canRec()public boolean canRedo()
public boolean canSave()
public boolean canUndo()
protected org.eclipse.swt.events.KeyListener createKeyListener()
public void editAction(int type)
type - The type of the EditAction to apply
public javax.sound.sampled.AudioInputStream getAudioInputStream()
throws NotReadyException
getAudioInputStream in interface AudioPlayerProviderNotReadyException - If no audio data can be presented at the
momentAudioPlayerProvider.getAudioInputStream()public int getChannels()
WaveFormProvider
getChannels in interface WaveFormProviderWaveFormProvider.getChannels()public CutListSource getCopySource()
public javax.sound.sampled.AudioFileFormat getFileFormat()
public javax.sound.sampled.AudioFormat getFormat()
public org.eclipse.swt.widgets.TabItem getItem()
public int getLastStart()
AudioPlayerProvidergetAudioInputStream()
getLastStart in interface AudioPlayerProviderAudioPlayerProvider.getLastStart()public java.lang.String getRedoName()
public org.eclipse.swt.widgets.Shell getShell()
public int[][] getSlices()
public java.io.File getSource()
public int getTotalLength()
WaveFormProvider
getTotalLength in interface WaveFormProviderWaveFormProvider.getTotalLength()public java.lang.String getUndoName()
public WaveFormDisplay getWaveDisplay()
public WaveForm getWaveForm(AbstractWaveFormDisplay display,
int start,
int length,
int width)
WaveFormProvider
getWaveForm in interface WaveFormProviderdisplay - The WaveFormDisplay that asks for the WaveFormstart - The start position of the WaveForm inside the source data
in sample frameslength - The length of the audio data that should be represented by
the WaveFormwidth - The width of the resulting WaveForm.
length sample frames of the
provider´s audio data beginning at position start to be
displayed in the width of width.WaveFormProvider.getWaveForm(com.groovemanager.sampled.waveform.AbstractWaveFormDisplay, int, int, int)
public javax.sound.sampled.AudioInputStream getWholeAudioInputStream()
throws NotReadyException
NotReadyException - If no audio data can be provided at the
momentpublic boolean hasBeenModified()
public boolean isNew()
public void performCopy()
public void performCut()
public void performDelete()
public void performPaste()
throws WaveTab.DifferentChannelException
WaveTab.DifferentChannelExceptionpublic void performRedo()
public void performTrim()
public void performUndo()
private void prepareClipboard()
public int rec(byte[] b,
int offset,
int length)
AudioPlayerProviderstartRec() and stopRec().
The delivered audio data will be in the format returned by
startRec().
rec in interface AudioPlayerProviderb - The Array containing the audio data to processoffset - Offset position inside the Array where the usable audio
data beginslength - The length of the usable audio data in bytes
length, the AudioPlayer will re-attempt to write the
remaining data in the next call.AudioPlayerProvider.rec(byte[], int, int)
protected void saveFile(javax.sound.sampled.AudioInputStream in,
java.io.File f,
AudioFileOutputStream out)
throws NotFinishedException,
NotReadyException
f - The file to save to (will be set as new source file)out - The AudioFileOutputStream to use for writing
NotFinishedException - If the save operation could not be completed
NotReadyException - If the audio data could not be providedprotected boolean savePeak()
protected void setInput(java.io.File f,
AudioFileWaveForm waveForm)
f - The source file to setwaveForm - The WaveForm corresponding to the file
public javax.sound.sampled.AudioFormat startRec()
throws NotReadyException
AudioPlayerProvider
startRec in interface AudioPlayerProviderNotReadyException - If recording is not possible at the momentAudioPlayerProvider.startRec()public void stopRec()
AudioPlayerProvider
stopRec in interface AudioPlayerProviderAudioPlayerProvider.stopRec()public void update(CutListElement element)
ModificationListener
update in interface ModificationListenerelement - The modified CutListElementModificationListener.update(com.groovemanager.sampled.nondestructive.CutListElement)public void update(CutListSource source)
ModificationListener
update in interface ModificationListenersource - The modified CutListSourceModificationListener.update(com.groovemanager.sampled.nondestructive.CutListSource)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||