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

Project Class Reference

Project class. More...

#include <Project.h>

List of all members.

Public Member Functions

 Project ()
 Constructor.

 ~Project ()
 Destructor.

bool AddTrack (Loader *ld, const track_t itrack, wxWindow *patent)
 Add a new track to the project.

bool RemoveTrack (const track_t track)
 Remove a track from the project.

track_t NumTracks ()
 Number of tracks.

bool SetMuteTrack (const track_t track, const bool state)
 Set mute flag of a track.

bool GetMuteTrack (const track_t track)
 Get mute flag of a track.

bool SetVolumeTrack (const track_t track, const track_t channel, const volume_t vol)
 Set output channel volume of a track.

volume_t GetVolumeTrack (const track_t track, const track_t channel)
 Get output channel volume of a track.

bool SetSelectionTrack (const track_t track, const samples_t start, const samples_t length)
 Set track selection.

void GetSelectionTrack (const track_t track, samples_t &start, samples_t &length)
 Get track selection.

bool CopySelectionTrack (const track_t track, wxWindow *parent)
 Copy track selection to clipboard.

bool CutSelectionTrack (const track_t track, wxWindow *parent)
 Cut track selection to clipboard.

bool PasteIntoTrack (const track_t track, wxWindow *parent)
 Paste clipboard into a track.

samples_t TrackPeaks (const track_t track)
 Get number of peaks of a track.

floatsample_t GetPeak (const track_t track, const samples_t ppos)
 Get a single peak value of a track.

bool Changed () const
 Is the project changed since last store/load/new.

const wxString * FileName () const
 Filename of the last project store.

void New ()
 Create an empty project.

bool Load (wxFile &file, const wxString filename, Frame *parent)
 Load project from file.

bool Store (wxFile &file, const wxString filename)
 Store project to file.

void Play ()
 Play the project.

void Pause ()
 Pause playback.

void Stop ()
 Stop playback.

void ZoomIn ()
 Zoom waveform visualization in.

void ZoomOut ()
 Zoom waveform visualization out.

samples_t GetCursor () const
 Get current cursor position.

bool SetCursor (samples_t pos)
 Set current cursor position.

samples_t UpdateCursor ()
 Update the cursor during playback.

bool RegisterLoader (Loader *(*reg)())
 Register a loader object.

int NumLoaders () const
 Get number of loaders.

LoaderGetLoader (const int index) const
 Get loader object.

bool RegisterDevice (Device *(*reg)())
 Register a device object.

int NumDevices () const
 Get number of devices.

DeviceGetDevice (const int index) const
 Get device object.

void SetPlayDevice (Device *dev)
 Set playback device.

format_ex_t GetPlayFormat ()
 Get current playback format.

bool Render (Loader *ld, const format_ex_t &fmt, wxWindow *parent)
 Render project.

wxString GetWorkDir ()
 Get working directory.

ratio_t GetInitPeakRatio ()
 Get initial peak ratio.

int GetDefPlayDevice ()
 Get default playback device.

void Configure (wxWindow *parent)
 Open configure dialog.


Private Member Functions

bool check_consistency ()
 Check internal track structures for consistency.

int loader_refcnt (const Loader *ld)
 Number of loader references in all tracks.

samples_t track_length (const track_t track)
 Get track length.

bool copy_selection (const track_t track, wxWindow *parent)
 Copy track selection to clipboard.

void append_clipboard (const track_t track, samples_t &npos, samples_t &nlen)
 Append clipboard to track.

void clean_tracks ()
 Remove all tracks.


Private Attributes

wxFile clipboard
 Clipboard.

Tracks tracks
 Tracks list.

wxMutex track_mutex
 Mutex for accessing track data from multiple threads.

Loaders loaders
 Loaders list.

Devices devices
 Devices list.

PlayCallback pcbk
 Playback callback.

ratio_t pratio
 Peak display ratio.

Devicepdev
 Playback device.

wxString fname
 Last store filename.

bool changed
 Changed since last store/load/new.

bool playing
 Currently playing.

bool paused
 Currently paused.

samples_t scursor
 Starting cursor position.

samples_t cursor
 Cursor position.


Friends

samples_t PlayCallback::OnBuffer (void *buf, const samples_t len, const samples_t pos, const format_ex_t &format)
 Playback Callback can access project's private structures.


Detailed Description

Project class.

Base class of a project. Project contains tracks, cuts, loaders, devices etc.


Constructor & Destructor Documentation

Project::Project  ) 
 

Constructor.

Initializes an empty project with default playback options.

Project::~Project  ) 
 

Destructor.

Stop playback and cleanup.


Member Function Documentation

bool Project::AddTrack Loader ld,
const track_t  itrack,
wxWindow *  parent
 

