Fix playback of WavPack

This commit is contained in:
Jonas Kvinge
2018-05-01 13:34:32 +02:00
parent 210601ffe4
commit ad2b567216
7 changed files with 70 additions and 54 deletions

View File

@@ -365,17 +365,18 @@ QString Song::JoinSpec(const QString &table) {
QString Song::TextForFiletype(FileType type) {
switch (type) {
case Song::Type_Asf: return QObject::tr("Windows Media audio");
case Song::Type_Wav: return QObject::tr("Wav");
case Song::Type_Flac: return QObject::tr("Flac");
case Song::Type_Mp4: return QObject::tr("MP4 AAC");
case Song::Type_Mpc: return QObject::tr("MPC");
case Song::Type_Mpeg: return QObject::tr("MP3");
case Song::Type_WavPack: return QObject::tr("WavPack");
case Song::Type_OggFlac: return QObject::tr("Ogg Flac");
case Song::Type_OggSpeex: return QObject::tr("Ogg Speex");
case Song::Type_OggVorbis: return QObject::tr("Ogg Vorbis");
case Song::Type_OggOpus: return QObject::tr("Ogg Opus");
case Song::Type_OggSpeex: return QObject::tr("Ogg Speex");
case Song::Type_Mpeg: return QObject::tr("MP3");
case Song::Type_Mp4: return QObject::tr("MP4 AAC");
case Song::Type_Asf: return QObject::tr("Windows Media audio");
case Song::Type_Aiff: return QObject::tr("AIFF");
case Song::Type_Wav: return QObject::tr("Wav");
case Song::Type_Mpc: return QObject::tr("MPC");
case Song::Type_TrueAudio: return QObject::tr("TrueAudio");
case Song::Type_Cdda: return QObject::tr("CDDA");
@@ -389,10 +390,11 @@ QString Song::TextForFiletype(FileType type) {
bool Song::IsFileLossless() const {
switch (filetype()) {
case Song::Type_Aiff:
case Song::Type_Wav:
case Song::Type_Flac:
case Song::Type_OggFlac:
case Song::Type_Wav:
case Song::Type_WavPack:
case Song::Type_Aiff:
return true;
default:
return false;
@@ -692,10 +694,21 @@ void Song::InitFromFilePartial(const QString &filename) {
QFileInfo info(filename);
d->basefilename_ = info.fileName();
QString suffix = info.suffix().toLower();
if (suffix == "mp3" || suffix == "ogg" || suffix == "flac" ||
suffix == "mpc" || suffix == "m4a" || suffix == "aac" ||
suffix == "wma" || suffix == "mp4" || suffix == "spx" ||
suffix == "wav" || suffix == "opus" || suffix == "m4b") {
if (suffix == "wav" ||
suffix == "flac" ||
suffix == "ogg" ||
suffix == "oga" ||
suffix == "wv" ||
suffix == "aac" ||
suffix == "m4a" ||
suffix == "m4b" ||
suffix == "mp4" ||
suffix == "wma" ||
suffix == "mp3" ||
suffix == "mpc" ||
suffix == "tta" ||
suffix == "spx" ||
suffix == "opus") {
d->valid_ = true;
}
else {

View File

@@ -95,19 +95,21 @@ class Song {
// If a new lossless file is added, also add it to IsFileLossless().
enum FileType {
Type_Unknown = 0,
Type_Asf = 1,
Type_Wav = 1,
Type_Flac = 2,
Type_Mp4 = 3,
Type_Mpc = 4,
Type_Mpeg = 5,
Type_OggFlac = 6,
Type_WavPack = 3,
Type_OggFlac = 4,
Type_OggVorbis = 5,
Type_OggOpus = 6,
Type_OggSpeex = 7,
Type_OggVorbis = 8,
Type_Aiff = 9,
Type_Wav = 10,
Type_TrueAudio = 11,
Type_Cdda = 12,
Type_OggOpus = 13,
Type_Mpeg = 8,
Type_Mp4 = 9,
Type_Asf = 10,
Type_Aiff = 11,
Type_Mpc = 12,
Type_TrueAudio = 13,
Type_Cdda = 90,
Type_Stream = 91,
};
static QString TextForFiletype(FileType type);

View File

@@ -229,10 +229,8 @@ void SongLoader::LoadLocalAsync(const QString &filename) {
parser = playlist_parser_->ParserForExtension(QFileInfo(filename).suffix().toLower());
}
if (parser) {
if (parser) { // It's a playlist!
qLog(Debug) << "Parsing using" << parser->name();
// It's a playlist!
LoadPlaylist(parser, filename);
return;
}
@@ -244,8 +242,7 @@ void SongLoader::LoadLocalAsync(const QString &filename) {
QFile cue(matching_cue);
cue.open(QIODevice::ReadOnly);
SongList song_list = cue_parser_->Load(&cue, matching_cue,
QDir(filename.section('/', 0, -2)));
SongList song_list = cue_parser_->Load(&cue, matching_cue, QDir(filename.section('/', 0, -2)));
for (Song song: song_list){
if (song.is_valid()) songs_ << song;
}