move router to module New func

This commit is contained in:
Joel Wetzell
2025-12-06 23:00:45 -06:00
parent 8d8347fc4d
commit 9a06949b5b
16 changed files with 30 additions and 93 deletions

View File

@@ -23,7 +23,7 @@ func init() {
RegisterModule(ModuleRegistration{
//TODO(jwetzell): find a better namespace than "misc"
Type: "misc.midi.client",
New: func(config config.ModuleConfig) (Module, error) {
New: func(config config.ModuleConfig, router *Router) (Module, error) {
params := config.Params
input, ok := params["input"]
@@ -49,7 +49,7 @@ func init() {
return nil, fmt.Errorf("misc.midi.client output must be a string")
}
return &MIDIClient{config: config, InputPort: inputString, OutputPort: outputString}, nil
return &MIDIClient{config: config, InputPort: inputString, OutputPort: outputString, router: router}, nil
},
})
}
@@ -62,10 +62,6 @@ func (mc *MIDIClient) Type() string {
return mc.config.Type
}
func (mc *MIDIClient) RegisterRouter(router *Router) {
mc.router = router
}
func (mc *MIDIClient) Run() error {
defer midi.CloseDriver()