Package sidplay
Klasse Player
java.lang.Object
libsidplay.HardwareEnsemble
sidplay.Player
- Alle implementierten Schnittstellen:
Consumer<VIC>,SIDListener,IMOS6510Extension,Ultimate64,VideoDriver
The player adds some music player capabilities to the HardwareEnsemble.
- Autor:
- Ken Händel
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen libsidplay.Ultimate64
Ultimate64.SocketCommand, Ultimate64.SocketStreamingCommand -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungCurrently used audio and corresponding audio driver.private booleanCheck default length in record mode (default is true).private booleanSet check loop off in record mode (default is true).private StringAuto-start command to be typed-in after reset (PETSCII).private intFast forward: skipped VIC frames.private IFingerprintMatcherWhatsSID?private booleanFirst entry of the play-list is first song (otherwise start song).private booleanForce check song length (default is false).Called each time a chunk of music has been played.static CalendarBuild date calculated from our own modify timeprivate static final StringAuto-start commands.private static final Loggerprivate static final intMaximum length for a user typed-in command.Called each time a tune starts to play.private List<IMOS6510Extension> Consumer for CPU JMP/JSR instructionsprivate BiFunction<Integer, SIDEmu, SIDEmu> Eject all SIDs.private static final intTimeout (in ms) for sleeping, if player is paused.private PropertyChangeListenerPlayer paused?Override player address of the tune.private RunnablePlayer runnable to play music in a background thread.private ThreadMusic player thread.private PlayListPlay list.private static final intPrevious song select timeout (< 4 secs).private booleanPSID64 format has been detected?private static final intTimeout (in ms) for quitting the player.private static final intRAM location for a user typed-in command.private static final intRAM location for a user typed-in command length.private static final intRAM screen address for a user typed-in command.Create a base name of a filename to be used for recording.private BiFunction<Integer, SIDEmu, SIDEmu> Insert required SIDs. use SID builder to create/destroy SIDs.private static final StringAuto-start commands.private SIDBuilderSID builder being used to create SID chips (real hardware or emulation).private SidDatabaseSong length database.private List<SIDListener> Consumer for SID register writesprivate IntFunction<Integer> Set base address of required SIDs.private ObjectProperty<State> Music player state.private STILSID tune information list.private static final StringAuto-start commands.private TimerPlay timer.private SidTuneCurrently played tune.private Thread.UncaughtExceptionHandlerUncaught Player exception handler.private List<VideoDriver> Consumer for VIC screen output as ARGB dataprivate WhatsSidEventRegularly scheduled event for tune recognition.private Consumer<MusicInfoWithConfidenceBean> Called after WhatsSID has detected a tune.Von Klasse geerbte Felder libsidplay.HardwareEnsemble
c1541Runner, c64, config, datasette, floppies, iecBus, printer, serialDevicesVon Schnittstelle geerbte Felder libsidplay.Ultimate64
SOCKET_CONNECT_TIMEOUT -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidFast forward skips frames and produces output for each Xth frame (X = 1x, 2x, 4x, ... , 32x).voidaddMOS6510Extension(IMOS6510Extension mos6510Extension) Add consumer of MOS6510 JMP/JSR instructions.voidaddSidListener(SIDListener consumer) Add consumer of SID register writesvoidaddVideoDriver(VideoDriver consumer) Add consumer of VIC screen output as ARGB dataprivate voidprivate voidclose()Close player.final voidconfigureMixer(Consumer<Mixer> action) Configure the mixer, optionally implemented by SID builder thread-safe.final voidconfigureSID(int chipNum, Consumer<SIDEmu> action) Configure one specific SID thread-safe.final voidconfigureSIDs(BiConsumer<Integer, SIDEmu> action) Configure all available SIDs thread-safe.final voidconfigureVICs(Consumer<VIC> action) Call to configure VIC chips thread-safe.private SIDBuildercreateSIDBuilder(CPUClock cpuClock) Create configured SID chip implementation (software/hardware).private voidexecuteInPlayerThread(String eventName, Runnable runnable) The runnable is executed immediately in player thread or scheduled thread-safe.final voidPlay first song.getAudio()Get Audio of audio driver or null for custom audio drivers.Get currently used audio driver.final StringgetCredits(String version) The credits for the authors of many parts of this emulator.Get a fingerprint matcher.final <T> TgetMixerInfo(Function<Mixer, T> function, T defaultValue) Get mixer info.final PlayListGet current play-list.Get recording filename, add audio related file extension (if known).final <T> TgetSidDatabaseInfo(Function<SidDatabase, T> function, T defaultValue) Get song length database info.final STIL.STILEntrygetStilEntry(String collectionName) Get SID Tune Information List info.final TimergetTimer()Get current timer.final SidTunegetTune()Get the currently played tune.Get a hook to be called when WhatsSid has detected a tune.static voidinitializeTmpDir(IConfig config) Create temporary directory, if it does not exist.
E.g.booleanvoidjmpJsr()final voidlastSong()Play last song.static voidTest main: Play a tune.final voidnextSong()Play next song.private voidopen()Open player.final voidPause or continue the player.private booleanplay()Play routine (clock chips until audio buffer is filled completely or player gets paused).final voidPlay tune.private voidTurn C64 off and on, load a tune and enter basic command.final voidPlay previous song.
Note: AfterPREV_SONG_TIMEOUThas been reached, the current tune is restarted instead.final voidquit()Quit player.voidremoveMOS6510Extension(IMOS6510Extension mos6510Extension) Remove consumer of MOS6510 JMP/JSR instructions.voidremoveSidListener(SIDListener consumer) Remove consumer of SID register writesvoidremoveVideoDriver(VideoDriver consumer) Remove consumer of VIC screen output as ARGB datafinal voidreset()Power-on C64 system.final voidReset C64 and enter basic command.private voidsetAudioAndDriver(Audio audio, AudioDriver audioDriver) Set audio for play-backfinal voidsetAudioDriver(AudioDriver audioDriver) Set alternative audio driver (not contained inAudio).
For example, If it is required to use a new instance of audio driver each time the player plays a tune (e.g.voidsetCheckDefaultLengthInRecordMode(boolean checkDefaultLengthInRecordMode) Set check default length in record mode (default is true).voidsetCheckLoopOffInRecordMode(boolean checkLoopOffInRecordMode) Set check loop off in record mode (default is true).private voidsetCommand(String command) Enter basic command after reset (PETSCII).voidsetFingerPrintMatcher(IFingerprintMatcher fingerPrintMatcher) Set a fingerprint matcher.voidsetFirstPlayListEntryIsOne(boolean firstPlayListEntryIsOne) Set first entry of the play-list is first song (otherwise start song).voidsetForceCheckSongLength(boolean forceCheckSongLength) Set force check song length (default is false).final voidsetInteractivityHook(Consumer<Player> interactivityHook) Set a hook to be called when the player has played a chunk.final voidsetMenuHook(Consumer<Player> menuHook) Set a hook to be called when the player has opened a tune.voidsetPlayAddrHook(Function<Integer, Integer> playAddrHook) Set a hook to be called when player address has been read from the tune.final voidsetRecordingFilenameProvider(Function<SidTune, String> recordingFilenameProvider) Set provider of recording filenames.final voidsetSidDatabase(SidDatabase sidDatabase) Set song length database.final voidSet SID Tune Information List (STIL).final voidSet a tune to play.voidsetUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) Set uncaught Player exception handler.voidsetWhatsSidHook(Consumer<MusicInfoWithConfidenceBean> whatsSidHook) Set a hook to be called when WhatsSid has detected a tune.final voidstartC64()Start player thread.final ObjectProperty<State> Get the player's state,final voidstopC64()Stop player thread.final voidstopC64(boolean quitOrWait) Stop or wait for player thread.final doubletime()What is the current playing time in secs.final voidtypeInCommand(String multiLineCommand) Simulate a user typed-in command.final voidCall to update SID chips each time SID configuration has been changed thread-safe.private voidCheck the configuration.voidwrite(int addr, byte data) Von Klasse geerbte Methoden libsidplay.HardwareEnsemble
connectC64AndC1541WithParallelCable, enableFloppyDiskDrives, enablePrinter, getC64, getConfig, getDatasette, getFloppies, getPrinter, insertCartridge, insertCartridge, insertCartridgeCRT, insertDisk, insertTape, setClock, setExtendImagePolicyVon Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden libsidplay.Ultimate64
sendCommand, sendInsertDisk, sendRamAndRun, sendRamAndSys, sendReset, sendWait, startStreaming, stopStreaming
-
Felddetails
-
LOG
-
LAST_MODIFIED
Build date calculated from our own modify time -
PAUSE_SLEEP_TIME
private static final int PAUSE_SLEEP_TIMETimeout (in ms) for sleeping, if player is paused.- Siehe auch:
-
QUIT_MAX_WAIT_TIME
private static final int QUIT_MAX_WAIT_TIMETimeout (in ms) for quitting the player.- Siehe auch:
-
PREV_SONG_TIMEOUT
private static final int PREV_SONG_TIMEOUTPrevious song select timeout (< 4 secs).- Siehe auch:
-
RAM_COMMAND_SCREEN_ADDRESS
private static final int RAM_COMMAND_SCREEN_ADDRESSRAM screen address for a user typed-in command.- Siehe auch:
-
RAM_COMMAND
private static final int RAM_COMMANDRAM location for a user typed-in command.- Siehe auch:
-
RAM_COMMAND_LEN
private static final int RAM_COMMAND_LENRAM location for a user typed-in command length.- Siehe auch:
-
MAX_COMMAND_LEN
private static final int MAX_COMMAND_LENMaximum length for a user typed-in command.- Siehe auch:
-
RUN
Auto-start commands.- Siehe auch:
-
SYS
Auto-start commands.- Siehe auch:
-
LOAD
Auto-start commands.- Siehe auch:
-
stateProperty
Music player state. -
timer
Play timer. -
playList
Play list. -
tune
Currently played tune. -
command
Auto-start command to be typed-in after reset (PETSCII). -
playerThread
Music player thread. -
interactivityHook
Called each time a chunk of music has been played. -
whatsSidHook
Called after WhatsSID has detected a tune. -
playAddrHook
Override player address of the tune. -
audioAndDriver
Currently used audio and corresponding audio driver. Note: If audio driver has been set externally bysetAudioDriver(AudioDriver), audio is null! -
uncaughtExceptionHandler
Uncaught Player exception handler. -
checkDefaultLengthInRecordMode
private boolean checkDefaultLengthInRecordModeCheck default length in record mode (default is true). Note: In record mode the player requires a default length. If it is not available, it will be limited to 180s. -
checkLoopOffInRecordMode
private boolean checkLoopOffInRecordModeSet check loop off in record mode (default is true). Note: In record mode the player must not loop forever. However, it can be forced to not being checked. -
forceCheckSongLength
private boolean forceCheckSongLengthForce check song length (default is false). Note: If song length has been reached, the player ends the current song, but not in RESET mode. However this can be forced by this switch. -
psid64Detected
private boolean psid64DetectedPSID64 format has been detected? -
firstPlayListEntryIsOne
private boolean firstPlayListEntryIsOneFirst entry of the play-list is first song (otherwise start song). -
sidBuilder
SID builder being used to create SID chips (real hardware or emulation). -
stil
SID tune information list. -
sidDatabase
Song length database. -
recordingFilenameProvider
Create a base name of a filename to be used for recording. -
requiredSIDs
Insert required SIDs. use SID builder to create/destroy SIDs. -
noSIDs
Eject all SIDs. -
sidLocator
Set base address of required SIDs. -
pauseListener
Player paused? Stop audio production. -
videoDrivers
Consumer for VIC screen output as ARGB data -
sidListeners
Consumer for SID register writes -
mos6510Extensions
Consumer for CPU JMP/JSR instructions -
fastForwardVICFrames
private int fastForwardVICFramesFast forward: skipped VIC frames. -
fingerPrintMatcher
WhatsSID? -
whatsSidEvent
Regularly scheduled event for tune recognition. -
playerRunnable
Player runnable to play music in a background thread.
-
-
Konstruktordetails
-
Player
Create a Music Player.- Parameter:
config- configuration
-
Player
Create a Music Player.- Parameter:
config- configurationcpuCreator- creator of the CPU class implementation to be used
-
-
Methodendetails
-
initializeTmpDir
Create temporary directory, if it does not exist.
E.g. Recordings and converted tapes are saved here! -
getFingerPrintMatcher
Get a fingerprint matcher.- Gibt zurück:
- fingerprint matcher
-
setFingerPrintMatcher
Set a fingerprint matcher.- Parameter:
fingerPrintMatcher- a fingerprint matcher
-
updateSIDChipConfiguration
public final void updateSIDChipConfiguration()Call to update SID chips each time SID configuration has been changed thread-safe. -
configureVICs
Call to configure VIC chips thread-safe.- Parameter:
action- VIC configuration action
-
configureSIDs
Configure all available SIDs thread-safe.- Parameter:
action- SID chip consumer
-
configureSID
Configure one specific SID thread-safe.- Parameter:
chipNum- SID chip numberaction- SID chip consumer
-
configureMixer
Configure the mixer, optionally implemented by SID builder thread-safe.- Parameter:
action- mixer consumer
-
executeInPlayerThread
The runnable is executed immediately in player thread or scheduled thread-safe.- Parameter:
eventName- event name for schedulingrunnable- runnable to execute in player thread
-
reset
public final void reset()Power-on C64 system.- Setzt außer Kraft:
resetin KlasseHardwareEnsemble
-
typeInCommand
Simulate a user typed-in command.- Parameter:
multiLineCommand- command to type-in (PETSCII)
-
setCommand
Enter basic command after reset (PETSCII).- Parameter:
command- basic command after reset
-
time
public final double time()What is the current playing time in secs.- Gibt zurück:
- the current playing time in secs
-
getPlayList
Get current play-list.- Gibt zurück:
- current tune-based play list
-
getTimer
Get current timer.- Gibt zurück:
- song length timer
-
getTune
Get the currently played tune.- Gibt zurück:
- the currently played tune
-
setTune
Set a tune to play.- Parameter:
tune- tune to play
-
startC64
public final void startC64()Start player thread. -
stopC64
public final void stopC64()Stop player thread. -
stopC64
public final void stopC64(boolean quitOrWait) Stop or wait for player thread.- Parameter:
quitOrWait- quit player (true) or wait for termination, only (false)
-
setMenuHook
Set a hook to be called when the player has opened a tune.- Parameter:
menuHook- menu hook
-
setInteractivityHook
Set a hook to be called when the player has played a chunk.- Parameter:
interactivityHook-
-
getWhatsSidHook
Get a hook to be called when WhatsSid has detected a tune.- Gibt zurück:
- hook to be called when WhatsSid has detected a tune
-
setWhatsSidHook
Set a hook to be called when WhatsSid has detected a tune.- Parameter:
whatsSidHook-
-
setPlayAddrHook
Set a hook to be called when player address has been read from the tune.- Parameter:
playAddrHook- player address hook
-
stateProperty
Get the player's state,- Gibt zurück:
- the player's state
-
open
Open player. Note: Audio driver different toAudiomembers are on hold!- Löst aus:
LineUnavailableException- audio line currently in useIOException- audio output file cannot be writtenInterruptedException
-
createSIDBuilder
Create configured SID chip implementation (software/hardware).- Parameter:
cpuClock- CPU clock frequency- Gibt zurück:
- SID builder
-
getSidBuilder
-
verifyConfiguration
private void verifyConfiguration()Check the configuration. -
getAudio
Get Audio of audio driver or null for custom audio drivers.- Gibt zurück:
- audio audio
-
getAudioDriver
Get currently used audio driver.- Gibt zurück:
- currently used audio driver
-
setAudioDriver
Set alternative audio driver (not contained inAudio).
For example, If it is required to use a new instance of audio driver each time the player plays a tune (e.g.MP3Driver.MP3StreamDriver)- Parameter:
audioDriver- for exampleMP3Driver.MP3StreamDriver- Löst aus:
IOException- configuration error
-
setAudioAndDriver
Set audio for play-back- Parameter:
audio- audio for play-back- Löst aus:
IOException- configuration error
-
setUncaughtExceptionHandler
Set uncaught Player exception handler.- Parameter:
uncaughtExceptionHandler- excdeption handler
-
setCheckDefaultLengthInRecordMode
public void setCheckDefaultLengthInRecordMode(boolean checkDefaultLengthInRecordMode) Set check default length in record mode (default is true).- Parameter:
checkDefaultLengthInRecordMode- check default length in record mode
-
setCheckLoopOffInRecordMode
public void setCheckLoopOffInRecordMode(boolean checkLoopOffInRecordMode) Set check loop off in record mode (default is true).- Parameter:
checkLoopOffInRecordMode- check loop off in record mode
-
setForceCheckSongLength
public void setForceCheckSongLength(boolean forceCheckSongLength) Set force check song length (default is false).- Parameter:
forceCheckSongLength- force check song length
-
setFirstPlayListEntryIsOne
public void setFirstPlayListEntryIsOne(boolean firstPlayListEntryIsOne) Set first entry of the play-list is first song (otherwise start song).- Parameter:
firstPlayListEntryIsOne- First entry of the play-list is first song (otherwise start song)
-
play
Play routine (clock chips until audio buffer is filled completely or player gets paused).- Gibt zurück:
- continue to play next time?
- Löst aus:
InterruptedException- audio production interrupted
-
close
private void close()Close player. -
play
Play tune.- Parameter:
tune- tune to play (RESET means just reset C64)
-
resetC64
Reset C64 and enter basic command.- Parameter:
command- basic command to be entered after a normal reset
-
play
Turn C64 off and on, load a tune and enter basic command.- Parameter:
tune- tune to play (RESET means just reset C64)command- basic command to be entered after a normal reset
-
pauseContinue
public final void pauseContinue()Pause or continue the player. -
nextSong
public final void nextSong()Play next song. -
previousSong
public final void previousSong()Play previous song.
Note: AfterPREV_SONG_TIMEOUThas been reached, the current tune is restarted instead. -
firstSong
public final void firstSong()Play first song. -
lastSong
public final void lastSong()Play last song. -
getMixerInfo
Get mixer info.- Parameter:
function- mixer function to applydefaultValue- default value, if SIDBuilder does not implement a mixer- Gibt zurück:
- mixer info
-
quit
public final void quit()Quit player. -
setSidDatabase
Set song length database.- Parameter:
sidDatabase- song length database
-
getSidDatabaseInfo
Get song length database info.- Typparameter:
T- SidDatabase return type- Parameter:
function- SidDatabase function to applydefaultValue- default value, if database is not set- Gibt zurück:
- song length database info
-
setSTIL
Set SID Tune Information List (STIL).- Parameter:
stil- SID Tune Information List
-
getStilEntry
Get SID Tune Information List info.- Parameter:
collectionName- entry path to get infos for- Gibt zurück:
- SID Tune Information List info
-
getRecordingFilename
Get recording filename, add audio related file extension (if known).- Gibt zurück:
- recording filename
-
setRecordingFilenameProvider
Set provider of recording filenames.- Parameter:
recordingFilenameProvider- provider of recording filenames
-
addVideoDriver
Add consumer of VIC screen output as ARGB data- Parameter:
consumer- consumer of C64 screen pixels as ARGB data
-
removeVideoDriver
Remove consumer of VIC screen output as ARGB data- Parameter:
consumer- consumer of C64 screen pixels as ARGB data
-
addSidListener
Add consumer of SID register writes- Parameter:
consumer- consumer of SID register writes
-
removeSidListener
Remove consumer of SID register writes- Parameter:
consumer- consumer of SID register writes
-
addMOS6510Extension
Add consumer of MOS6510 JMP/JSR instructions.- Parameter:
mos6510Extension- consumer of MOS6510 JMP/JSR instructions
-
removeMOS6510Extension
Remove consumer of MOS6510 JMP/JSR instructions.- Parameter:
mos6510Extension- of MOS6510 JMP/JSR instructions
-
accept
Fast forward skips frames and produces output for each Xth frame (X = 1x, 2x, 4x, ... , 32x).- Angegeben von:
acceptin SchnittstelleConsumer<VIC>- Angegeben von:
acceptin SchnittstelleVideoDriver
-
write
public void write(int addr, byte data) - Angegeben von:
writein SchnittstelleSIDListener
-
jmpJsr
public void jmpJsr()- Angegeben von:
jmpJsrin SchnittstelleIMOS6510Extension
-
autodetectPSID64
private void autodetectPSID64() -
isPsid64Detected
public boolean isPsid64Detected() -
getCredits
The credits for the authors of many parts of this emulator.- Parameter:
version- containing version of JSIDPlay2- Gibt zurück:
- the credits
-
main
Test main: Play a tune.- Parameter:
args- the filename of the tune is the first arg- Löst aus:
SidTuneError- SID tune errorIOException- tune file cannot be read
-