mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
[javasound] Fix invalid cast on non windows os (#2988)
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
This commit is contained in:
+16
-1
@@ -109,7 +109,22 @@ public class JavaSoundAudioSource implements AudioSource {
|
||||
// on OSs other than windows we can open multiple lines for the microphone
|
||||
if (!windowsOS) {
|
||||
TargetDataLine microphone = initMicrophone(format);
|
||||
var inputStream = new JavaSoundInputStream((InputStream) microphone, audioFormat);
|
||||
var inputStream = new JavaSoundInputStream(new InputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return microphone.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte @Nullable [] b, int off, int len) throws IOException {
|
||||
return microphone.read(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
microphone.close();
|
||||
}
|
||||
}, audioFormat);
|
||||
microphone.start();
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user