-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tracker): add menu to load instrument presets
The presets are embedded in the executable, so there's no additional files. Closes #91
- Loading branch information
Showing
55 changed files
with
2,262 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package tracker | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"sort" | ||
|
||
"github.com/vsariola/sointu" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
type PresetList []sointu.Instrument | ||
|
||
//go:embed presets/* | ||
var presetFS embed.FS | ||
|
||
var Presets PresetList | ||
|
||
func init() { | ||
fs.WalkDir(presetFS, ".", func(path string, d fs.DirEntry, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if d.IsDir() { | ||
return nil | ||
} | ||
data, err := fs.ReadFile(presetFS, path) | ||
if err != nil { | ||
return nil | ||
} | ||
var instr sointu.Instrument | ||
if yaml.Unmarshal(data, &instr) != nil { | ||
return nil | ||
} | ||
Presets = append(Presets, instr) | ||
return nil | ||
}) | ||
sort.Sort(Presets) | ||
} | ||
|
||
func (p PresetList) Len() int { | ||
return len(p) | ||
} | ||
|
||
func (p PresetList) Less(i, j int) bool { | ||
return p[i].Name < p[j].Name | ||
} | ||
|
||
func (p PresetList) Swap(i, j int) { | ||
p[i], p[j] = p[j], p[i] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Fairies | ||
numvoices: 1 | ||
units: | ||
- type: envelope | ||
id: 1 | ||
parameters: {attack: 80, decay: 96, gain: 128, release: 88, stereo: 0, sustain: 80} | ||
- type: envelope | ||
id: 2 | ||
parameters: {attack: 0, decay: 96, gain: 128, release: 88, stereo: 0, sustain: 40} | ||
- type: distort | ||
id: 3 | ||
parameters: {drive: 32, stereo: 0} | ||
- type: send | ||
id: 5 | ||
parameters: {amount: 96, port: 0, sendpop: 1, target: 12} | ||
- type: oscillator | ||
id: 232 | ||
parameters: {color: 3, detune: 56, gain: 64, lfo: 0, phase: 3, shape: 64, stereo: 0, transpose: 64, type: 1} | ||
- type: oscillator | ||
id: 233 | ||
parameters: {color: 3, detune: 72, gain: 64, lfo: 0, phase: 3, shape: 64, stereo: 0, transpose: 64, type: 1} | ||
- type: addp | ||
id: 234 | ||
parameters: {stereo: 0} | ||
- type: distort | ||
id: 10 | ||
parameters: {drive: 96, stereo: 0} | ||
- type: filter | ||
id: 12 | ||
parameters: {bandpass: 0, frequency: 16, highpass: 1, lowpass: 0, negbandpass: 0, neghighpass: 0, resonance: 24, stereo: 0} | ||
- type: mulp | ||
id: 13 | ||
parameters: {stereo: 0} | ||
- type: pan | ||
id: 14 | ||
parameters: {panning: 64, stereo: 0} | ||
- type: delay | ||
id: 15 | ||
parameters: {damp: 64, dry: 128, feedback: 64, notetracking: 2, pregain: 96, stereo: 1} | ||
varargs: [48, 24] | ||
- type: outaux | ||
id: 19 | ||
parameters: {auxgain: 64, outgain: 64, stereo: 1} |
Oops, something went wrong.