Skip to content

Starting a Synthesizer with Port Audio and a device input count of greater then two crashes #89

@lukasroberts

Description

@lukasroberts

When starting the synthesizer engine with a count of devices greater than two utilising the PortAudio bindings the library just crashes. It does work when just specifying the number of device inputs to two.

I am trying this on a Mac (10.15.6) with the JNIlibs properly linked.

Also to add the output from the logs of the JSyn lib:
Audio input from Rane Seventy-Two Audio - Core Audio JPortAudio: 64-bit requestedFramesPerBuffer = 128, coreAudioBufferSizeFrames = 384 ringBufferSize after = 2048

^^ The above shows that it's initialising the device, and then allocating the ringBufferSize, however then it appears lower down in src/hostapi/coreaudio/pa_mac_core_blocking.c, it doesn't like that size as from initializeBlioRingBuffers it get's a SIGABRT

All I'm trying to achieve is getting specific inputs for two specific line ins for a soundcard (a bit like the DualOscilloscope example ) However, I'm having absolutely no luck.

Here is the output I'm getting as a general crash for the system:

System Integrity Protection: enabled Crashed Thread: 37 Java: DefaultDispatcher-worker-1 @coroutine#130
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0x8:

__TEXT 00000001041fe000-00000001041ff000 [ 4K] r-x/rwx SM=COW /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java

Application Specific Information:
Assertion failed: (!err), function initializeBlioRingBuffers, file /Users/phil/Work/portaudio/pav19/build/macosx/MacPA/MacPA/../../../../src/hostapi/coreaudio/pa_mac_core_blocking.c, line 177.

Here is the code:
fun simpleLineInExample(){ val lineIn: LineIn val lineOut: LineOut

        // Create a context for the synthesizer.

        // Create a context for the synthesizer.
        val synth = JSyn.createSynthesizer()
        // Add an audio input.
        synth.add(LineIn().also { lineIn = it })
        // Add an audio output.
        synth.add(LineOut().also { lineOut = it })
        // Connect the input to the output.
        lineIn.output.connect(0, lineOut.input, 0)
        lineIn.output.connect(1, lineOut.input, 1)

        // Both stereo.

        // Both stereo.
        val numInputChannels = 14 // (I know the soundcard has this many, but I could get it from device info)
        val numOutputChannels = 2
        synth.stop()
        synth.start(
            44100, AudioDeviceManager.USE_DEFAULT_DEVICE, numInputChannels,
            AudioDeviceManager.USE_DEFAULT_DEVICE, numOutputChannels
        )

        // We only need to start the LineOut. It will pull data from the LineIn.
        lineOut.start()
        // Sleep a while.
        try {
            val time = synth.currentTime
            // Sleep for a few seconds.
            synth.sleepUntil(time + 8.0)
        } catch (e: InterruptedException) {
            e.printStackTrace()
        }
        // Stop everything.
        synth.stop()
    }`

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions