diff options
Diffstat (limited to 'src/lib/hd24transferengine.h')
-rw-r--r-- | src/lib/hd24transferengine.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/src/lib/hd24transferengine.h b/src/lib/hd24transferengine.h new file mode 100644 index 0000000..03d8392 --- /dev/null +++ b/src/lib/hd24transferengine.h | |||
@@ -0,0 +1,188 @@ | |||
1 | #ifndef __hd24transferengine_h__ | ||
2 | #define __hd24transferengine_h__ | ||
3 | |||
4 | class MixerControl; | ||
5 | |||
6 | #include <config.h> | ||
7 | #include <hd24fs.h> | ||
8 | #include <hd24sndfile.h> | ||
9 | #include <ui_mixer.h> | ||
10 | #include <smpte.h> | ||
11 | class hd24transferjob | ||
12 | { | ||
13 | friend class hd24transferengine; | ||
14 | private: | ||
15 | long long llsizelimit; /* to hold max filesize for autosplit */ | ||
16 | int mixleft; | ||
17 | int mixright; | ||
18 | int m_selectedformat; | ||
19 | hd24fs* jobsourcefs; | ||
20 | hd24song* jobsourcesong; | ||
21 | hd24fs* jobtargetfs; | ||
22 | hd24song* jobtargetsong; | ||
23 | __uint32 m_startoffset; | ||
24 | __uint32 m_endoffset; | ||
25 | SNDFILE* filehandle[24]; /* todo: implement as hd24sndfile* */ | ||
26 | char* filepath[24]; /* one full file path/name per track | ||
27 | mainly to be used for export to hd24 */ | ||
28 | bool have_smpte; | ||
29 | int m_trackaction[24]; | ||
30 | SMPTEgenerator* smptegen; | ||
31 | public: | ||
32 | |||
33 | string* m_projectdir; | ||
34 | int usecustomrate; // 1 to stamp export with custom sample rate | ||
35 | // 0 to keep song sample rate | ||
36 | __uint32 stamprate; //sample rate to use if usecustomrate==1 | ||
37 | int wantsplit; | ||
38 | int* trackselected; | ||
39 | hd24transferjob(); | ||
40 | ~hd24transferjob(); | ||
41 | void init_vars(); | ||
42 | |||
43 | void sizelimit(__sint64 llsizelimit); | ||
44 | __sint64 sizelimit(); | ||
45 | |||
46 | __uint32 startoffset(); | ||
47 | __uint32 endoffset(); | ||
48 | void startoffset(__uint32 newoff); | ||
49 | void endoffset(__uint32 newoff); | ||
50 | |||
51 | void projectdir(const char* projectdir); | ||
52 | const char* projectdir(); | ||
53 | void selectedformat(int format); | ||
54 | int selectedformat(); | ||
55 | hd24fs* sourcefs(); | ||
56 | hd24fs* targetfs(); | ||
57 | hd24song* sourcesong(); | ||
58 | hd24song* targetsong(); | ||
59 | void sourcefs(hd24fs* fs); | ||
60 | void targetfs(hd24fs* fs); | ||
61 | void sourcesong(hd24song* song); | ||
62 | void targetsong(hd24song* song); | ||
63 | char* sourcefilename(int base1tracknum); | ||
64 | void sourcefilename(int base1tracknum,const char* name); | ||
65 | void trackaction(int base1tracknum,int action); | ||
66 | int trackaction(int base1tracknum); | ||
67 | }; | ||
68 | |||
69 | class hd24transferengine | ||
70 | { | ||
71 | private: | ||
72 | void* ui; | ||
73 | |||
74 | MixerControl* transfermixer; | ||
75 | hd24transferjob* job; | ||
76 | |||
77 | __uint32 songnum; | ||
78 | __uint32 totsongs; | ||
79 | __sint64 totbytestotransfer; | ||
80 | __sint64 totbytestransferred; | ||
81 | |||
82 | int prefix; | ||
83 | int transfer_cancel; | ||
84 | int trackspergroup; | ||
85 | int* audiobuf[24]; /* for libsndfile int reading from file */ | ||
86 | bool isfirstchanofgroup[24]; /* for exporting stereo pairs/groups of channels */ | ||
87 | bool islastchanofgroup[24]; /* for exporting stereo pairs/groups of channels */ | ||
88 | |||
89 | void setstatus(void* ui,string* message,double percent); | ||
90 | |||
91 | void openbuffers(unsigned char** audiobuf,unsigned int channels,unsigned int bufsize); | ||
92 | void closebuffers(unsigned char** audiobuf,unsigned int channels); | ||
93 | void writerawbuf(hd24sndfile* filehandle,unsigned char* buf,long subblockbytes); | ||
94 | void flushbuffer(hd24sndfile** filehandle,unsigned char** buffer,__uint32 flushbytes,unsigned int channels); | ||
95 | |||
96 | |||
97 | bool overwritegivesproblems(hd24song* thesong,int partnum); | ||
98 | bool confirmfileoverwrite(); // perform interactive/GUI callback | ||
99 | // to confirm if file overwriting is OK | ||
100 | bool anyfilesexist(hd24song* thesong); | ||
101 | void transfer_in_progress(bool active); | ||
102 | |||
103 | time_t starttime; // these are for benchmarking the transfer | ||
104 | time_t endtime; | ||
105 | |||
106 | /* Regarding populating list of supported file formats | ||
107 | TODO: Move to a separate class? | ||
108 | */ | ||
109 | int formatcount; | ||
110 | void populate_formatlist(); | ||
111 | vector<string>* m_format_outputextension; | ||
112 | vector<string>* m_format_shortdesc; | ||
113 | int m_format_outputformat[100]; | ||
114 | int m_format_outputchannels[100]; | ||
115 | int m_format_bitdepth[100]; | ||
116 | bool m_format_sndfile[100]; | ||
117 | string* m_lasterror; | ||
118 | |||
119 | public: | ||
120 | SoundFileWrapper* soundfile; | ||
121 | bool (*uiconfirmfunction)(void* ui,const char*); | ||
122 | void (*setstatusfunction)(void* ui,const char*,double progress_pct); | ||
123 | |||
124 | void set_ui(void* p_ui); | ||
125 | |||
126 | hd24transferengine(); | ||
127 | ~hd24transferengine(); | ||
128 | |||
129 | void mixer(MixerControl* m_mixer); | ||
130 | MixerControl* mixer(); | ||
131 | |||
132 | void lasterror(const char* errormessage); | ||
133 | string* lasterror(); | ||
134 | |||
135 | int supportedformatcount(); | ||
136 | int format_outputchannels(int i); | ||
137 | const char* getformatdesc(int formatnum); | ||
138 | |||
139 | void trackselected(__uint32 base0tracknum,bool select); | ||
140 | bool trackselected(__uint32 base0tracknum); | ||
141 | |||
142 | void mixleft(bool select); | ||
143 | bool mixleft(); | ||
144 | void mixright(bool select); | ||
145 | bool mixright(); | ||
146 | |||
147 | void init_vars(); | ||
148 | void prepare_transfer_to_pc( | ||
149 | __uint32 songnum, __uint32 totsongs, | ||
150 | __sint64 totbytestotransfer, | ||
151 | __sint64 totbytestransferred, | ||
152 | int wantsplit,__uint32 prefix); | ||
153 | |||
154 | __sint64 transfer_to_pc(); | ||
155 | __sint64 transfer_to_hd24(); | ||
156 | |||
157 | bool openinputfiles(SNDFILE** filehandle,SF_INFO* sfinfoin,unsigned int channels); | ||
158 | void closeinputfiles(SNDFILE** filehandle,unsigned int channels); | ||
159 | bool dontopenoutputfiles(hd24sndfile** filehandle,unsigned int channels,unsigned int partnum,int prefix); //HACK | ||
160 | |||
161 | bool openoutputfiles(hd24sndfile** filehandle,unsigned int channels,unsigned int partnum,int prefix); | ||
162 | void closeoutputfiles(hd24sndfile** filehandle,unsigned int channels); | ||
163 | string* generate_filename(int tracknum,int partnum,int prefix); | ||
164 | void sizelimit(__sint64 llsizelimit); | ||
165 | __sint64 sizelimit(); | ||
166 | void projectdir(const char* projectdir); | ||
167 | const char* projectdir(); | ||
168 | |||
169 | void selectedformat(int format); | ||
170 | int selectedformat(); | ||
171 | |||
172 | void sourcesong(hd24song* newsong); | ||
173 | hd24song* sourcesong(); | ||
174 | void targetsong(hd24song* newsong); | ||
175 | hd24song* targetsong(); | ||
176 | |||
177 | __uint32 startoffset(); | ||
178 | __uint32 endoffset(); | ||
179 | void startoffset(__uint32 newoff); | ||
180 | void endoffset(__uint32 newoff); | ||
181 | char* sourcefilename(int base1tracknum); | ||
182 | void sourcefilename(int base1tracknum,const char* name); | ||
183 | void trackaction(int base1tracknum,int action); | ||
184 | int trackaction(int base1tracknum); | ||
185 | |||
186 | }; | ||
187 | |||
188 | #endif | ||