AbstractPlayer:
Filter:
crucial-library/Classes (extension) | Libraries > crucial > Players

AbstractPlayer
ExtensionExtension

the base class for all Players : a playable object

Description

Players are things that can play. The AbstractPlayer interface encapsulates each of the steps to load an object, get its resources onto the server (eg. loading buffers, populating lookup tables) , to play at precise times, stop and free its resources when finished.

Players may have one synth or many or even none. They may hold groups, busses and buffers in its instance variables.

Players have an output spec and some of them have inputs and input specs.

If they have editable parameters then the framework supports saving and loading of the player object in compile string document format.

Class Methods

.bundleClass

.bundle

Arguments:

server
atTime

see atTime

buildFunction

.ar

Arguments:

... args

.kr

Arguments:

... args

.annotate

Arguments:

thing
note

.getAnnotation

Arguments:

thing

.removeAnnotation

Arguments:

thing

.initClass

.load

Arguments:

obj
warnIfNotFound

.enpath

Arguments:

obj

Instance Methods

.path

if loaded or saved, the player knows its path

Arguments:

p

.synth

.group

Arguments:

g

.server

.patchOut

.status

.play

boots the server, prepares the player for play (loading resources like samples etc.) and spawns the player

all args are optional

Arguments:

group

a Server (will use the root node) a Group nil (default server's root node)

atTime

see atTime

bus

bus - (Bus,Integer,Nil) a specific Bus to play on, otherwise will default to the main audio outs

.prPlay

Arguments:

atTime

see atTime

bus
timeOfRequest

.prSetStatus

Arguments:

newStatus

.isPrepared

.readyForPlay

.prepareForPlay

this loads the synthDef to the server for the player and all of its children, and allocates any resources such as buffers, loading sound files etc.

Arguments:

group

group - a Server, a Group or Nil

private

isPrivate: a public bus is one of the main audio outputs of your soundcard. a private bus is one that will be patched and mixed further down the line. When makePatchOut is called on the top player (the one that actually was sent .play) it plays to a public (main audio output), and any internal children are told to allocate and play onto a private bus.

bus

bus - a specific Bus to play on. this will cause isPrivate to be ignored

.prepareToBundle

Arguments:

agroup
bundle
private
bus

.makeResourcesToBundle

.prepareChildrenToBundle

Arguments:

bundle

.loadDefFileToBundle

Arguments:

bundle
server

.defaultAtTime

.loadBuffersToBundle

.makePatchOut

Arguments:

agroup
private
bus
bundle

.topMakePatchOut

Arguments:

agroup
private
bus

.setPatchOut

Arguments:

po

.spawn

assumes the player has been prepared. see prepareForPlay

Arguments:

atTime

see atTime

timeOfRequest

.spawnOn

Arguments:

group
bus
atTime

see atTime

timeOfRequest

.spawnToBundle

Arguments:

bundle
selector

.spawnOnToBundle

Arguments:

agroup
bus
bundle

.didSpawn

.isPlaying

.cmdPeriod

.onPlay

Arguments:

func
timeout
listener
oneShot
throwErrorOnTimeout

.onStop

Arguments:

func
timeout
listener
oneShot
throwErrorOnTimeout

.onReady

Arguments:

func
timeout
listener
oneShot
throwErrorOnTimeout

.freeOnStop

.prOn

Arguments:

status
func
timeout
listener
oneShot
throwErrorOnTimeout

.stop

stops playing but does not deallocate any resources (buffers etc.) You need to .free to deallocate it

Arguments:

atTime

see atTime

.stopToBundle

Arguments:

bundle

.didStop

.release

call release on the synth, with the releaseTime then calls stop on the player, so even if the synthDef does not have a \gate input, it will function the same as stop after a short delay.

Arguments:

releaseTime
atTime

.releaseToBundle

Arguments:

releaseTime
bundle

.free

frees all allocated resources (buffers etc.) if it is playing then it also stops it

Arguments:

atTime

see atTime

.freeToBundle

Arguments:

bundle

.freeResourcesToBundle

.didFree

.freeSynthToBundle

Arguments:

bundle

.freePatchOutToBundle

Arguments:

bundle

.record

Arguments:

path
endBeat
onComplete
recHeaderFormat
recSampleFormat
atTime

see atTime

.busIndex

.bus

Arguments:

b

.asSynthDef

.writeDefFile

Arguments:

dir

.synthDefArgs

.defName

.rate

.numChannels

.spec

.addToSynthDef

Arguments:

synthDef
name

.synthArg

.instrArgFromControl

Arguments:

control

.ar

.kr

.value

.valueArray

.plot

Arguments:

duration
bounds

.connectTo

Arguments:

hasInput

.connectToInputAt

Arguments:

player
inputIndex

.connectToPatchIn

Arguments:

patchIn
needsValueSetNow

.disconnect

.children

for players that hold other players or objects, return those children player classes should implement where appropriate. a Patch has its args as children SFP has its underlying object as child

using this.children.do({arg item; .... }) can save you from having to muck up the Player class with extra methods.

.deepDo

do to allChildren

Arguments:

function

.allChildren

and all your children's children, and their children...

.composeUnaryOp

Arguments:

operator

.composeBinaryOp

Arguments:

operator
pattern

.reverseComposeBinaryOp

Arguments:

operator
pattern

.beatDuration

.timeDuration

.embedInStream

Arguments:

inval

.delta

.name

if loaded or saved then the name is the filename, else its the normal asString for an object (eg. "a Patch")

.asString

.save

Arguments:

apath

.didSaveAs

Arguments:

apath

.asCompileString

.storeParamsOn

Arguments:

stream

.simplifyStoreArgs

Arguments:

args

.annotate

Arguments:

thing
note

.changed

Arguments:

what
... moreArgs

.copy

.guiClass

.addToDefName

.proxyControlClass

.wrapInFader

Arguments:

bus

.releaseAndFreeToBundle

Arguments:

releaseTime
bundle

.enpath

.loadDocument

.didLoadFromPath

Arguments:

argpath

.load

Arguments:

obj
warnIfNotFound

.busReport

Arguments:

f
slogan

.asKAsset

.swapperApp

Arguments:

sb

.wigglyness