fix FUCK! Well
This commit is contained in:
parent
7bc1a238ed
commit
94094640e6
@ -30,6 +30,7 @@ func NewClient(name string) error {
|
|||||||
return fmt.Errorf("Error while setting sequencer name. %d", errCode)
|
return fmt.Errorf("Error while setting sequencer name. %d", errCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPort to reigister new MIDI port.
|
// NewPort to reigister new MIDI port.
|
||||||
@ -40,6 +41,7 @@ func NewPort(name string) error {
|
|||||||
if status != 0 {
|
if status != 0 {
|
||||||
return fmt.Errorf("Error while createing sequencer port. %d", status)
|
return fmt.Errorf("Error while createing sequencer port. %d", status)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendData to ALSA
|
// SendData to ALSA
|
||||||
@ -51,13 +53,14 @@ func SendData(p []byte) error {
|
|||||||
stage, errCode := resolveErrCode(status)
|
stage, errCode := resolveErrCode(status)
|
||||||
switch stage {
|
switch stage {
|
||||||
case 1:
|
case 1:
|
||||||
return 0, fmt.Errorf("Error while creating MIDI event. %d", errCode)
|
return fmt.Errorf("Error while creating MIDI event. %d", errCode)
|
||||||
case 2:
|
case 2:
|
||||||
return 0, fmt.Errorf("Error while encoding MIDI event. %d", errCode)
|
return fmt.Errorf("Error while encoding MIDI event. %d", errCode)
|
||||||
case 3:
|
case 3:
|
||||||
return 0, fmt.Errorf("Error while sending data. %d", errCode)
|
return fmt.Errorf("Error while sending data. %d", errCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveErrCode(code int) (int, int) {
|
func resolveErrCode(code int) (int, int) {
|
||||||
|
@ -36,7 +36,10 @@ func (midiDev *MIDIDevice) Init() error {
|
|||||||
|
|
||||||
func (midiDev *MIDIDevice) Write(p []byte) (int, error) {
|
func (midiDev *MIDIDevice) Write(p []byte) (int, error) {
|
||||||
midiDev.Signal <- 1
|
midiDev.Signal <- 1
|
||||||
alsa.SendData(p)
|
err := alsa.SendData(p)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user