I’m building an application using JUCE + tracktion and first of all let me thank the people that have been developing these libraries because they are awesome. Would be nice to have more docs for tracktion but the examples are nice and well, I hope I’ll get answers in the forum
Much like the playback example, my app has an audio track that loads a file to be played in loop. I’d like to display an audio meter for the track. I use the following code from examples to load the audio file and place it in track #0
auto f = File::createTempFile ("tambourine.wav"); f.replaceWithData (BinaryData::tambourine_wav, BinaryData::tambourine_wavSize); auto clip = EngineHelpers::loadAudioFileAsClip (edit, f); EngineHelpers::loopAroundClip(*clip);
Then elsewhere in the application I set a timer at a rate of 15hz which runs a callback that will collect the level for the track and store it somewhere so I can show it in GUI. I saw the
getLevelMeterPlugin method from
AudioTrack, so I guessed all audio tracks are created with a number of basic plugins (including the level meter) to facilitate these things. I have the following code run in my timer callback:
track = EngineHelpers::getOrInsertAudioTrackAt (edit, 0); std::cout << track->getLevelMeterPlugin()->measurer.getLevelCache() << std::endl;
But this is always printing -100 on the console, which seems to be the default value (even if can hear the audio is playing). I guessed the
getLevelCache() would be the function to use but again there’s almost no documentation so I’m not sure. Maybe I need to initialise the plugin somehow or tell it to be “active” but I’m not sure how to continue.
Any help will be much appreciated. Thanks!