Hello Juce team and community. I want to start off by saying thanks to the devs for your work on this software. You guys have probably helped me reduce months of work into what will hopefully result in a functional prototype for my audio app in the next week or so. I’ve only been at the Juce development stage for a few days, and I’m pretty satisfied with the progress I’m making.
Now on to Business:
I’m new to Juce and C++, and I was using some snippets from the “Processing Audio Input” tutorial. In the first line in the body of
getNextAudioBlock(), you guys initialize a pointer to
- It seems when a juce project is executed while the linux jack server is running, there is quite a delay in start up. The audio device pointers seems to be null when the audio app component first calls
getNextAudioBlock(), and this causes a segfault.
device in an if statement, and things were running smoothly. At this point, I can pass an input buffer sample to the
AudioVisualiserComponent and see a waveform, so I’m know I’m getting data through. Great! Now if I start playing around with the input and output channel options produced by
AudioSelectorComponent, I get three problems.
The gui is not responsive after disabling all channels. E.g. after turning off all output channels it becomes difficult to turn them back on.
Toggling the channels on and off inside the project eventually causes a segfault.
Toggling the connections in jack eventually causes the error “AddressSanitizer: heap-use-after-free”
Currently, I’m reading up on c++/juce debugging, coredumps, etc. and trying to figure out how to help you help me now and in the future in you’re so inclined. If it matters, my project deviates from the default due to me adding
-fsanitize=address compiler and linker flags in my linux makefile, and I added the
JUCE_JACK definition to the juce_audio_devices module.
All of this leads to my final questions:
What is the preferred way of showing debug info to you all? I’ve seen valgrind and gdb mentioned.
Should I be guarding every pointer with an if statement before use? The audio processing tutorial didn’t show this idiom, but this seems to be the thing to do in C++.
Are there any general best practices when dealing with audiobuffers, midi buffers, audio devices and gui updating? Now that I’ve gotten this far, I get the feeling I’m going to be running into more memory issues than anything else as I proceed.
I can see from a few gdb sessions that multiple threads are started up when the binary is started. I can imagine there would be some issues between the gui sending messages to turn audio device features on and off, and actual processing of the audio data, but async programming isn’t really my forte, so I’m not sure how to proceed.