Documentation
¶
Overview ¶
Package xm loads FastTracker 2 XM 1.04 modules and replays pitched PCM.
Index ¶
Constants ¶
const Profile = "FastTracker 2 XM 1.04 PCM"
Profile is the name of the supported playback profile.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
Note, Instrument, Volume, Effect, Param uint8
}
Cell retains the XM note, instrument, volume-column and command bytes.
type ChannelState ¶
ChannelState reports a channel's selected instrument, sounding sample slot, native period and volume before applying the volume envelope.
type Envelope ¶
type Envelope struct {
Points []EnvelopePoint
Sustain, LoopStart, LoopEnd, Flags uint8
}
Envelope preserves an instrument's native point list and loop indices.
type EnvelopePoint ¶
type EnvelopePoint struct {
Tick, Value int
}
EnvelopePoint is a native tick and level.
type Instrument ¶
type Instrument struct {
Name string
Type uint8
Keymap [96]uint8
Volume, Pan Envelope
VibratoType, VibratoSweep, VibratoDepth, VibratoRate uint8
Fadeout int
Samples []Sample
}
Instrument contains the note-to-sample map and native playback metadata.
type Module ¶
type Module struct {
Title, Tracker string
Version, Restart, Channels, Flags, Speed, BPM int
Orders []uint8
Patterns []Pattern
Instruments []Instrument
}
Module contains an XM 1.04 song and its native timing and pitch flags.
type Replay ¶
Replay implements the XM PCM profile.
func NewReplayWithOptions ¶
func NewReplayWithOptions[T audio.Sample](m *Module, options ReplayOptions) (*Replay[T], tracker.ReplayConfig[T], error)
NewReplayWithOptions builds the XM sample bank and replay with the selected timing and native restart behavior.
func (*Replay[T]) AppendChannelStates ¶
func (r *Replay[T]) AppendChannelStates(dst []ChannelState) []ChannelState
AppendChannelStates appends the state after the most recent tick.
type ReplayOptions ¶
type ReplayOptions struct {
// FastTrackerWAV uses the reference WAV renderer's truncated tick lengths
// and fixed-point pitch at the output rate, up to 48 kHz.
FastTrackerWAV bool
AdditionalPlays int // Extra passes from the native restart order, preserving playback state.
}
ReplayOptions selects FastTracker-specific playback behavior.
type Sample ¶
type Sample struct {
Name string
Length, LoopStart, LoopLength int64
Volume, Type, Pan, Reserved uint8
FineTune, RelativeNote int8
PCM audio.Buffer[float64]
}
Sample describes a delta-encoded mono slot. Length and loop fields are measured in bytes, as in the XM header. PCM holds decoded source frames.