void TrackInfoObject::parse() { // Log parsing of header information in developer mode. This is useful for // tracking down corrupt files. const QString& canonicalLocation = m_fileInfo.canonicalFilePath(); if (CmdlineArgs::Instance().getDeveloper()) { qDebug() << "TrackInfoObject::parse()" << canonicalLocation; } // Parse the information stored in the sound file. SoundSourceProxy proxy(canonicalLocation, m_pSecurityToken); Mixxx::SoundSource* pProxiedSoundSource = proxy.getProxiedSoundSource(); if (pProxiedSoundSource != NULL && proxy.parseHeader() == OK) { // Dump the metadata extracted from the file into the track. // TODO(XXX): This involves locking the mutex for every setXXX // method. We should figure out an optimization where there are private // setters that don't lock the mutex. // If Artist, Title and Type fields are not blank, modify them. // Otherwise, keep their current values. // TODO(rryan): Should we re-visit this decision? if (!(pProxiedSoundSource->getArtist().isEmpty())) { setArtist(pProxiedSoundSource->getArtist()); } if (!(pProxiedSoundSource->getTitle().isEmpty())) { setTitle(pProxiedSoundSource->getTitle()); } if (!(pProxiedSoundSource->getType().isEmpty())) { setType(pProxiedSoundSource->getType()); } setAlbum(pProxiedSoundSource->getAlbum()); setAlbumArtist(pProxiedSoundSource->getAlbumArtist()); setYear(pProxiedSoundSource->getYear()); setGenre(pProxiedSoundSource->getGenre()); setComposer(pProxiedSoundSource->getComposer()); setGrouping(pProxiedSoundSource->getGrouping()); setComment(pProxiedSoundSource->getComment()); setTrackNumber(pProxiedSoundSource->getTrackNumber()); setReplayGain(pProxiedSoundSource->getReplayGain()); setBpm(pProxiedSoundSource->getBPM()); setDuration(pProxiedSoundSource->getDuration()); setBitrate(pProxiedSoundSource->getBitrate()); setSampleRate(pProxiedSoundSource->getSampleRate()); setChannels(pProxiedSoundSource->getChannels()); setKeyText(pProxiedSoundSource->getKey(), mixxx::track::io::key::FILE_METADATA); setHeaderParsed(true); } else { qDebug() << "TrackInfoObject::parse() error at file" << canonicalLocation; setHeaderParsed(false); // Add basic information derived from the filename: parseFilename(); } }
void PlaybackSettings::save() { Settings::self()->saveStopOnExit(stopOnExit->isChecked()); #if (defined Q_OS_LINUX && defined QT_QTDBUS_FOUND) || (defined Q_OS_MAC && defined IOKIT_FOUND) Settings::self()->saveInhibitSuspend(inhibitSuspend->isChecked()); #endif if (MPDConnection::self()->isConnected()) { int crossFade=crossfading->value(); if (crossFade!=MPDStatus::self()->crossFade()) { emit setCrossFade(crossFade); } QString rg=replayGain->itemData(replayGain->currentIndex()).toString(); if (rgSetting!=rg) { rgSetting=rg; emit setReplayGain(rg); } if (outputsView->isVisible()) { for (int i=0; i<outputsView->count(); ++i) { QListWidgetItem *item=outputsView->item(i); bool isEnabled=Qt::Checked==item->checkState(); int id=item->data(Qt::UserRole).toInt(); if (isEnabled && !enabledOutputs.contains(id)) { enabledOutputs.insert(id); emit enableOutput(id, isEnabled); } else if (!isEnabled && enabledOutputs.contains(id)) { enabledOutputs.remove(id); emit enableOutput(id, isEnabled); } } } } }
void SoundSource::parseReplayGainString (QString sReplayGain) { QString ReplayGainstring = sReplayGain.remove( " dB" ); float fReplayGain = pow(10,(ReplayGainstring.toFloat())/20); //I found some mp3s of mine with replaygain tag set to 0dB even if not normalized. //This is because of Rapid Evolution 3, I suppose. I prefer to rescan them by setting value to 0 (i.e. rescan via analyserrg) if(fReplayGain==1.0f){ fReplayGain= 0.0f; } setReplayGain(fReplayGain); }