I’m a beginner in C++ programming and I’m trying to create a small application able to analyze an audio file such as a .wav or a .mp3, and draw the relative waveform on a PNG file. I’m working with linux on eclipse C++ .
What I’m trying to do is to use the AudioThumbnail class:
AudioThumbnail (const int sourceSamplesPerThumbnailSample, AudioFormatManager &formatManagerToUse, AudioThumbnailCache &cacheToUse)
Creates an audio thumbnail.
From that class i wanna use the functionality to draw the channels:
drawChannel (Graphics &g, int x, int y, int w, int h, double startTimeSeconds, double endTimeSeconds, int channelNum, const float verticalZoomFactor)
Renders the waveform shape for a channel
there i start to get a little bit in troubles because I don’t understand the documentation very good, it’s everything clear more or less but the first parameter I need is a Graphic objet, isn’t it?
The I find that:
- So there I need to create an Image object: but the problem is that I don’t find the way to declare the first parameter of it…
Image (const PixelFormat format, const int imageWidth, const int imageHeight, const bool clearImage)
Creates an in-memory image with a specified size and format.
I tried with something like “PixelFormatRGB”, “juce::PixelRGB”, “PixelformatRGB 3”…I tried everyway but from compiling this always goes to an error, telling me that the first parameter is wrongly declared.
- What imageToDraw stands for?? is it a string for the output filename? or something else?
Does someone know how to do it correclty? or anyway tell me a nice source to learn about how to use this library?