aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/sid/decoder_sid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/sid/decoder_sid.cpp')
-rw-r--r--src/plugins/Input/sid/decoder_sid.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/plugins/Input/sid/decoder_sid.cpp b/src/plugins/Input/sid/decoder_sid.cpp
index b89617913..289e969c7 100644
--- a/src/plugins/Input/sid/decoder_sid.cpp
+++ b/src/plugins/Input/sid/decoder_sid.cpp
@@ -32,7 +32,7 @@
#include "decoder_sid.h"
// Decoder class
-DecoderSID::DecoderSID(SidDatabase *db, const QString &url) : Decoder()
+DecoderSID::DecoderSID(SidDatabase *db, const QString &url) : Decoder(), m_tune(0)
{
m_db = db;
m_url = url;
@@ -56,34 +56,30 @@ bool DecoderSID::initialize()
path.remove(QRegExp("#\\d+$"));
int track = m_url.section("#", -1).toInt();
- SidTune *tune = new SidTune(0);
- tune->load(qPrintable(path));
- if(!tune->getInfo())
+ m_tune.load(qPrintable(path));
+ if(!m_tune.getInfo())
{
- qWarning("DecoderSID: unable to load tune, error: %s", tune->statusString());
- delete tune;
+ qWarning("DecoderSID: unable to load tune, error: %s", m_tune.statusString());
return false;
}
- int count = tune->getInfo()->songs();
+ int count = m_tune.getInfo()->songs();
if(track > count || track < 1)
{
qWarning("DecoderSID: track number is out of range");
- delete tune;
return false;
}
- tune->selectSong(track);
+ m_tune.selectSong(track);
- if(!tune->getStatus())
+ if(!m_tune.getStatus())
{
- qWarning("DecoderSID: error: %s", tune->statusString());
- delete tune;
+ qWarning("DecoderSID: error: %s", m_tune.statusString());
return false;
}
//send metadata for pseudo-protocol
- const SidTuneInfo *tune_info = tune->getInfo();
+ const SidTuneInfo *tune_info = m_tune.getInfo();
QMap<Qmmp::MetaData, QString> metadata;
metadata.insert(Qmmp::TITLE, tune_info->infoString(0));
metadata.insert(Qmmp::ARTIST, tune_info->infoString(1));
@@ -98,7 +94,7 @@ bool DecoderSID::initialize()
if(settings.value("use_hvsc", false).toBool())
{
char md5[SidTune::MD5_LENGTH+1];
- tune->createMD5(md5);
+ m_tune.createMD5(md5);
m_length = m_db->length(md5, track);
}
@@ -135,7 +131,7 @@ bool DecoderSID::initialize()
return false;
}
- if(!m_player->load(tune))
+ if(!m_player->load(&m_tune))
{
qWarning("DecoderSID: unable to load tune, error: %s", m_player->error());
return false;
@@ -170,5 +166,5 @@ qint64 DecoderSID::read(unsigned char *data, qint64 size)
if(size <= 0)
return 0;
m_read_bytes += size;
- return m_player->play((short *)data, size/2) * 2;
+ return m_player->play((short *)data, size/2) * 2;
}