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

Project.h

Go to the documentation of this file.
00001 /***********************************************************************
00002 
00003   FinalMix: Project.h
00004   by Martin Decky
00005   
00006   Redistribution of this file is permitted under the GNU Public License.
00007 
00008   0.9.2     Managing project
00009   0.9.3     Cleanup
00010   0.9.5     Documentation
00011 
00012 **********************************************************************/
00013 
00014 
00015 #ifndef _FM_PROJECT_H_
00016 #define _FM_PROJECT_H_
00017 
00018 
00019 #include "generic.h"
00020 #include "Peaks.h"
00021 #include "Loaders.h"
00022 #include "Devices.h"
00023 #include "Frame.h"
00024 #include <wx/wx.h>
00025 #include <wx/list.h>
00026 #include <wx/thread.h>
00027 #include <wx/file.h>
00028 
00029 
00033 typedef struct {
00034     samples_t start; 
00035     samples_t len;   
00036 } mapping_t;
00037 
00038 
00042 WX_DECLARE_LIST(mapping_t, Mappings);
00043 
00044 
00048 WX_DECLARE_LIST(volume_t, Volumes);
00049 
00050 
00054 typedef struct {
00055     Loader * loader;     
00056     track_t itrack;      
00057     Peaks * peaks;       
00058     format_t format;     
00059     bool mute;           
00060     Volumes volume;      
00061     Mappings mapping;    
00062     samples_t selstart;  
00063     samples_t sellength; 
00064 } track_desc_t;
00065 
00066 
00070 WX_DECLARE_LIST(track_desc_t, Tracks);
00071 
00072 
00076 typedef struct {
00077     Loader * ( * reg)(); 
00078     int tag;             
00079 } loader_t;
00080 
00081 
00085 WX_DECLARE_LIST(loader_t, Loaders);
00086 
00087 
00091 typedef struct {
00092     Device * ( * reg)(); 
00093     int tag;             
00094 } device_t;
00095 
00096 
00100 WX_DECLARE_LIST(device_t, Devices);
00101 
00102 
00109 class PlayCallback : public DeviceCallback {
00110     public:
00111         virtual samples_t OnBuffer(void * buf, const samples_t len, const samples_t pos, const format_ex_t & format); 
00112 };
00113 
00114 
00120 class Project {
00121     public:
00122         Project();  
00123         ~Project(); 
00125         bool AddTrack(Loader * ld, const track_t itrack, wxWindow * patent); 
00126         bool RemoveTrack(const track_t track);                               
00127         track_t NumTracks();                                                 
00129         bool SetMuteTrack(const track_t track, const bool state); 
00130         bool GetMuteTrack(const track_t track);                   
00132         bool SetVolumeTrack(const track_t track, const track_t channel, const volume_t vol); 
00133         volume_t GetVolumeTrack(const track_t track, const track_t channel);                 
00135         bool SetSelectionTrack(const track_t track, const samples_t start, const samples_t length); 
00136         void GetSelectionTrack(const track_t track, samples_t & start, samples_t & length);         
00137         bool CopySelectionTrack(const track_t track, wxWindow * parent); 
00138         bool CutSelectionTrack(const track_t track, wxWindow * parent);  
00139         bool PasteIntoTrack(const track_t track, wxWindow * parent);     
00141         samples_t TrackPeaks(const track_t track);                        
00142         floatsample_t GetPeak(const track_t track, const samples_t ppos); 
00144         bool Changed() const;                                              
00145         const wxString * FileName() const;                                 
00146         void New();                                                        
00147         bool Load(wxFile & file, const wxString filename, Frame * parent); 
00148         bool Store(wxFile & file, const wxString filename);                
00150         void Play();  
00151         void Pause(); 
00152         void Stop();  
00154         void ZoomIn();  
00155         void ZoomOut(); 
00157         samples_t GetCursor() const;   
00158         bool SetCursor(samples_t pos); 
00159         samples_t UpdateCursor();      
00161         bool RegisterLoader(Loader * ( * reg)());  
00162         int NumLoaders() const;                    
00163         Loader * GetLoader(const int index) const; 
00165         bool RegisterDevice(Device * ( * reg)());  
00166         int NumDevices() const;                    
00167         Device * GetDevice(const int index) const; 
00169         void SetPlayDevice(Device * dev);                                     
00170         format_ex_t GetPlayFormat();                                          
00171         bool Render(Loader * ld, const format_ex_t & fmt, wxWindow * parent); 
00173         wxString GetWorkDir();             
00174         ratio_t GetInitPeakRatio();        
00175         int GetDefPlayDevice();            
00176         void Configure(wxWindow * parent); 
00178         friend samples_t PlayCallback::OnBuffer(void * buf, const samples_t len, const samples_t pos, const format_ex_t & format);  
00179     private:
00180         bool check_consistency();                                                       
00181         int loader_refcnt(const Loader * ld);                                           
00182         samples_t track_length(const track_t track);                                    
00183         bool copy_selection(const track_t track, wxWindow * parent);                    
00184         void append_clipboard(const track_t track, samples_t & npos, samples_t & nlen); 
00185         void clean_tracks();                                                            
00187         wxFile clipboard; 
00189         Tracks tracks;       
00190         wxMutex track_mutex; 
00191         Loaders loaders;     
00192         Devices devices;     
00194         PlayCallback pcbk; 
00196         ratio_t pratio; 
00198         Device * pdev; 
00200         wxString fname;    
00201         bool changed;      
00202         bool playing;      
00203         bool paused;       
00204         samples_t scursor; 
00205         samples_t cursor;  
00206 };
00207 
00208 #endif

Generated on Wed Jul 28 17:17:42 2004 for FinalMix by doxygen 1.3.5