Changeset 254


Ignore:
Timestamp:
03/29/07 15:42:31 (18 years ago)
Author:
r2d
Message:
  • tag writing OK
  • better tag reading
  • maybe less pb with x64
Location:
winamp-musepack/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • winamp-musepack/trunk/mpc_player.cpp

    r253 r254  
    2929#include <mpc/minimax.h>
    3030
    31 #include <taglib/tag.h>
    32 #include <taglib/tfile.h>
    33 
     31#include <tag.h>
     32#include <tfile.h>
     33
     34const char* mpc_player::GenreList [NO_GENRES] = {
     35    "", "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
     36    "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies",
     37    "Other", "Pop", "R&B", "Rap", "Reggae", "Rock",
     38    "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks",
     39    "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
     40    "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House",
     41    "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass",
     42    "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock",
     43    "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk",
     44    "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
     45    "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
     46    "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
     47    "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical",
     48    "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing",
     49    "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
     50    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band",
     51    "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson",
     52    "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
     53    "Po""rn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
     54    "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
     55    "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall",
     56    "Goa", "Drum & Bass", "Club House", "Ha""rd""co""re", "Terror",
     57    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat",
     58    "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
     59    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
     60    "SynthPop",
     61};
    3462
    3563mpc_player::mpc_player(In_Module * in_mod)
     
    5886        wait_event = 0;
    5987        tag_file = 0;
     88       
     89        TagLib::FileRef fileRef;
     90        fileRef.file()->useWinAnsiCP(true);
    6091}
    6192
     
    189220        if (length_in_ms) *length_in_ms = getLength();
    190221        if (title) {
    191                 if(tag_file == 0) {
     222                if (tag_file == 0)
    192223                        tag_file = new TagLib::FileRef(lastfn, false);
    193                         (tag_file->file())->useWinAnsiCP(true);
    194                 }
    195224
    196225                if (tag_file->isNull() || !tag_file->tag()) {
     
    201230                        TagLib::Tag *tag = tag_file->tag();
    202231                        sprintf(title, "%s - %s", tag->artist().toCString(), tag->title().toCString());
    203                         //tag->artist()
    204                         //tag->album()
    205                         //tag->year()
    206                         //tag->comment()
    207                         //tag->track()
    208                         //tag->genre()
    209232                }
    210233        }
     
    281304                TagLib::Tag *tag = tag_file->tag();
    282305
    283                 //tag->setTitle(wch);
    284                 //tag->setArtist(wch);
    285                 //tag->setAlbum(wch);
    286 
    287                 //TagLib::String year(wch);
    288                 //tag->setYear(year.toInt());
    289 
    290                 //TagLib::String track(wch);
    291                 //tag->setTrack(track.toInt());
    292 
    293                 //tag->setGenre(wch);
    294                 //tag->setComment(wch);
    295 
    296                 tag_file->save(); // FIXME : make all crash
     306                WCHAR buf[2048];
     307
     308                GetDlgItemTextW(hDlg, IDC_TITLE, buf, 2048);
     309                tag->setTitle(buf);
     310                GetDlgItemTextW(hDlg, IDC_ARTIST, buf, 2048);
     311                tag->setArtist(buf);
     312                GetDlgItemTextW(hDlg, IDC_ALBUM, buf, 2048);
     313                tag->setAlbum(buf);
     314                GetDlgItemTextW(hDlg, IDC_YEAR, buf, 2048);
     315                TagLib::String year(buf);
     316                tag->setYear(year.toInt());
     317                GetDlgItemTextW(hDlg, IDC_TRACK, buf, 2048);
     318                TagLib::String track(buf);
     319                tag->setTrack(track.toInt());
     320                GetDlgItemTextW(hDlg, IDC_GENRE, buf, 2048);
     321                tag->setGenre(buf);
     322                GetDlgItemTextW(hDlg, IDC_COMMENT, buf, 2048);
     323                tag->setComment(buf);
     324
     325                tag_file->save();
    297326        }
    298327}
     
    324353        SetDlgItemText(hDlg, IDC_STREAM_INFO, tmp.str().c_str());
    325354
    326         if(tag_file == 0) {
     355        SetDlgItemText(hDlg, IDC_FILE, lastfn);
     356
     357        if (tag_file == 0)
    327358                tag_file = new TagLib::FileRef(lastfn, false);
    328                 (tag_file->file())->useWinAnsiCP(true);
    329         }
    330359
    331360        if (!tag_file->isNull() && tag_file->tag()) {
     
    350379                SetDlgItemTextW(hDlg, IDC_COMMENT, buf);
    351380        }
     381
     382        HWND hGenre = GetDlgItem ( hDlg, IDC_GENRE );
     383        for ( int n = 0; n < NO_GENRES; n++ )
     384        SendMessage ( hGenre, CB_ADDSTRING, 0, (LONG)(LPSTR)GenreList[n] );
    352385}
    353386
     
    358391        {
    359392        case WM_INITDIALOG:
    360                 SetWindowLong(hDlg, DWL_USER, lParam);
     393                SetWindowLongPtr(hDlg, DWLP_USER, lParam);
    361394                ((mpc_player *) lParam)->initDlg(hDlg);
    362395                return TRUE;
     
    367400                        return TRUE;
    368401                } else if (LOWORD(wParam) == IDC_RELOAD) {
    369                         // FIXME : this will not work on X64
    370                         ((mpc_player*)GetWindowLong(hDlg, DWL_USER))->initDlg(hDlg);
     402                        ((mpc_player*)GetWindowLongPtr(hDlg, DWLP_USER))->initDlg(hDlg);
    371403                } else if (LOWORD(wParam) == IDC_SAVE) {
    372                         ((mpc_player*)GetWindowLong(hDlg, DWL_USER))->writeTags(hDlg);
     404                        ((mpc_player*)GetWindowLongPtr(hDlg, DWLP_USER))->writeTags(hDlg);
    373405                        EndDialog(hDlg, LOWORD(wParam));
    374406                        return TRUE;
     
    382414{
    383415        DialogBoxParam(mod->hDllInstance, (LPCTSTR)IDD_INFO_BOX, hwnd, (DLGPROC)About, (LPARAM) this);
    384 
    385         //loadTags(% infoBox);
    386 
    387         //infoBox.ShowDialog();
    388416        return 0;
    389417}
  • winamp-musepack/trunk/mpc_player.h

    r250 r254  
    2121
    2222#include <mpc/mpcdec.h>
    23 #include <taglib/fileref.h>
     23#include <fileref.h>
    2424
    2525// post this to the main window at end of file (after playback as stopped)
    2626#define WM_WA_EOF WM_USER+2
    2727
     28#define NO_GENRES 149
    2829
    2930class mpc_player
     
    5152private:
    5253        char lastfn[MAX_PATH];  // currently playing file (used for getting info on the current file)
     54        static const char* GenreList[NO_GENRES];
    5355        mpc_streaminfo si;
    5456        mpc_reader reader;
  • winamp-musepack/trunk/resource.h

    r250 r254  
    1010#define IDC_GENRE                       1004
    1111#define IDC_ALBUM                       1005
    12 #define IDC_BUTTON1                     1006
    1312#define IDC_CANCEL                      1006
    1413#define IDC_YEAR                        1007
     
    1716#define IDC_TRACK                       1010
    1817#define IDC_COMMENT                     1011
     18#define IDC_EDIT1                       1012
     19#define IDC_FILE                        1012
    1920#define IDC_STATIC                      -1
    2021
     
    2526#define _APS_NEXT_RESOURCE_VALUE        102
    2627#define _APS_NEXT_COMMAND_VALUE         40001
    27 #define _APS_NEXT_CONTROL_VALUE         1007
     28#define _APS_NEXT_CONTROL_VALUE         1013
    2829#define _APS_NEXT_SYMED_VALUE           101
    2930#endif
  • winamp-musepack/trunk/winamp-musepack.rc

    r250 r254  
    5757//
    5858
    59 IDD_INFO_BOX DIALOGEX 0, 0, 406, 186
     59IDD_INFO_BOX DIALOGEX 0, 0, 406, 202
    6060STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
    6161CAPTION "Musepack file information"
    6262FONT 8, "MS Shell Dlg", 0, 0, 0x0
    6363BEGIN
    64     GROUPBOX        "Stream",IDC_STATIC,264,0,138,180,BS_FLAT
    65     LTEXT           "C'est juste un test.\nPour voir si tout va bien.",
    66                     IDC_STREAM_INFO,270,11,126,163
    67     GROUPBOX        "Tag",IDC_STATIC,6,0,252,180,BS_FLAT
    68     EDITTEXT        IDC_TITLE,54,12,198,12,ES_AUTOHSCROLL
    69     RTEXT           "Title",IDC_STATIC,12,14,36,8
    70     EDITTEXT        IDC_ARTIST,54,30,198,12,ES_AUTOHSCROLL
    71     RTEXT           "Artist",IDC_STATIC,12,32,36,8
    72     EDITTEXT        IDC_ALBUM,54,48,198,12,ES_AUTOHSCROLL
    73     RTEXT           "Album",IDC_STATIC,12,50,36,8
    74     EDITTEXT        IDC_YEAR,54,66,42,12,ES_AUTOHSCROLL | ES_NUMBER
    75     RTEXT           "Year",IDC_STATIC,12,68,36,8
    76     EDITTEXT        IDC_TRACK,228,66,24,12,ES_AUTOHSCROLL | ES_NUMBER
    77     RTEXT           "Track",IDC_STATIC,162,68,60,8
    78     COMBOBOX        IDC_GENRE,54,84,198,18,CBS_DROPDOWN | CBS_SORT |
     64    GROUPBOX        "Stream",IDC_STATIC,264,18,138,180,BS_FLAT
     65    LTEXT           "",IDC_STREAM_INFO,270,29,126,163
     66    GROUPBOX        "Tag",IDC_STATIC,6,18,252,180,BS_FLAT
     67    EDITTEXT        IDC_TITLE,54,30,198,12,ES_AUTOHSCROLL
     68    RTEXT           "Title",IDC_STATIC,12,32,36,8
     69    EDITTEXT        IDC_ARTIST,54,48,198,12,ES_AUTOHSCROLL
     70    RTEXT           "Artist",IDC_STATIC,12,50,36,8
     71    EDITTEXT        IDC_ALBUM,54,66,198,12,ES_AUTOHSCROLL
     72    RTEXT           "Album",IDC_STATIC,12,68,36,8
     73    EDITTEXT        IDC_YEAR,54,84,42,12,ES_AUTOHSCROLL | ES_NUMBER
     74    RTEXT           "Year",IDC_STATIC,12,86,36,8
     75    EDITTEXT        IDC_TRACK,228,84,24,12,ES_AUTOHSCROLL | ES_NUMBER
     76    RTEXT           "Track",IDC_STATIC,162,86,60,8
     77    COMBOBOX        IDC_GENRE,54,102,198,18,CBS_DROPDOWN | CBS_SORT |
    7978                    WS_VSCROLL | WS_TABSTOP
    80     RTEXT           "Genre",IDC_STATIC,12,86,36,8
    81     EDITTEXT        IDC_COMMENT,54,102,198,54,ES_MULTILINE | ES_AUTOHSCROLL
    82     RTEXT           "Comment",IDC_STATIC,12,104,36,8
    83     PUSHBUTTON      "Cancel",IDC_CANCEL,186,162,66,12
    84     PUSHBUTTON      "Reload",IDC_RELOAD,99,162,66,12
    85     PUSHBUTTON      "Save",IDC_SAVE,12,162,66,12
     79    RTEXT           "Genre",IDC_STATIC,12,104,36,8
     80    EDITTEXT        IDC_COMMENT,54,120,198,54,ES_MULTILINE | ES_AUTOHSCROLL
     81    RTEXT           "Comment",IDC_STATIC,12,122,36,8
     82    PUSHBUTTON      "Cancel",IDC_CANCEL,186,180,66,12
     83    PUSHBUTTON      "Reload",IDC_RELOAD,99,180,66,12
     84    PUSHBUTTON      "Save",IDC_SAVE,12,180,66,12
     85    EDITTEXT        IDC_FILE,24,6,378,12,ES_AUTOHSCROLL | ES_READONLY
     86    RTEXT           "File",IDC_STATIC,6,8,12,8
    8687END
    8788
     
    100101        RIGHTMARGIN, 399
    101102        TOPMARGIN, 7
    102         BOTTOMMARGIN, 179
     103        BOTTOMMARGIN, 195
    103104    END
    104105END
  • winamp-musepack/trunk/winamp-musepack.vcproj

    r249 r254  
    2121                                Name="VCCLCompilerTool"
    2222                                Optimization="0"
    23                                 AdditionalIncludeDirectories="&quot;C:\Program Files\taglib\include&quot;;&quot;$(SolutionDir)\..\libmpc\include&quot;"
     23                                AdditionalIncludeDirectories="&quot;C:\Program Files\taglib\include\taglib&quot;;&quot;$(SolutionDir)\..\libmpc\include&quot;"
    2424                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WINAMPMUSEPACK_EXPORTS"
    2525                                MinimalRebuild="TRUE"
     
    7272                        <Tool
    7373                                Name="VCCLCompilerTool"
    74                                 AdditionalIncludeDirectories="&quot;C:\Program Files\taglib\include&quot;;&quot;$(SolutionDir)\..\libmpc\include&quot;"
     74                                AdditionalIncludeDirectories="&quot;C:\Program Files\taglib\include\taglib&quot;;&quot;$(SolutionDir)\..\libmpc\include&quot;"
    7575                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WINAMPMUSEPACK_EXPORTS"
    7676                                RuntimeLibrary="2"
Note: See TracChangeset for help on using the changeset viewer.