From 469316ca9c63006cda58b4b25bd5f6b1f7d67f4b Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Thu, 13 Dec 2012 00:18:21 +0000 Subject: Fixed some vst controls stuck. Added vst master timebase (sequencers should work now). Not quite finished. Fixed weird QString bug causing some patch names to appear with garbage characters. --- muse2/ChangeLog | 4 ++++ muse2/muse/dssihost.cpp | 2 +- muse2/muse/dssihost.h | 2 +- muse2/muse/instruments/minstrument.cpp | 4 ++-- muse2/muse/instruments/minstrument.h | 2 +- muse2/muse/synth.cpp | 8 ++------ muse2/muse/synth.h | 13 ++++--------- muse2/muse/ticksynth.cpp | 2 +- muse2/muse/vst.h | 2 +- muse2/muse/vst_native.cpp | 10 ++-------- muse2/muse/vst_native.h | 2 +- muse2/muse/widgets/mtrackinfo.cpp | 9 +-------- muse2/synti/deicsonze/deicsonze.cpp | 2 +- muse2/synti/deicsonze/deicsonze.h | 2 +- muse2/synti/fluid/fluid.cpp | 2 +- muse2/synti/fluid/fluid.h | 2 +- muse2/synti/fluidsynth/fluidsynti.cpp | 3 ++- muse2/synti/fluidsynth/fluidsynti.h | 2 +- muse2/synti/libsynti/mess.h | 4 ++-- muse2/synti/simpledrums2/simpledrums.cpp | 4 ++-- muse2/synti/simpledrums2/simpledrums.h | 2 +- 21 files changed, 33 insertions(+), 50 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 45013525..3b9168b0 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,7 @@ +12.12.2012: + - Fixed some vst controls stuck. (Tim) + - Added vst master timebase (sequencers should work now). WIP Not quite finished. (Tim) + - Fixed weird QString bug causing some patch names to appear with garbage characters. (Tim) 11.12.2012: - Fix native vst path (VST_NATIVE_PATH, VST_PATH, then preset). Also ladspa, dssi paths. Added -help text. (Tim) 10.12.2012: diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index 8e49b368..4391dfd9 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -2163,7 +2163,7 @@ void DssiSynthIF::doSelectProgram(LADSPA_Handle handle, int bank, int prog) // getPatchName //--------------------------------------------------------- -const char* DssiSynthIF::getPatchName(int /*chan*/, int prog, bool /*drum*/) +QString DssiSynthIF::getPatchName(int /*chan*/, int prog, bool /*drum*/) const { unsigned program = prog & 0x7f; int lbank = (prog >> 8) & 0xff; diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h index 99626c92..27ef05a3 100644 --- a/muse2/muse/dssihost.h +++ b/muse2/muse/dssihost.h @@ -173,7 +173,7 @@ class DssiSynthIF : public SynthIF virtual void deactivate3(); - virtual const char* getPatchName(int, int, bool); + virtual QString getPatchName(int, int, bool) const; virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool); virtual void write(int level, Xml& xml) const; diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index b7a2c7bf..c119f0bc 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -1093,7 +1093,7 @@ void MidiInstrument::populatePatchPopup(MusEGui::PopupMenu* menu, int /*chan*/, // getPatchName //--------------------------------------------------------- -const char* MidiInstrument::getPatchName(int /*channel*/, int prog, bool drum) const +QString MidiInstrument::getPatchName(int /*channel*/, int prog, bool drum) const { int pr = prog & 0xff; if(prog == CTRL_VAL_UNKNOWN || pr == 0xff) @@ -1115,7 +1115,7 @@ const char* MidiInstrument::getPatchName(int /*channel*/, int prog, bool drum) c && (hbank == mp->hbank || !hb || mp->hbank == -1) && (lbank == mp->lbank || !lb || mp->lbank == -1)) - return mp->name.toLatin1().constData(); + return mp->name; } } return ""; diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h index 665c2437..5a520e67 100644 --- a/muse2/muse/instruments/minstrument.h +++ b/muse2/muse/instruments/minstrument.h @@ -238,7 +238,7 @@ class MidiInstrument { virtual void writeToGui(const MidiPlayEvent&) {} virtual void reset(int); - virtual const char* getPatchName(int,int,bool) const; + virtual QString getPatchName(int,int,bool) const; virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool); void read(Xml&); void write(int level, Xml&); diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index 92c0a27d..e16e87d6 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -919,14 +919,10 @@ void SynthI::read(Xml& xml) // getPatchName //--------------------------------------------------------- -const char* MessSynthIF::getPatchName(int channel, int prog, bool drum) +QString MessSynthIF::getPatchName(int channel, int prog, bool drum) const { if (_mess) - { - const char* s = _mess->getPatchName(channel, prog, drum); - if(s) - return s; - } + return _mess->getPatchName(channel, prog, drum); return ""; } diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h index 62c461c4..6b42c1f5 100644 --- a/muse2/muse/synth.h +++ b/muse2/muse/synth.h @@ -154,7 +154,7 @@ class SynthIF : public PluginIBase { virtual int totalOutChannels() const = 0; virtual int totalInChannels() const = 0; virtual void deactivate3() = 0; - virtual const char* getPatchName(int, int, bool) = 0; + virtual QString getPatchName(int, int, bool) const = 0; virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool) = 0; virtual void write(int level, Xml& xml) const = 0; virtual float getParameter(unsigned long idx) const = 0; @@ -270,13 +270,8 @@ class SynthI : public AudioTrack, public MidiDevice, Synth* synth() const { return synthesizer; } virtual bool isSynti() const { return true; } - virtual const char* getPatchName(int ch, int prog, bool dr) const { - // REMOVE Tim. - const char* s = _sif->getPatchName(ch, prog, dr); - //fprintf(stderr, "SynthI::getPatchName patch name:%s\n", s); // REMOVE Tim. - return s; - - ///return _sif->getPatchName(ch, prog, dr); + virtual QString getPatchName(int ch, int prog, bool dr) const { + return _sif->getPatchName(ch, prog, dr); } virtual void populatePatchPopup(MusEGui::PopupMenu* m, int i, bool d) { @@ -363,7 +358,7 @@ class MessSynthIF : public SynthIF { virtual int totalOutChannels() const; virtual int totalInChannels() const; virtual void deactivate3(); - virtual const char* getPatchName(int, int, bool); + virtual QString getPatchName(int, int, bool) const; virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool); virtual void write(int level, Xml& xml) const; virtual float getParameter(unsigned long) const { return 0.0; } diff --git a/muse2/muse/ticksynth.cpp b/muse2/muse/ticksynth.cpp index f03414fc..a70d0174 100644 --- a/muse2/muse/ticksynth.cpp +++ b/muse2/muse/ticksynth.cpp @@ -100,7 +100,7 @@ class MetronomeSynthIF : public SynthIF virtual int totalOutChannels() const { return 1; } virtual int totalInChannels() const { return 0; } virtual void deactivate3() {} - virtual const char* getPatchName(int, int, bool) { return ""; } + virtual QString getPatchName(int, int, bool) const { return ""; } virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool) {}; virtual void write(int, Xml&) const {} virtual float getParameter(unsigned long) const { return 0.0; } diff --git a/muse2/muse/vst.h b/muse2/muse/vst.h index 7e693863..1143d56e 100644 --- a/muse2/muse/vst.h +++ b/muse2/muse/vst.h @@ -93,7 +93,7 @@ class VstSynthIF : public SynthIF virtual int totalOutChannels() const; virtual int totalInChannels() const; virtual void deactivate3(); - virtual const char* getPatchName(int, int, bool) { return ""; } + virtual QString getPatchName(int, int, bool) const { return ""; } virtual void populatePatchPopup(PopupMenu*, int, bool) {}; virtual void write(int level, Xml& xml) const; virtual float getParameter(unsigned long idx) const; diff --git a/muse2/muse/vst_native.cpp b/muse2/muse/vst_native.cpp index 6de5f8f4..b6208d5b 100644 --- a/muse2/muse/vst_native.cpp +++ b/muse2/muse/vst_native.cpp @@ -1414,8 +1414,6 @@ void VstNativeSynthIF::queryPrograms() } //#endif - //fprintf(stderr, " VstNativeSynthIF::queryPrograms(): patch name:%s\n", buf); // REMOVE Tim. - int bankH = (prog >> 14) & 0x7f; int bankL = (prog >> 7) & 0x7f; int patch = prog & 0x7f; @@ -1520,7 +1518,7 @@ void VstNativeSynthIF::doSelectProgram(int bankH, int bankL, int prog) // getPatchName //--------------------------------------------------------- -const char* VstNativeSynthIF::getPatchName(int /*chan*/, int prog, bool /*drum*/) +QString VstNativeSynthIF::getPatchName(int /*chan*/, int prog, bool /*drum*/) const { unsigned long program = prog & 0x7f; unsigned long lbank = (prog >> 8) & 0xff; @@ -1536,12 +1534,8 @@ const char* VstNativeSynthIF::getPatchName(int /*chan*/, int prog, bool /*drum*/ { for(std::vector::const_iterator i = programs.begin(); i != programs.end(); ++i) { - //fprintf(stderr, " VstNativeSynthIF::patch name:%s\n", i->name.toLatin1().constData()); // REMOVE Tim. if(i->program == p) - { - //fprintf(stderr, " found patch name:%s\n", i->name.toLatin1().constData()); // REMOVE Tim. - return i->name.toLatin1().constData(); - } + return i->name; } } return "?"; diff --git a/muse2/muse/vst_native.h b/muse2/muse/vst_native.h index 5b8f1328..4bbe1411 100644 --- a/muse2/muse/vst_native.h +++ b/muse2/muse/vst_native.h @@ -208,7 +208,7 @@ class VstNativeSynthIF : public SynthIF virtual int totalOutChannels() const; virtual int totalInChannels() const; virtual void deactivate3(); - virtual const char* getPatchName(int chan, int prog, bool drum); + virtual QString getPatchName(int chan, int prog, bool drum) const; virtual void populatePatchPopup(MusEGui::PopupMenu* menu, int chan, bool drum); virtual void write(int level, Xml& xml) const; virtual float getParameter(unsigned long idx) const; diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index 203a81e7..09d45577 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -415,16 +415,13 @@ void MidiTrackInfo::heartBeat() { MusECore::MidiInstrument* instr = mp->instrument(); const QString name = instr->getPatchName(outChannel, nprogram, track->isDrumTrack()); - //const char* name = instr->getPatchName(outChannel, nprogram, track->isDrumTrack()); if(name.isEmpty()) - //if(name == NULL) { const QString n("???"); if(iPatch->text() != n) iPatch->setText(n); } else if(iPatch->text() != name) - //else if(strcmp(iPatch->text().constData(), QChar name)) iPatch->setText(name); } } @@ -458,12 +455,8 @@ void MidiTrackInfo::heartBeat() //else //{ MusECore::MidiInstrument* instr = mp->instrument(); - //const QString name = instr->getPatchName(outChannel, program, track->isDrumTrack()); - const char* chr_name = instr->getPatchName(outChannel, program, track->isDrumTrack()); - const QString name(chr_name); - //fprintf(stderr, "patch name qstring:%s charstr:%s\n", name.toLatin1().constData(), chr_name); // REMOVE Tim. + const QString name = instr->getPatchName(outChannel, program, track->isDrumTrack()); if(iPatch->text() != name) - //if(!strcmp(iPatch->text().toLatin1().constData(), name)) iPatch->setText(name); int hb = ((program >> 16) & 0xff) + 1; diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 61e9b1f3..ef5644fa 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -3698,7 +3698,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { // getPatchName //--------------------------------------------------------- -const char* DeicsOnze::getPatchName(int ch, int val, bool) const { +QString DeicsOnze::getPatchName(int ch, int val, bool) const { if(_global.channel[ch].isEnable) { Preset* p_preset; int hbank = (val & 0xff0000) >> 16; diff --git a/muse2/synti/deicsonze/deicsonze.h b/muse2/synti/deicsonze/deicsonze.h index e458b688..2df235e3 100644 --- a/muse2/synti/deicsonze/deicsonze.h +++ b/muse2/synti/deicsonze/deicsonze.h @@ -592,7 +592,7 @@ class DeicsOnze : public Mess { bool sysex(int length, const unsigned char* data, bool fromGui); virtual bool sysex(int l, const unsigned char* d); - virtual const char* getPatchName(int ch, int number, bool) const; + virtual QString getPatchName(int ch, int number, bool) const; virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; virtual int getControllerInfo(int arg1, const char** arg2, diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp index fa34d67e..5ee3835f 100644 --- a/muse2/synti/fluid/fluid.cpp +++ b/muse2/synti/fluid/fluid.cpp @@ -405,7 +405,7 @@ bool ISynth::processEvent(const MusECore::MidiPlayEvent& ev) // getPatchName //--------------------------------------------------------- -const char* ISynth::getPatchName(int /*ch*/, int val, bool /*drum*/) const +QString ISynth::getPatchName(int /*ch*/, int val, bool /*drum*/) const { int prog = val & 0xff; if(val == MusECore::CTRL_VAL_UNKNOWN || prog == 0xff) diff --git a/muse2/synti/fluid/fluid.h b/muse2/synti/fluid/fluid.h index 60449568..a9891f3f 100644 --- a/muse2/synti/fluid/fluid.h +++ b/muse2/synti/fluid/fluid.h @@ -76,7 +76,7 @@ class ISynth : public Mess { virtual bool sysex(int len, const unsigned char* p); virtual bool processEvent(const MusECore::MidiPlayEvent&); - virtual const char* getPatchName (int, int, bool) const; + virtual QString getPatchName (int, int, bool) const; virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; virtual void getInitData(int*, const unsigned char**); diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index 3dd45105..d3561fb9 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -34,6 +34,7 @@ #include #include +#include //#include "common_defs.h" #include "fluidsynti.h" @@ -1220,7 +1221,7 @@ void FluidSynth::rewriteChannelSettings() //--------------------------------------------------------- // getPatchName //--------------------------------------------------------- -const char* FluidSynth::getPatchName(int i, int, bool /*drum*/) const +QString FluidSynth::getPatchName(int i, int, bool /*drum*/) const { if (channels[i].font_intid == FS_UNSPECIFIED_FONT || channels[i].font_intid == FS_UNSPECIFIED_ID) diff --git a/muse2/synti/fluidsynth/fluidsynti.h b/muse2/synti/fluidsynth/fluidsynti.h index 7e448536..ca24f6f8 100644 --- a/muse2/synti/fluidsynth/fluidsynti.h +++ b/muse2/synti/fluidsynth/fluidsynti.h @@ -138,7 +138,7 @@ public: virtual bool setController(int, int, int); void setController(int, int , int, bool); virtual void getInitData(int*, const unsigned char**); - virtual const char* getPatchName(int, int, bool) const; + virtual QString getPatchName(int, int, bool) const; virtual const MidiPatch* getPatchInfo(int i, const MidiPatch* patch) const; virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const; virtual bool processEvent(const MusECore::MidiPlayEvent&); diff --git a/muse2/synti/libsynti/mess.h b/muse2/synti/libsynti/mess.h index 79d3d7e7..db74c1c8 100644 --- a/muse2/synti/libsynti/mess.h +++ b/muse2/synti/libsynti/mess.h @@ -26,10 +26,10 @@ #define MESS_MAJOR_VERSION 1 #define MESS_MINOR_VERSION 1 +#include #include "mpevent.h" class QWidget; -class QString; class MessP; //--------------------------------------------------------- @@ -88,7 +88,7 @@ class Mess { virtual void getInitData(int* n, const unsigned char**) /*const*/ { *n = 0; } // No const: Synths may need to allocate member pointers. p4.0.27 Tim virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const {return 0;} - virtual const char* getPatchName(int, int, bool) const { return "?"; } + virtual QString getPatchName(int, int, bool) const { return "?"; } virtual const MidiPatch* getPatchInfo(int, const MidiPatch*) const { return 0; } // synthesizer -> host communication diff --git a/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp index ef626954..2cc42ba6 100644 --- a/muse2/synti/simpledrums2/simpledrums.cpp +++ b/muse2/synti/simpledrums2/simpledrums.cpp @@ -644,10 +644,10 @@ bool SimpleSynth::sysex(int len, const unsigned char* d) \fn SimpleSynth::getPatchName \brief Called from host to get names of patches \param index - which patchnr we're about to deliver - \return const char* with patchname + \return QString with patchname */ //--------------------------------------------------------- -const char* SimpleSynth::getPatchName(int /*index*/, int, bool) const +QString SimpleSynth::getPatchName(int /*index*/, int, bool) const { SS_TRACE_IN SS_TRACE_OUT diff --git a/muse2/synti/simpledrums2/simpledrums.h b/muse2/synti/simpledrums2/simpledrums.h index 8de202ea..5a7e2821 100644 --- a/muse2/synti/simpledrums2/simpledrums.h +++ b/muse2/synti/simpledrums2/simpledrums.h @@ -137,7 +137,7 @@ class SimpleSynth : public Mess virtual bool processEvent(const MusECore::MidiPlayEvent& arg1); virtual bool setController(int arg1, int arg2, int arg3); virtual bool sysex(int arg1, const unsigned char* arg2); - virtual const char* getPatchName(int arg1, int arg2, bool arg3) const; + virtual QString getPatchName(int arg1, int arg2, bool arg3) const; virtual const MidiPatch* getPatchInfo(int arg1, const MidiPatch* arg2) const; virtual int getControllerInfo(int arg1, const char** arg2, int* arg3, int* arg4, int* arg5, int* arg6) const; virtual void processMessages(); -- cgit v1.2.3