Shiptest 13 - Modules - TypesVar Details - Proc Details

Instrument Datums

Instrument datums hold the data for any given instrument, as well as data on how to play it and what bounds there are to playing it.

The datums themselves are kept in SSinstruments in a list by their unique ID. The reason it uses ID instead of typepath is to support the runtime creation of instruments. Since songs cache them while playing, there isn't realistic issues regarding performance from accessing.

Vars

HIGHEST_KEYDon't touch this
LOWEST_KEYDon't touch this x2
abstract_typeUsed for categorization subtypes
admin_onlyOh no - For truly troll instruments.
categoryCategory
idUniquely identifies this instrument so runtime changes are possible as opposed to paths. If this is unset, things will use path instead.
instrument_flagsSee __DEFINES/flags/instruments.dm
legacy_instrument_extFor legacy instruments, our file extension
legacy_instrument_pathFor legacy instruments, the path to our notes
nameName of the instrument
real_samplesWrite here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127
samplesassoc list key = /datum/instrument_key. do not fill this yourself!
songs_usingWhat songs are using us
volume_multiplierVolume multiplier. Synthesized instruments are quite loud and I don't like to cut off potential detail via editing. (someone correct me if this isn't a thing)

Procs

InitializeInitializes the instrument, calculating its samples if necessary.
calculate_samplesFor synthesized instruments, this is how the instrument generates the "keys" that a /datum/song uses to play notes. Calculating them on the fly would be unperformant, so we do it during init and keep it all cached in a list.
readyChecks if this instrument is ready to play.

Var Details

HIGHEST_KEY

Don't touch this

LOWEST_KEY

Don't touch this x2

abstract_type

Used for categorization subtypes

admin_only

Oh no - For truly troll instruments.

category

Category

id

Uniquely identifies this instrument so runtime changes are possible as opposed to paths. If this is unset, things will use path instead.

instrument_flags

See __DEFINES/flags/instruments.dm

legacy_instrument_ext

For legacy instruments, our file extension

legacy_instrument_path

For legacy instruments, the path to our notes

name

Name of the instrument

real_samples

Write here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127

samples

assoc list key = /datum/instrument_key. do not fill this yourself!

songs_using

What songs are using us

volume_multiplier

Volume multiplier. Synthesized instruments are quite loud and I don't like to cut off potential detail via editing. (someone correct me if this isn't a thing)

Proc Details

Initialize

Initializes the instrument, calculating its samples if necessary.

calculate_samples

For synthesized instruments, this is how the instrument generates the "keys" that a /datum/song uses to play notes. Calculating them on the fly would be unperformant, so we do it during init and keep it all cached in a list.

ready

Checks if this instrument is ready to play.