public class Player extends HardwareEnsemble implements Consumer<int[]>
Type | Property and Description |
---|---|
ObjectProperty<State> |
state
Get the player's state,
|
Modifier and Type | Field and Description |
---|---|
static Calendar |
LAST_MODIFIED
Build date calculated from our own modify time
|
protected List<Consumer<int[]>> |
pixelConsumers
Consumer for VIC screen output as BGRA data
|
protected static Charset |
US_ASCII |
c1541Runner, c64, config, datasette, floppies, iecBus, printer, serialDevices
Constructor and Description |
---|
Player(IConfig config)
Create a Music Player.
|
Player(IConfig config,
Class<? extends MOS6510> cpuClass)
Create a Music Player.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(int[] bgraData)
Fast forward skips frames and produces output for each Xth frame (X = 1x, 2x,
4x, ... , 32x).
|
void |
addPixelConsumer(Consumer<int[]> consumer)
Add consumer of VIC screen output as ARGB data
|
void |
configureMixer(Consumer<Mixer> action)
Configure the mixer, optionally implemented by SID builder.
|
void |
configureSID(int chipNum,
Consumer<SIDEmu> action)
Configure one specific SID.
|
void |
configureSIDs(BiConsumer<Integer,SIDEmu> action)
Configure all available SIDs.
|
void |
configureVICs(Consumer<VIC> action)
Call to configure VIC chips thread-safe.
|
void |
firstSong()
Play first song.
|
String |
getCredits(Properties properties)
The credits for the authors of many parts of this emulator.
|
<T> T |
getHardwareSIDBuilderInfo(Function<HardwareSIDBuilder,T> function,
T defaultValue)
Get hardware SID builder info.
|
<T> T |
getMixerInfo(Function<Mixer,T> function,
T defaultValue)
Get mixer info.
|
PlayList |
getPlayList()
Get current play-list.
|
String |
getRecordingFilename()
Get recording filename, add audio related file extension (if known).
|
<T> T |
getSidDatabaseInfo(Function<SidDatabase,T> function,
T defaultValue)
Get song length database info.
|
STIL.STILEntry |
getStilEntry(String collectionName)
Get SID Tune Information List info.
|
Timer |
getTimer()
Get current timer.
|
SidTune |
getTune()
Get the currently played tune.
|
void |
lastSong()
Play last song.
|
static void |
main(String[] args)
Test main: Play a tune.
|
void |
nextSong()
Play next song.
|
void |
pauseContinue()
Pause or continue the player.
|
void |
play(SidTune tune)
Play tune.
|
void |
previousSong()
Play previous song.
|
void |
quit()
Quit player.
|
void |
removePixelConsumer(Consumer<int[]> consumer)
Remove consumer of VIC screen output as ARGB data
|
protected void |
reset()
Power-on C64 system.
|
void |
resetC64(String command)
Reset C64 and enter basic command.
|
void |
sendRamAndRun() |
void |
sendRamAndSys(int startAddr) |
void |
setAudioDriver(AudioDriver audioDriver)
Set alternative audio driver (not contained in
Audio ). |
void |
setInteractivityHook(Consumer<Player> interactivityHook)
Set a hook to be called when the player has played a chunk.
|
void |
setMenuHook(Consumer<Player> menuHook)
Set a hook to be called when the player has opened a tune.
|
void |
setRecordingFilenameProvider(Function<SidTune,String> recordingFilenameProvider)
Set provider of recording filenames.
|
void |
setSidDatabase(SidDatabase sidDatabase)
Set song length database.
|
void |
setSTIL(STIL stil)
Set SID Tune Information List (STIL).
|
void |
setTune(SidTune tune)
Set a tune to play.
|
void |
startC64()
Start player thread.
|
ObjectProperty<State> |
stateProperty()
Get the player's state,
|
void |
stopC64()
Stop player thread.
|
void |
stopC64(boolean quitOrWait)
Stop or wait for player thread.
|
double |
time()
What is the current playing time in secs.
|
void |
typeInCommand(String command)
Simulate a user typed-in command.
|
void |
updateSIDChipConfiguration()
Call to update SID chips each time SID configuration has been changed
thread-safe.
|
connectC64AndC1541WithParallelCable, enableFloppyDiskDrives, enablePrinter, getC64, getConfig, getDatasette, getFloppies, getPrinter, insertCartridge, insertCartridge, insertCartridgeCRT, insertDisk, insertTape, setClock, setExtendImagePolicy
public final ObjectProperty<State> stateProperty
public static Calendar LAST_MODIFIED
protected static final Charset US_ASCII
public Player(IConfig config)
config
- configurationpublic final void updateSIDChipConfiguration()
public final void configureVICs(Consumer<VIC> action)
action
- VIC configuration actionpublic final void configureSIDs(BiConsumer<Integer,SIDEmu> action)
action
- SID chip consumerpublic final void configureSID(int chipNum, Consumer<SIDEmu> action)
chipNum
- SID chip numberaction
- SID chip consumerpublic final void configureMixer(Consumer<Mixer> action)
action
- mixer consumerpublic void sendRamAndSys(int startAddr) throws InterruptedException
InterruptedException
public void sendRamAndRun() throws InterruptedException
InterruptedException
protected final void reset()
reset
in class HardwareEnsemble
public final void typeInCommand(String command)
command
- command to type-inpublic final double time()
public final PlayList getPlayList()
public final Timer getTimer()
public final SidTune getTune()
public final void setTune(SidTune tune)
tune
- tune to playpublic final void startC64()
public final void stopC64()
public final void stopC64(boolean quitOrWait)
quitOrWait
- quit player (true) or wait for termination, only (false)public final void setMenuHook(Consumer<Player> menuHook)
menuHook
- menu hookpublic final void setInteractivityHook(Consumer<Player> interactivityHook)
interactivityHook
- public final ObjectProperty<State> stateProperty()
public final void setAudioDriver(AudioDriver audioDriver)
Audio
).MP3Driver.MP3Stream
)audioDriver
- for example MP3Driver.MP3Stream
public final void play(SidTune tune)
tune
- tune to play (RESET means just reset C64)public final void resetC64(String command)
command
- basic command to be entered after a normal resetpublic final void pauseContinue()
public final void nextSong()
public final void previousSong()
PREV_SONG_TIMEOUT
has been reached, the current
tune is restarted instead.public final void firstSong()
public final void lastSong()
public final <T> T getMixerInfo(Function<Mixer,T> function, T defaultValue)
function
- mixer function to applydefaultValue
- default value, if SIDBuilder does not implement a mixerpublic final <T> T getHardwareSIDBuilderInfo(Function<HardwareSIDBuilder,T> function, T defaultValue)
function
- hardware SID builder function to applydefaultValue
- default value, if SIDBuilder does not implement a
hardware SID builderpublic final void quit()
public final void setSidDatabase(SidDatabase sidDatabase)
sidDatabase
- song length databasepublic final <T> T getSidDatabaseInfo(Function<SidDatabase,T> function, T defaultValue)
T
- SidDatabase return typefunction
- SidDatabase function to applydefaultValue
- default value, if database is not setpublic final void setSTIL(STIL stil)
stil
- SID Tune Information Listpublic final STIL.STILEntry getStilEntry(String collectionName)
collectionName
- entry path to get infos forpublic String getRecordingFilename()
public final void setRecordingFilenameProvider(Function<SidTune,String> recordingFilenameProvider)
recordingFilenameProvider
- provider of recording filenamespublic void addPixelConsumer(Consumer<int[]> consumer)
consumer
- consumer of C64 screen pixels as ARGB datapublic void removePixelConsumer(Consumer<int[]> consumer)
consumer
- consumer of C64 screen pixels as ARGB datapublic void accept(int[] bgraData)
public final String getCredits(Properties properties)
properties
- containing dynamic values for the credits (e.g. version)public static void main(String[] args) throws IOException, SidTuneError
args
- the filename of the tune is the first argSidTuneError
- SID tune errorIOException
- tune file cannot be readCopyright © 2018 Ken Händel. All rights reserved.