com.badlogic.gdx.audio.Sound doesn't work on ios-moe

Hii,

The application crash when I set the volume of the sound, it happens only at iOS-moe, and it is working find on other OS. Appreciate if anyone could advise…

*** Terminating app due to uncaught exception ‘java.lang.ClassCastException’, reason: 'java.lang.ClassCastException: apple.NSObject cannot be cast to com.badlogic.gdx.backends.iosmoe.objectal.ALSource
at com.badlogic.gdx.backends.iosmoe.IOSSound.getSoundSource(IOSSound.java:159)
at com.badlogic.gdx.backends.iosmoe.IOSSound.setVolume(IOSSound.java:118)

*** snippet:
sound.setVolume(ID.SOUND.ordinal(), 0.0f);

Best regards,
mc

Hi!

Which libgdx version did you use?
I tried with libgdx 1.9.7-SNAPSHOT version, this code and worked fine :

        FileHandle fh = Gdx.files.internal("alarm.mp3");
        IOSSound iosSound = new IOSSound(fh);
        long id = iosSound.play();
        iosSound.setVolume(id, 0.0f);

Best regards,
Roland

Hi Roland,

Ahh, I am using gdxVersion 1.9.5… However, added a try / catch resolved the problem. Anyway, thanks and I will update to 1.9.7-SNAPSHOT.

Best regards,
mc