jassertfalse hit when JucePlugin_MaxNumInputChannels==0?


#1

Hi,

This happens with latest tip, under Linux, when compiling an audio plugin with the standalone wrapper: stdout is spammed with the message

“JUCE Assertion failure in /home/johannes/code/juce-git/src/audio/dsp/juce_AudioSampleBuffer.cpp, line 82”

Only happens with the Standalone wrapper, not with the VST wrapper.

In my JucePluginCharacteristics.h, JucePlugin_MaxNumInputChannels is #defined as 0, and JucePlugin_IsSynth as 1. When I #define JucePlugin_MaxNumInputChannels 2, problem goes away.

Is it illegal to have zero input channels? I thought it would be logical for a synth. I’m not processing any audio input, only generating output.

Another (unrelated) problem with latest tip is that Linux GUI programs use 100% CPU after a while. There seems to be some kind of short-circuit in message processing. I’ll post about this later when/if I find out more.

I know that Jules is on holiday so I’m not expecting the usual immediate fix :slight_smile:


#2

Have you got a stack trace for that? I can’t see where it might be getting called from…


#3

Stacktrace:

#0 ( 0x0012d422 in __kernel_vsyscall() (??:??) #1 0x55d7a6 kill() (/lib/tls/i686/cmov/libc.so.6:??) #2 0x8074979 AudioSampleBuffer(this=0xb77d4130, dataToReferTo=0x82cead8, numChannels_=0, numSamples=512) (/home/johannes/code/juce-git/src/audio/dsp/juce_AudioSampleBuffer.cpp:82) #3 0x8066d75 AudioFilterStreamer::audioDeviceIOCallback(this=0x82ce880, inputChannelData=0x82cd8d4, totalNumInputChannels=0, outputChannelData=0x82cd6d0, totalNumOutputChannels=2, numSamples=512) (../juce-git/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp:75) #4 0x8070f4b juce::AudioDeviceManager::audioDeviceIOCallbackInt(this=0x82ce678, inputChannelData=0x82cd8d4, numInputChannels=0, outputChannelData=0x82cd6d0, numOutputChannels=2, numSamples=512) (/home/johannes/code/juce-git/src/audio/devices/juce_AudioDeviceManager.cpp:668) #5 0x8071d3f juce::AudioDeviceManager::CallbackHandler::audioDeviceIOCallback(this=0x82ce868, inputChannelData=0x82cd8d4, numInputChannels=0, outputChannelData=0x82cd6d0, numOutputChannels=2, numSamples=512) (/home/johannes/code/juce-git/src/audio/devices/juce_AudioDeviceManager.cpp:901) #6 0x8130303 juce::ALSAThread::run(this=0x82cd510) (/home/johannes/code/juce-git/src/native/linux/juce_linux_Audio.cpp:540) #7 0x8145741 juce::Thread::threadEntryPoint(thread=0x82cd510) (/home/johannes/code/juce-git/src/threads/juce_Thread.cpp:65) #8 0x814587e juce::juce_threadEntryPoint(userData=0x82cd510) (/home/johannes/code/juce-git/src/threads/juce_Thread.cpp:88) #9 0x811ddf5 juce::threadEntryProc(value=0x82cd510) (/home/johannes/code/juce-git/src/native/linux/juce_linux_Threads.cpp:43) #10 0x1b280e start_thread(arg=0xb77d4b70) (pthread_create.c:300) #11 0x5ff8de clone() (../sysdeps/unix/sysv/linux/i386/clone.S:130)


#4

Ok, I see. Well, I guess the simplest approach would just be to tweak this line in AudioFilterStreamer::audioDeviceIOCallback()

const int numInsWanted = jmax (2, filter.getNumInputChannels());


#5

[quote=“jules”]Ok, I see. Well, I guess the simplest approach would just be to tweak this line in AudioFilterStreamer::audioDeviceIOCallback()

const int numInsWanted = jmax (2, filter.getNumInputChannels()); [/quote]

Cool, that fixes it. “jmax(1, filter.getNumInputChannels())” seems to work also…
Does this do any extra work like copying empty input data?


#6

No, it shouldn’t do any significant amount of extra work.


#7

Am I missing something here? When I set the number of audio inputs to 0 in the Plugindemo, there is no output sound! I don’t want any audio inputs into a synth I’m creating.

Well I figured it out. These two lines of code should not be there.

    // In case we have more outputs than inputs, we'll clear any output
    // channels that didn't contain input data, (because these aren't
    // guaranteed to be empty - they may contain garbage).
for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());

OK, what should it have been?