Commit e7f2f84b authored by Luis's avatar Luis

Interface's errors fixed

parent 9e612c62
......@@ -27,8 +27,6 @@
#include <KDE/KActionCollection>
#include <KDE/KFileDialog>
#include <drumstick/qsmf.h>
#include <interfaces/icore.h>
#include <interfaces/isoundcontroller/isoundcontroller.h>
#include <interfaces/isoundcontroller/imidiobject.h>
......@@ -38,203 +36,17 @@ namespace Spinet
{
ISmfFactory::ISmfFactory()
: m_smfReader(new drumstick::QSmf), m_midiObject(0)
{
//setXMLFile("ismffactoryui.rc");
/*KAction *midiFileOpen = new KAction(KIcon("document-open"), i18n("Open &Midi"), this);
actionCollection()->addAction(QLatin1String("open_midifile"), midiFileOpen);
connect(midiFileOpen, SIGNAL(triggered(bool)), SLOT(slotOpenMidiFile()));*/
/*
connect(m_smfReader, SIGNAL(signalSMFError(QString)), SLOT(slotSMFError(QString)));
connect(m_smfReader, SIGNAL(signalSMFHeader(int,int,int)), SLOT(slotSMFHeader(int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFNoteOn(int,int,int)), SLOT(slotSMFNoteOn(int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFNoteOff(int,int,int)), SLOT(slotSMFNoteOff(int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFKeyPress(int,int,int)), SLOT(slotSMFKeyPress(int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFCtlChange(int,int,int)), SLOT(slotSMFCtlChange(int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFPitchBend(int,int)), SLOT(slotSMFPitchBend(int,int)));
connect(m_smfReader, SIGNAL(signalSMFProgram(int,int)), SLOT(slotSMFProgram(int,int)));
connect(m_smfReader, SIGNAL(signalSMFChanPress(int,int)), SLOT(slotSMFChanPress(int,int)));
connect(m_smfReader, SIGNAL(signalSMFSysex(QByteArray)), SLOT(slotSMFSysex(QByteArray)));
connect(m_smfReader, SIGNAL(signalSMFSeqSpecific(QByteArray)), SLOT(slotSMFSeqSpecific(QByteArray)));
connect(m_smfReader, SIGNAL(signalSMFMetaUnregistered(int,QByteArray)), SLOT(slotSMFMetaUnregistered(int,QByteArray)));
connect(m_smfReader, SIGNAL(signalSMFMetaMisc(int,QByteArray)), SLOT(slotSMFMetaMisc(int,QByteArray)));
connect(m_smfReader, SIGNAL(signalSMFSequenceNum(int)), SLOT(slotSMFSequenceNum(int)));
connect(m_smfReader, SIGNAL(signalSMFforcedChannel(int)), SLOT(slotSMFforcedChannel(int)));
connect(m_smfReader, SIGNAL(signalSMFforcedPort(int)), SLOT(slotSMFforcedPort(int)));
connect(m_smfReader, SIGNAL(signalSMFText(int,QString)), SLOT(slotSMFText(int,QString)));
connect(m_smfReader, SIGNAL(signalSMFSmpte(int,int,int,int,int)), SLOT(slotSMFSmpte(int,int,int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFTimeSig(int,int,int,int)), SLOT(slotSMFTimeSig(int,int,int,int)));
connect(m_smfReader, SIGNAL(signalSMFKeySig(int,int)), SLOT(slotSMFKeySig(int,int)));
connect(m_smfReader, SIGNAL(signalSMFTempo(int)), SLOT(slotSMFTempo(int)));
connect(m_smfReader, SIGNAL(signalSMFendOfTrack()), SLOT(slotSMFendOfTrack()));
connect(m_smfReader, SIGNAL(signalSMFTrackStart()), SLOT(slotSMFTrackStart()));
connect(m_smfReader, SIGNAL(signalSMFTrackEnd()), SLOT(slotSMFTrackEnd()));
connect(m_smfReader, SIGNAL(signalSMFWriteTempoTrack()), SLOT(slotSMFWriteTempoTrack()));
connect(m_smfReader, SIGNAL(signalSMFWriteTrack(int)), SLOT(slotSMFWriteTrack(int)));*/
}
ISmfFactory::~ISmfFactory()
{
delete m_smfReader;
}
IMidiObject *ISmfFactory::fromFile(const QString &fileName)
{
m_midiObject = ICore::self()->soundController()->newMidiObject();
m_smfReader->readFromFile(fileName);
m_midiObject->sort();
m_midiObject->resetPosition();
return m_midiObject;
}
void ISmfFactory::unload()
{
}
void ISmfFactory::slotOpenMidiFile()
{/*
QString fileName = KFileDialog::getOpenFileName(KUrl(), "*.mid");
if(!fileName.isEmpty())
{
fromFile(fileName);
ICore::self()->soundController()->midiSequencers()[0]->setMidiObject(m_midiObject);
}
*/}
/*void ISmfFactory::slotSMFError(const QString &errorStr)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFError, errorStr));
}
void ISmfFactory::slotSMFHeader(int format, int ntrks, int division)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFHeader, format, ntrks, division));
}
void ISmfFactory::slotSMFNoteOn(int chan, int pitch, int vol)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFNoteOn, chan, pitch, vol));
}
void ISmfFactory::slotSMFNoteOff(int chan, int pitch, int vol)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFNoteOff, chan, pitch, vol));
}
void ISmfFactory::slotSMFKeyPress(int chan, int pitch, int press)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFKeyPress, chan, pitch, press));
}
void ISmfFactory::slotSMFCtlChange(int chan, int ctl, int value)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFCtlChange, chan, ctl, value));
}
void ISmfFactory::slotSMFPitchBend(int chan, int value)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFPitchBend, chan, value));
}
void ISmfFactory::slotSMFProgram(int chan, int patch)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFProgram, chan, patch));
}
void ISmfFactory::slotSMFChanPress(int chan, int press)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFChanPress, chan, press));
}
void ISmfFactory::slotSMFSysex(const QByteArray &data)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFSysex, data));
}
void ISmfFactory::slotSMFSeqSpecific(const QByteArray &data)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFSeqSpecific, data));
}
void ISmfFactory::slotSMFMetaUnregistered(int typ, const QByteArray &data)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFMetaUnregistered, typ, data));
}
void ISmfFactory::slotSMFMetaMisc(int typ, const QByteArray &data)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFMetaMisc, typ, data));
}
void ISmfFactory::slotSMFSequenceNum(int seq)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFSequenceNum, seq));
}
void ISmfFactory::slotSMFforcedChannel(int channel)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFforcedChannel, channel));
}
void ISmfFactory::slotSMFforcedPort(int port)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFforcedPort, port));
}
void ISmfFactory::slotSMFText(int typ, const QString &data)
{
// MIDI text events are a special case of MISC event and will be handled in MetaMisc slot
Q_UNUSED(typ);
Q_UNUSED(data);
}
void ISmfFactory::slotSMFSmpte(int b0, int b1, int b2, int b3, int b4)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFSmpte, b0, b1, b2, b3, b4));
}
void ISmfFactory::slotSMFTimeSig(int b0, int b1, int b2, int b3)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFTimeSig, b0, b1, b2, b3));
}
void ISmfFactory::slotSMFKeySig(int b0, int b1)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFKeySig, b0, b1));
}
void ISmfFactory::slotSMFTempo(int tempo)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFTempo, tempo));
}
void ISmfFactory::slotSMFendOfTrack()
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFendOfTrack));
}
void ISmfFactory::slotSMFTrackStart()
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFTrackStart));
}
void ISmfFactory::slotSMFTrackEnd()
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFTrackEnd));
}
void ISmfFactory::slotSMFWriteTempoTrack()
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFWriteTempoTrack));
}
void ISmfFactory::slotSMFWriteTrack(int track)
{
m_midiObject->appendEvent(ICore::self()->soundController()->newMidiEvent(m_smfReader->getCurrentTime(), IMidiEvent::SMFWriteTrack, track));
}*/
}
......@@ -24,14 +24,10 @@
#include <QtCore/QObject>
#include <interfaces/iplugin.h>
#include <interfaces/isoundcontroller/imidiobject.h>
#include "interfacesexport.h"
namespace drumstick
{
class QSmf;
}
namespace Spinet
{
......@@ -44,11 +40,11 @@ public:
explicit ISmfFactory();
virtual ~ISmfFactory();
virtual IMidiObject *fromFile(const QString &fileName);
virtual IMidiObject *fromFile(const QString &fileName) = 0;
virtual void unload();
private Q_SLOTS:
virtual void slotOpenMidiFile();
virtual void slotOpenMidiFile() = 0;
virtual void slotSMFError(const QString &errorStr) = 0;
virtual void slotSMFHeader(int format, int ntrks, int division) = 0;
......@@ -76,10 +72,7 @@ private Q_SLOTS:
virtual void slotSMFTrackEnd() = 0;
virtual void slotSMFWriteTempoTrack() = 0;
virtual void slotSMFWriteTrack(int track) = 0;
private:
drumstick::QSmf *m_smfReader;
IMidiObject *m_midiObject;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment