korlibs-archive / korau Goto Github PK
View Code? Open in Web Editor NEWKotlin cORoutines AUdio - Pure Kotlin WAV, MP3 and OGG vorbis decoders
Home Page: https://korlibs.soywiz.com/korau/
License: Other
Kotlin cORoutines AUdio - Pure Kotlin WAV, MP3 and OGG vorbis decoders
Home Page: https://korlibs.soywiz.com/korau/
License: Other
After Upgrading from Korge 1.10.0.0
to 1.12.2.0
the
VfsFile.readSound()
doesn't work anymore for a specific mp3 file.
Platform: installAndroidDebug
You can find the Sound files here:
https://github.com/TobseF/HitKlack/tree/master/src/commonMain/resources/sounds
The file which causes the exception is the line_missed.mp3
.
The other Sounds work. - Sometimes a bit choppy but OK.
The full project:
https://github.com/TobseF/HitKlack/tree/UpgradeKorge
After updating to Korge 1.11.1.0
the audio stopped working on the JS build.
In the Console it prints the warning:
korau-root-korau.js:8121 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.
But I think this already was there before the update.
After Upgrading from Korge 1.10.0.0
to 1.12.0.2
the
VfsFile.readNativeSound()
doesn't work anymore.
I replaced it with
VfsFile.readSound()
which also produces the same stacktrace.
Platform: runJVM
You can find the Sound files here:
https://github.com/TobseF/HitKlack/tree/master/src/commonMain/resources/sounds
and the full project:
https://github.com/TobseF/HitKlack/tree/UpgradeKorge
ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -75 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:21)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -75 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:21)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -155 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:22)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -155 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:22)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -75 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:23)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -75 out of bounds for byte[2048]
at java.base/java.lang.System.arraycopy(Native Method)
at kotlin.collections.ArraysKt___ArraysJvmKt.copyInto(_ArraysJvm.kt:773)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.samples_III$korau(JavaMp3Decoder.kt:2007)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.decodeFrame(JavaMp3Decoder.kt:622)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:506)
at com.soywiz.korau.format.mp3.JavaMp3Decoder.init(JavaMp3Decoder.kt:500)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:21)
at com.soywiz.korau.format.mp3.MP3DecoderKt.createJavaMp3DecoderStream(MP3Decoder.kt:16)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream$suspendImpl(MP3Decoder.kt:12)
at com.soywiz.korau.format.mp3.MP3Decoder.decodeStream(MP3Decoder.kt)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormats.decodeStream(AudioFormat.kt:95)
at com.soywiz.korau.format.AudioFormat.decode(AudioFormat.kt:27)
at com.soywiz.korau.sound.impl.jna.JnaOpenALNativeSoundProvider.createSound(JnaSoundProvider.kt:62)
at com.soywiz.korau.sound.NativeSoundProvider.createSound$suspendImpl(NativeSound.kt:48)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:52)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:53)
at com.soywiz.korau.sound.NativeSoundKt.readSound(NativeSound.kt:291)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:288)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:288)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:23)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:32)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2$2.invokeSuspend(Korge.kt:453)
at com.soywiz.korge.Korge$invoke$2$2.invoke(Korge.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:450)
at com.soywiz.korge.Korge$invoke$2.invoke(Korge.kt)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:397)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Korge.kt)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invokeSuspend(Win32GameWindow.kt:436)
at com.soywiz.korgw.win32.Win32GameWindow$loop$2.invoke(Win32GameWindow.kt)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(AsyncExt.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:18)
at com.soywiz.korgw.win32.Win32GameWindow.loop(Win32GameWindow.kt:435)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:396)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:421)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:419)
at MainKt.main(main.kt:10)
at MainKt$$$main.invoke(Unknown Source)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
at MainKt.main(main.kt)
Platform: Windows 10 JVM 17
Reproducibility: 100%
Repo that reproduces the issue: https://github.com/Clintonio/korau-bug-example
Description:
Whenever running the (GUIless) code in the above repository, which runs one piece of music, and then the same sound 100 times, the music will become faster, jitterier, and echoier the more often the other sound is played.
I do not have a video to demonstrate this as I am running Korau in this repository without a GUI and recording just sound from an application is not something I have familiarity with (OBS, perhaps?), but you can clone the repository and run it in under a minute.
I have tried this on one other Windows 10 machine and the issue persists. I have not tested other configurations as I am only targeting this platform at this time.
Reported here: https://soywiz.slack.com/archives/CH2RW1UH5/p1578859800019800
Process: de.tfr.game.hitclack, PID: 26825 java.lang.IllegalStateException: Android context not set! Please call `withAndroidContext()` method in your coroutine body
at com.soywiz.korio.android.KorioAndroidContextKt.androidContext(KorioAndroidContext.kt:24)
at com.soywiz.korio.file.std.ResourcesVfsProviderAndroid$invoke$1.init(VfsAndroid.kt:45)
at com.soywiz.korio.file.Vfs$Proxy.initOnce(Vfs.kt:144)
at com.soywiz.korio.file.Vfs$Proxy.getUnderlyingUnscapedFile(Vfs.kt:135)
at com.soywiz.korio.file.VfsFile.getUnderlyingUnscapedFile(VfsFile.kt:217)
at com.soywiz.korio.file.Vfs$Proxy.getUnderlyingUnscapedFile(Vfs.kt:135)
at com.soywiz.korio.file.VfsFile.getUnderlyingUnscapedFile(VfsFile.kt:217)
at com.soywiz.korau.sound.NativeSoundProvider.createSound(NativeSound.kt:41)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:116)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:116)
at de.tfr.game.SoundMachine.newSound(SoundMachine.kt:18)
at de.tfr.game.SoundMachine.create(SoundMachine.kt:21)
at de.tfr.game.BoxGame.create(BoxGame.kt:30)
at de.tfr.game.HitKlack.create(HitKlack.kt:34)
at MainKt$main$2.invokeSuspend(main.kt:13)
at MainKt$main$2.invoke(Unknown Source:10)
at com.soywiz.korge.Korge$invoke$2$3.invokeSuspend(Korge.kt:464)
at com.soywiz.korge.Korge$invoke$2$3.invoke(Unknown Source:10)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(Unknown Source:10)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launchImmediately(AsyncExt.kt:9)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:463)
at com.soywiz.korge.Korge$invoke$2.invoke(Unknown Source:10)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invokeSuspend(Korge.kt:408)
at com.soywiz.korge.Korge$KoruiWithLogger$2.invoke(Unknown Source:10)
at com.soywiz.korgw.AndroidGameWindow.loop(DefaultGameWindowAndroid.kt:74)
at com.soywiz.korge.Korge.KoruiWithLogger(Korge.kt:407)
at com.soywiz.korge.Korge.invoke-nom0QHw(Korge.kt:432)
at com.soywiz.korge.Korge.invoke-nom0QHw$default(Korge.kt:430)
at MainKt.main(main.kt:10)
at de.tfr.game.hitclack.MainActivity.activityMain(MainActivity.kt:13)
at com.soywiz.korgw.KorgwActivity$onCreate$2$1.invokeSuspend(KorgwActivity.kt:169)
at com.soywiz.korgw.KorgwActivity$onCreate$2$1.invoke(Unknown Source:10)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:154)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at com.soywiz.korgw.KorgwActivity$onCreate$2.invokeSuspend(KorgwActivity.kt:168)
at com.soywiz.korgw.KorgwActivity$onCreate$2.invoke(Unknown Source:10)
at com.soywiz.korio.KorioAndroidKt$Korio$1$1.invokeSuspend(KorioAndroid.kt:8)
at com.soywiz.korio.KorioAndroidKt$Korio$1$1.invoke(Unknown Source:10)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:154)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at com.soywiz.korio.android.KorioAndroidContextKt.withAndroidContext(KorioAndroidContext.kt:19)
at com.soywiz.korio.KorioAndroidKt$Korio$1.invokeSuspend(KorioAndroid.kt:8)
at com.soywiz.korio.KorioAndroidKt$Korio$1.invoke(Unknown Source:10)
at com.soywiz.korio.async.AsyncExtAndroidKt$asyncEntryPoint$1.invokeSuspend(AsyncExtAndroid.kt:7)
at com.soywiz.korio.async.AsyncExtAndroidKt$asyncEntryPoint$1.invoke(Unknown Source:10)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invokeSuspend(AsyncExt.kt:34)
at com.soywiz.korio.async.AsyncExtKt$_launch$1.invoke(Unknown Source:10)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at com.soywiz.korio.async.AsyncExtKt._launch(AsyncExt.kt:32)
at com.soywiz.korio.async.AsyncExtKt.launch(AsyncExt.kt:8)
at com.soywiz.korio.async.AsyncExtAndroidKt.asyncEntryPoint(AsyncExtAndroid.kt:6)
at com.soywiz.korio.KorioAndroidKt.Korio(KorioAndroid.kt:8)
at com.soywiz.korgw.KorgwActivity.onCreate(KorgwActivity.kt:166)
at android.app.Activity.performCreate(Activity.java:7159)
at android.app.Activity.performCreate(Activity.java:7150)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3001)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3156)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:205)
at android.app.ActivityThread.main(ActivityThread.java:6991)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
All KOR libraries
404
Tried to port a pure-java library for MP3, but the quality of the library seems to not be too good and relied on ArrayIndexOutOfBoundsException
and have some output issues. So let's try to restore minimp3 again. Maybe we convert it to pure Kotlin later (without the HEAP and the inline classes, step by step)
Tries to handle issues commented here: #18
The OpenAL framework is deprecated on apple platforms and remains present for compatibility purposes. Transition to AVAudioEngine for spatial audio functionality.
https://developer.apple.com/documentation/avfoundation/avaudioengine
--------- beginning of crash
2020-05-01 18:35:10.603 5538-5617/com.senaptec.senxtoolpt E/AndroidRuntime: FATAL EXCEPTION: Thread-21
Process: com.senaptec.senxtoolpt, PID: 5538
java.lang.IllegalStateException: play() called on uninitialized AudioTrack.
at android.media.AudioTrack.play(AudioTrack.java:1742)
at com.soywiz.korau.sound.AndroidNativeSoundProvider$createAudioStream$1$start$1.invoke(AndroidNativeSoundProvider.kt:66)
at com.soywiz.korau.sound.AndroidNativeSoundProvider$createAudioStream$1$start$1.invoke(AndroidNativeSoundProvider.kt:34)
at com.soywiz.korau.sound.AndroidNativeSoundProvider$MyThread.run(AndroidNativeSoundProvider.kt:22)
2020-05-01 18:35:10.622 5538-5538/com.senaptec.senxtoolpt E/SENBT: Location: true NETWORK: false
Reproduce with this minimal sample:https://github.com/emign/korAuNoSoundSample
Sound does not get played. Neither in JS nor JVM targets.
JVM target does open the korge window but does throw this error:
WARNING. Slower startup: NOT in main thread! Using AWT! (on mac use -XstartOnFirstThread when possible)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.soywiz.korgw.awt.AwtGameWindow$frame$1 (file:/Users/nicolaiemig/Downloads/untitled1/build/libs/untitled1-all-4.10.1.jar) to method sun.java2d.opengl.OGLUtilities.invokeWithOGLContextCurrent(java.awt.Graphics,java.lang.Runnable)
WARNING: Please consider reporting this to the maintainers of com.soywiz.korgw.awt.AwtGameWindow$frame$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Error trying to get URLs from classloader jdk.internal.loader.ClassLoaders$AppClassLoader@55054057
java.lang.reflect.InaccessibleObjectException: Unable to make field final jdk.internal.loader.URLClassPath jdk.internal.loader.ClassLoaders$AppClassLoader.ucp accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @325fbc0c
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:344)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:284)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:170)
at com.soywiz.korio.dynamic.DynamicInternal.tryGetField(DynamicInternal.kt:14)
at com.soywiz.korio.dynamic.DynamicInternal.get(DynamicInternal.kt:64)
at com.soywiz.korio.dynamic.KDynamic.get(KDynamic.kt:42)
at com.soywiz.korio.file.std.LocalVfsJvmKt.tryGetURLs(LocalVfsJvm.kt:50)
at com.soywiz.korio.file.std.ResourcesVfsProviderJvm$invoke$1.init(LocalVfsJvm.kt:81)
at com.soywiz.korio.file.Vfs$Proxy.initOnce(Vfs.kt:144)
at com.soywiz.korio.file.Vfs$Proxy.getUnderlyingUnscapedFile(Vfs.kt:135)
at com.soywiz.korio.file.VfsFile.getUnderlyingUnscapedFile(VfsFile.kt:217)
at com.soywiz.korio.file.Vfs$Proxy.getUnderlyingUnscapedFile(Vfs.kt:135)
at com.soywiz.korio.file.VfsFile.getUnderlyingUnscapedFile(VfsFile.kt:217)
at com.soywiz.korim.format.NativeImageFormatProvider.decode(NativeImageFormatProvider.kt:17)
at com.soywiz.korim.format.NativeImageFormatProvider.decode(NativeImageFormatProvider.kt:23)
at com.soywiz.korim.format.KorioExtKt.readBitmap(KorioExt.kt:102)
at com.soywiz.korim.format.KorioExtKt.readBitmap$default(KorioExt.kt:98)
at MainKt$main$2.invokeSuspend(main.kt:17)
at MainKt$main$2.invoke(main.kt)
at com.soywiz.korge.Korge$invoke$2.invokeSuspend(Korge.kt:459)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at com.soywiz.korgw.GameWindowCoroutineDispatcher.executePending(GameWindow.kt:91)
at com.soywiz.korgw.GameWindow.frame(GameWindow.kt:190)
at com.soywiz.korgw.awt.AwtGameWindow$frame$1$paint$2.run(AwtGameWindow.kt:112)
at java.desktop/sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:231)
at java.base/java.lang.Thread.run(Thread.java:830)
java.util.ServiceConfigurationError: com.soywiz.korau.format.AudioFormat: com.soywiz.korau.format.mp3.MP3Decoder Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1233)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1155)
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1188)
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1179)
at com.soywiz.korau.sound.AwtNativeSoundProviderKt.<clinit>(AwtNativeSoundProvider.kt:19)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:116)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:116)
at MainKt$main$2.invokeSuspend(main.kt:23)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at com.soywiz.korgw.GameWindowCoroutineDispatcher.executePending(GameWindow.kt:91)
at com.soywiz.korgw.GameWindow.frame(GameWindow.kt:190)
at com.soywiz.korgw.awt.AwtGameWindow$frame$1$paint$2.run(AwtGameWindow.kt:112)
at java.desktop/sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:231)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.NoSuchMethodException: com.soywiz.korau.format.mp3.MP3Decoder.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3350)
at java.base/java.lang.Class.getConstructor(Class.java:2152)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:661)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:658)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:669)
... 18 more
Exception in thread "Java2D Queue Flusher" java.util.ServiceConfigurationError: com.soywiz.korau.format.AudioFormat: com.soywiz.korau.format.mp3.MP3Decoder Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1233)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1155)
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1188)
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1179)
at com.soywiz.korau.sound.AwtNativeSoundProviderKt.<clinit>(AwtNativeSoundProvider.kt:19)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound(NativeSound.kt:116)
at com.soywiz.korau.sound.NativeSoundKt.readNativeSound$default(NativeSound.kt:116)
at MainKt$main$2.invokeSuspend(main.kt:23)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at com.soywiz.korgw.GameWindowCoroutineDispatcher.executePending(GameWindow.kt:91)
at com.soywiz.korgw.GameWindow.frame(GameWindow.kt:190)
at com.soywiz.korgw.awt.AwtGameWindow$frame$1$paint$2.run(AwtGameWindow.kt:112)
at java.desktop/sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:231)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.NoSuchMethodException: com.soywiz.korau.format.mp3.MP3Decoder.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3350)
at java.base/java.lang.Class.getConstructor(Class.java:2152)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:661)
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:658)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:669)
... 18 more
The current OpenAL implementation doesn't support audio streaming
This code stops producing sound when the number goes over about 260:
suspend fun main() = Korge {
val flap = resourcesVfs["flap.wav"].readSound()
var times = 0
val text = text("")
addFixedUpdater(50.timesPerSecond) {
flap.play() // Stops working after repeat #260
++times
text.text = times.toString()
}
}
There are no errors logged in console. If sound dies, it can't be played after it at all, even after a big delay.
You can take sound files from this dir: https://github.com/SerVB/korge-zombie-bird/tree/master/src/commonMain/resources . They are short wav files, around 20 KB of size.
I've also made another test: make many sounds but before stopping, lower the frequency. Here are the results:
suspend fun main() = Korge {
val flap = resourcesVfs["flap.wav"].readSound()
var times = 0
val text = text("")
fun play() {
flap.play()
++times
text.text = times.toString()
}
repeat(240) {
play()
delay(20)
}
while (true) {
play()
// delay(110) // stops playing at repeat #290
// delay(113) // stops playing at repeat #300
delay(116) // seems not to die: keeps playing after repeat more than #400
}
}
In JS, this bug is not present. Haven't tested on JVMs of other computers, results can be different there...
Check that this works on all the targets:
AudioTone.generate(1.seconds, 5000.0).toNativeSound().play()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.