gordonklaus / portaudio

Go bindings for the PortAudio audio I/O library
MIT License
704 stars 95 forks source link

Invalid error returned for paNoDevice in DefaultInputDevice and DefaultOutputDevice #35

Closed delthas closed 2 years ago

delthas commented 4 years ago

When there are no input devices or output devices on the system, DefaultInputDevice (DefaultOutputDevice) calls C.Pa_GetDefaultInputDevice (C.Pa_GetDefaultInputDevice) which returns paNoDevice.

paNoDevice is < 0 so the wrappers return newError(C.PaError(i)); however paNoDevice is not a PaError. It's just a special number returned when there's no device.

Later when this error is printed it prints Invalid error code because paNoDevice is not a valid error code.

This error should not be wrapped under a portaudio.Error but probably instead just return some constant portaudio.errNoDevice.