libtrackerboy/engine/enginecontrol

Source   Edit  

Engine control.

This module contains the core components of Engine, and is responsible for music and sound effect playback of TrackerBoy modules.

A brief overview of these components:

  • fc, FrequencyControl - handles frequency calculation and effects. Each track has its own fc.
  • ir, InstrumentRuntime - for performing an instrument by stepping through its sequences. Each track has its own ir, as one instrument is played per track.
  • tc, TrackControl - handles the state of a channel for a track. It serves as a container for an fc and ir, and ticks them when it is ticked. A tc also handles note triggers and cuts.
  • mr, MusicRuntime - handles the performance of a Song. It is a container for a tracker and each channel's tc. It also manages the state of each channel.

This module is part of the inner workings of the engine module, and has an unstable API.

Types

MusicResult = object
  halted*: bool
  locked*: set[ChannelId]
Result object from ticking a MusicRuntime.
  • halted: true if the runtime halted at this tick
  • locked: A set of channels that were explicitly locked by the L00 effect.
Source   Edit  
MusicRuntime = object
  
Source   Edit  

Procs

proc halt(r: var MusicRuntime) {....raises: [], tags: [], forbids: [].}
Source   Edit  
func initMusicRuntime(song: Song; startAt: SongPos; patternRepeat: bool): MusicRuntime {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc jump(r: var MusicRuntime; song: Song; pattern: Natural) {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
func note(r: MusicRuntime; ch: ChannelId): uint8 {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func pos(r: MusicRuntime): SongPos {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
func speed(r: MusicRuntime): Speed {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
func status(r: MusicRuntime): TrackerStatus {.inline, ...raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc tick(r: var MusicRuntime; song: Song; itable: InstrumentTable;
          unlocked: set[ChannelId]; apuOp: var ApuOperation): MusicResult {.
    ...raises: [], tags: [], forbids: [].}
Steps the runtime for 1 frame or tick. Returns true if the runtime halted or is currently halted. Afterwards, the frame variable will be updated with the details of the tick that was just stepped. Also, op will be updated with the necessary changes to the Apu as a result of this tick. Source   Edit  
func trackEnvelope(r: MusicRuntime; ch: ChannelId): uint8 {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
func trackPanning(r: MusicRuntime; ch: ChannelId): uint8 {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func trackState(r: MusicRuntime; ch: ChannelId): ChannelState {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
func trackTimbre(r: MusicRuntime; ch: ChannelId): uint8 {....raises: [], tags: [],
    forbids: [].}
Source   Edit  

Exports

Order, ChannelUpdate, mget, getTickrate, trow, ==, SomeTable, TrackId, ModulePiece, hash, updateAll, Track, [], initPattern, nextUnused, ==, $, toEffectCmd, ChannelAction, getPatternView, items, isHalted, ==, SongSpan, duplicate, data, ==, WaveData, tick, TrackerResult, SomeData, ==, capacity, editPattern, ==, isEnabled, defaultRpb, hash, len, isValid, initWaveformTable, initWaveform, removeUnusedTracks, ByteIndex, get, Tickrate, InstrumentColumn, patternRepeat=, isValid, getRow, [], toOption, getPath, pos, initCounter, trackLen, effectsFilter, $, effectNone, []=, estimateSpeed, initOrderRow, tempo, ==, tick, ChannelState, uniqueIds, SequenceKind, ==, toSpeed, tempo, $, items, [], [], Tracker, viewPattern, toFloat, SongList, clone, Speed, Tristate, getOp, $, patternLen, clone, speed, initTrack, ApuOperation, shortensPattern, Pcm, [], totalTracks, noteNone, trackLen=, removeAllTracks, Instrument, defaultTrackLen, value, ==, revisionMinor, len, EffectCounts, ==, initSong, songSpan, totalRows, isRunning, effectCmdToChar, immutable, mitems, SequenceLen, isNil, isValid, defaultRpm, WaveformTable, <=, contains, SomeTrack, remove, data, initInstrumentTable, ==, TrackLen, runtime, PatternRow, Module, tempo, getTrack, jump, [], trackerResult, ==, len, SongPath, UpdateFlag, rangeSpeed, FixedSeq, runtime, ==, songPos, revisionMajor, clone, iptr, allocateTracks, isValid, isValid, editTrack, isEmpty, PcmF32, orow, iref, initTrackView, ==, defaultSpeed, all, viewTrack, initTrack, isValid, capacity, ==, toView, InstrumentTable, patternRepeat, [], Counter, initInstrument, noteColumn, initModule, mitems, add, instrumentNone, NoteColumn, newModule, len, isValid, has, <, Pattern, initTracker, ==, =copy, initEffect, unitSpeed, value, OrderRow, immutable, isValid, Effect, noCounter, noLoopPoint, ==, TrackerStatus, runtime, SongPos, ==, isValid, defaultTickrate, len, has, $, initChannelState, effectCharMap, [], instrumentColumn, PositiveByte, effectiveTickrate, items, ==, LoopPoint, toOption, halt, OrderLen, PatternView, songSpan, [], TableId, getTrackView, initTrackRow, effectsFilter=, [], items, trackIds, totalRows, next, EffectCmd, version, ==, getRow, initLoopPoint, nextAvailableId, EngineFrame, patternLen, SomePattern, initLoopPoint, System, UpdateFlags, TrackRow, newSong, initSequence, getPattern, toView, add, isValid, filter, initSongList, asSlice, isNil, Waveform, InfoString, isValid, $, ==, setLen, items, Song, noteColumn, initOrder, []=, Sequence, toInfoString, TrackView, ChannelId, add, hertz