Package at.ofai.music.match
Class AligningAudioPlayer
- java.lang.Object
-
- at.ofai.music.match.AligningAudioPlayer
-
- All Implemented Interfaces:
- java.lang.Runnable, java.util.EventListener, javax.swing.event.ChangeListener
public class AligningAudioPlayer extends java.lang.Object implements javax.swing.event.ChangeListener, java.lang.Runnable
-
-
Field Summary
Fields Modifier and Type Field and Description protected long
audioLength
protected javax.sound.sampled.SourceDataLine
audioOut
protected AudioFile
currentFile
protected long
currentPosition
protected static int
defaultOutputBufferSize
protected java.util.LinkedList<AudioFile>
files
protected GUI
gui
protected javax.swing.JFileChooser
jfc
protected java.util.LinkedList<java.lang.Long>
marks
protected at.ofai.music.match.AligningAudioPlayer.Matcher
matcher
protected java.lang.Thread
matchThread
protected int
outputBufferSize
protected boolean
playFromMark
protected boolean
playing
protected PerformanceMatcher
pm1
protected PerformanceMatcher
pm2
protected byte[]
readBuffer
protected byte[]
readBuffer2
protected static int
readBufferSize
protected AudioFile
requestedFile
protected long
requestedPosition
protected at.ofai.music.match.ScrollingMatrix
sm
protected boolean
stopRequested
-
Constructor Summary
Constructors Constructor and Description AligningAudioPlayer(GUI g, PerformanceMatcher p1, PerformanceMatcher p2, at.ofai.music.match.ScrollingMatrix s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addFile(java.lang.String fileName, at.ofai.music.match.GUI.FileNameSelection selector)
void
addMark()
static java.lang.String
checkString(java.lang.String in, java.lang.String prefix)
static java.lang.String
checkString(java.lang.String in, java.lang.String prefix, boolean exc)
protected void
clearFiles()
long
correctedPosition()
long
getCurrentFileLength()
int
getFileCount()
java.util.ListIterator<java.lang.Long>
getMarkListIterator()
void
load()
void
load(java.lang.String fileName)
void
nextFile()
void
pause()
void
play()
void
previousFile()
void
run()
Code for audio playback thread.void
save()
void
setCurrentFile(int index)
void
setCurrentFile(AudioFile newFile)
void
setCurrentFile(at.ofai.music.match.GUI.FileNameSelection selector)
void
setMode(boolean fromMark)
protected void
setPosition(long positionRequested)
void
skipToNextMark()
void
skipToPreviousMark()
void
stateChanged(javax.swing.event.ChangeEvent e)
Implements ChangeListener interfacevoid
stop()
void
togglePlay()
protected void
updateGUI()
-
-
-
Field Detail
-
audioLength
protected long audioLength
-
audioOut
protected javax.sound.sampled.SourceDataLine audioOut
-
currentFile
protected AudioFile currentFile
-
currentPosition
protected long currentPosition
-
defaultOutputBufferSize
protected static final int defaultOutputBufferSize
- See Also:
- Constant Field Values
-
files
protected java.util.LinkedList<AudioFile> files
-
gui
protected GUI gui
-
jfc
protected javax.swing.JFileChooser jfc
-
marks
protected java.util.LinkedList<java.lang.Long> marks
-
matcher
protected at.ofai.music.match.AligningAudioPlayer.Matcher matcher
-
matchThread
protected java.lang.Thread matchThread
-
outputBufferSize
protected int outputBufferSize
-
playFromMark
protected boolean playFromMark
-
playing
protected boolean playing
-
pm1
protected PerformanceMatcher pm1
-
pm2
protected PerformanceMatcher pm2
-
readBuffer
protected byte[] readBuffer
-
readBuffer2
protected byte[] readBuffer2
-
readBufferSize
protected static final int readBufferSize
- See Also:
- Constant Field Values
-
requestedFile
protected AudioFile requestedFile
-
requestedPosition
protected long requestedPosition
-
sm
protected at.ofai.music.match.ScrollingMatrix sm
-
stopRequested
protected boolean stopRequested
-
-
Constructor Detail
-
AligningAudioPlayer
public AligningAudioPlayer(GUI g, PerformanceMatcher p1, PerformanceMatcher p2, at.ofai.music.match.ScrollingMatrix s)
-
-
Method Detail
-
getFileCount
public int getFileCount()
-
play
public void play()
-
pause
public void pause()
-
stop
public void stop()
-
togglePlay
public void togglePlay()
-
setMode
public void setMode(boolean fromMark)
-
setPosition
protected void setPosition(long positionRequested)
-
updateGUI
protected void updateGUI()
-
skipToNextMark
public void skipToNextMark()
-
skipToPreviousMark
public void skipToPreviousMark()
-
addMark
public void addMark()
-
correctedPosition
public long correctedPosition()
-
getMarkListIterator
public java.util.ListIterator<java.lang.Long> getMarkListIterator()
-
getCurrentFileLength
public long getCurrentFileLength()
-
save
public void save()
-
load
public void load()
-
checkString
public static java.lang.String checkString(java.lang.String in, java.lang.String prefix)
-
checkString
public static java.lang.String checkString(java.lang.String in, java.lang.String prefix, boolean exc)
-
load
public void load(java.lang.String fileName)
-
clearFiles
protected void clearFiles()
-
addFile
public void addFile(java.lang.String fileName, at.ofai.music.match.GUI.FileNameSelection selector)
-
setCurrentFile
public void setCurrentFile(int index)
-
setCurrentFile
public void setCurrentFile(at.ofai.music.match.GUI.FileNameSelection selector)
-
setCurrentFile
public void setCurrentFile(AudioFile newFile)
-
previousFile
public void previousFile()
-
nextFile
public void nextFile()
-
run
public void run()
Code for audio playback thread. Implements Runnable interface.- Specified by:
run
in interfacejava.lang.Runnable
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent e)
Implements ChangeListener interface- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
-
-