Changeset 250 for winamp-musepack/trunk/mpc_player.cpp
- Timestamp:
- 03/28/07 19:19:56 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
winamp-musepack/trunk/mpc_player.cpp
r249 r250 144 144 } 145 145 WaitForSingleObject(wait_event, 100); // give a little CPU time back to the system. 146 } else if (mod->outMod->CanWrite() >= ( MPC_FRAME_LENGTH * sizeof(short) * si.channels)*(mod->dsp_isactive()?2:1)) {146 } else if (mod->outMod->CanWrite() >= (int)((MPC_FRAME_LENGTH * sizeof(short) * si.channels)*(mod->dsp_isactive()?2:1))) { 147 147 // CanWrite() returns the number of bytes you can write, so we check that 148 148 // to the block size. the reason we multiply the block size by two if … … 255 255 // dividing by 1000 for the first parameter of setinfo makes it 256 256 // display 'H'... for hundred.. i.e. 14H Kbps. 257 mod->SetInfo( si.average_bitrate / 1000, si.sample_freq / 1000, si.channels, 1);257 mod->SetInfo((int)(si.average_bitrate / 1000), si.sample_freq / 1000, si.channels, 1); 258 258 259 259 // initialize visualization stuff … … 273 273 } 274 274 275 //void mpc_player::loadTags(mpc_info ^ infoBox) 276 //{ 277 // if(tag_file == 0) 278 // tag_file = new TagLib::FileRef(lastfn, false); 279 // 280 // if (!tag_file->isNull() && tag_file->tag()) { 281 // TagLib::Tag *tag = tag_file->tag(); 282 // infoBox->txtTitle->Text = gcnew String(tag->title().toCString(true), 0, strlen(tag->title().toCString(true)), System::Text::Encoding::UTF8); 283 // infoBox->txtArtist->Text = gcnew String(tag->artist().toCString(true), 0, strlen(tag->artist().toCString(true)), System::Text::Encoding::UTF8); 284 // infoBox->txtAlbum->Text = gcnew String(tag->album().toCString(true), 0, strlen(tag->album().toCString(true)), System::Text::Encoding::UTF8); 285 // infoBox->txtYear->Text = ""; 286 // infoBox->txtYear->Text += tag->year(); 287 // infoBox->txtTrack->Text = ""; 288 // infoBox->txtTrack->Text += tag->track(); 289 // infoBox->comboGenre->Text = gcnew String(tag->genre().toCString(true), 0, strlen(tag->genre().toCString(true)), System::Text::Encoding::UTF8); 290 // infoBox->txtComment->Text = gcnew String(tag->comment().toCString(true), 0, strlen(tag->comment().toCString(true)), System::Text::Encoding::UTF8); 291 // } 292 //} 293 294 //void mpc_player::writeTags(mpc_info ^ infoBox) 295 //{ 296 // if (!tag_file->isNull() && tag_file->tag()) { 297 // TagLib::Tag *tag = tag_file->tag(); 298 // 299 // pin_ptr<const wchar_t> wch = PtrToStringChars(infoBox->txtTitle->Text); 300 // tag->setTitle(wch); 301 // 302 // wch = PtrToStringChars(infoBox->txtArtist->Text); 303 // tag->setArtist(wch); 304 // 305 // wch = PtrToStringChars(infoBox->txtAlbum->Text); 306 // tag->setAlbum(wch); 307 // 308 // wch = PtrToStringChars(infoBox->txtYear->Text); 309 // TagLib::String year(wch); 310 // tag->setYear(year.toInt()); 311 // 312 // wch = PtrToStringChars(infoBox->txtTrack->Text); 313 // TagLib::String track(wch); 314 // tag->setTrack(track.toInt()); 315 // 316 // wch = PtrToStringChars(infoBox->comboGenre->Text); 317 // tag->setGenre(wch); 318 // 319 // wch = PtrToStringChars(infoBox->txtComment->Text); 320 // tag->setComment(wch); 321 // 322 // tag_file->save(); // FIXME : make all crash 323 // } 324 //} 275 void mpc_player::writeTags(HWND hDlg) 276 { 277 if (!tag_file->isNull() && tag_file->tag()) { 278 TagLib::Tag *tag = tag_file->tag(); 279 280 //tag->setTitle(wch); 281 //tag->setArtist(wch); 282 //tag->setAlbum(wch); 283 284 //TagLib::String year(wch); 285 //tag->setYear(year.toInt()); 286 287 //TagLib::String track(wch); 288 //tag->setTrack(track.toInt()); 289 290 //tag->setGenre(wch); 291 //tag->setComment(wch); 292 293 tag_file->save(); // FIXME : make all crash 294 } 295 } 325 296 326 297 void mpc_player::initDlg(HWND hDlg) … … 328 299 std::ostringstream tmp; 329 300 330 tmp << "Streamversion "; 331 tmp << si.stream_version; 332 tmp << "\nEncoder : "; 333 tmp << si.encoder; 334 tmp << "\nProfile : "; 335 tmp << si.profile_name; 301 tmp << "Streamversion " << si.stream_version; 302 tmp << "\nEncoder : " << si.encoder; 303 tmp << "\nProfile : " << si.profile_name; 336 304 tmp << "\nPNS : "; 337 305 if (si.pns) tmp << "on"; … … 340 308 if (si.is_true_gapless) tmp << "on"; 341 309 else tmp << "off"; 342 tmp << "\nAverage bitrate : "; 343 tmp << floor(si.average_bitrate * 1.e-3 + .5); 344 tmp << " Kbps \nSamplerate : "; 345 tmp << si.sample_freq; 346 tmp << "\nChannels : "; 347 tmp << si.channels; 348 tmp << "\nFile size : "; 349 tmp << si.total_file_length; 350 tmp << " Bytes"; 351 //// FIXME : add replay gain info 310 tmp << "\nAverage bitrate : " << floor(si.average_bitrate * 1.e-3 + .5) << " Kbps"; 311 tmp << "\nSamplerate : " << si.sample_freq; 312 tmp << "\nChannels : " << si.channels; 313 tmp << "\nFile size : " << si.total_file_length << " Bytes"; 314 //// FIXME : add replay gain info, lenth (min:sec), sample number 352 315 353 316 SetDlgItemText(hDlg, IDC_STREAM_INFO, tmp.str().c_str()); 317 318 if(tag_file == 0) 319 tag_file = new TagLib::FileRef(lastfn, false); 320 321 if (!tag_file->isNull() && tag_file->tag()) { 322 TagLib::Tag *tag = tag_file->tag(); 323 SetDlgItemText(hDlg, IDC_TITLE, tag->title().toCString(true)); 324 SetDlgItemText(hDlg, IDC_ARTIST, tag->artist().toCString(true)); 325 SetDlgItemText(hDlg, IDC_ALBUM, tag->album().toCString(true)); 326 tmp.str(""); 327 tmp << tag->year(); 328 SetDlgItemText(hDlg, IDC_YEAR, tmp.str().c_str()); 329 tmp.str(""); 330 tmp << tag->track(); 331 SetDlgItemText(hDlg, IDC_TRACK, tmp.str().c_str()); 332 SetDlgItemText(hDlg, IDC_GENRE, tag->genre().toCString(true)); 333 SetDlgItemText(hDlg, IDC_COMMENT, tag->comment().toCString(true)); 334 } 354 335 } 355 336 … … 360 341 { 361 342 case WM_INITDIALOG: 343 SetWindowLong(hDlg, DWL_USER, lParam); 362 344 ((mpc_player *) lParam)->initDlg(hDlg); 363 345 return TRUE; 364 346 365 347 case WM_COMMAND: 366 if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) 367 { 348 if (LOWORD(wParam) == IDC_CANCEL || LOWORD(wParam) == IDCANCEL) { 349 EndDialog(hDlg, LOWORD(wParam)); 350 return TRUE; 351 } else if (LOWORD(wParam) == IDC_RELOAD) { 352 // FIXME : this will not work on X64 353 ((mpc_player*)GetWindowLong(hDlg, DWL_USER))->initDlg(hDlg); 354 } else if (LOWORD(wParam) == IDC_SAVE) { 355 ((mpc_player*)GetWindowLong(hDlg, DWL_USER))->writeTags(hDlg); 368 356 EndDialog(hDlg, LOWORD(wParam)); 369 357 return TRUE;
Note: See TracChangeset
for help on using the changeset viewer.