models

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

internal/models/tab.go

Index

Constants

View Source
const MeasureLength = 16 // Characters per measure

Helper methods for Tab

Variables

This section is empty.

Functions

This section is empty.

Types

type EditMode

type EditMode int
const (
	EditNormal EditMode = iota
	EditInsert
	EditSelect
)

type PlaybackState

type PlaybackState struct {
	IsPlaying   bool
	Position    int
	Highlighted []Position
	Tempo       int
}

type Position

type Position struct {
	String   int
	Position int
}

type SessionState

type SessionState struct {
	CurrentTab    *Tab
	CursorPos     Position
	ViewMode      ViewMode
	PlaybackState PlaybackState
	EditMode      EditMode
}

type Tab

type Tab struct {
	ID            int       `json:"id" db:"id"`
	Name          string    `json:"name" db:"name"`
	Artist        string    `json:"artist" db:"artist"`
	Content       [6]string `json:"content" db:"content"` // 6 strings - now supports variable length
	Tuning        [6]string `json:"tuning" db:"tuning"`   // E A D G B e
	Tempo         int       `json:"tempo" db:"tempo"`
	TimeSignature string    `json:"time_signature" db:"time_signature"`
	Measures      int       `json:"measures" db:"measures"` // Number of measures
	CreatedAt     time.Time `json:"created_at" db:"created_at"`
	UpdatedAt     time.Time `json:"updated_at" db:"updated_at"`
}

func NewEmptyTab

func NewEmptyTab(name string) *Tab

func NewTestTab

func NewTestTab(name string) *Tab

NewTestTab creates a tab with some sample notes for testing

func (*Tab) AddMeasure

func (t *Tab) AddMeasure()

AddMeasure adds a new measure to the tab

func (*Tab) GetMeasureCount

func (t *Tab) GetMeasureCount() int

GetMeasureCount returns the number of measures based on content length

func (*Tab) GetTotalLength

func (t *Tab) GetTotalLength() int

GetTotalLength returns the total number of positions in the tab

func (*Tab) RemoveMeasure

func (t *Tab) RemoveMeasure()

RemoveMeasure removes the last measure from the tab

type ViewMode

type ViewMode int
const (
	ViewHome ViewMode = iota
	ViewEditor
	ViewBrowser
	ViewSettings
	ViewHelp
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL