Changeset 322
- Timestamp:
- 05/11/07 14:08:16 (18 years ago)
- Location:
- winamp-musepack/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
winamp-musepack/trunk/in_mpc.cpp
r248 r322 1 1 /* 2 Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>2 Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net> 3 3 This file is part of the Musepack Winamp plugin. 4 4 … … 48 48 49 49 mpc_player * player; 50 mpc_player * player_ext; 50 51 51 52 // module definition. … … 93 94 void config(HWND hwndParent) 94 95 { 95 MessageBoxA(hwndParent, " No configuration yet", "Configuration", MB_OK);96 MessageBoxA(hwndParent, "Do you really need a configuration ?", "Musepack Configuration", MB_OK); 96 97 } 97 98 void about(HWND hwndParent) 98 99 { 99 MessageBoxA(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI", "Uh ?", MB_OK); 100 if (MessageBoxA(hwndParent,"Musepack plugin for winamp\nAll bugs © Nicolas BOTTI\n\nDo you want to go to http://www.musepack.net ?", "Uh ?", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) 101 ShellExecute( hwndParent, "open", "http://www.musepack.net", NULL, NULL, SW_NORMAL); 100 102 } 101 103 … … 225 227 } 226 228 227 } 229 __declspec( dllexport ) int winampGetExtendedFileInfo(const char *fn, const char *data, char *dest, int destlen ) 230 { 231 if ( !fn || (fn && !fn[0]) ) return 0; 232 233 if (player_ext == 0) 234 player_ext = new mpc_player(fn, 0); 235 else 236 player_ext->openFile(fn); 237 238 dest[0] = 0; 239 240 return player_ext->getExtendedFileInfo(data, dest, destlen); 241 } 242 243 } -
winamp-musepack/trunk/mpc_player.cpp
r283 r322 1 1 /* 2 Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>2 Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net> 3 3 This file is part of the Musepack Winamp plugin. 4 4 … … 20 20 #include <windows.h> 21 21 #include <math.h> 22 #include <strsafe.h> 22 23 23 24 #include <sstream> … … 66 67 } 67 68 68 mpc_player::mpc_player(c har * fn, In_Module * in_mod)69 mpc_player::mpc_player(const char * fn, In_Module * in_mod) 69 70 { 70 71 init(in_mod); … … 92 93 } 93 94 94 int mpc_player::openFile(char * fn) 95 { 95 int mpc_player::openFile(const char * fn) 96 { 97 if (strcmp(fn, lastfn) == 0) 98 return 0; 99 96 100 closeFile(); 97 101 … … 425 429 return 0; 426 430 } 431 432 int mpc_player::getExtendedFileInfo(const char *data, char *dest, int destlen ) 433 { 434 if (!stricmp(data, "length")) { 435 StringCchPrintfA(dest, destlen, "%u", getLength()); 436 } else if (!stricmp(data, "bitrate")) { 437 StringCchPrintfA(dest, destlen, "%u", (unsigned int)(si.average_bitrate/1000.)); 438 } else if (!stricmp(data, "replaygain_album_gain")) { 439 if (si.gain_album) 440 StringCchPrintfA(dest, destlen, "%-+.2f dB", 64.82f - si.gain_album / 256.f); 441 } else if (!stricmp(data, "replaygain_album_peak")) { 442 if (si.peak_album) 443 StringCchPrintfA(dest, destlen, "%-.9f", (float)((1 << 15) / pow(10, si.peak_album / (20 * 256)))); 444 } else if (!stricmp(data, "replaygain_track_gain")) { 445 if (si.gain_title) 446 StringCchPrintfA(dest, destlen, "%-+.2f dB", 64.82f - si.gain_title / 256.f); 447 } else if (!stricmp(data, "replaygain_track_peak")) { 448 if (si.peak_title) 449 StringCchPrintfA(dest, destlen, "%-.9f", (float)((1 << 15) / pow(10, si.peak_title / (20 * 256)))); 450 } else { 451 452 if (tag_file == 0) 453 tag_file = new TagLib::FileRef(lastfn, false); 454 455 if (!tag_file->isNull() && tag_file->tag()) { 456 TagLib::Tag *tag = tag_file->tag(); 457 WCHAR buf[2048]; 458 459 if (!stricmp(data, "title")) 460 MultiByteToWideChar(CP_UTF8, 0, tag->title().toCString(true), -1, buf, 2048); 461 else if (!stricmp(data, "artist")) 462 MultiByteToWideChar(CP_UTF8, 0, tag->artist().toCString(true), -1, buf, 2048); 463 else if (!stricmp(data, "album")) 464 MultiByteToWideChar(CP_UTF8, 0, tag->album().toCString(true), -1, buf, 2048); 465 else if (!stricmp(data, "comment")) 466 MultiByteToWideChar(CP_UTF8, 0, tag->comment().toCString(true), -1, buf, 2048); 467 else if (!stricmp(data, "genre")) 468 MultiByteToWideChar(CP_UTF8, 0, tag->genre().toCString(true), -1, buf, 2048); 469 else if (!stricmp(data, "trackno")) { 470 StringCchPrintfA(dest, destlen, "%u", tag->track()); 471 return 1; 472 } else if (!stricmp(data, "year")) { 473 StringCchPrintfA(dest, destlen, "%u", tag->year()); 474 return 1; 475 } 476 477 WideCharToMultiByte(CP_ACP, 0, buf, -1, dest, destlen, NULL, NULL); 478 } else 479 return 0; 480 } 481 return 1; 482 } -
winamp-musepack/trunk/mpc_player.h
r254 r322 1 1 /* 2 Copyright (C) 2006 Nicolas BOTTI <rududu at laposte.net>2 Copyright (C) 2006-2007 Nicolas BOTTI <rududu at laposte.net> 3 3 This file is part of the Musepack Winamp plugin. 4 4 … … 32 32 public: 33 33 mpc_player(In_Module * in_mod); 34 mpc_player(c har * fn, In_Module * in_mod);34 mpc_player(const char * fn, In_Module * in_mod); 35 35 ~mpc_player(void); 36 36 37 int openFile(const char * fn); 37 38 int play(char *fn); 38 39 void stop(void); 39 40 40 41 void getFileInfo(char *title, int *length_in_ms); 41 int getLength(void) {return (int)(si.samples * 1000 / si.sample_freq);} 42 int getExtendedFileInfo(const char *data, char *dest, int destlen); 43 int getLength(void) {return (int)(mpc_streaminfo_get_length(&si) * 1000);} 42 44 int getOutputTime(void) {return (int)(decode_pos_sample * 1000 / si.sample_freq);} 43 45 … … 72 74 static DWORD WINAPI runThread(void * pThis); 73 75 int decodeFile(void); 74 int openFile(char * fn);75 76 void closeFile(void); 76 77
Note: See TracChangeset
for help on using the changeset viewer.