29 lines
850 B
Go
29 lines
850 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package sound
|
|
|
|
// Use progress's pitch mapping with a triangle wave to distinguish indentation
|
|
// from progress's clipped sine. Cache 0..100 columns before input opens.
|
|
func indentation_clips() [101]*clip {
|
|
var clips [101]*clip
|
|
for level := range clips {
|
|
clips[level] = progress_tone_shape(float64(level), true)
|
|
}
|
|
return clips
|
|
}
|
|
|
|
// Indentation uses ordinary cue admission, independently of the progress
|
|
// monitor and its cancellation/coalescing state. Deeper levels use tone 100.
|
|
func (s *Service) Play_indentation(level int) bool {
|
|
if s == nil || s.closed.Load() || s.finishing.Load() || level < 0 {
|
|
return false
|
|
}
|
|
item := s.indentationTones[min(level, len(s.indentationTones)-1)]
|
|
if item == nil {
|
|
return false
|
|
}
|
|
s.pending.Store(item)
|
|
return true
|
|
}
|