Pablo
01/26/2025, 9:41 PMcommonMain/composeResouces/files/audio.wav
? I tryed with File("files/audio.wav")
and gave me .FileNotFoundException
genovich
01/26/2025, 9:44 PMPablo
01/26/2025, 9:48 PMPablo
01/26/2025, 9:49 PMPablo
01/26/2025, 9:49 PMPablo
01/26/2025, 9:49 PMMichael Paus
01/26/2025, 10:54 PMcommonMain/composeResouces/files/audio.wav
the correct way to read it is Res.readBytes("files/audio.wav")
. I read a config file that way in my projects.genovich
01/26/2025, 10:57 PMFile
API to access you resources. You're assuming that the files are stored "near" your executable, but it is not true and heavily dependent on the platform you're running on.genovich
01/26/2025, 10:58 PMPablo
01/26/2025, 10:58 PMval audioInputStream = AudioSystem.getAudioInputStream(File(sound.path))
val clip: Clip = AudioSystem.getClip()
clip.open(audioInputStream)
clip.start()
Pablo
01/26/2025, 11:00 PMPablo
01/26/2025, 11:01 PMAudioSystem.getAudioInputStream
Michael Paus
01/26/2025, 11:02 PMPablo
01/26/2025, 11:02 PMPablo
01/26/2025, 11:03 PMPablo
01/26/2025, 11:03 PMMichael Paus
01/26/2025, 11:05 PMPablo
01/26/2025, 11:05 PMMichael Paus
01/26/2025, 11:06 PMPablo
01/26/2025, 11:06 PMPablo
01/27/2025, 10:13 AM