Add a new track to the project.

Adds new track (via its loader) to the project.

Parameters:
ld Loader to add.
itrack Which subtrack in the loader to use.
parent wxWindow to use for showing visual feedback (progress bars etc.).
Returns:
True on success.

void Project::append_clipboard const track_t  track,
samples_t npos,
samples_t nlen
[private]
 

Append clipboard to track.

Append the contents of the clipboard to the given track.

Parameters:
track Track to append to.
npos Physical position (in samples) of the appended data.
nlen Length (in samples) of the appended data.

bool Project::Changed  )  const
 

Is the project changed since last store/load/new.

Returns:
True if the project is changed since the last load/store/new operation.

bool Project::check_consistency  )  [private]
 

Check internal track structures for consistency.

Iterate throught the internal structures of the project a check for consistency (i.e. the count of tracks equals to the number of allocated tracks, etc.).

Returns:
True if all data structures are consistent.

void Project::clean_tracks  )  [private]
 

Remove all tracks.

Cleanup the project by removing and disposing all tracks.

void Project::Configure wxWindow *  parent  ) 
 

Open configure dialog.

Parameters:
parent Parent window.

bool Project::copy_selection const track_t  track,
wxWindow *  parent
[private]
 

Copy track selection to clipboard.

Parameters:
track Track to copy from.
parent Parent window.
Returns:
True on success.

bool Project::CopySelectionTrack const track_t  track,
wxWindow *  parent
 

Copy track selection to clipboard.

Parameters:
track Track to copy from.
parent Parent window.
Returns:
True on success.

bool Project::CutSelectionTrack const track_t  track,
wxWindow *  parent
 

Cut track selection to clipboard.

Parameters:
track Track to cut from.
parent Parent window.
Returns:
True on success.

const wxString * Project::FileName  )  const
 

Filename of the last project store.

Returns:
Static reference to the filename of the last project store (or NULL) if not yet stored).

samples_t Project::GetCursor  )  const
 

Get current cursor position.

Get current position of the cursor (in peak units).

Returns:
Cursor position.

int Project::GetDefPlayDevice  ) 
 

Get default playback device.

Returns:
Default playback device.

Device * Project::GetDevice const int  index  )  const
 

Get device object.

Get the 'index'-th device from the devices list by calling the register fuction.

Parameters:
index Index of the device in the list.
Returns:
Device object.

ratio_t Project::GetInitPeakRatio  ) 
 

Get initial peak ratio.

Returns:
Initial peak ratio.

Loader * Project::GetLoader const int  index  )  const
 

Get loader object.

Get the 'index'-th loader from the loaders list by calling the register fuction.

Parameters:
index Index of the loader in the list.
Returns:
Loader object.

bool Project::GetMuteTrack const track_t  i  ) 
 

Get mute flag of a track.

Queries the mute or unmute state of a single track.

Parameters:
i Track to query.
Returns:
Mute or unmute state.

floatsample_t Project::GetPeak const track_t  track,
const samples_t  ppos
 

Get a single peak value of a track.

Get the value of a peak in current zoom factor on a given position (in zoomed units) of a track.

Parameters:
track Track to query.
ppos Position of the peak.
Returns:
Peak value.

format_ex_t Project::GetPlayFormat  ) 
 

Get current playback format.

Returns:
Playback format.

void Project::GetSelectionTrack const track_t  track,
samples_t start,
samples_t length
 

Get track selection.

Get the selection range of a track.

Parameters:
track Track to query.
start Beginning of the selection (in peak units).
length Lnegth of the selection (in peak units).

volume_t Project::GetVolumeTrack const track_t  i,
const track_t  channel
 

Get output channel volume of a track.

Get the volume of a given output channel of a track.

Parameters:
i Track to query.
channel Output channel to query.
Returns:
Volume of the channel in the track.

wxString Project::GetWorkDir  ) 
 

Get working directory.

Returns:
Current working directory.

bool Project::Load wxFile &  file,
const wxString  filename,
Frame parent
 

Load project from file.

Create a new project from file. All previous project data is discarted.

Parameters:
file File to load from (from current file offset)
filename Imput file filename.
parent GUI window requesting the load operation (for any visual feedback).

int Project::loader_refcnt const Loader ld  )  [private]
 

Number of loader references in all tracks.

Returns:
Number of tracks which are using the given loader.

void Project::New  ) 
 

Create an empty project.

Create a new empty project. All previous project data is discarted.

int Project::NumDevices  )  const
 

Get number of devices.

Returns:
Number of registered devices.

int Project::NumLoaders  )  const
 

Get number of loaders.

Returns:
Number of registered loaders.

