Documentation
¶
Index ¶
- Variables
- func ForEachEventWithTime(mid *smf.SMF, yield func(time int64, track int, msg smf.Message) error) error
- func KeySorter(s []Key) func(i, j int) bool
- func Process(mid *smf.SMF, config *Config, options *Options) (map[OutputKey]*smf.SMF, error)
- func WithDefault[T comparable](a, b T) T
- func WithDefaultPtr[T comparable](a *T, b T) T
- type Config
- type Key
- type NoteTracker
- func (t NoteTracker) Handle(time int64, track int, msg smf.Message) (bool, int)
- func (t NoteTracker) NotePlaying(k Key) bool
- func (t NoteTracker) NoteStart(k Key) int64
- func (t NoteTracker) NoteTrack(k Key) int
- func (t NoteTracker) NotesPlaying() []Key
- func (t NoteTracker) Playing() bool
- func (t NoteTracker) SetNoteStart(k Key, time int64)
- type Options
- type OutputKey
- type Pos
- type Range
- type SpecialPart
Constants ¶
This section is empty.
Variables ¶
View Source
var StopIteration = errors.New("ForEachEventWithTime: StopIteration")
StopIteration can be returned to return without failure.
Functions ¶
func ForEachEventWithTime ¶
func ForEachEventWithTime(mid *smf.SMF, yield func(time int64, track int, msg smf.Message) error) error
ForEachEventWithTime runs the given function for each event, with current absolute time and other info.
func WithDefault ¶
func WithDefault[T comparable](a, b T) T
func WithDefaultPtr ¶
func WithDefaultPtr[T comparable](a *T, b T) T
Types ¶
type Config ¶
type Config struct { // Hymnbook specific configuration. Not needed in UI. MelodyTrackNameRE string `yaml:"melody_track_name_re,omitempty"` BassTrackNameRE string `yaml:"bass_track_name_re,omitempty"` SoloTrackNameRE string `yaml:"solo_track_name_re,omitempty"` // Organ specific configuration or override. Should be offered as UI element. Channel int `yaml:"channel,omitempty"` MelodyChannel int `yaml:"melody_channel,omitempty"` BassChannel int `yaml:"bass_channel,omitempty"` HoldRedundantNotes bool `yaml:"hold_redundant_notes,omitempty"` // Organist preferences. Should be offered as UI element. BPMFactor float64 `yaml:"bpm_factor,omitempty"` PreludePlayerRepeat int `yaml:"prelude_player_repeat,omitempty"` PreludePlayerSleepSec float64 `yaml:"prelude_player_sleep_sec,omitempty"` // Interpreted fermatas. Only used for prelude and postlude. Not needed in UI. FermatasInPrelude bool `yaml:"fermatas_in_prelude,omitempty"` FermatasInPostlude bool `yaml:"fermatas_in_postlude,omitempty"` FermataExtendBeats int `yaml:"fermata_extend_beats,omitempty"` FermataRestBeats int `yaml:"fermata_rest_beats,omitempty"` // Misc for exporting. Not needed in UI. RestBetweenVersesBeats int `yaml:"rest_between_verses_beats,omitempty"` WholeExportSleepSec float64 `yaml:"whole_export_sleep_sec,omitempty"` // Device configuration. Used by the player. OutputPort string `yaml:"output_port,omitempty"` // DataPassword to read the data, if needed. DataPassword string `yaml:"data_password,omitempty"` }
Config define global settings.
type NoteTracker ¶
type NoteTracker struct {
// contains filtered or unexported fields
}
func NewNoteTracker ¶
func NewNoteTracker(refcounting bool) *NoteTracker
func (NoteTracker) NotePlaying ¶
func (t NoteTracker) NotePlaying(k Key) bool
func (NoteTracker) NoteStart ¶
func (t NoteTracker) NoteStart(k Key) int64
func (NoteTracker) NoteTrack ¶
func (t NoteTracker) NoteTrack(k Key) int
func (NoteTracker) NotesPlaying ¶
func (t NoteTracker) NotesPlaying() []Key
func (NoteTracker) Playing ¶
func (t NoteTracker) Playing() bool
func (NoteTracker) SetNoteStart ¶
func (t NoteTracker) SetNoteStart(k Key, time int64)
type Options ¶
type Options struct { // Managed by the main program right now. InputFile string `yaml:"input_file"` InputFileSHA256 string `yaml:"input_file_sha256,omitempty"` // For this module. Fermatas []Pos `yaml:"fermatas,omitempty"` Prelude []Range `yaml:"prelude,omitempty"` Verse []Range `yaml:"verse,omitempty"` Postlude []Range `yaml:"postlude,omitempty"` NumVerses int `yaml:"num_verses,omitempty"` UnrolledNumVerses int `yaml:"unrolled_num_verses,omitempty"` QPMOverride float64 `yaml:"qpm_override,omitempty"` BPMFactor float64 `yaml:"bpm_factor,omitempty"` MaxAdjust int64 `yaml:"max_adjust,omitempty"` KeepEventOrder bool `yaml:"keep_event_order,omitempty"` MelodyTracks []int `yaml:"melody_tracks,omitempty"` BassTracks []int `yaml:"bass_tracks,omitempty"` SoloTracks []int `yaml:"solo_tracks,omitempty"` FermatasInPrelude *bool `yaml:"fermatas_in_prelude,omitempty"` FermatasInPostlude *bool `yaml:"fermatas_in_postlude,omitempty"` // Tags for automatic selection for prelude. Tags []string `yaml:"tags,omitempty"` // Pure comment fields. Declared here to preserve them when rewriting the checksum. // Can't use YAML # comments because yq loses them. Comment string `yaml:"_comment,omitempty"` }
Options define file specific options.
type OutputKey ¶
type OutputKey struct { // Special indicates which part this is. Special SpecialPart // Part indicates the part index in case Special is Single. Part int }
type SpecialPart ¶
type SpecialPart int
const ( // Single indicates that this file covers a single part of a verse. Single SpecialPart = iota // Whole indicates that this file covers the whole output with prelude, all verses and postlude. Whole // Prelude indicates that this file covers the prelude. Prelude // Verse indicates that this file covers an entire verse. Verse // Postlude indicates that this file covers the postlude. Postlude // Panic indicates that this file just stops all notes. Panic )
Click to show internal directories.
Click to hide internal directories.