Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Peaks Class Reference

Peaks class. More...

#include <Peaks.h>

List of all members.

Public Member Functions

 Peaks (Loader *ld, const track_t itrack, const wxString &name, const ratio_t density)
 Constructor.

 ~Peaks ()
 Destructor.

bool Synchronize (wxWindow *parent)
 Update peaks with visual feedback.

bool GetPeak (const samples_t ppos, const ratio_t density, floatsample_t &peak)
 Get a single peak.


Private Member Functions

bool write_header (const length_t length)
 Write cache file header.

bool check_header (const length_t length)
 Check cache file header.

void not_persistent ()
 Switch off the cache.


Private Attributes

Loaderloader
 Loader.

track_t track
 Subtrack.

bool empty
 Empty flag.

wxFile * peaks
 Peaks persistent file.

ratio_t ratio
 Display ratio.

off_t stamppos
 Position of the stamp in cache file.

off_t datapos
 Position of the first peak in cache file.


Detailed Description

Peaks class.

Peak class is used to quickly access audio track peaks to display the waveform on screen. The class uses memory and disk cache for the peak data and maintains persistent peak file for each track.


Constructor & Destructor Documentation

Peaks::Peaks Loader ld,
const track_t  itrack,
const wxString &  name,
const ratio_t  density
 

Constructor.

Create a peak object from wave data supplied by 'ld' (internal track 'itrack') and store the cache to file 'name' with default zoom ratio 'density'.

Parameters:
ld Loader for getting wave data.
itrack Internal track (for the loader) of the data.
name Filename of the peak file.
density Default zoom ratio.

Peaks::~Peaks  ) 
 

Destructor.

Close peak file and cleanup.


Member Function Documentation

bool Peaks::check_header const length_t  length  )  [private]
 

Check cache file header.

Switch off any peak caching, all peak values are calculated on-the-fly.

bool Peaks::GetPeak const samples_t  ppos,
const ratio_t  density,
floatsample_t peak
 

Get a single peak.

Get a single peak from the cache. If 'density' is any of the zoom ratios precached, then get the peak from the cache, otherwise calculate the peak value on-the-fly.

Parameters:
ppos Position (in peak units).
density Zoom ratio.
peak Output peak.
Returns:
True on success.

void Peaks::not_persistent  )  [private]
 

Switch off the cache.

bool Peaks::Synchronize wxWindow *  parent  ) 
 

Update peaks with visual feedback.

Update the peak cache (peak file) from data from the loader. Give a visual feedback the update process.

Parameters:
parent Parent window.
Returns:
True on success.

bool Peaks::write_header const length_t  length  )  [private]
 

Write cache file header.

Write a header (tag, version, etc.) to the peak file.

Parameters:
length Raw length of the original wave file (as suplied by the loader).
Returns:
True on success.


Member Data Documentation

off_t Peaks::datapos [private]
 

Position of the first peak in cache file.

bool Peaks::empty [private]
 

Empty flag.

Loader* Peaks::loader [private]
 

Loader.

wxFile* Peaks::peaks [private]
 

Peaks persistent file.

ratio_t Peaks::ratio [private]
 

Display ratio.

off_t Peaks::stamppos [private]
 

Position of the stamp in cache file.

track_t Peaks::track [private]
 

Subtrack.


The documentation for this class was generated from the following files:
Generated on Wed Jul 28 17:17:43 2004 for FinalMix by doxygen 1.3.5