track_t Project::NumTracks  ) 
 

Number of tracks.

Returns:
Number of tracks in project.

bool Project::PasteIntoTrack const track_t  track,
wxWindow *  parent
 

Paste clipboard into a track.

Paste the contents of the clipboard into the given track (at the position of the cursor). All data after the cursor position is shifted forward.

Parameters:
track Track to paste into.
parent Parent window.
Returns:
True on success.

void Project::Pause  ) 
 

Pause playback.

Pause or resume playback.

void Project::Play  ) 
 

Play the project.

Start playback.

bool Project::RegisterDevice Device *(*  reg)()  ) 
 

Register a device object.

Append a device object (its registration function) to the devices list.

Parameters:
reg Device registration function.
Returns:
True on success.

bool Project::RegisterLoader Loader *(*  reg)()  ) 
 

Register a loader object.

Append a loader object (its registration function) to the loaders list.

Parameters:
reg Loader registration function.
Returns:
True on success.

bool Project::RemoveTrack const track_t  track  ) 
 

Remove a track from the project.

Parameters:
track Track to remove.

bool Project::Render Loader ld,
const format_ex_t fmt,
wxWindow *  parent
 

Render project.

Render (mix) the whole project to a file.

Parameters:
ld Loader used to store the output.
fmt Format of the output.
parent Parent window.
Returns:
True on success.

bool Project::SetCursor samples_t  pos  ) 
 

Set current cursor position.

Change the cursor position (by user click, etc.).

Parameters:
pos New cursor position.
Returns:
True if the position was affected.

bool Project::SetMuteTrack const track_t  i,
const bool  state
 

Set mute flag of a track.

Mutes or unmutes a single track.

Parameters:
i Track to change flag to.
state Mute/unmute.
Returns:
True on success.

void Project::SetPlayDevice Device dev  ) 
 

Set playback device.

Set the playback device of the project. Any previously chosen device is shut down.

Parameters:
dev Device to choose.

bool Project::SetSelectionTrack const track_t  track,
const samples_t  start,
const samples_t  length
 

Set track selection.

Set the selection range of a track.

Parameters:
track Track to change the selection for.
start Beginning of the selection (in peak units).
length Lnegth of the selection (in peak units).

bool Project::SetVolumeTrack const track_t  i,
const track_t  channel,
const volume_t  vol
 

Set output channel volume of a track.

Change the volume of a given output channel of a track.

Parameters:
i Track to change volume to.
channel Output channel to change volume to.
vol Desired volume.
Returns:
True on success.

void Project::Stop  ) 
 

Stop playback.

Stop playback.

bool Project::Store wxFile &  file,
const wxString  filename
 

Store project to file.

Store the current project data to file and reset the changed flag.

Parameters:
file File to store to (from current file offset)
filename Output file filename.

samples_t Project::track_length const track_t  track  )  [private]
 

Get track length.

Returns:
Length of a given track (in samples).

samples_t Project::TrackPeaks const track_t  track  ) 
 

Get number of peaks of a track.

Get the number of peaks which represent the waveform of a track in current zoom factor.

Parameters:
track Track to query.
Returns:
Number of peaks.

samples_t Project::UpdateCursor  ) 
 

Update the cursor during playback.

Update the cursor position from the current position of the playback device.

Returns:
Updated cursor position.

void Project::ZoomIn  ) 
 

Zoom waveform visualization in.

Divide the zoom factor by 2, thus zoom the project in (each peak will represent less wave samples).

void Project::ZoomOut  ) 
 

Zoom waveform visualization out.

Multiply the zoom factor by 2, thus zoom the project out (each peak will represent more wave samples).


Friends And Related Function Documentation

samples_t PlayCallback::OnBuffer void *  buf,
const samples_t  len,
const samples_t  pos,
const format_ex_t format
[friend]
 

Playback Callback can access project's private structures.


Member Data Documentation

bool Project::changed [private]
 

Changed since last store/load/new.

wxFile Project::clipboard [private]
 

Clipboard.

samples_t Project::cursor [private]
 

Cursor position.

Devices Project::devices [private]
 

Devices list.

wxString Project::fname [private]
 

Last store filename.

Loaders Project::loaders [private]
 

Loaders list.

bool Project::paused [private]
 

Currently paused.

PlayCallback Project::pcbk [private]
 

Playback callback.

Device* Project::pdev [private]
 

Playback device.

bool Project::playing [private]
 

Currently playing.

ratio_t Project::pratio [private]
 

Peak display ratio.

samples_t Project::scursor [private]
 

Starting cursor position.

wxMutex Project::track_mutex [private]
 

Mutex for accessing track data from multiple threads.

Tracks Project::tracks [private]
 

Tracks list.


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