diff options
| -rw-r--r-- | muse/muse/audio.cpp | 7 | ||||
| -rw-r--r-- | muse/muse/audio.h | 3 | ||||
| -rw-r--r-- | muse/muse/audioaux.cpp | 19 | ||||
| -rw-r--r-- | muse/muse/audiotrack.cpp | 87 | ||||
| -rw-r--r-- | muse/muse/audiotrack.h | 18 | ||||
| -rw-r--r-- | muse/muse/ctrl.h | 5 | ||||
| -rw-r--r-- | muse/muse/ctrl/ctrldialog.cpp | 4 | ||||
| -rw-r--r-- | muse/muse/mixer/astrip.cpp | 11 | ||||
| -rw-r--r-- | muse/muse/mixer/astrip.h | 1 | ||||
| -rw-r--r-- | muse/muse/mixer/rack.cpp | 64 | ||||
| -rw-r--r-- | muse/muse/mixer/rack.h | 7 | ||||
| -rw-r--r-- | muse/muse/seqmsg.cpp | 13 | ||||
| -rw-r--r-- | muse/muse/wavetrack.cpp | 2 | 
13 files changed, 145 insertions, 96 deletions
| diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp index 64f438b7..a1168e0b 100644 --- a/muse/muse/audio.cpp +++ b/muse/muse/audio.cpp @@ -68,14 +68,12 @@ const char* seqMsgList[] = {  /*20*/"AUDIO_ADDPLUGIN",        "AUDIO_ADDMIDIPLUGIN",        "AUDIO_SET_SEG_SIZE", -      "AUDIO_SET_PREFADER",        "AUDIO_SET_CHANNELS",        "MS_PROCESS",        "MS_START",        "MS_STOP",        "MS_SET_RTC",        "SEQM_IDLE", -//      "SEQM_SEEK",        "SEQM_ADD_CTRL",        "SEQM_REMOVE_CTRL"        }; @@ -532,7 +530,7 @@ void Audio::process(unsigned frames)  	            else        	            printf("PANIC: process(): no buffer from audio driver\n");                    } -      	if (!ao->multiplyCopy(och, buffer)) { +      	if (!ao->multiplyCopy(och, buffer, 0)) {                    for (int i = 0; i < och; ++i)                          memset(buffer[i], 0, sizeof(float) * frames);                    } @@ -571,9 +569,6 @@ void Audio::processMsg()              case AUDIO_ROUTEREMOVE:                    removeRoute(msg->sroute, msg->droute);                    break; -            case AUDIO_SET_PREFADER: -                  ((AudioTrack*)msg->track)->setPrefader(msg->ival); -                  break;              case AUDIO_SET_CHANNELS:                    msg->track->setChannels(msg->ival);                    break; diff --git a/muse/muse/audio.h b/muse/muse/audio.h index a18774c6..bb411770 100644 --- a/muse/muse/audio.h +++ b/muse/muse/audio.h @@ -98,7 +98,6 @@ enum {        AUDIO_ADDPLUGIN,        AUDIO_ADDMIDIPLUGIN,        AUDIO_SET_SEG_SIZE, -      AUDIO_SET_PREFADER,        AUDIO_SET_CHANNELS,        MS_PROCESS, @@ -107,7 +106,6 @@ enum {        MS_SET_RTC,        SEQM_IDLE, -//      SEQM_SEEK,        SEQM_ADD_CTRL,        SEQM_REMOVE_CTRL        }; @@ -247,7 +245,6 @@ class Audio {        void msgAddSynthI(SynthI* synth);        void msgRemoveSynthI(SynthI* synth);        void msgSetSegSize(int, int); -      void msgSetPrefader(AudioTrack*, int);        void msgSetChannels(AudioTrack*, int);        void msgSetOff(AudioTrack*, bool);        void msgUndo(); diff --git a/muse/muse/audioaux.cpp b/muse/muse/audioaux.cpp index 9023f058..1d5a16f9 100644 --- a/muse/muse/audioaux.cpp +++ b/muse/muse/audioaux.cpp @@ -81,17 +81,9 @@ void AudioAux::setChannels(int n)  void AudioAux::collectInputData()  	{        bufferEmpty = false; -      int ctrl = AC_AUX;        AuxList* al = song->auxs();          // aux sends -      int idx = 0; -      for (iAudioAux i = al->begin(); i != al->end(); ++i, ++idx) { -            if (*i == this) { -            	ctrl += idx; -                  break; -                  } -            } -//      RouteList* rl = inRoutes(); -      bool copy = true; +      int bus    = AC_AUX + al->index(this) + 1; +      bool copy   = true;        TrackList* tl = song->tracks();        for (iTrack i = tl->begin(); i != tl->end(); ++i) { @@ -100,11 +92,10 @@ void AudioAux::collectInputData()              AudioTrack* track = (AudioTrack*)(*i);              if (!track->hasAuxSend() || track->off() || song->bounceTrack == track)                    continue; -            if (copy) { -      		copy = !track->multiplyCopy(channels(), buffer, ctrl); -                  } +            if (copy) +      		copy = !track->multiplyCopy(channels(), buffer, bus);              else -	            track->multiplyAdd(channels(), buffer, ctrl); +	            track->multiplyAdd(channels(), buffer, bus);              }        if (copy) {        	for (int i = 0; i < channels(); ++i) diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp index 2f3608bc..83b23bd8 100644 --- a/muse/muse/audiotrack.cpp +++ b/muse/muse/audiotrack.cpp @@ -159,6 +159,16 @@ void AudioTrack::addAuxSend(int n)              QString s("AuxSend-");              s += QString("%1").arg(i+1);              Ctrl* ctrl = new Ctrl(AC_AUX + i, s); +            ctrl->setRange(pow(10.0f, config.minSlider*0.05f), 2.0f); +            addController(ctrl); + +            c = getController(AC_AUX_PAN + i); +            if (c) +                  continue; +            s = ("AuxSendPan-"); +            s += QString("%1").arg(i+1); +            ctrl = new Ctrl(AC_AUX_PAN + i, s); +            ctrl->setRange(-1.0f, +1.0f);              addController(ctrl);              }        } @@ -418,9 +428,9 @@ void AudioTrack::process()        //    metering        //--------------------------------------------------- -      double vol[2]; -      double _volume = ctrlVal(AC_VOLUME).f; -    	if (_volume == 0.0 || bufferEmpty) { +      double vol[channels()]; +      double _volume = _mute ? 0.0 : ctrlVal(AC_VOLUME).f; +    	if (bufferEmpty || (!_prefader && _volume == 0.0)) {              for (int i = 0; i < channels(); ++i)                    setMeter(i, 0.0);              } @@ -439,7 +449,7 @@ void AudioTrack::process()  				++p;        	            }  	      	if (!_prefader) -      	            meter *= (vol[i] * (_mute ? 0.0 : 1.0)); +      	            meter *= vol[i];  	         	setMeter(i, meter);        	      }  	      } @@ -447,16 +457,30 @@ void AudioTrack::process()  //---------------------------------------------------------  //   multiplyAdd +//    apply _volume and _pan to track buffer and add to +//    destination buffer  //--------------------------------------------------------- -void AudioTrack::multiplyAdd(int dstChannels, float** dstBuffer, int ctrl) +void AudioTrack::multiplyAdd(int dstChannels, float** dstBuffer, int bus)  	{ -      double _volume = ctrlVal(ctrl).f; -      if (_mute || bufferEmpty || _volume == 0.0) +      if (_mute || bufferEmpty) +            return; +      int volCtrl; +      int panCtrl; +      if (bus == 0) { +            volCtrl = AC_VOLUME; +            panCtrl = AC_PAN; +            } +      else { +            volCtrl = AC_AUX + bus - 1; +            panCtrl = AC_AUX_PAN + bus - 1; +            } +      double _volume = ctrlVal(volCtrl).f; +      if (_volume == 0.0)              return;        int srcChannels = channels();        double vol[2]; -      double _pan = ctrlVal(AC_PAN).f; +      double _pan = ctrlVal(panCtrl).f;        vol[0] = _volume * (1.0 - _pan);        vol[1] = _volume * (1.0 + _pan); @@ -469,15 +493,23 @@ void AudioTrack::multiplyAdd(int dstChannels, float** dstBuffer, int ctrl)                          dp[k] += (sp[k] * v);                    }              } +      // +      // mix mono to stereo +      //        else if (srcChannels == 1 && dstChannels == 2) { -            for (int c = 0; c < dstChannels; ++c) { -                  float* dp = dstBuffer[c]; -                  float* sp = buffer[0]; -                  float v   = vol[c]; -                  for (unsigned k = 0; k < segmentSize; ++k) -                        dp[k] += (sp[k] * v); +            float* dp1 = dstBuffer[0]; +            float* dp2 = dstBuffer[1]; +            float* sp = buffer[0]; +            double v1   = vol[0]; +            double v2   = vol[1]; +            for (unsigned k = 0; k < segmentSize; ++k) { +                  dp1[k] += (sp[k] * v1); +                  dp2[k] += (sp[k] * v2);                    }              } +      // +      // downmix stereo to mono +      //        else if (srcChannels == 2 && dstChannels == 1) {              float* sp1 = buffer[0];              float* sp2 = buffer[1]; @@ -489,17 +521,29 @@ void AudioTrack::multiplyAdd(int dstChannels, float** dstBuffer, int ctrl)  //---------------------------------------------------------  //   multiplyCopy -//	return false if multiply by zero +//	return false if resulting buffer would be silence  //--------------------------------------------------------- -bool AudioTrack::multiplyCopy(int dstChannels, float** dstBuffer, int ctrl) +bool AudioTrack::multiplyCopy(int dstChannels, float** dstBuffer, int bus)  	{ -      double _volume = ctrlVal(ctrl).f; -      if (_mute || bufferEmpty || _volume == 0.0) +      if (_mute || bufferEmpty) +            return false; +      int volCtrl; +      int panCtrl; +      if (bus == 0) { +            volCtrl = AC_VOLUME; +            panCtrl = AC_PAN; +            } +      else { +            volCtrl = AC_AUX + bus - 1; +            panCtrl = AC_AUX_PAN + bus - 1; +            } +      double _volume = ctrlVal(volCtrl).f; +      if (_volume == 0.0)              return false;        int srcChannels = channels();        float vol[2]; -      float _pan = ctrlVal(AC_PAN).f; +      float _pan = ctrlVal(panCtrl).f;        vol[0] = _volume * (1.0 - _pan);        vol[1] = _volume * (1.0 + _pan); @@ -535,6 +579,7 @@ bool AudioTrack::multiplyCopy(int dstChannels, float** dstBuffer, int ctrl)  //---------------------------------------------------------  //   collectInputData +//    if buffer contains silence, set bufferEmpty to true  //---------------------------------------------------------  void AudioTrack::collectInputData() @@ -547,9 +592,9 @@ void AudioTrack::collectInputData()              if (track->off() || song->bounceTrack == track)                    continue;              if (copy) -      		copy = !track->multiplyCopy(channels(), buffer); +      		copy = !track->multiplyCopy(channels(), buffer, 0);              else -	            track->multiplyAdd(channels(), buffer); +	            track->multiplyAdd(channels(), buffer, 0);              }        if (copy) {              // diff --git a/muse/muse/audiotrack.h b/muse/muse/audiotrack.h index 312a9127..54fe4ab4 100644 --- a/muse/muse/audiotrack.h +++ b/muse/muse/audiotrack.h @@ -27,6 +27,14 @@  class PluginI;  //--------------------------------------------------------- +//   AuxSend +//--------------------------------------------------------- + +struct AuxSend { +      bool postfader; +      }; + +//---------------------------------------------------------  //   AudioTrack  //--------------------------------------------------------- @@ -35,11 +43,14 @@ class AudioTrack : public Track {        bool _prefader;               // prefader metering        Pipeline* _efxPipe; +      QList<AuxSend> sends;        void readRecfile(QDomNode);     protected: -      float** buffer; +      float** buffer;               // this buffer is filled by process() +                                    // _volume and _pan is not applied +        bool bufferEmpty;			// set by process() to optimize        					// data flow @@ -79,7 +90,6 @@ class AudioTrack : public Track {        bool prefader() const              { return _prefader; }        void addAuxSend(int n); -        void setPrefader(bool val);        Pipeline* efxPipe()                { return _efxPipe;  }        void addPlugin(PluginI* plugin, int idx); @@ -87,8 +97,8 @@ class AudioTrack : public Track {        virtual bool hasAuxSend() const { return false; }        virtual void process(); -      void multiplyAdd(int channel, float**, int ctrl = AC_VOLUME); -      bool multiplyCopy(int channel, float**, int ctrl = AC_VOLUME); +      void multiplyAdd(int channel,  float**, int bus); +      bool multiplyCopy(int channel, float**, int bus);        };  #endif diff --git a/muse/muse/ctrl.h b/muse/muse/ctrl.h index 2474db1a..3d5f7139 100644 --- a/muse/muse/ctrl.h +++ b/muse/muse/ctrl.h @@ -31,12 +31,13 @@ class MidiController;  //  // predefined audio controller id's:  // +const int NUM_AUX   = 32;     // max number of aux channels +  const int AC_VOLUME = 0;  const int AC_PAN    = 1;  const int AC_MUTE   = 2;  const int AC_AUX    = 3;      // 3 -- 3+NUM_AUX - -const int NUM_AUX   = 32;     // max number of aux channels +const int AC_AUX_PAN = AC_AUX + NUM_AUX;  inline int genACnum(int plugin, int ctrl) { return plugin * 0x10000 + ctrl; } diff --git a/muse/muse/ctrl/ctrldialog.cpp b/muse/muse/ctrl/ctrldialog.cpp index 25fab300..77307204 100644 --- a/muse/muse/ctrl/ctrldialog.cpp +++ b/muse/muse/ctrl/ctrldialog.cpp @@ -65,6 +65,10 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent)              }        else if (!track->isMidiTrack()) {              // +            // aux send streams +            // +             +            //              // present plugin parameter              //              Pipeline* pl = ((AudioTrack*)track)->efxPipe(); diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp index 0310d501..c8746430 100644 --- a/muse/muse/mixer/astrip.cpp +++ b/muse/muse/mixer/astrip.cpp @@ -107,7 +107,7 @@ void AudioStrip::updateOffState()  void AudioStrip::preToggled(bool val)        { -      audio->msgSetPrefader((AudioTrack*)track, val); +      ((AudioTrack*)track)->setPrefader(val);        resetPeaks();        song->update(SC_ROUTE);        } @@ -348,14 +348,6 @@ Awl::PanKnob* AudioStrip::addPanKnob(Awl::PanEntry** dlabel)  //---------------------------------------------------------  //   AudioStrip -//--------------------------------------------------------- - -AudioStrip::~AudioStrip() -      { -      } - -//--------------------------------------------------------- -//   AudioStrip  //    create mixer strip  //--------------------------------------------------------- @@ -520,7 +512,6 @@ AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align)        //---------------------------------------------------        QHBoxLayout* rBox = new QHBoxLayout(0); -//      if (type != Track::AUDIO_AUX && type != Track::AUDIO_SOFTSYNTH) {        if (type != Track::AUDIO_AUX) {              iR = new QToolButton(this);              iR->setFont(config.fonts[1]); diff --git a/muse/muse/mixer/astrip.h b/muse/muse/mixer/astrip.h index f761299c..a1ded865 100644 --- a/muse/muse/mixer/astrip.h +++ b/muse/muse/mixer/astrip.h @@ -91,7 +91,6 @@ class AudioStrip : public Strip {     public:        AudioStrip(Mixer*, AudioTrack*, bool align); -      ~AudioStrip();        };  #endif diff --git a/muse/muse/mixer/rack.cpp b/muse/muse/mixer/rack.cpp index 836c9394..46f9332c 100644 --- a/muse/muse/mixer/rack.cpp +++ b/muse/muse/mixer/rack.cpp @@ -59,18 +59,27 @@ QSize EffectRack::sizeHint() const  void EffectRack::songChanged(int typ)        { -      if (typ & (SC_ROUTE | SC_RACK)) { -            clear(); -            foreach(PluginI* plugin, *(track->efxPipe())) { -                  QListWidgetItem* item = new QListWidgetItem; -                  item->setText(plugin->name()); -                  // tooltip should only be set if name does not fit -                  // (is elided) -                  item->setToolTip(plugin->name()); -                  item->setBackgroundColor(plugin->on() ? Qt::white : Qt::gray); -                  addItem(item); -                  } +      if (!(typ & (SC_ROUTE | SC_RACK))) +            return; + +      clear(); +      int i = 0; +      foreach (PluginI* plugin, *(track->efxPipe())) { +            QListWidgetItem* item = new QListWidgetItem(this, EFFECT_TYPE + i); +            ++i; +            item->setText(plugin->name()); +            // tooltip should only be set if name does not fit +            // (is elided) +            item->setToolTip(plugin->name()); +            item->setBackgroundColor(plugin->on() ? Qt::white : Qt::gray);              } +      // +      // debug: dummy +      // +      QListWidgetItem* item = new QListWidgetItem(this, SEND_TYPE); +      item->setText("Aux 1"); +      item->setToolTip("Auxiliary Send 1"); +      item->setBackgroundColor(Qt::white);        }  //--------------------------------------------------------- @@ -90,10 +99,13 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)        QAction* upAction         = menu->addAction(QIcon(*upIcon), tr("move up"));        QAction* downAction       = menu->addAction(QIcon(*downIcon), tr("move down"));        QAction* removeAction     = menu->addAction(tr("remove")); +                                  menu->addSeparator();        QAction* bypassAction     = menu->addAction(tr("bypass"));        QAction* showAction       = menu->addAction(tr("show gui"));        QAction* showCustomAction = menu->addAction(tr("show native gui")); -      QAction* newAction        = menu->addAction(tr("new")); +                                  menu->addSeparator(); +      QAction* newAction        = menu->addAction(tr("New Plugin")); +      QAction* auxAction        = menu->addAction(tr("New Aux Send"));        bypassAction->setCheckable(true);        showAction->setCheckable(true); @@ -111,15 +123,21 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)              idx = row(item);              upAction->setEnabled(idx != 0);              downAction->setEnabled(idx < pipe->size()-1); -            showCustomAction->setEnabled(pipe->hasNativeGui(idx)); - -            bypassAction->setEnabled(true); -            showAction->setEnabled(true); -            showCustomAction->setEnabled(true); - -            bypassAction->setChecked(!pipe->isOn(idx)); -            showAction->setChecked(pipe->guiVisible(idx)); -            showCustomAction->setChecked(pipe->nativeGuiVisible(idx)); +            if (item->type() < SEND_TYPE) { +                  idx = item->type(); +                  showCustomAction->setEnabled(pipe->hasNativeGui(idx)); +                  bypassAction->setEnabled(true); +                  showAction->setEnabled(true); + +                  bypassAction->setChecked(!pipe->isOn(idx)); +                  showAction->setChecked(pipe->guiVisible(idx)); +                  showCustomAction->setChecked(pipe->nativeGuiVisible(idx)); +                  } +            else { +                  showCustomAction->setEnabled(false); +                  bypassAction->setEnabled(false); +                  showAction->setEnabled(false); +                  }              }        QAction* sel = menu->exec(mapToGlobal(pt), newAction); @@ -158,6 +176,10 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)                    pipe->move(idx, false);                    }              } +      else if (sel == auxAction) { +            printf("add new aux send: not implemented\n"); +            } +        song->update(SC_RACK);        } diff --git a/muse/muse/mixer/rack.h b/muse/muse/mixer/rack.h index cea6c1ad..f8718f8c 100644 --- a/muse/muse/mixer/rack.h +++ b/muse/muse/mixer/rack.h @@ -13,6 +13,13 @@  class AudioTrack; +// +// EffectRack can contain effect plugins and aux send's: +// +static const int EFFECT_TYPE = 0; +static const int SEND_TYPE   = 32000; // this is the implicit maximal number +                                      // of possible effect plugins in the rack +  //---------------------------------------------------------  //   EffectRack  //--------------------------------------------------------- diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp index 70b088ef..5e9c187d 100644 --- a/muse/muse/seqmsg.cpp +++ b/muse/muse/seqmsg.cpp @@ -177,19 +177,6 @@ void Audio::msgAddPlugin(AudioTrack* node, int idx, PluginI* plugin)        }  //--------------------------------------------------------- -//   msgSetPrefader -//--------------------------------------------------------- - -void Audio::msgSetPrefader(AudioTrack* node, int val) -      { -      AudioMsg msg; -      msg.id    = AUDIO_SET_PREFADER; -      msg.track = node; -      msg.ival  = val; -      sendMsg(&msg); -      } - -//---------------------------------------------------------  //   msgSetChannels  //--------------------------------------------------------- diff --git a/muse/muse/wavetrack.cpp b/muse/muse/wavetrack.cpp index 7aa299fc..f177164d 100644 --- a/muse/muse/wavetrack.cpp +++ b/muse/muse/wavetrack.cpp @@ -318,7 +318,7 @@ void WaveTrack::collectInputData()        	if (song->bounceTrack == this && audio->isPlaying()) {        		OutputList* ol = song->outputs();              	if (!ol->empty()) -      			ol->front()->multiplyCopy(channels(), buffer); +      			ol->front()->multiplyCopy(channels(), buffer, 0);              	}              else        		AudioTrack::collectInputData(); | 
