21 #include "hx3d/audio/display/waveform.hpp" 23 #include "hx3d/math/interpolation.hpp" 24 #include "hx3d/utils/log.hpp" 31 Waveform::~Waveform() {}
47 int step = length / w;
49 for (
int i = 1; i < w - 1; ++i) {
50 int amp = stream[i * step];
54 float normalized_amp = (1.f/32767.f) * amp;
55 normalized_amp = 0.5f + normalized_amp / 2;
62 y_pos = (h/2.f) - (normalized_amp * (h/2.f));
63 bar_h = (normalized_amp * (h/2.f)) * 2;
void update(float delta)
Update the timer.
void reset()
Reset the timer.
void drawBorders()
Draw white borders.
void setRect(unsigned int x, unsigned int y, unsigned int w, unsigned int h, Color color)
Set a rectangle with a color.
Four [0..255] components defined color.
unsigned int getHeight()
Get the image height.
bool hasEnded()
Test if the timer has ended.
T interpolate(T a, T b, float t, Interpolation type)
Interpolate between two values.
void updateTextureZone(unsigned int x, unsigned int y, unsigned int w, unsigned int h)
Update an existing texture zone.
Timer _timer
Refresh timer.
unsigned int getWidth()
Get the image width.
graphics::Image _image
Drawing image.
bool _initialized
Is the display initialized ?