Documentation ¶
Index ¶
- Constants
- Variables
- func WriteonlyBeats(channels []chan Beats) []chan<- Beats
- func WriteonlyInt(channels []chan int) []chan<- int
- func WriteonlyInterval(channels []chan Interval) []chan<- Interval
- type Beats
- type Button
- type DrumMachine
- func (dm *DrumMachine) Amplitude() chan<- float64
- func (dm *DrumMachine) Close() chan<- struct{}
- func (dm *DrumMachine) Keyboard() chan<- bbox.Coord
- func (dm *DrumMachine) New(wavDurs map[string]time.Duration) beatboxer.Program
- func (dm *DrumMachine) Play() <-chan string
- func (dm *DrumMachine) Render() <-chan render.State
- func (dm *DrumMachine) Yield() <-chan struct{}
- type Interval
- type Keyboard
- type Loop
- type Render
Constants ¶
View Source
const ( TEMPO_TICK = 15 // prod DECAY = 3 * time.Minute KEEP_ALIVE = 14 * time.Minute // if 50% of beats are active, yield to the next program YIELD_LIMIT = SOUNDS * BEATS / 3 )
View Source
const ( DEFAULT_BPM = 120 MIN_BPM = 30 MAX_BPM = 480 SOUNDS = 4 BEATS = 16 DEFAULT_TICKS_PER_BEAT = 10 DEFAULT_TICKS = BEATS * DEFAULT_TICKS_PER_BEAT TEMPO_DECAY = 3 * time.Minute )
View Source
const (
TICK_DELAY = -6
)
Variables ¶
View Source
var (
WAVS = [SOUNDS]string{
"hihat-808.wav",
"kick-classic.wav",
"perc-808.wav",
"tom-808.wav",
}
)
Functions ¶
func WriteonlyBeats ¶
can't pass a slice of non-direction channels as a slice of directional channels, so we have to convert the whole slice to directional first.
func WriteonlyInt ¶
func WriteonlyInterval ¶
Types ¶
type DrumMachine ¶
type DrumMachine struct {
// contains filtered or unexported fields
}
func (*DrumMachine) Close ¶
func (dm *DrumMachine) Close() chan<- struct{}
func (*DrumMachine) Keyboard ¶
func (dm *DrumMachine) Keyboard() chan<- bbox.Coord
func (*DrumMachine) Render ¶
func (dm *DrumMachine) Render() <-chan render.State
func (*DrumMachine) Yield ¶
func (dm *DrumMachine) Yield() <-chan struct{}
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
normal operation:
beats -> emit -> msgs
shtudown operation:
'`' -> closing<- {timers.Stop(), close(msgs), close(emit)} -> termbox.Close()
func InitKeyboard ¶
Click to show internal directories.
Click to hide internal directories.