Hi, I just updated to Processing 4 and found the sound library stopped working with Python Mode. The Java mode worked fine. Any help is much appreciated.
add_library("sound")
sf = None
def setup():
global sf
sf = SoundFile(this, "boxiddngbell.mp3")
sf.play()
Processing showed a ClassCastException as follows:
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)
at jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315)
at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164)
at jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140)
at jycessing.LibraryImporter$1.call(LibraryImporter.java:82)
at org.python.core.PyObject.call(PyObject.java:480)
at org.python.core.PyObject.call(PyObject.java:484)
at org.python.pycode._pyx141.f$0(sketch_230215b.pyde:4)
at org.python.pycode._pyx141.call_function(sketch_230215b.pyde)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.Py.exec(Py.java:1658)
at org.python.pycode._pyx140.f$0(/Users/rguo/Documents/Processing/sketch_230215b/sketch_230215b.pyde:96)
at org.python.pycode._pyx140.call_function(/Users/rguo/Documents/Processing/sketch_230215b/sketch_230215b.pyde)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.Py.exec(Py.java:1658)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)
at jycessing.PAppletJythonDriver.processSketch(PAppletJythonDriver.java:233)
at jycessing.PAppletJythonDriver.findSketchMethods(PAppletJythonDriver.java:613)
at jycessing.Runner.runSketchBlocking(Runner.java:399)
at jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:112)
at java.base/java.lang.Thread.run(Thread.java:833)
Hmm. Can’t load native code to bring window to front using the absolute path: /Users/rguo/Documents/Processing/modes/PythonMode/mode/libjniosx.dylib.
Hmm. Can’t load native code to bring window to front.