mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
refactor!: rename SynthService to Synther and related types
The -er suffix is more idiomatic for single method interfaces, and the interface is not doing much more than converting the patch to a synth. Names were updated throughout the project to reflect this change. In particular, the "Service" in SynthService was not telling anything helpful.
This commit is contained in:
parent
e4a2ed9f32
commit
0a67129a0c
@ -140,7 +140,7 @@ func (t *Tracker) saveSong(w io.WriteCloser) bool {
|
||||
}
|
||||
|
||||
func (t *Tracker) exportWav(w io.WriteCloser, pcm16 bool) {
|
||||
data, err := sointu.Play(t.synthService, t.Song(), true) // render the song to calculate its length
|
||||
data, err := sointu.Play(t.synther, t.Song(), true) // render the song to calculate its length
|
||||
if err != nil {
|
||||
t.Alert.Update(fmt.Sprintf("Error rendering the song during export: %v", err), Error, time.Second*3)
|
||||
return
|
||||
|
@ -64,7 +64,7 @@ type Tracker struct {
|
||||
quitted bool
|
||||
unmarshalRecoveryChannel chan []byte
|
||||
marshalRecoveryChannel chan (chan []byte)
|
||||
synthService sointu.SynthService
|
||||
synther sointu.Synther
|
||||
|
||||
*trackerModel
|
||||
}
|
||||
@ -116,7 +116,7 @@ func (t *Tracker) UnmarshalContent(bytes []byte) error {
|
||||
return errors.New("was able to unmarshal a song, but the bpm was 0")
|
||||
}
|
||||
|
||||
func NewTracker(model *tracker.Model, synthService sointu.SynthService) *Tracker {
|
||||
func NewTracker(model *tracker.Model, synther sointu.Synther) *Tracker {
|
||||
t := &Tracker{
|
||||
Theme: material.NewTheme(),
|
||||
BPM: new(NumberInput),
|
||||
@ -146,7 +146,7 @@ func NewTracker(model *tracker.Model, synthService sointu.SynthService) *Tracker
|
||||
TrackEditor: NewTrackEditor(),
|
||||
|
||||
errorChannel: make(chan error, 32),
|
||||
synthService: synthService,
|
||||
synther: synther,
|
||||
trackerModel: model,
|
||||
|
||||
marshalRecoveryChannel: make(chan (chan []byte)),
|
||||
|
@ -29,7 +29,7 @@ type (
|
||||
recordingFrames int
|
||||
recordingEvents []PlayerProcessEvent
|
||||
|
||||
synthService sointu.SynthService
|
||||
synther sointu.Synther
|
||||
playerMessages chan<- PlayerMessage
|
||||
modelMessages <-chan interface{}
|
||||
}
|
||||
@ -85,11 +85,11 @@ type (
|
||||
|
||||
const NUM_RENDER_TRIES = 10000
|
||||
|
||||
func NewPlayer(synthService sointu.SynthService, playerMessages chan<- PlayerMessage, modelMessages <-chan interface{}) *Player {
|
||||
func NewPlayer(synther sointu.Synther, playerMessages chan<- PlayerMessage, modelMessages <-chan interface{}) *Player {
|
||||
p := &Player{
|
||||
playerMessages: playerMessages,
|
||||
modelMessages: modelMessages,
|
||||
synthService: synthService,
|
||||
synther: synther,
|
||||
volume: Volume{Average: [2]float64{1e-9, 1e-9}, Peak: [2]float64{1e-9, 1e-9}},
|
||||
}
|
||||
return p
|
||||
@ -308,10 +308,10 @@ func (p *Player) compileOrUpdateSynth() {
|
||||
}
|
||||
} else {
|
||||
var err error
|
||||
p.synth, err = p.synthService.Compile(p.patch, p.bpm)
|
||||
p.synth, err = p.synther.Synth(p.patch, p.bpm)
|
||||
if err != nil {
|
||||
p.synth = nil
|
||||
p.trySend(PlayerCrashMessage{fmt.Errorf("synthService.Compile: %w", err)})
|
||||
p.trySend(PlayerCrashMessage{fmt.Errorf("synther.Synth: %w", err)})
|
||||
return
|
||||
}
|
||||
for i := 0; i < 32; i++ {
|
||||
|
Reference in New Issue
Block a user