1 |
|
---|
2 | /*
|
---|
3 | * This file was generated by the SOM Compiler.
|
---|
4 | * Generated using:
|
---|
5 | * SOM incremental update: 2.47
|
---|
6 | */
|
---|
7 |
|
---|
8 |
|
---|
9 | /*
|
---|
10 | * (C) Chris Wohlgemuth 2002-2004
|
---|
11 | *
|
---|
12 | */
|
---|
13 | /*
|
---|
14 | * This program is free software; you can redistribute it and/or modify
|
---|
15 | * it under the terms of the GNU General Public License as published by
|
---|
16 | * the Free Software Foundation; either version 2, or (at your option)
|
---|
17 | * any later version.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful,
|
---|
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
22 | * GNU General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; see the file COPYING. If not, write to
|
---|
26 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
27 | */
|
---|
28 | /*
|
---|
29 | * If you need another license for your project/product contact me at
|
---|
30 | *
|
---|
31 | * http://www.os2world.com/cdwriting
|
---|
32 | * http://www.geocities.com/SiliconValley/Sector/5785/
|
---|
33 | */
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * This file was generated by the SOM Compiler and Emitter Framework.
|
---|
37 | * Generated using:
|
---|
38 | * SOM Emitter emitctm: 2.42
|
---|
39 | */
|
---|
40 |
|
---|
41 | #ifndef SOM_Module_cwmp3_Source
|
---|
42 | #define SOM_Module_cwmp3_Source
|
---|
43 | #endif
|
---|
44 | #define CWMP3_Class_Source
|
---|
45 | #define M_CWMP3_Class_Source
|
---|
46 |
|
---|
47 |
|
---|
48 | #define INCL_PM
|
---|
49 | #define INCL_DOS
|
---|
50 | #define INCL_DOSERRORS
|
---|
51 |
|
---|
52 | #include "os2.h"
|
---|
53 | #include <stdio.h>
|
---|
54 | #include <wpdisk.h>
|
---|
55 | #include "cwaudio.h"
|
---|
56 | #include "cwaudio.h"
|
---|
57 | #include "cwmp3.ih"
|
---|
58 |
|
---|
59 | #include "cwaudioinc.h"
|
---|
60 | #include "sys_funcs.h"
|
---|
61 |
|
---|
62 | #define ID3TAGVALUE_BUFFER_SIZE 31
|
---|
63 |
|
---|
64 | extern char classDLLPath[CCHMAXPATH];
|
---|
65 |
|
---|
66 | int iGenreLast=191;
|
---|
67 | char *genreList[]={
|
---|
68 | "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
|
---|
69 | "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies",
|
---|
70 | "Other", "Pop", "R&B", "Rap", "Reggae", "Rock",
|
---|
71 | "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks",
|
---|
72 | "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
|
---|
73 | "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House",
|
---|
74 | "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass",
|
---|
75 | "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock",
|
---|
76 | "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk",
|
---|
77 | "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
|
---|
78 | "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
|
---|
79 | "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
|
---|
80 | "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical",
|
---|
81 | "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing",
|
---|
82 | "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
|
---|
83 | "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band",
|
---|
84 | "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson",
|
---|
85 | "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
|
---|
86 | "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
|
---|
87 | "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
|
---|
88 | "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall",
|
---|
89 | "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
|
---|
90 | "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat",
|
---|
91 | "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
|
---|
92 | "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
|
---|
93 | "SynthPop", "Christmas", "Art rock", "Baroque", "Bhangra", "Big beat", "Breakbeat",
|
---|
94 | "Chillout", "Downtempo", "Dub", "EBM", "Eclectic", "Electro", "Electroclash", "Emo",
|
---|
95 | "Experimental", "Garage", "Global", "IDM", "Illbient", "Industro-Goth", "Jam Band",
|
---|
96 | "Krautrock", "Leftfield", "Lounge", "Math rock", "New romantic", "Nu-breakz", "Post-punk",
|
---|
97 | "Post-rock", "Psytrance", "Shoegaze", "Space rock", "Trop rock", "World music", "Neoclassical",
|
---|
98 | "Audiobook", "Audio theatre", "Neue Deutsche Welle", "Podcast", "Indie-rock", "G-Funk",
|
---|
99 | "Dubstep", "Garage rock", "Psybient"
|
---|
100 | };
|
---|
101 |
|
---|
102 | HMODULE queryResModuleHandle(void);
|
---|
103 | HMODULE queryModuleHandle(void);
|
---|
104 | PSZ queryModuleName(void);
|
---|
105 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
|
---|
106 | void _removeTrailingSpaces(char * chrString);
|
---|
107 |
|
---|
108 | /* In som_and_wps.c */
|
---|
109 | BOOL cwObjectIsOnCD(WPObject * somSelf);
|
---|
110 | BOOL cwObjectIsOnInvalidDrive(WPObject * somSelf);
|
---|
111 | BOOL cwObjectIsOnInvalidID3Drive(WPObject * somSelf);
|
---|
112 |
|
---|
113 | ULONG cwQueryOSRelease(void);
|
---|
114 | BOOL cwMoveNotebookButtonsWarp4(HWND hwndDlg, USHORT usID, USHORT usDelta);
|
---|
115 | void SysWriteToTrapLog(const char* chrFormat, ...);
|
---|
116 | ULONG launchPMProg(PSZ pszTitle, PSZ wrapperExe, PSZ parameters, WPObject *thisPtr, ULONG ulView);
|
---|
117 | MRESULT EXPENTRY waveInfoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
118 |
|
---|
119 | PSZ _queryMp3HelpLibraryName(void)
|
---|
120 | {
|
---|
121 | static char helpLibraryName[CCHMAXPATH];
|
---|
122 | BOOL bDone=FALSE;
|
---|
123 |
|
---|
124 | if(!bDone) {
|
---|
125 | if(queryModuleHandle()) {
|
---|
126 | char *ptr;
|
---|
127 | strncpy(helpLibraryName, classDLLPath, sizeof(helpLibraryName)-1);
|
---|
128 | if((ptr=strrchr(helpLibraryName, '\\'))!=NULLHANDLE) {
|
---|
129 | *(++ptr)=0;
|
---|
130 | if(strlen(helpLibraryName)+strlen(MP3FILE_HELP_LIBRARY)<sizeof(helpLibraryName)) {
|
---|
131 | strcat(helpLibraryName, MP3FILE_HELP_LIBRARY );
|
---|
132 | bDone=TRUE;
|
---|
133 | return helpLibraryName;
|
---|
134 | }
|
---|
135 | }
|
---|
136 | }
|
---|
137 | return NULLHANDLE;
|
---|
138 | }
|
---|
139 |
|
---|
140 | return helpLibraryName;
|
---|
141 | }
|
---|
142 |
|
---|
143 | void _fillEntryfieldsWithCurrentId3( MMMP3 *cwMp3, HWND hwnd)
|
---|
144 | {
|
---|
145 | ID3TAG id3Tag;
|
---|
146 | char fName[31];
|
---|
147 |
|
---|
148 | if(_cwmmQueryId3Tag(cwMp3, &id3Tag))
|
---|
149 | {
|
---|
150 | fName[0]=0;
|
---|
151 | strncat(fName,id3Tag.id3Name,30);
|
---|
152 | fName[30]=0;
|
---|
153 | _removeTrailingSpaces(fName);
|
---|
154 | WinSetWindowText(WinWindowFromID(hwnd, IDEF_ID3NAME),fName);
|
---|
155 |
|
---|
156 | fName[0]=0;
|
---|
157 | strncat(fName,id3Tag.id3Artist,30);
|
---|
158 | fName[30]=0;
|
---|
159 | _removeTrailingSpaces(fName);
|
---|
160 | WinSetWindowText(WinWindowFromID(hwnd, IDEF_ID3ARTIST),fName);
|
---|
161 |
|
---|
162 | fName[0]=0;
|
---|
163 | strncat(fName,id3Tag.id3Album,30);
|
---|
164 | fName[30]=0;
|
---|
165 | _removeTrailingSpaces(fName);
|
---|
166 | WinSetWindowText(WinWindowFromID(hwnd, IDEF_ID3ALBUM),fName);
|
---|
167 |
|
---|
168 | fName[0]=0;
|
---|
169 | strncat(fName,id3Tag.id3Year,4);
|
---|
170 | fName[4]=0;
|
---|
171 | _removeTrailingSpaces(fName);
|
---|
172 | WinSetWindowText(WinWindowFromID(hwnd, IDEF_ID3YEAR),fName);
|
---|
173 |
|
---|
174 | fName[0]=0;
|
---|
175 | strncat(fName,id3Tag.id3Comment,30);
|
---|
176 | fName[30]=0;
|
---|
177 | _removeTrailingSpaces(fName);
|
---|
178 | WinSetWindowText(WinWindowFromID(hwnd, IDEF_ID3COMMENT),fName);
|
---|
179 |
|
---|
180 | /* Genre */
|
---|
181 | if(id3Tag.id3Genre[0]>iGenreLast) {
|
---|
182 | fName[0]=0;
|
---|
183 | strncat(fName,"",30);
|
---|
184 | fName[30]=0;
|
---|
185 | _removeTrailingSpaces(fName);
|
---|
186 | WinSetWindowText(WinWindowFromID(hwnd, IDDD_ID3GENRE), fName);
|
---|
187 | }
|
---|
188 | else {
|
---|
189 | WinSetWindowText(WinWindowFromID(hwnd, IDDD_ID3GENRE),genreList[id3Tag.id3Genre[0]]);
|
---|
190 | }
|
---|
191 | }
|
---|
192 | }
|
---|
193 |
|
---|
194 | MRESULT EXPENTRY id3TagDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
195 | {
|
---|
196 | MMMP3 *cwMp3;
|
---|
197 |
|
---|
198 | switch(msg) {
|
---|
199 | case WM_INITDLG :
|
---|
200 | cwMp3=(MMMP3*)PVOIDFROMMP(mp2);
|
---|
201 | WinSetWindowULong(WinWindowFromID(hwnd,IDEF_ID3NAME),
|
---|
202 | QWL_USER,(ULONG)cwMp3);//Save object ptr.
|
---|
203 | if(somIsObj(cwMp3)) {
|
---|
204 | for(;;) {
|
---|
205 | int a;
|
---|
206 | HWND hwndTemp;
|
---|
207 | HWND hwndSave, hwndUndo;
|
---|
208 |
|
---|
209 | if(cwObjectIsOnCD(cwMp3))
|
---|
210 | {
|
---|
211 | /* CDs are readonly so remove 'Save' and 'Undo' buttons */
|
---|
212 | WinDestroyWindow(WinWindowFromID(hwnd,IDPB_ID3SAVE));
|
---|
213 | WinDestroyWindow(hwndUndo=WinWindowFromID(hwnd,IDPB_CANCEL));
|
---|
214 | /* Make entry fields read only */
|
---|
215 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3NAME),EM_SETREADONLY,MPFROMSHORT((SHORT)TRUE),0);
|
---|
216 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3ARTIST),EM_SETREADONLY,MPFROMSHORT((SHORT)TRUE),0);
|
---|
217 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3ALBUM),EM_SETREADONLY,MPFROMSHORT((SHORT)TRUE),0);
|
---|
218 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3COMMENT),EM_SETREADONLY,MPFROMSHORT((SHORT)TRUE),0);
|
---|
219 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3YEAR),EM_SETREADONLY,MPFROMSHORT((SHORT)TRUE),0);
|
---|
220 | }
|
---|
221 |
|
---|
222 | /* Move default buttons on Warp 4 */
|
---|
223 | cwMoveNotebookButtonsWarp4(hwnd, IDPB_ID3HELP, 15);
|
---|
224 |
|
---|
225 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3NAME),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
|
---|
226 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3ARTIST),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
|
---|
227 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3ALBUM),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
|
---|
228 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3COMMENT),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
|
---|
229 | WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3YEAR),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)4),0);
|
---|
230 | /* Fill drop downlist */
|
---|
231 | hwndTemp=WinWindowFromID(hwnd, IDDD_ID3GENRE);
|
---|
232 | for(a=0;a<=iGenreLast;a++)
|
---|
233 | WinSendMsg(hwndTemp, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),MPFROMP(genreList[a]));
|
---|
234 |
|
---|
235 | /* Get the ID3 tags from the file and insert them into the entry fields */
|
---|
236 | _fillEntryfieldsWithCurrentId3(cwMp3, hwnd);
|
---|
237 | break;
|
---|
238 | }
|
---|
239 | }
|
---|
240 | WinSetWindowULong(WinQueryWindow(hwnd, QW_PARENT), QWL_HWNDFOCUSSAVE, hwnd);
|
---|
241 | return (MRESULT)TRUE;
|
---|
242 | /* This prevents switching the notebook page behind the open folder */
|
---|
243 | case WM_WINDOWPOSCHANGED:
|
---|
244 | {
|
---|
245 | MRESULT mr;
|
---|
246 |
|
---|
247 | if(WinQueryFocus(HWND_DESKTOP)!=
|
---|
248 | WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
|
---|
249 | mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
|
---|
250 | mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
251 | return mr;
|
---|
252 | }
|
---|
253 | break;
|
---|
254 | }
|
---|
255 | case WM_FOCUSCHANGE:
|
---|
256 | {
|
---|
257 | if(!SHORT1FROMMP(mp2)) {
|
---|
258 | if(HWNDFROMMP(mp1)==hwnd) {
|
---|
259 | MRESULT mr;
|
---|
260 |
|
---|
261 | mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
262 | WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
|
---|
263 | return mr;
|
---|
264 | }
|
---|
265 | }
|
---|
266 | break;
|
---|
267 | }
|
---|
268 | case WM_DESTROY:
|
---|
269 | /* The notebook closes and gets destroyed */
|
---|
270 | /* Set focus to desktop to prevent PM freeze */
|
---|
271 | WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);
|
---|
272 | break;
|
---|
273 | case WM_COMMAND:
|
---|
274 | cwMp3=(MMMP3*) WinQueryWindowULong(WinWindowFromID(hwnd, IDEF_ID3NAME),QWL_USER);
|
---|
275 | if(somIsObj(cwMp3)) {
|
---|
276 | ID3TAG id3Tag;
|
---|
277 | char fName[31];
|
---|
278 |
|
---|
279 | switch(SHORT1FROMMP(mp1))
|
---|
280 | {
|
---|
281 | case IDPB_CANCEL:
|
---|
282 | /* Get the ID3 tags from the file and insert them into the entry fields */
|
---|
283 | _fillEntryfieldsWithCurrentId3(cwMp3, hwnd);
|
---|
284 | break;
|
---|
285 | case IDPB_ID3SAVE:
|
---|
286 | {
|
---|
287 | int a;
|
---|
288 |
|
---|
289 | memset(&id3Tag,0,sizeof(id3Tag));
|
---|
290 | memcpy(id3Tag.id3Tag,"TAG",sizeof(id3Tag.id3Tag));
|
---|
291 | WinQueryWindowText(WinWindowFromID(hwnd, IDEF_ID3NAME), 31, fName);
|
---|
292 | memcpy(id3Tag.id3Name, fName,strlen(fName));
|
---|
293 | WinQueryWindowText(WinWindowFromID(hwnd, IDEF_ID3ARTIST), 31, fName);
|
---|
294 | memcpy(id3Tag.id3Artist, fName,strlen(fName));
|
---|
295 | WinQueryWindowText(WinWindowFromID(hwnd, IDEF_ID3ALBUM), 31, fName);
|
---|
296 | memcpy(id3Tag.id3Album, fName,strlen(fName));
|
---|
297 | WinQueryWindowText(WinWindowFromID(hwnd, IDEF_ID3COMMENT), 31, fName);
|
---|
298 | memcpy(id3Tag.id3Comment, fName,strlen(fName));
|
---|
299 | WinQueryWindowText(WinWindowFromID(hwnd, IDEF_ID3YEAR), 5, fName);
|
---|
300 | memcpy(id3Tag.id3Year, fName,strlen(fName));
|
---|
301 |
|
---|
302 | /* Find genre */
|
---|
303 | WinQueryWindowText(WinWindowFromID(hwnd, IDDD_ID3GENRE), 31, fName);
|
---|
304 | for(a=0;a<=iGenreLast;a++)
|
---|
305 | if(!stricmp(fName, genreList[a]))
|
---|
306 | break;
|
---|
307 | if(a>iGenreLast)
|
---|
308 | id3Tag.id3Genre[0]=0xFF;/* No Genre inserted */
|
---|
309 | else
|
---|
310 | id3Tag.id3Genre[0]=a;
|
---|
311 | _cwmmSetId3Tag(cwMp3, &id3Tag);
|
---|
312 | }
|
---|
313 | break;
|
---|
314 | default:
|
---|
315 | break;
|
---|
316 | }
|
---|
317 | }
|
---|
318 | return (MRESULT) TRUE;
|
---|
319 | default:
|
---|
320 | break;
|
---|
321 | }
|
---|
322 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
323 | }
|
---|
324 |
|
---|
325 | /*
|
---|
326 | * The prototype for cwmp3_cwmmAddId3TagPage was replaced by the following prototype:
|
---|
327 | */
|
---|
328 | /*!*******************************************************/
|
---|
329 | /* */
|
---|
330 | /* @@DESC */
|
---|
331 | /* */
|
---|
332 | /* This instance method is called to allow the object */
|
---|
333 | /* to add the ID3 tag page to its Settings notebook. */
|
---|
334 | /* :p. */
|
---|
335 | /* This page can be used to change the ID3 tag of an */
|
---|
336 | /* MP3 file. */
|
---|
337 | /* */
|
---|
338 | /* @@USAGE */
|
---|
339 | /* */
|
---|
340 | /* This method must only be called from within an */
|
---|
341 | /* override of wpAddSettingsPages(). */
|
---|
342 | /* */
|
---|
343 | /* @@PARAM */
|
---|
344 | /* */
|
---|
345 | /* MMMP3 *somSelf input */
|
---|
346 | /* */
|
---|
347 | /* Pointer to the object on which the method is being */
|
---|
348 | /* invoked. */
|
---|
349 | /* :p. */
|
---|
350 | /* Points to an object of class :hp2.MMImage:ehp2.. */
|
---|
351 | /* */
|
---|
352 | /* @@PARAM */
|
---|
353 | /* */
|
---|
354 | /* HWND hwndNotebook input */
|
---|
355 | /* */
|
---|
356 | /* Settings notebook handle. */
|
---|
357 | /* */
|
---|
358 | /* @@OVERRIDE */
|
---|
359 | /* */
|
---|
360 | /* This method should always be overridden in order to */
|
---|
361 | /* remove or replace the image information page from */
|
---|
362 | /* the object's Settings notbook. */
|
---|
363 | /* :p. */
|
---|
364 | /* To remove the page from the Settings notebook, the */
|
---|
365 | /* override method should return */
|
---|
366 | /* :hp1.SETTINGS_PAGE_REMOVED:ehp1. without calling the */
|
---|
367 | /* the parent method. To replace the page with another */
|
---|
368 | /* page, the override method should call the */
|
---|
369 | /* wpInsertSettingsPAge method without calling the */
|
---|
370 | /* parent method. */
|
---|
371 | /* */
|
---|
372 | /* @@RETURNS */
|
---|
373 | /* */
|
---|
374 | /* ULONG rc */
|
---|
375 | /* */
|
---|
376 | /* :parml compact tsize=15 break=none. */
|
---|
377 | /* :pt.0:pd.Error occurred */
|
---|
378 | /* :pt.PageId :pd.Identifier for the inserted page. */
|
---|
379 | /* :eparml. */
|
---|
380 | /* */
|
---|
381 | /*!!******************************************************/
|
---|
382 | SOM_Scope ULONG SOMLINK cwmp3_cwmmAddId3TagPage(MMMP3 *somSelf,
|
---|
383 | HWND hwndNotebook)
|
---|
384 | {
|
---|
385 | PAGEINFO pageinfo;
|
---|
386 | char pageName[100];
|
---|
387 |
|
---|
388 | /* CWMP3Data *somThis = CWMP3GetData(somSelf);*/
|
---|
389 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmAddId3TagPage");
|
---|
390 |
|
---|
391 | //Clear the pageinfo structure
|
---|
392 | memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
|
---|
393 | //Fill the pageinfo structure
|
---|
394 | pageinfo.cb = sizeof(PAGEINFO);
|
---|
395 | pageinfo.hwndPage = NULLHANDLE;
|
---|
396 | pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
|
---|
397 | pageinfo.usPageInsertFlags = BKA_FIRST;
|
---|
398 | //We want page numbers
|
---|
399 | pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
|
---|
400 | //The dialog procedure for this page
|
---|
401 | pageinfo.pfnwp = id3TagDlgProc;
|
---|
402 | //The resource DLL
|
---|
403 | pageinfo.resid = queryResModuleHandle();
|
---|
404 | //pageinfo.resid = queryModuleHandle();
|
---|
405 | //The ID of the dialog template
|
---|
406 | pageinfo.dlgid = IDDLG_ID3TAGS;
|
---|
407 | //We need a pointer to our WPS-object in the dialog procedure
|
---|
408 | //to call class functions
|
---|
409 | pageinfo.pCreateParams = somSelf;
|
---|
410 | //The ID of the help panel for this page
|
---|
411 | if(cwObjectIsOnCD(somSelf))
|
---|
412 | pageinfo.idDefaultHelpPanel = MP3FILE_SETTINGS_PANEL_CD;
|
---|
413 | else
|
---|
414 | pageinfo.idDefaultHelpPanel = MP3FILE_SETTINGS_PANEL;
|
---|
415 | //Tell the WPS the help library name
|
---|
416 | pageinfo.pszHelpLibraryName = _queryMp3HelpLibraryName();
|
---|
417 | //We have a major tab so we need a name
|
---|
418 | if(!getMessage(pageName, ID_ID3TAGSPAGENAME, sizeof(pageName), queryResModuleHandle(), hwndNotebook))
|
---|
419 | strcpy(pageName, "~ID3 tag");
|
---|
420 | pageinfo.pszName = pageName;
|
---|
421 | //Insert the page into the settings notebook
|
---|
422 |
|
---|
423 | return _wpInsertSettingsPage(somSelf,hwndNotebook,&pageinfo);
|
---|
424 |
|
---|
425 | }
|
---|
426 |
|
---|
427 | static void convertID3CodePage(ID3TAG *id3Tag, ULONG ulFromCp, ULONG ulToCp)
|
---|
428 | {
|
---|
429 | if(ulFromCp==0 || ulToCp==0)
|
---|
430 | return;
|
---|
431 | else {
|
---|
432 | char fName[32];
|
---|
433 | char fTransName[32];
|
---|
434 | ID3TAG id3Temp;
|
---|
435 |
|
---|
436 | HAB hab=WinQueryAnchorBlock(HWND_DESKTOP);
|
---|
437 |
|
---|
438 | id3Temp=*id3Tag;
|
---|
439 | memset(&id3Temp,0,sizeof(id3Temp));
|
---|
440 | memcpy(id3Temp.id3Tag,"TAG",sizeof(id3Temp.id3Tag));
|
---|
441 |
|
---|
442 | strncpy(fName, id3Tag->id3Name,30);
|
---|
443 | fName[30]=0;/* The ID3 spec allows 30 chars. */
|
---|
444 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
445 | return;
|
---|
446 | fTransName[30]=0;
|
---|
447 | strncpy(id3Temp.id3Name, fTransName, 30);
|
---|
448 |
|
---|
449 | // memset(fname,0,sizeof(fname));
|
---|
450 | strncpy(fName,id3Tag->id3Artist,30);
|
---|
451 | fName[30]=0;
|
---|
452 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
453 | return;
|
---|
454 | fTransName[30]=0;
|
---|
455 | strncpy(id3Temp.id3Artist, fTransName, 30);
|
---|
456 |
|
---|
457 | strncpy(fName,id3Tag->id3Album,30);
|
---|
458 | fName[30]=0;
|
---|
459 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
460 | return;
|
---|
461 | fTransName[30]=0;
|
---|
462 | strncpy(id3Temp.id3Album, fTransName, 30);
|
---|
463 |
|
---|
464 | strncpy(fName,id3Tag->id3Year,4);
|
---|
465 | fName[4]=0;
|
---|
466 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
467 | return;
|
---|
468 | fTransName[30]=0;
|
---|
469 | strncpy(id3Temp.id3Year, fTransName, 4);
|
---|
470 |
|
---|
471 |
|
---|
472 | if(id3Tag->id3Comment[28]==0 &&
|
---|
473 | id3Tag->id3Comment[29]!=0 ) {
|
---|
474 | strncpy(fName,id3Tag->id3Comment,28); /* Keep Track information of ID3 V1.1 */
|
---|
475 | fName[28]=0;
|
---|
476 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
477 | return;
|
---|
478 | fTransName[28]=0;
|
---|
479 | strncpy(id3Temp.id3Comment, fTransName,strlen(fTransName));
|
---|
480 | id3Temp.id3Comment[28]=0;
|
---|
481 | id3Temp.id3Comment[29]=id3Tag->id3Comment[29];
|
---|
482 | }
|
---|
483 | else {
|
---|
484 | strncpy(fName,id3Tag->id3Comment,30);
|
---|
485 | fName[30]=0;
|
---|
486 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
487 | return;
|
---|
488 | fTransName[30]=0;
|
---|
489 | strncpy(id3Temp.id3Comment, fTransName,strlen(fTransName));
|
---|
490 | }
|
---|
491 |
|
---|
492 | #if 0
|
---|
493 | fName[0]=0;
|
---|
494 | strncat(fName, id3Tag->id3Name,30);
|
---|
495 | fName[30]=0;/* The ID3 spec allows 30 chars. */
|
---|
496 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
497 | return;
|
---|
498 | fTransName[30]=0;
|
---|
499 | memcpy(id3Temp.id3Name, fTransName, 30);
|
---|
500 |
|
---|
501 | // memset(fname,0,sizeof(fname));
|
---|
502 | fName[0]=0;
|
---|
503 | strncat(fName,id3Tag->id3Artist,30);
|
---|
504 | fName[30]=0;
|
---|
505 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
506 | return;
|
---|
507 | fTransName[30]=0;
|
---|
508 | memcpy(id3Temp.id3Artist, fTransName, 30);
|
---|
509 |
|
---|
510 | fName[0]=0;
|
---|
511 | strncat(fName,id3Tag->id3Album,30);
|
---|
512 | fName[30]=0;
|
---|
513 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
514 | return;
|
---|
515 | fTransName[30]=0;
|
---|
516 | memcpy(id3Temp.id3Album, fTransName, 30);
|
---|
517 |
|
---|
518 | fName[0]=0;
|
---|
519 | strncat(fName,id3Tag->id3Year,4);
|
---|
520 | fName[4]=0;
|
---|
521 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
522 | return;
|
---|
523 | fTransName[30]=0;
|
---|
524 | memcpy(id3Temp.id3Year, fTransName, 4);
|
---|
525 |
|
---|
526 |
|
---|
527 | if(id3Tag->id3Comment[28]==0 &&
|
---|
528 | id3Tag->id3Comment[29]!=0 ) {
|
---|
529 | strncpy(fName,id3Tag->id3Comment,28); /* Keep Track information of ID3 V1.1 */
|
---|
530 | fName[28]==0;
|
---|
531 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
532 | return;
|
---|
533 | fTransName[28]=0;
|
---|
534 | }
|
---|
535 | else {
|
---|
536 | strncpy(fName,id3Tag->id3Comment,30);
|
---|
537 | fName[30]==0;
|
---|
538 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
539 | return;
|
---|
540 | fTransName[30]=0;
|
---|
541 | }
|
---|
542 |
|
---|
543 | #if 0
|
---|
544 | fName[0]=0;
|
---|
545 | strncat(fName,id3Tag->id3Comment,30);
|
---|
546 | fName[30]=0;
|
---|
547 | if(!WinCpTranslateString(hab, ulFromCp, fName, ulToCp, 31, fTransName))
|
---|
548 | return;
|
---|
549 | fTransName[30]=0;
|
---|
550 | #endif
|
---|
551 | memcpy(id3Temp.id3Comment, fTransName,strlen(fTransName));
|
---|
552 | #endif
|
---|
553 |
|
---|
554 | id3Temp.id3Genre[0]=id3Tag->id3Genre[0];
|
---|
555 |
|
---|
556 | *id3Tag=id3Temp;
|
---|
557 | }
|
---|
558 |
|
---|
559 | }
|
---|
560 |
|
---|
561 | /*
|
---|
562 | * This method gets the ID3 tags from the file, converts the codepage to
|
---|
563 | * the current system codepage and puts the information in the instance vars.
|
---|
564 | */
|
---|
565 | SOM_Scope BOOL SOMLINK cwmp3_cwmmQueryId3Tag(MMMP3 *somSelf,
|
---|
566 | ID3TAG* id3Tag)
|
---|
567 | {
|
---|
568 | FILE *file;
|
---|
569 | ULONG ulSize;
|
---|
570 | char fName[CCHMAXPATH];
|
---|
571 | M_MMMP3* m_cwMP3;
|
---|
572 | M_MMMP3Data *m_cwMP3Data;
|
---|
573 |
|
---|
574 | /* CWMP3Data *somThis = CWMP3GetData(somSelf); */
|
---|
575 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmQueryId3Tag");
|
---|
576 |
|
---|
577 | /* Get ID3 tag */
|
---|
578 | ulSize=sizeof(fName);
|
---|
579 | if(!_wpQueryRealName(somSelf, fName, &ulSize, TRUE))
|
---|
580 | return FALSE;
|
---|
581 |
|
---|
582 | if((file=fopen(fName, "rb"))==NULL)
|
---|
583 | return FALSE;
|
---|
584 |
|
---|
585 | if(fseek(file, -128, SEEK_END)){
|
---|
586 | fclose(file);
|
---|
587 | return FALSE;
|
---|
588 | }
|
---|
589 | if(128!=fread(id3Tag, 1, 128, file)){
|
---|
590 | fclose(file);
|
---|
591 | return FALSE;
|
---|
592 | }
|
---|
593 | fclose(file);
|
---|
594 |
|
---|
595 | if(memicmp(id3Tag->id3Tag,"TAG",3))
|
---|
596 | return FALSE;/* No ID3 tag */
|
---|
597 |
|
---|
598 | /* Convert the info to ISO 8859-1. Somewhere I've seen info the ID3 tag uses this charset.
|
---|
599 | Can't find this reference anymore :-(. Because the windows CP is nearly identical
|
---|
600 | we should convert the data anyway to see the right info if put into the tag on W*n systems.
|
---|
601 | It's a W*n world out there so it's likely this CP was used. The usual W*ndoze user does not
|
---|
602 | care about details but just clicks 'OK'. Do I hear I LOVE YOU? <eg> */
|
---|
603 | m_cwMP3=_MMMP3;
|
---|
604 | if(!somIsObj(m_cwMP3))
|
---|
605 | return TRUE;
|
---|
606 |
|
---|
607 | m_cwMP3Data = M_MMMP3GetData(m_cwMP3);
|
---|
608 | convertID3CodePage(id3Tag, m_cwMP3Data->ulIsoCodePage, m_cwMP3Data->ulCodePage);
|
---|
609 | return TRUE;
|
---|
610 | }
|
---|
611 |
|
---|
612 | /*
|
---|
613 | * This method writes track information from the instance vars to the files ID3 tag.
|
---|
614 | * If the tag doesn't exist yet it will be created. The information is converted from
|
---|
615 | * the current codepage to the ISO8859-1 codepage used by ID3 tags.
|
---|
616 | */
|
---|
617 | SOM_Scope BOOL SOMLINK cwmp3_cwmmSetId3Tag(MMMP3 *somSelf, ID3TAG* id3Tag)
|
---|
618 | {
|
---|
619 | ID3TAG id3TagQuery;
|
---|
620 | ULONG ulSize;
|
---|
621 | char fName[CCHMAXPATH];
|
---|
622 | BOOL bHaveTag=FALSE;
|
---|
623 | HFILE hFile;
|
---|
624 | ULONG ulAction;
|
---|
625 | ULONG rc;
|
---|
626 | M_MMMP3* m_cwMP3;
|
---|
627 | M_MMMP3Data *m_cwMP3Data;
|
---|
628 |
|
---|
629 | /* CWMP3Data *somThis = CWMP3GetData(somSelf); */
|
---|
630 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmSetId3Tag");
|
---|
631 |
|
---|
632 | if(!id3Tag)
|
---|
633 | return FALSE;
|
---|
634 |
|
---|
635 | /* Ensure the tag has the signature */
|
---|
636 | memcpy(id3Tag, "TAG", 3);
|
---|
637 |
|
---|
638 | /* Needed to access class instance variables */
|
---|
639 | m_cwMP3=_MMMP3;
|
---|
640 | if(!somIsObj(m_cwMP3))
|
---|
641 | return FALSE;
|
---|
642 | m_cwMP3Data = M_MMMP3GetData(m_cwMP3);
|
---|
643 |
|
---|
644 | /* Check if there's already a Tag */
|
---|
645 | if(_cwmmQueryId3Tag(somSelf, &id3TagQuery))
|
---|
646 | {
|
---|
647 | if(!memicmp(id3TagQuery.id3Tag,"TAG",3))
|
---|
648 | bHaveTag=TRUE; /* Make sure we have valid information to write. If not the old Tag is kept. */
|
---|
649 | }
|
---|
650 |
|
---|
651 | /* Open the MP3 */
|
---|
652 | ulSize=sizeof(fName);
|
---|
653 | _wpQueryRealName(somSelf, fName, &ulSize, TRUE);
|
---|
654 | if((rc=DosOpen(fName, &hFile, &ulAction, 0, 0, OPEN_ACTION_FAIL_IF_NEW|OPEN_ACTION_OPEN_IF_EXISTS,
|
---|
655 | OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYWRITE|OPEN_ACCESS_WRITEONLY,NULL))!=NULLHANDLE) {
|
---|
656 | return FALSE;
|
---|
657 | }
|
---|
658 |
|
---|
659 | if(bHaveTag) {
|
---|
660 | /* There's a Tag so move fileptr to the beginning of it */
|
---|
661 | if(DosSetFilePtr(hFile, -128, FILE_END, &ulSize)){
|
---|
662 | DosClose(hFile);
|
---|
663 | return FALSE;
|
---|
664 | }
|
---|
665 | }
|
---|
666 | else
|
---|
667 | {
|
---|
668 | /* No Tag yet. Move fileptr to the end of the file */
|
---|
669 | if(DosSetFilePtr(hFile, 0, FILE_END, &ulSize)){
|
---|
670 | DosClose(hFile);
|
---|
671 | return FALSE;
|
---|
672 | }
|
---|
673 | }
|
---|
674 |
|
---|
675 | /* Convert the data from current codepage to ISO 8859-1 which is used for ID3 */
|
---|
676 | convertID3CodePage(id3Tag, m_cwMP3Data->ulCodePage, m_cwMP3Data->ulIsoCodePage);
|
---|
677 |
|
---|
678 | /* Save comment field */
|
---|
679 | fName[0]=id3Tag->id3Comment[28];
|
---|
680 | fName[1]=id3Tag->id3Comment[29];
|
---|
681 |
|
---|
682 | /* Write Tag to the file */
|
---|
683 | if(bHaveTag) {
|
---|
684 | /* If there's an old tag, keep the track info of ID3 V1.1 */
|
---|
685 | if(id3TagQuery.id3Comment[28]==0 &&
|
---|
686 | id3TagQuery.id3Comment[29]!=0) {
|
---|
687 | /* Track number is the last byte of the comment field. */
|
---|
688 | id3Tag->id3Comment[28]=0;/* Terminate comment */
|
---|
689 | id3Tag->id3Comment[29]=id3TagQuery.id3Comment[29];/* Old track number */
|
---|
690 | }
|
---|
691 | }
|
---|
692 | if(DosWrite(hFile,id3Tag, 128, &ulSize)){
|
---|
693 | DosClose(hFile);
|
---|
694 | /* Convert back */
|
---|
695 | convertID3CodePage(id3Tag, m_cwMP3Data->ulIsoCodePage, m_cwMP3Data->ulCodePage);
|
---|
696 | return FALSE;
|
---|
697 | }
|
---|
698 | DosClose(hFile);
|
---|
699 |
|
---|
700 | id3Tag->id3Comment[28]=fName[0];
|
---|
701 | id3Tag->id3Comment[29]=fName[1];
|
---|
702 |
|
---|
703 | /* Convert back */
|
---|
704 | convertID3CodePage(id3Tag, m_cwMP3Data->ulIsoCodePage, m_cwMP3Data->ulCodePage);
|
---|
705 |
|
---|
706 | #if 0
|
---|
707 | /* Set new instance data. */
|
---|
708 | fName[0]=0;
|
---|
709 | strncat(fName,id3Tag->id3Name,30);
|
---|
710 | fName[30]=0;
|
---|
711 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_NAME);
|
---|
712 |
|
---|
713 | fName[0]=0;
|
---|
714 | strncat(fName,id3Tag->id3Artist,30);
|
---|
715 | fName[30]=0;
|
---|
716 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_ARTIST);
|
---|
717 |
|
---|
718 | fName[0]=0;
|
---|
719 | strncat(fName,id3Tag->id3Album,30);
|
---|
720 | fName[30]=0;
|
---|
721 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_ALBUM);
|
---|
722 |
|
---|
723 | fName[0]=0;
|
---|
724 | strncat(fName,id3Tag->id3Year,4);
|
---|
725 | fName[4]=0;
|
---|
726 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_YEAR);
|
---|
727 |
|
---|
728 | fName[0]=0;
|
---|
729 | strncat(fName,id3Tag->id3Comment,30);
|
---|
730 | fName[30]=0;
|
---|
731 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_COMMENT);
|
---|
732 |
|
---|
733 | if(id3Tag->id3Genre[0]>iGenreLast) {
|
---|
734 | fName[0]=0;
|
---|
735 | strncat(fName,"",30);
|
---|
736 | fName[30]=0;
|
---|
737 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_GENRE);
|
---|
738 | }
|
---|
739 | else {
|
---|
740 | _cwmmSetTrackInfo(somSelf, genreList[id3Tag->id3Genre[0]], 0, IDINFO_GENRE);
|
---|
741 | }
|
---|
742 | #endif
|
---|
743 |
|
---|
744 | return TRUE;
|
---|
745 | }
|
---|
746 |
|
---|
747 |
|
---|
748 | /*
|
---|
749 | * The prototype for cwmp3_cwmmQueryId3TagValue was replaced by the following prototype:
|
---|
750 | */
|
---|
751 | SOM_Scope BOOL SOMLINK cwmp3_cwmmQueryId3TagValue(MMMP3 *somSelf,
|
---|
752 | PSZ pszValue,
|
---|
753 | ULONG ulWhich)
|
---|
754 | {
|
---|
755 | ID3TAG id3Tag;
|
---|
756 |
|
---|
757 | /* MMMP3Data *somThis = MMMP3GetData(somSelf);*/
|
---|
758 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmQueryId3TagValue");
|
---|
759 |
|
---|
760 | /* No ID3 tag yet */
|
---|
761 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag))
|
---|
762 | return FALSE;
|
---|
763 |
|
---|
764 | memset(pszValue,0, ID3TAGVALUE_BUFFER_SIZE);
|
---|
765 |
|
---|
766 | switch(ulWhich)
|
---|
767 | {
|
---|
768 | case IDINFO_NAME:
|
---|
769 | if(id3Tag.id3Name[0]) {
|
---|
770 | memcpy(pszValue, id3Tag.id3Name, 30);
|
---|
771 | return TRUE;
|
---|
772 | }
|
---|
773 | break;
|
---|
774 | case IDINFO_ARTIST:
|
---|
775 | if(id3Tag.id3Artist[0]) {
|
---|
776 | memcpy(pszValue, id3Tag.id3Artist, 30);
|
---|
777 | return TRUE;
|
---|
778 | }
|
---|
779 | break;
|
---|
780 | case IDINFO_ALBUM:
|
---|
781 | if(id3Tag.id3Album[0]) {
|
---|
782 | memcpy(pszValue, id3Tag.id3Artist, 30);
|
---|
783 | return TRUE;
|
---|
784 | }
|
---|
785 | break;
|
---|
786 | case IDINFO_YEAR:
|
---|
787 | if(id3Tag.id3Year[0]) {
|
---|
788 | memcpy(pszValue, id3Tag.id3Year, 4);
|
---|
789 | return TRUE;
|
---|
790 | }
|
---|
791 | break;
|
---|
792 | case IDINFO_COMMENT:
|
---|
793 | if(id3Tag.id3Comment[0]) {
|
---|
794 | memcpy(pszValue, id3Tag.id3Comment, 30);
|
---|
795 | return TRUE;
|
---|
796 | }
|
---|
797 | break;
|
---|
798 | case IDINFO_GENRE:
|
---|
799 | if(id3Tag.id3Genre[0] != (char)0xFF) {
|
---|
800 | pszValue[0]=id3Tag.id3Genre[0];
|
---|
801 | return TRUE;
|
---|
802 | }
|
---|
803 | break;
|
---|
804 | default:
|
---|
805 | break;
|
---|
806 | }
|
---|
807 |
|
---|
808 | /* Return statement to be customized: */
|
---|
809 | return FALSE;
|
---|
810 | }
|
---|
811 |
|
---|
812 |
|
---|
813 | SOM_Scope BOOL SOMLINK cwmp3_cwmmSetId3TagValue(MMMP3 *somSelf,
|
---|
814 | PSZ pszValue,
|
---|
815 | ULONG ulWhich)
|
---|
816 | {
|
---|
817 | ID3TAG id3Tag;
|
---|
818 |
|
---|
819 | /* MMMP3Data *somThis = MMMP3GetData(somSelf);*/
|
---|
820 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmSetId3TagValue");
|
---|
821 |
|
---|
822 | if(!pszValue || pszValue[0]==0)
|
---|
823 | return FALSE;
|
---|
824 |
|
---|
825 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)) {
|
---|
826 | memset(&id3Tag, 0, sizeof(id3Tag)); /* No tag yet. Set it to empty. */
|
---|
827 | /* Default for genre is 0xff not 0 which equals 'blues' */
|
---|
828 | id3Tag.id3Genre[0]=0xFF;
|
---|
829 | }
|
---|
830 |
|
---|
831 | switch(ulWhich)
|
---|
832 | {
|
---|
833 | case IDINFO_NAME:
|
---|
834 | strncpy(id3Tag.id3Name, pszValue, 30);
|
---|
835 | break;
|
---|
836 | case IDINFO_ARTIST:
|
---|
837 | strncpy(id3Tag.id3Artist, pszValue, 30);
|
---|
838 | break;
|
---|
839 | case IDINFO_ALBUM:
|
---|
840 | strncpy(id3Tag.id3Album, pszValue, 30);
|
---|
841 | break;
|
---|
842 | case IDINFO_YEAR:
|
---|
843 | strncpy(id3Tag.id3Year, pszValue, 4);
|
---|
844 | break;
|
---|
845 | case IDINFO_COMMENT:
|
---|
846 | strncpy(id3Tag.id3Comment, pszValue, 30);
|
---|
847 | break;
|
---|
848 | case IDINFO_GENRE:
|
---|
849 | pszValue[0]=id3Tag.id3Genre[0]=pszValue[0];
|
---|
850 | break;
|
---|
851 | default:
|
---|
852 | return FALSE;
|
---|
853 | }
|
---|
854 | /* ID3 tag built now write it to the file */
|
---|
855 | _cwmmSetId3Tag(somSelf, &id3Tag);
|
---|
856 |
|
---|
857 | return TRUE;
|
---|
858 | }
|
---|
859 |
|
---|
860 | /*
|
---|
861 | * cwmmAddTrackNamePage : override;
|
---|
862 | */
|
---|
863 |
|
---|
864 | /*
|
---|
865 | * SOM_Scope ULONG SOMLINK cwmp3_cwmmQueryTrackInfo(MMMP3 *somSelf,
|
---|
866 | * PSZ chrString,
|
---|
867 | * ULONG ulSize,
|
---|
868 | * int iWhich)
|
---|
869 | */
|
---|
870 |
|
---|
871 | /*
|
---|
872 | * The prototype for cwmp3_cwmmQueryTrackInfo was replaced by the following prototype:
|
---|
873 | */
|
---|
874 | SOM_Scope ULONG SOMLINK cwmp3_cwmmQueryTrackInfo(MMMP3 *somSelf,
|
---|
875 | PSZ chrString,
|
---|
876 | ULONG ulSize,
|
---|
877 | ULONG iWhich)
|
---|
878 | {
|
---|
879 | somId id;
|
---|
880 | ULONG rc;
|
---|
881 | /* somTD_MMAudio_cwmmQueryTrackInfo methodPtr; */
|
---|
882 |
|
---|
883 | /* MMMP3Data *somThis = MMMP3GetData(somSelf);*/
|
---|
884 | /* MMAudioData *somThis = MMAudioGetData(somSelf); */
|
---|
885 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmQueryTrackInfo");
|
---|
886 |
|
---|
887 |
|
---|
888 | if(iWhich<1||iWhich>IDINFO_LASTINFO)
|
---|
889 | return FALSE;
|
---|
890 |
|
---|
891 |
|
---|
892 | switch(iWhich)
|
---|
893 | {
|
---|
894 | case IDINFO_BITRATE:
|
---|
895 | return (MMMP3_parent_MMAudio_cwmmQueryTrackInfo(somSelf,
|
---|
896 | chrString,
|
---|
897 | ulSize, iWhich));
|
---|
898 | default:
|
---|
899 | break;
|
---|
900 | }
|
---|
901 | // SysWriteToTrapLog("%s %d\n", __FUNCTION__, __LINE__);
|
---|
902 | return (MMMP3_parent_MMAudio_cwmmQueryTrackInfo(somSelf,
|
---|
903 | chrString,
|
---|
904 | ulSize, iWhich));
|
---|
905 |
|
---|
906 |
|
---|
907 | #if 0
|
---|
908 | if((mySomId=somIdFromString("cwmmQueryTrackInfo"))!=NULLHANDLE) {
|
---|
909 | rc=((somTD_M_WPObject_wpclsQueryStyle)
|
---|
910 | somParentNumResolve(__ClassObject->somGetPClsMtabs(),
|
---|
911 | 1,
|
---|
912 | __ClassObject->
|
---|
913 | somGetMethodToken(mySomId))
|
---|
914 | )(this);
|
---|
915 | SOMFree(mySomId);
|
---|
916 | }
|
---|
917 |
|
---|
918 | SysWriteToTrapLog("%s %d, %d, %x %x %x %d, Addr: %x\n", __FUNCTION__, __LINE__, iWhich, somSelf, chrString, ulSize, iWhich, cwmp3_cwmmQueryTrackInfo);
|
---|
919 |
|
---|
920 | /* Get method address */
|
---|
921 | if((id=somIdFromString("cwmmQueryTrackInfo"))!=NULLHANDLE) {
|
---|
922 | methodPtr= (somTD_MMAudio_cwmmQueryTrackInfo) _somFindSMethod(_somGetClass(_MMAudio), id);
|
---|
923 | methodPtr= (somTD_MMAudio_cwmmQueryTrackInfo) _somFindSMethod(_MMAudio, id);
|
---|
924 | if(methodPtr) {
|
---|
925 | SysWriteToTrapLog("%s %d, %d, %x %x %x %d, Addr: %x\n", __FUNCTION__, __LINE__, iWhich, somSelf, chrString, ulSize, iWhich, methodPtr);
|
---|
926 | methodPtr(somSelf, chrString, ulSize, iWhich);
|
---|
927 | /*( (somTD_MMAudio_cwmmQueryTrackInfo) MMMP3_parent_MMAudio_cwmmQueryTrackInfo_resolved)
|
---|
928 | (somSelf,chrString,ulSize,iWhich);
|
---|
929 | */
|
---|
930 | SysWriteToTrapLog("%s %d, %d, %x %x %x %d, Addr: %x !!\n", __FUNCTION__, __LINE__, iWhich, somSelf, chrString, ulSize, iWhich,
|
---|
931 | MMMP3_parent_MMAudio_cwmmQueryTrackInfo_resolved);
|
---|
932 | }
|
---|
933 | SOMFree(id);
|
---|
934 | }/* somId */
|
---|
935 | #endif
|
---|
936 | }
|
---|
937 |
|
---|
938 |
|
---|
939 | SOM_Scope ULONG SOMLINK cwmp3_cwmmAddAudioInformationPage(MMMP3 *somSelf,
|
---|
940 | HWND hwndNotebook)
|
---|
941 | {
|
---|
942 | PAGEINFO pageinfo;
|
---|
943 | char pageName[100];
|
---|
944 |
|
---|
945 | /* MMMP3Data *somThis = MMMP3GetData(somSelf); */
|
---|
946 | MMMP3MethodDebug("MMMP3","cwmp3_cwmmAddAudioInformationPage");
|
---|
947 |
|
---|
948 |
|
---|
949 | //Clear the pageinfo structure
|
---|
950 | memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
|
---|
951 | //Fill the pageinfo structure
|
---|
952 | pageinfo.cb = sizeof(PAGEINFO);
|
---|
953 | pageinfo.hwndPage = NULLHANDLE;
|
---|
954 | pageinfo.usPageStyleFlags = BKA_MAJOR | BKA_STATUSTEXTON;
|
---|
955 | pageinfo.usPageInsertFlags = BKA_FIRST;
|
---|
956 | //We want page numbers
|
---|
957 | pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
|
---|
958 | //The dialog procedure for this page
|
---|
959 | pageinfo.pfnwp = waveInfoDlgProc;
|
---|
960 | //The resource DLL
|
---|
961 | pageinfo.resid = queryResModuleHandle();
|
---|
962 | //pageinfo.resid = queryModuleHandle();
|
---|
963 | //The ID of the dialog template
|
---|
964 | pageinfo.dlgid = IDDLG_WAVEINFOPAGE;
|
---|
965 | //We need a pointer to our WPS-object in the dialog procedure
|
---|
966 | //to call class functions
|
---|
967 | pageinfo.pCreateParams = somSelf;
|
---|
968 | //The ID of the help panel for this page
|
---|
969 | //pageinfo.idDefaultHelpPanel = IDDLG_GENERAL2PAGE;
|
---|
970 | //Tell the WPS the help library name
|
---|
971 | pageinfo.pszHelpLibraryName = NULLHANDLE;
|
---|
972 | //We have a major tab so we need a name
|
---|
973 | if(!getMessage(pageName, ID_WAVEINFOPAGENAME, sizeof(pageName), queryResModuleHandle(), hwndNotebook))
|
---|
974 | strcpy(pageName, "~Audio information");
|
---|
975 | pageinfo.pszName = pageName;
|
---|
976 |
|
---|
977 |
|
---|
978 | /* The following is only important for MP3 files because gathering the audio info
|
---|
979 | for MP3 files is currently very slow. Will improve with future releases of MMIOMP3*/
|
---|
980 | if(__get_ulFileSize(somSelf)!=_wpQueryFileSize(somSelf)) {
|
---|
981 | /* The filesize changed, somebody altered the audio file so reread the info */
|
---|
982 | if(!cwObjectIsOnInvalidDrive(somSelf)) {
|
---|
983 | // if(!cwObjectIsOnCD(somSelf)) {
|
---|
984 | /* Only get audio info when file isn't on CD. This speeds up opening of folders on CDs filled with
|
---|
985 | MP3s. Doesn't hurt because folders of CDs open in normal details view as default so the audio info
|
---|
986 | isn't necessary. When opening the settings notebook the info is reread anyway. */
|
---|
987 |
|
---|
988 | /* Get class object */
|
---|
989 | M_CWMMDataFile *m_cwmmDataFile=_CWMMDataFile;
|
---|
990 |
|
---|
991 | /* Send the object pointer to the audio worker thread to read the audio info in the background. */
|
---|
992 | WinPostMsg(__get_hwndAudioWorker(_CWMMDataFile), WM_APPTERMINATENOTIFY, somSelf, 0);
|
---|
993 | }
|
---|
994 | else
|
---|
995 | return SETTINGS_PAGE_REMOVED; /* Don't show info page on CD because all info is zero anyway. */
|
---|
996 | }
|
---|
997 |
|
---|
998 | //Insert the page into the settings notebook
|
---|
999 | return _wpInsertSettingsPage(somSelf,hwndNotebook,&pageinfo);
|
---|
1000 |
|
---|
1001 | // return (MMMP3_parent_MMAudio_cwmmAddAudioInformationPage(somSelf,
|
---|
1002 | // hwndNotebook));
|
---|
1003 | }
|
---|
1004 |
|
---|
1005 | SOM_Scope BOOL SOMLINK cwmp3_wpAddSettingsPages(MMMP3 *somSelf,
|
---|
1006 | HWND hwndNotebook)
|
---|
1007 | {
|
---|
1008 | BOOL rc;
|
---|
1009 | /* MMMP3Data *somThis = MMMP3GetData(somSelf); */
|
---|
1010 | MMMP3MethodDebug("MMMP3","cwmp3_wpAddSettingsPages");
|
---|
1011 |
|
---|
1012 | rc=(MMMP3_parent_MMAudio_wpAddSettingsPages(somSelf,
|
---|
1013 | hwndNotebook));
|
---|
1014 | _cwmmAddId3TagPage(somSelf,
|
---|
1015 | hwndNotebook);
|
---|
1016 |
|
---|
1017 | return rc;
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | /*
|
---|
1021 | * The prototype for cwmp3_wpRestoreState was replaced by the following prototype:
|
---|
1022 | */
|
---|
1023 | SOM_Scope BOOL SOMLINK cwmp3_wpRestoreState(MMMP3 *somSelf,
|
---|
1024 | ULONG ulReserved)
|
---|
1025 | {
|
---|
1026 | BOOL bRc;
|
---|
1027 | ID3TAG id3Tag;
|
---|
1028 | char fName[CCHMAXPATH];
|
---|
1029 |
|
---|
1030 | /* CWMP3Data *somThis = CWMP3GetData(somSelf); */
|
---|
1031 | MMMP3MethodDebug("MMMP3","cwmp3_wpRestoreState");
|
---|
1032 |
|
---|
1033 | /* Read info from EA in MMAudio(). This fills the instance vars with
|
---|
1034 | e.g. the trackname, artist etc. ID3 tags are not read and the length of
|
---|
1035 | that information is much greater than the length of ID3 tags. This
|
---|
1036 | information is shown in the details view of folders. */
|
---|
1037 | bRc= (MMMP3_parent_MMAudio_wpRestoreState(somSelf, ulReserved));
|
---|
1038 |
|
---|
1039 | /* Don't read ID3 tags for files on CD because this takes ages on slow drives. */
|
---|
1040 | #if 0
|
---|
1041 | if(cwObjectIsOnCD(somSelf))
|
---|
1042 | return bRc;
|
---|
1043 | #endif
|
---|
1044 |
|
---|
1045 | /* Don't read ID3 tags for files on user specified drives because this may take ages on slow drives. */
|
---|
1046 | /* The list of drives may be specified in USER ini */
|
---|
1047 | if(cwObjectIsOnInvalidID3Drive(somSelf))
|
---|
1048 | return bRc;
|
---|
1049 |
|
---|
1050 | /* Get ID3 tag */
|
---|
1051 | if(_cwmmQueryId3Tag(somSelf, &id3Tag))
|
---|
1052 | {
|
---|
1053 | char chrDummy[20];
|
---|
1054 |
|
---|
1055 | fName[0]=0;
|
---|
1056 | strncat(fName,id3Tag.id3Name,30);
|
---|
1057 | fName[30]=0;/* The ID3 spec allows 30 chars. */
|
---|
1058 | _removeTrailingSpaces(fName);
|
---|
1059 | /* Set trackinfo of EA only if not already restored. By doing it this way longer info (see MAX_EA_SIZE)
|
---|
1060 | isn't overwritten by the shorter ID3 tag info. */
|
---|
1061 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_NAME)) {
|
---|
1062 | //SysWriteToTrapLog("!! %s %d\n", __FUNCTION__, __LINE__);
|
---|
1063 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_NAME);
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | fName[0]=0;
|
---|
1067 | strncat(fName,id3Tag.id3Artist,30);
|
---|
1068 | fName[30]=0;
|
---|
1069 | _removeTrailingSpaces(fName);
|
---|
1070 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_ARTIST))
|
---|
1071 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_ARTIST);
|
---|
1072 |
|
---|
1073 | fName[0]=0;
|
---|
1074 | strncat(fName,id3Tag.id3Album,30);
|
---|
1075 | fName[30]=0;
|
---|
1076 | _removeTrailingSpaces(fName);
|
---|
1077 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_ALBUM))
|
---|
1078 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_ALBUM);
|
---|
1079 |
|
---|
1080 | fName[0]=0;
|
---|
1081 | strncat(fName,id3Tag.id3Year,4);
|
---|
1082 | fName[4]=0;
|
---|
1083 | // SysWriteToTrapLog("%s %d: %s\n", __FUNCTION__, __LINE__, fName);
|
---|
1084 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_YEAR))
|
---|
1085 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_YEAR);
|
---|
1086 |
|
---|
1087 | fName[0]=0;
|
---|
1088 | strncat(fName,id3Tag.id3Comment,30);
|
---|
1089 | fName[30]=0;
|
---|
1090 | _removeTrailingSpaces(fName);
|
---|
1091 | // SysWriteToTrapLog("%s %d: %s\n", __FUNCTION__, __LINE__, fName);
|
---|
1092 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_COMMENT))
|
---|
1093 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_COMMENT);
|
---|
1094 |
|
---|
1095 | if(id3Tag.id3Genre[0]>iGenreLast) {
|
---|
1096 | fName[0]=0;
|
---|
1097 | strncat(fName,"",30);
|
---|
1098 | fName[30]=0;/* ID3 encodes genre into one byte. */
|
---|
1099 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_GENRE))
|
---|
1100 | _cwmmSetTrackInfo(somSelf, fName, 0, IDINFO_GENRE);
|
---|
1101 | }
|
---|
1102 | else {
|
---|
1103 | if(!_cwmmQueryTrackInfo(somSelf, chrDummy, sizeof(chrDummy), IDINFO_GENRE))
|
---|
1104 | _cwmmSetTrackInfo(somSelf, genreList[id3Tag.id3Genre[0]], 0, IDINFO_GENRE);
|
---|
1105 | }
|
---|
1106 | }
|
---|
1107 | else {
|
---|
1108 | /* No ID3 tag yet. Insert the info from the EAs */
|
---|
1109 | //FIXME
|
---|
1110 | /* Not implemented yet */
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 | /* Get MP3 technical data */
|
---|
1114 | return bRc;
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 |
|
---|
1118 | /*
|
---|
1119 | * The prototype for cwmp3_wpSetup was replaced by the following prototype:
|
---|
1120 | */
|
---|
1121 | SOM_Scope BOOL SOMLINK cwmp3_wpSetup(MMMP3 *somSelf, PSZ pszSetupString)
|
---|
1122 | {
|
---|
1123 | char buffer[CCHMAXPATH];
|
---|
1124 | ULONG bufferSize;
|
---|
1125 | ID3TAG id3Tag;
|
---|
1126 | int a;
|
---|
1127 | BOOL bRc;
|
---|
1128 |
|
---|
1129 | /* CWMP3Data *somThis = CWMP3GetData(somSelf); */
|
---|
1130 | MMMP3MethodDebug("MMMP3","cwmp3_wpSetup");
|
---|
1131 |
|
---|
1132 | /* Call parent. This will fill the instance vars for EAs with the tracknames etc. */
|
---|
1133 | bRc=(MMMP3_parent_MMAudio_wpSetup(somSelf, pszSetupString));
|
---|
1134 |
|
---|
1135 | /* New generic names */
|
---|
1136 | bufferSize=sizeof(buffer);
|
---|
1137 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOTRACKNAME, buffer, &bufferSize))
|
---|
1138 | {
|
---|
1139 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1140 |
|
---|
1141 | /* Save the ID3 tag into the file */
|
---|
1142 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_NAME))
|
---|
1143 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1144 | truncated to the allowed length of the ID3 tag. */
|
---|
1145 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_NAME);
|
---|
1146 |
|
---|
1147 | #if 0
|
---|
1148 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1149 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1150 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1151 | id3Tag.id3Genre[0]=0xFF;
|
---|
1152 | }
|
---|
1153 | memcpy(id3Tag.id3Name, buffer, 30);
|
---|
1154 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1155 | #endif
|
---|
1156 | }
|
---|
1157 | bufferSize=sizeof(buffer);
|
---|
1158 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOARTIST, buffer, &bufferSize))
|
---|
1159 | {
|
---|
1160 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1161 |
|
---|
1162 | /* Save the ID3 tag into the file */
|
---|
1163 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_ARTIST))
|
---|
1164 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1165 | truncated to the allowed length of the ID3 tag. */
|
---|
1166 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_ARTIST);
|
---|
1167 |
|
---|
1168 | #if 0
|
---|
1169 | /* Save the ID3 tag into the file */
|
---|
1170 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1171 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1172 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1173 | id3Tag.id3Genre[0]=0xFF;
|
---|
1174 | }
|
---|
1175 | // if(bufferSize<30+1)
|
---|
1176 | // buffer[bufferSize-1]=' ';
|
---|
1177 | memcpy(id3Tag.id3Artist, buffer, 30);
|
---|
1178 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1179 | #endif
|
---|
1180 | }
|
---|
1181 | bufferSize=sizeof(buffer);
|
---|
1182 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOALBUM, buffer, &bufferSize))
|
---|
1183 | {
|
---|
1184 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1185 |
|
---|
1186 | /* Save the ID3 tag into the file */
|
---|
1187 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_ALBUM))
|
---|
1188 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1189 | truncated to the allowed length of the ID3 tag. */
|
---|
1190 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_ALBUM);
|
---|
1191 | #if 0
|
---|
1192 | /* Save the ID3 tag into the file */
|
---|
1193 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1194 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1195 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1196 | id3Tag.id3Genre[0]=0xFF;
|
---|
1197 | }
|
---|
1198 | memcpy(id3Tag.id3Album, buffer, 30);
|
---|
1199 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1200 | #endif
|
---|
1201 | }
|
---|
1202 | bufferSize=sizeof(buffer);
|
---|
1203 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOCOMMENT, buffer, &bufferSize))
|
---|
1204 | {
|
---|
1205 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1206 |
|
---|
1207 | /* Save the ID3 tag into the file */
|
---|
1208 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_COMMENT))
|
---|
1209 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1210 | truncated to the allowed length of the ID3 tag. */
|
---|
1211 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_COMMENT);
|
---|
1212 | #if 0
|
---|
1213 | /* Save the ID3 tag into the file */
|
---|
1214 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1215 | memset(&id3Tag,0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1216 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1217 | id3Tag.id3Genre[0]=0xFF;
|
---|
1218 | }
|
---|
1219 | memcpy(id3Tag.id3Comment, buffer, 30);
|
---|
1220 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1221 | #endif
|
---|
1222 | }
|
---|
1223 | bufferSize=sizeof(buffer);
|
---|
1224 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOYEAR, buffer, &bufferSize))
|
---|
1225 | {
|
---|
1226 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1227 |
|
---|
1228 | /* Save the ID3 tag into the file */
|
---|
1229 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_YEAR) && bufferSize==4+1)
|
---|
1230 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1231 | truncated to the allowed length of the ID3 tag. */
|
---|
1232 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_YEAR);
|
---|
1233 | #if 0
|
---|
1234 | /* Save the ID3 tag into the file */
|
---|
1235 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1236 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1237 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1238 | id3Tag.id3Genre[0]=0xFF;
|
---|
1239 | }
|
---|
1240 | if(bufferSize==4+1) {
|
---|
1241 | memcpy(id3Tag.id3Year, buffer, 4);
|
---|
1242 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1243 | }
|
---|
1244 | #endif
|
---|
1245 | }
|
---|
1246 | bufferSize=sizeof(buffer);
|
---|
1247 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_MMAUDIOGENRE, buffer, &bufferSize))
|
---|
1248 | {
|
---|
1249 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1250 |
|
---|
1251 | /* Save the ID3 tag into the file */
|
---|
1252 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_GENRE)) {
|
---|
1253 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1254 | truncated to the allowed length of the ID3 tag. */
|
---|
1255 | /* Find genre from string */
|
---|
1256 | for(a=0;a<=iGenreLast;a++)
|
---|
1257 | if(!stricmp(buffer, genreList[a]))
|
---|
1258 | break;
|
---|
1259 | if(a>iGenreLast)
|
---|
1260 | id3Value[0]=0xFF;/* No Genre inserted */
|
---|
1261 | else
|
---|
1262 | id3Value[0]=a;
|
---|
1263 | _cwmmSetId3TagValue(somSelf, id3Value, IDINFO_GENRE);
|
---|
1264 | }
|
---|
1265 | #if 0
|
---|
1266 | /* Save the ID3 tag into the file */
|
---|
1267 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1268 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1269 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1270 | id3Tag.id3Genre[0]=0xFF;
|
---|
1271 | }
|
---|
1272 | /* Find genre from string */
|
---|
1273 | for(a=0;a<=iGenreLast;a++)
|
---|
1274 | if(!stricmp(buffer, genreList[a]))
|
---|
1275 | break;
|
---|
1276 | if(a>iGenreLast)
|
---|
1277 | id3Tag.id3Genre[0]=0xFF;/* No Genre inserted */
|
---|
1278 | else
|
---|
1279 | id3Tag.id3Genre[0]=a;
|
---|
1280 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1281 | #endif
|
---|
1282 | }
|
---|
1283 |
|
---|
1284 |
|
---|
1285 |
|
---|
1286 | /* Old depracted names. Will vanish in the future. */
|
---|
1287 | bufferSize=sizeof(buffer);
|
---|
1288 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3TRACKNAME, buffer, &bufferSize))
|
---|
1289 | {
|
---|
1290 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1291 |
|
---|
1292 | /* Save the ID3 tag into the file */
|
---|
1293 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_NAME))
|
---|
1294 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1295 | truncated to the allowed length of the ID3 tag. */
|
---|
1296 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_NAME);
|
---|
1297 | #if 0
|
---|
1298 | /* Save the ID3 tag into the file */
|
---|
1299 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1300 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1301 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1302 | id3Tag.id3Genre[0]=0xFF;
|
---|
1303 | }
|
---|
1304 | memcpy(id3Tag.id3Name, buffer, 30);
|
---|
1305 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance ID3 tag data */
|
---|
1306 | #endif
|
---|
1307 | }
|
---|
1308 | bufferSize=sizeof(buffer);
|
---|
1309 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3ARTIST, buffer, &bufferSize))
|
---|
1310 | {
|
---|
1311 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1312 |
|
---|
1313 | /* Save the ID3 tag into the file */
|
---|
1314 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_ARTIST))
|
---|
1315 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1316 | truncated to the allowed length of the ID3 tag. */
|
---|
1317 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_ARTIST);
|
---|
1318 | #if 0
|
---|
1319 | /* Save the ID3 tag into the file */
|
---|
1320 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1321 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1322 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1323 | id3Tag.id3Genre[0]=0xFF;
|
---|
1324 | }
|
---|
1325 | memcpy(id3Tag.id3Artist, buffer, 30);
|
---|
1326 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1327 | #endif
|
---|
1328 | }
|
---|
1329 | bufferSize=sizeof(buffer);
|
---|
1330 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3ALBUM, buffer, &bufferSize))
|
---|
1331 | {
|
---|
1332 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1333 |
|
---|
1334 | /* Save the ID3 tag into the file */
|
---|
1335 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_ALBUM))
|
---|
1336 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1337 | truncated to the allowed length of the ID3 tag. */
|
---|
1338 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_ALBUM);
|
---|
1339 | #if 0
|
---|
1340 | /* Save the ID3 tag into the file */
|
---|
1341 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1342 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1343 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1344 | id3Tag.id3Genre[0]=0xFF;
|
---|
1345 | }
|
---|
1346 | memcpy(id3Tag.id3Album, buffer, 30);
|
---|
1347 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1348 | #endif
|
---|
1349 | }
|
---|
1350 | bufferSize=sizeof(buffer);
|
---|
1351 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3COMMENT, buffer, &bufferSize))
|
---|
1352 | {
|
---|
1353 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1354 |
|
---|
1355 | /* Save the ID3 tag into the file */
|
---|
1356 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_COMMENT))
|
---|
1357 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1358 | truncated to the allowed length of the ID3 tag. */
|
---|
1359 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_COMMENT);
|
---|
1360 | #if 0
|
---|
1361 | /* Save the ID3 tag into the file */
|
---|
1362 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1363 | memset(&id3Tag,0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1364 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1365 | id3Tag.id3Genre[0]=0xFF;
|
---|
1366 | }
|
---|
1367 | memcpy(id3Tag.id3Comment, buffer, 30);
|
---|
1368 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1369 | #endif
|
---|
1370 | }
|
---|
1371 | bufferSize=sizeof(buffer);
|
---|
1372 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3YEAR, buffer, &bufferSize))
|
---|
1373 | {
|
---|
1374 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1375 |
|
---|
1376 | /* Save the ID3 tag into the file */
|
---|
1377 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_YEAR) && bufferSize==4+1)
|
---|
1378 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1379 | truncated to the allowed length of the ID3 tag. */
|
---|
1380 | _cwmmSetId3TagValue(somSelf, buffer, IDINFO_YEAR);
|
---|
1381 | #if 0
|
---|
1382 | /* Save the ID3 tag into the file */
|
---|
1383 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1384 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1385 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1386 | id3Tag.id3Genre[0]=0xFF;
|
---|
1387 | }
|
---|
1388 | if(bufferSize==4+1) {
|
---|
1389 | memcpy(id3Tag.id3Year, buffer, 4);
|
---|
1390 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1391 | }
|
---|
1392 | #endif
|
---|
1393 | }
|
---|
1394 | bufferSize=sizeof(buffer);
|
---|
1395 | if(_wpScanSetupString(somSelf, pszSetupString, SETUP_ID3GENRE, buffer, &bufferSize))
|
---|
1396 | {
|
---|
1397 | char id3Value[ID3TAGVALUE_BUFFER_SIZE];
|
---|
1398 |
|
---|
1399 | /* Save the ID3 tag into the file */
|
---|
1400 | if(!_cwmmQueryId3TagValue(somSelf, id3Value, IDINFO_GENRE)) {
|
---|
1401 | /* This ID3 tag value not yet set. So add it to the file. The length will be automatically
|
---|
1402 | truncated to the allowed length of the ID3 tag. */
|
---|
1403 | /* Find genre from string */
|
---|
1404 | for(a=0;a<=iGenreLast;a++)
|
---|
1405 | if(!stricmp(buffer, genreList[a]))
|
---|
1406 | break;
|
---|
1407 | if(a>iGenreLast)
|
---|
1408 | id3Value[0]=0xFF;/* No Genre inserted */
|
---|
1409 | else
|
---|
1410 | id3Value[0]=a;
|
---|
1411 | _cwmmSetId3TagValue(somSelf, id3Value, IDINFO_GENRE);
|
---|
1412 | }
|
---|
1413 | #if 0
|
---|
1414 | /* Save the ID3 tag into the file */
|
---|
1415 | if(!_cwmmQueryId3Tag(somSelf, &id3Tag)){ /* Get ID3 tag */
|
---|
1416 | memset(&id3Tag, 0,sizeof(id3Tag)); /* No tag yet, clear struct. */
|
---|
1417 | strncpy(id3Tag.id3Tag, "TAG", 3);
|
---|
1418 | id3Tag.id3Genre[0]=0xFF;
|
---|
1419 | }
|
---|
1420 | /* Find genre from string */
|
---|
1421 | for(a=0;a<=iGenreLast;a++)
|
---|
1422 | if(!stricmp(buffer, genreList[a]))
|
---|
1423 | break;
|
---|
1424 | if(a>iGenreLast)
|
---|
1425 | id3Tag.id3Genre[0]=0xFF;/* No Genre inserted */
|
---|
1426 | else
|
---|
1427 | id3Tag.id3Genre[0]=a;
|
---|
1428 | _cwmmSetId3Tag(somSelf, &id3Tag); /* This sets also the instance data */
|
---|
1429 | #endif
|
---|
1430 | }
|
---|
1431 |
|
---|
1432 | return bRc;
|
---|
1433 | }
|
---|
1434 |
|
---|
1435 |
|
---|
1436 | /*
|
---|
1437 | * The prototype for cwmp3_wpSaveState was replaced by the following prototype:
|
---|
1438 | */
|
---|
1439 | SOM_Scope BOOL SOMLINK cwmp3_wpSaveState(MMMP3 *somSelf)
|
---|
1440 | {
|
---|
1441 | char chrBuf[256];
|
---|
1442 | ULONG ulLength;
|
---|
1443 | BOOL rc;
|
---|
1444 |
|
---|
1445 | /* CWMP3Data *somThis = CWMP3GetData(somSelf); */
|
---|
1446 | MMMP3MethodDebug("MMMP3","cwmp3_wpSaveState");
|
---|
1447 |
|
---|
1448 | /* call parent first. By doing so, the MP3 type is written after the Digital Audio type.
|
---|
1449 | This way the default class the WPS picks is MMMP3 and not MMAudio. */
|
---|
1450 | rc=(MMMP3_parent_MMAudio_wpSaveState(somSelf));
|
---|
1451 |
|
---|
1452 | /* Set .TYPE EA so the editor and the player are happy. */
|
---|
1453 | strncpy(chrBuf, _wpQueryType(somSelf), sizeof(chrBuf));
|
---|
1454 | chrBuf[sizeof(chrBuf)-1]=0;
|
---|
1455 | // if(!getMessage(chrTitle, IDSTR_MP3TITLE, sizeof(chrTitle), queryModuleHandle(), HWND_DESKTOP))
|
---|
1456 | // strcpy(chrTitle, CLSTYPE_MP3);
|
---|
1457 |
|
---|
1458 | /* Look if type already set */
|
---|
1459 | if(!strstr(chrBuf,TYPE_MP3)) {
|
---|
1460 | ulLength=strlen(chrBuf);
|
---|
1461 | if(ulLength) {
|
---|
1462 | if(ulLength+2+sizeof(TYPE_MP3) < sizeof(chrBuf)) {
|
---|
1463 | strcat(chrBuf, "\n");
|
---|
1464 | strcat(chrBuf, TYPE_MP3);
|
---|
1465 | }
|
---|
1466 | }
|
---|
1467 | else
|
---|
1468 | strcpy(chrBuf, TYPE_MP3);
|
---|
1469 | }
|
---|
1470 | /* Set .TYPE EA so the editor and the player are happy. */
|
---|
1471 | _wpSetType(somSelf, chrBuf , NULL);
|
---|
1472 |
|
---|
1473 | return rc;
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | SOM_Scope HWND SOMLINK cwmp3_wpOpen(MMMP3 *somSelf, HWND hwndCnr,
|
---|
1477 | ULONG ulView, ULONG param)
|
---|
1478 | {
|
---|
1479 | ULONG ulRc;
|
---|
1480 | /* MMMP3Data *somThis = MMMP3GetData(somSelf); */
|
---|
1481 | MMMP3MethodDebug("MMMP3","cwmp3_wpOpen");
|
---|
1482 |
|
---|
1483 | switch(ulView)
|
---|
1484 | {
|
---|
1485 | case ID_MENU_PLAYER:
|
---|
1486 | /*case 0xbbe5: Player */
|
---|
1487 | {
|
---|
1488 | char chrPlayer[CCHMAXPATH]={0};
|
---|
1489 | char chrParams[CCHMAXPATH+2]="\"";
|
---|
1490 | char chrTitle[50];
|
---|
1491 | char *chrPtr=chrParams;
|
---|
1492 | ULONG ulSize;
|
---|
1493 |
|
---|
1494 | if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "mp3player", NULLHANDLE, chrPlayer,sizeof(chrPlayer)))
|
---|
1495 | break; /* Fall back to MMAudio player */
|
---|
1496 |
|
---|
1497 | chrPtr++;
|
---|
1498 | ulSize=sizeof(chrParams)-2;
|
---|
1499 | _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
|
---|
1500 | strcat(chrPtr,"\"");
|
---|
1501 |
|
---|
1502 | if(!getMessage(chrTitle, IDSTR_AUDPLAYERTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
|
---|
1503 | strcpy(chrTitle, "Player");
|
---|
1504 |
|
---|
1505 | if((ulRc=launchPMProg(chrTitle, chrPlayer, chrParams, somSelf, ulView))==NULLHANDLE) {
|
---|
1506 | break;
|
---|
1507 | }
|
---|
1508 | return NULLHANDLE;
|
---|
1509 | }
|
---|
1510 | case ID_MENU_EDITOR:
|
---|
1511 | /* case 0xbc0d: Editor */
|
---|
1512 | {
|
---|
1513 | char chrPlayer[CCHMAXPATH]={0};
|
---|
1514 | char chrParams[CCHMAXPATH+10]={0};
|
---|
1515 | char chrTitle[50];
|
---|
1516 | char *chrPtr=chrParams;
|
---|
1517 | ULONG ulSize;
|
---|
1518 |
|
---|
1519 | if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "mp3editor", NULLHANDLE, chrPlayer,sizeof(chrPlayer)))
|
---|
1520 | break; /* Fall back to MMAudio editor */
|
---|
1521 |
|
---|
1522 | chrPtr+=4;
|
---|
1523 | ulSize=sizeof(chrParams)-2;
|
---|
1524 | _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
|
---|
1525 | strcat(chrPtr,"\"");
|
---|
1526 |
|
---|
1527 | if(!getMessage(chrTitle, IDSTR_AUDEDITORTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
|
---|
1528 | strcpy(chrTitle, "Editor");
|
---|
1529 |
|
---|
1530 | if((ulRc=launchPMProg( chrTitle, chrPlayer, chrParams, somSelf, ulView))==NULLHANDLE) {
|
---|
1531 | break;
|
---|
1532 | }
|
---|
1533 | return NULLHANDLE;
|
---|
1534 | }
|
---|
1535 | default:
|
---|
1536 | break;
|
---|
1537 | }
|
---|
1538 |
|
---|
1539 | return (MMMP3_parent_MMAudio_wpOpen(somSelf, hwndCnr, ulView,
|
---|
1540 | param));
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 |
|
---|
1544 | /*
|
---|
1545 | * The prototype for cwmp3M_wpclsQueryTitle was replaced by the following prototype:
|
---|
1546 | */
|
---|
1547 | SOM_Scope PSZ SOMLINK cwmp3M_wpclsQueryTitle(M_MMMP3 *somSelf)
|
---|
1548 | {
|
---|
1549 | static char chrTitle[20]={0};
|
---|
1550 | /* M_CWMP3Data *somThis = M_CWMP3GetData(somSelf); */
|
---|
1551 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsQueryTitle");
|
---|
1552 |
|
---|
1553 | if(chrTitle[0]==0)
|
---|
1554 | if(!getMessage(chrTitle, IDSTR_MP3TITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
|
---|
1555 | strcpy(chrTitle,"MP3Audio.MP3");
|
---|
1556 |
|
---|
1557 | return chrTitle;
|
---|
1558 | }
|
---|
1559 |
|
---|
1560 | /*
|
---|
1561 | * The prototype for cwmp3M_wpclsQueryInstanceType was replaced by the following prototype:
|
---|
1562 | */
|
---|
1563 | SOM_Scope PSZ SOMLINK cwmp3M_wpclsQueryInstanceType(M_MMMP3 *somSelf)
|
---|
1564 | {
|
---|
1565 | /* M_CWMP3Data *somThis = M_CWMP3GetData(somSelf); */
|
---|
1566 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsQueryInstanceType");
|
---|
1567 |
|
---|
1568 | return TYPE_MP3;//"MP3";
|
---|
1569 | }
|
---|
1570 |
|
---|
1571 | #if 0
|
---|
1572 | char* _cwmmGetExtFromIni(M_MMMP3 *somSelf, const PSZ pszDefaultExt)
|
---|
1573 | {
|
---|
1574 | char chrKey[10];
|
---|
1575 | ULONG ulLength;
|
---|
1576 | pByte pByte;
|
---|
1577 |
|
---|
1578 | sprintf(chrKey, "%sExt", pszDefaultExt);
|
---|
1579 |
|
---|
1580 | if(!PrfQueryProfileSize(HINI_USERPROFILE, "CWMM", chrKey, NULL, &ulLength))
|
---|
1581 | return NULLHANDLE;
|
---|
1582 |
|
---|
1583 | pByte=_ wpAllocMem
|
---|
1584 | if(PrfQueryProfileString(HINI_USERPROFILE, "CWMM", chrKey, NULL, ))
|
---|
1585 | {
|
---|
1586 | /* Key found */
|
---|
1587 |
|
---|
1588 | }
|
---|
1589 | }
|
---|
1590 | #endif
|
---|
1591 |
|
---|
1592 | /*
|
---|
1593 | * The prototype for cwmp3M_wpclsQueryInstanceFilter was replaced by the following prototype:
|
---|
1594 | */
|
---|
1595 | SOM_Scope PSZ SOMLINK cwmp3M_wpclsQueryInstanceFilter(M_MMMP3 *somSelf)
|
---|
1596 | {
|
---|
1597 | // static char* chrExt;
|
---|
1598 | /* M_CWMP3Data *somThis = M_CWMP3GetData(somSelf); */
|
---|
1599 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsQueryInstanceFilter");
|
---|
1600 |
|
---|
1601 | return "*.MP3,*.*.MP3,*.*.*.MP3";
|
---|
1602 |
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | /*
|
---|
1606 | * The prototype for cwmp3M_wpclsQueryIconData was replaced by the following prototype:
|
---|
1607 | */
|
---|
1608 | SOM_Scope ULONG SOMLINK cwmp3M_wpclsQueryIconData(M_MMMP3 *somSelf,
|
---|
1609 | PICONINFO pIconInfo)
|
---|
1610 | {
|
---|
1611 | HMODULE hmod;
|
---|
1612 | /* M_CWMP3Data *somThis = M_CWMP3GetData(somSelf); */
|
---|
1613 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsQueryIconData");
|
---|
1614 |
|
---|
1615 | hmod=queryModuleHandle();
|
---|
1616 | if(!hmod)
|
---|
1617 | return M_MMMP3_parent_M_MMAudio_wpclsQueryIconData(somSelf, pIconInfo);
|
---|
1618 |
|
---|
1619 | if (pIconInfo) {
|
---|
1620 | pIconInfo->fFormat = ICON_RESOURCE;
|
---|
1621 | pIconInfo->hmod = hmod;
|
---|
1622 | pIconInfo->resid = ID_ICONMP3FILE;
|
---|
1623 | } /* endif */
|
---|
1624 |
|
---|
1625 | return ( sizeof(ICONINFO) );
|
---|
1626 | }
|
---|
1627 |
|
---|
1628 |
|
---|
1629 | ULONG _getISOCp(void)
|
---|
1630 | {
|
---|
1631 | ULONG ulData;
|
---|
1632 | ULONG ulNumCp;
|
---|
1633 |
|
---|
1634 | /* Get number of codepages */
|
---|
1635 | if((ulNumCp=WinQueryCpList(WinQueryAnchorBlock(HWND_DESKTOP), 1, &ulData))!=0) {
|
---|
1636 | ULONG *ulCpList;
|
---|
1637 |
|
---|
1638 | /* Get memory for codepage list */
|
---|
1639 | ulCpList=(ULONG*)malloc(ulNumCp*sizeof(ULONG));
|
---|
1640 | if(ulCpList) {
|
---|
1641 | int a;
|
---|
1642 | /* Get codepage list */
|
---|
1643 | if((ulNumCp=WinQueryCpList(WinQueryAnchorBlock(HWND_DESKTOP), ulNumCp, ulCpList))!=0) {
|
---|
1644 | for(a=0;a<ulNumCp;a++)
|
---|
1645 | {
|
---|
1646 | if(ulCpList[a]==819) {
|
---|
1647 | free(ulCpList);
|
---|
1648 | return (ULONG) 819;/* The IBM ISO 8859-1 CP */
|
---|
1649 | }
|
---|
1650 | }
|
---|
1651 | /* ISO 8859-1 CP not found. Try to find 1004 (Windows extended) which is a quite good match */
|
---|
1652 | for(a=0;a<ulNumCp;a++)
|
---|
1653 | {
|
---|
1654 | if(ulCpList[a]==1004) {
|
---|
1655 | free(ulCpList);
|
---|
1656 | return (ULONG) 1004;/* The IBM ISO 8859-1 CP */
|
---|
1657 | }
|
---|
1658 | }
|
---|
1659 | }
|
---|
1660 | free(ulCpList);
|
---|
1661 | }
|
---|
1662 | }
|
---|
1663 | /* No CP found or an error occured */
|
---|
1664 | return 0;
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 | /*
|
---|
1668 | * The prototype for cwmp3M_wpclsInitData was replaced by the following prototype:
|
---|
1669 | */
|
---|
1670 | SOM_Scope void SOMLINK cwmp3M_wpclsInitData(M_MMMP3 *somSelf)
|
---|
1671 | {
|
---|
1672 | ULONG ulCp[4];
|
---|
1673 | ULONG ulInfoLen=0;
|
---|
1674 |
|
---|
1675 | M_MMMP3Data *somThis = M_MMMP3GetData(somSelf);
|
---|
1676 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsInitData");
|
---|
1677 |
|
---|
1678 | M_MMMP3_parent_M_MMAudio_wpclsInitData(somSelf);
|
---|
1679 |
|
---|
1680 | /* Get system codepage */
|
---|
1681 | if(DosQueryCp(sizeof(ulCp), ulCp,&ulInfoLen)!=NO_ERROR) {
|
---|
1682 | _ulCodePage=0;/* Indicate some error */
|
---|
1683 | }
|
---|
1684 | else
|
---|
1685 | _ulCodePage=ulCp[0];
|
---|
1686 |
|
---|
1687 | /* Get ISO codepage */
|
---|
1688 | _ulIsoCodePage=_getISOCp();
|
---|
1689 |
|
---|
1690 |
|
---|
1691 | #if 0
|
---|
1692 | pszMp3ColTitles[0]=chrTrackName;
|
---|
1693 | pszMp3ColTitles[1]=chrArtist;
|
---|
1694 | pszMp3ColTitles[2]=chrAlbum;
|
---|
1695 | pszMp3ColTitles[3]=chrYear;
|
---|
1696 | pszMp3ColTitles[4]=chrComment;
|
---|
1697 | pszMp3ColTitles[5]=chrGenre;
|
---|
1698 |
|
---|
1699 | /* Setup the static data for the details view */
|
---|
1700 | for(i=0,pCfi=cfiMp3FieldInfo;i<NUM_MP3_FIELDS;i++,pCfi++)
|
---|
1701 | {
|
---|
1702 | memset((PCH)pCfi,0,sizeof(CLASSFIELDINFO));
|
---|
1703 |
|
---|
1704 | pCfi->cb=sizeof(CLASSFIELDINFO);
|
---|
1705 | pCfi->flData=CFA_LEFT|CFA_SEPARATOR|CFA_FIREADONLY;
|
---|
1706 | pCfi->flTitle=CFA_CENTER|CFA_SEPARATOR|CFA_HORZSEPARATOR|CFA_STRING|CFA_FITITLEREADONLY;
|
---|
1707 | pCfi->pNextFieldInfo=pCfi+1;
|
---|
1708 | pCfi->pTitleData=(PVOID)pszMp3ColTitles[i];
|
---|
1709 | pCfi->flCompare=COMPARE_SUPPORTED|SORTBY_SUPPORTED;
|
---|
1710 |
|
---|
1711 | switch(i)
|
---|
1712 | {
|
---|
1713 | case 0:
|
---|
1714 | pCfi->flData|=CFA_STRING;
|
---|
1715 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszTrackName));
|
---|
1716 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1717 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1718 | break;
|
---|
1719 | case 1:
|
---|
1720 | pCfi->flData|=CFA_STRING;
|
---|
1721 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszArtist));
|
---|
1722 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1723 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1724 | // WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, pszMp3ColTitles[i], pCfi->pTitleData,1234, MB_MOVEABLE|MB_OK);
|
---|
1725 | break;
|
---|
1726 | case 2:
|
---|
1727 | pCfi->flData|=CFA_STRING;
|
---|
1728 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszAlbum));
|
---|
1729 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1730 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1731 | break;
|
---|
1732 | case 3: /* CC */
|
---|
1733 | pCfi->flData|=CFA_STRING;
|
---|
1734 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszYear));
|
---|
1735 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1736 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1737 | break;
|
---|
1738 | case 4:
|
---|
1739 | pCfi->flData|=CFA_STRING;
|
---|
1740 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszComment));
|
---|
1741 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1742 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1743 | break;
|
---|
1744 | case 5:
|
---|
1745 | pCfi->flData|=CFA_STRING;
|
---|
1746 | pCfi->offFieldData=(ULONG)(FIELDOFFSETUL(MP3DETAILS,pszGenre));
|
---|
1747 | pCfi->ulLenFieldData=sizeof(PSZ);
|
---|
1748 | pCfi->DefaultComparison=CMP_EQUAL;
|
---|
1749 | break;
|
---|
1750 | }/* switch(i) */
|
---|
1751 | }/* for() */
|
---|
1752 | cfiMp3FieldInfo[NUM_MP3_FIELDS-1].pNextFieldInfo=NULL;
|
---|
1753 | #endif
|
---|
1754 |
|
---|
1755 | }
|
---|
1756 |
|
---|
1757 | /*
|
---|
1758 | * The prototype for cwmp3M_wpclsQueryDefaultHelp was replaced by the following prototype:
|
---|
1759 | */
|
---|
1760 | SOM_Scope BOOL SOMLINK cwmp3M_wpclsQueryDefaultHelp(M_MMMP3 *somSelf,
|
---|
1761 | PULONG pHelpPanelId,
|
---|
1762 | PSZ pszHelpLibrary)
|
---|
1763 | {
|
---|
1764 | PSZ pszHelpLibName;
|
---|
1765 |
|
---|
1766 | /* M_CWMP3Data *somThis = M_CWMP3GetData(somSelf); */
|
---|
1767 | M_MMMP3MethodDebug("M_MMMP3","cwmp3M_wpclsQueryDefaultHelp");
|
---|
1768 |
|
---|
1769 | if((pszHelpLibName=_queryMp3HelpLibraryName())!=NULLHANDLE)
|
---|
1770 | {
|
---|
1771 | if(pHelpPanelId)
|
---|
1772 | *pHelpPanelId=MP3FILE_HELP_PANEL;
|
---|
1773 | if(pszHelpLibrary)
|
---|
1774 | strncpy(pszHelpLibrary, pszHelpLibName, CCHMAXPATH);
|
---|
1775 | return TRUE;
|
---|
1776 | }
|
---|
1777 |
|
---|
1778 | return (M_MMMP3_parent_M_MMAudio_wpclsQueryDefaultHelp(somSelf,
|
---|
1779 | pHelpPanelId,
|
---|
1780 | pszHelpLibrary));
|
---|
1781 | }
|
---|
1782 |
|
---|
1783 |
|
---|