| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 |
/*!******************************************************************** |
| 3 |
|
| 4 |
Audacity: A Digital Audio Editor |
| 5 |
|
| 6 |
WaveData.h |
| 7 |
|
| 8 |
Dmitry Vedenko |
| 9 |
|
| 10 |
**********************************************************************/ |
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <vector> |
| 14 |
|
| 15 |
#include "PixelSampleMapper.h" |
| 16 |
|
| 17 |
//! Data for sample blocks related to the column |
| 18 |
struct WAVE_TRACK_PAINT_API WaveDisplayColumn final |
| 19 |
{ |
| 20 |
float min; |
| 21 |
float max; |
| 22 |
float rms; |
| 23 |
}; |
| 24 |
|
| 25 |
//! A bundle of data needed for drawing waveforms. The object may or may not |
| 26 |
//! own the storage for those arrays. If it does, it destroys them. |
| 27 |
class WAVE_TRACK_PAINT_API WaveformDisplay final |
| 28 |
{ |
| 29 |
public: |
| 30 |
int width { 0 }; |
| 31 |
|
| 32 |
WaveDisplayColumn* columns { nullptr }; |
| 33 |
PixelSampleMapper mapper; |
| 34 |
|
| 35 |
void |
| 36 |
AppendColumns(const WaveDisplayColumn* begin, const WaveDisplayColumn* end); |
| 37 |
|
| 38 |
private: |
| 39 |
std::vector<WaveDisplayColumn> ownColums; |
| 40 |
|
| 41 |
public: |
| 42 |
WaveformDisplay(int w); |
| 43 |
|
| 44 |
// Create "own" arrays. |
| 45 |
void Allocate(); |
| 46 |
|
| 47 |
~WaveformDisplay(); |
| 48 |
}; |