Broken - Tutorial: Looping audio using the AudioSampleBuffer class


#1

Hi this is likely something i should contact support about but maybe you the community can help me on that.

Im going through the tutorial:
Tutorial: Looping audio using the AudioSampleBuffer class
https://www.juce.com/doc/tutorial_looping_audio_sample_buffer

my problem is that demo project seems to compile correctly but then breaks when you load a sample ( i did use a short sample and its .wav it should work )

i have wondered why in the source code there is nothing like setAudioChannels(0,2) and i tried it with that without success ( btw changing the channel configuration from (0,1) to (0,2) in the past tutorial fixed a problem in the source code that had the same break occurring )

i have attached a screenshot of the break. i feel like it has something to do with the channel configuration but no success so far.

btw i use windows 10 / visual studio 2015

any help would be appreciated !

best
b.


#2

For what it’s worth: works fine here on my machine (Win7 64-bit, program built with VS2015).
Tried with the 2 samples that come with the .zip file of the tutorial + also some files of my own.

From your screenshot, I would think your audio card couldn’t be initialized with the given number of input and output channels.

PS
A hint to make it easier for other people to help you:
When you post about a crashing bug, please always post a stack trace. It’s the only way to see which code path led to the crash. A view of the relevant variables at that moment can also help.


#3

Hi Koen

thanks for your reply and hint … i am a newbie and these suggestions help !

in vs 2015 i assume the stack trace is the stack callback window ?

this is what it prints:

LoopingAudioSampleBufferTutorial.exe!juce::AudioAppComponent::setAudioChannels(int numInputChannels, int numOutputChannels) Line 39 C++
LoopingAudioSampleBufferTutorial.exe!MainContentComponent::openButtonClicked() Line 121 C++
LoopingAudioSampleBufferTutorial.exe!MainContentComponent::buttonClicked(juce::Button * button) Line 83 C++
LoopingAudioSampleBufferTutorial.exe!juce::ListenerList<juce::Button::Listener,juce::Array<juce::Button::Listener *,juce::DummyCriticalSection,0> >::callChecked<juce::Component::BailOutChecker,juce::Button >(const juce::Component::BailOutChecker & bailOutChecker, void(juce::Button::Listener::)(juce::Button *) callbackFunction, juce::Button * param1) Line 182 C++
LoopingAudioSampleBufferTutorial.exe!juce::Button::sendClickMessage(const juce::ModifierKeys & modifiers) Line 412 C++
LoopingAudioSampleBufferTutorial.exe!juce::Button::internalClickCallback(const juce::ModifierKeys & modifiers) Line 356 C++
LoopingAudioSampleBufferTutorial.exe!juce::Button::mouseUp(const juce::MouseEvent & e) Line 468 C++
LoopingAudioSampleBufferTutorial.exe!juce::Component::internalMouseUp(juce::MouseInputSource source, juce::Point relativePos, juce::Time time, const juce::ModifierKeys oldModifiers) Line 2504 C++
LoopingAudioSampleBufferTutorial.exe!juce::MouseInputSourceInternal::sendMouseUp(juce::Component & comp, juce::Point screenPos, juce::Time time, const juce::ModifierKeys oldMods) Line 150 C++
LoopingAudioSampleBufferTutorial.exe!juce::MouseInputSourceInternal::setButtons(juce::Point screenPos, juce::Time time, const juce::ModifierKeys newButtonState) Line 193 C++
LoopingAudioSampleBufferTutorial.exe!juce::MouseInputSourceInternal::handleEvent(juce::ComponentPeer & newPeer, juce::Point positionWithinPeer, juce::Time time, const juce::ModifierKeys newMods, float newPressure) Line 311 C++
LoopingAudioSampleBufferTutorial.exe!juce::MouseInputSource::handleEvent(juce::ComponentPeer & peer, juce::Point pos, int64 time, juce::ModifierKeys mods, float pressure) Line 582 C++
LoopingAudioSampleBufferTutorial.exe!juce::ComponentPeer::handleMouseEvent(int touchIndex, juce::Point pos, juce::ModifierKeys newMods, float newPressure, int64 time) Line 91 C++
LoopingAudioSampleBufferTutorial.exe!juce::HWNDComponentPeer::doMouseEvent(juce::Point position, float pressure) Line 1676 C++
LoopingAudioSampleBufferTutorial.exe!juce::HWNDComponentPeer::doMouseUp(juce::Point position, const unsigned int wParam) Line 1820 C++
LoopingAudioSampleBufferTutorial.exe!juce::HWNDComponentPeer::peerWindowProc(HWND
* h, unsigned int message, unsigned int wParam, long lParam) Line 2477 C++
LoopingAudioSampleBufferTutorial.exe!juce::HWNDComponentPeer::windowProc(HWND
* h, unsigned int message, unsigned int wParam, long lParam) Line 2401 C++
[External Code]
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
LoopingAudioSampleBufferTutorial.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(bool returnIfNoPendingMessages) Line 147 C++
LoopingAudioSampleBufferTutorial.exe!juce::MessageManager::runDispatchLoop() Line 130 C++
LoopingAudioSampleBufferTutorial.exe!juce::JUCEApplicationBase::main() Line 244 C++
LoopingAudioSampleBufferTutorial.exe!WinMain(HINSTANCE__ * formal, HINSTANCE * __formal, char * __formal, int __formal) Line 101 C++


#4

as to the variable that causes it im not sure how to determine that it does report this error list:

Severity Code Description Project File Line Suppression State
Error (active) name followed by ‘::’ must be a class or namespace name LoopingAudioSampleBufferTutorial c:\Users\Home\JUCE\modules\juce_audio_utils\gui\juce_AudioAppComponent.cpp 25
Error (active) name followed by ‘::’ must be a class or namespace name LoopingAudioSampleBufferTutorial c:\Users\Home\JUCE\modules\juce_audio_utils\gui\juce_AudioAppComponent.cpp 29
Error (active) identifier “audioSourcePlayer” is undefined LoopingAudioSampleBufferTutorial c:\Users\Home\JUCE\modules\juce_audio_utils\gui\juce_AudioAppComponent.cpp 33
Warning C4244 ‘argument’: conversion from ‘juce::int64’ to ‘int’, possible loss of data LoopingAudioSampleBufferTutorial d:\program learning\juce\tutorial_looping_audio_sample_buffer\tutorial_looping_audio_sample_buffer\source\maincomponent.cpp 106
Warning C4244 ‘argument’: conversion from ‘juce::int64’ to ‘int’, possible loss of data LoopingAudioSampleBufferTutorial d:\program learning\juce\tutorial_looping_audio_sample_buffer\tutorial_looping_audio_sample_buffer\source\maincomponent.cpp 112


#5

I know this is an old thread, but it seems like the only one. Have you found an answer?
Even the example code doesn’t seem to be working.


#6

I can only repeat what @KoenT has already mentioned: from the stacktrace it seems that the given number of input/output channels is not supported by your audio hardware/driver. There’s nothing that JUCE can do about this. Try the “audio settings” page in the JUCE demo to figure out which channel/driver combination your hardware supports.


#7

I overlooked that, because of the type of audio card I have. I’m looking at the demo now, and will try and it to the tutorial to see if it changes anything.