Changeset 322 for winamp-musepack/trunk/mpc_player.cpp
- Timestamp:
- 05/11/07 14:08:16 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.