Add new comment

Permalink

I made a little patch, so that qtractor now happily obeys volume/pan controllers from my midi controller. I'm not sure this is "the right way" to do it. It is channel based, meaning that for every volume change received the program tries to find midi tracks corresponding to that channel. This may be a bit awkward, but I don't know how to do it otherwise. Also, qtractorTrackGainCommand with its redo/undo system is omitted; volume and pan is set directly through track->setPanning() and setVolume(). I did this because the first implementation had some feedback issues, events not coming back soon enough; there is a lot of happening if you push many faders at once :) I also had some crashes in appendMessages(), so I commented that out temporarily. Need to investigate that some more.

Below is what I added to void qtractorMainForm::midiControlEvent ( qtractorMidiControlEvent *pCtlEvent )

Bye, Marko

    // handle volume controls
    if (pCtlEvent->controller() == 7) {
        for (int i = 0; i  m_pSession->tracks().count(); i++)  {
            qtractorTrack* pTrack = m_pSession->tracks().at(i);
            if (pTrack && (pTrack->trackType() == qtractorTrack::Midi) &&
                    pTrack->midiChannel() == pCtlEvent->channel()) {
                float fGain  = float(pCtlEvent->value()) / 127.0f;
                // Set track gain directly bypassing undo/redo system
                // to avoid feedback issues with motorized external
                // controllers
                pTrack->setGain(fGain);
                qtractorMidiBus *pMidiBus
                    = static_cast (pTrack->outputBus());
                if (pMidiBus)
                    pMidiBus->setVolume(pTrack, fGain);
                qtractorMixer *pMixer = mixer();
                if (pMixer) {
                    qtractorMixerStrip *pStrip  
                        = pMixer->trackRack()->findStrip(pTrack->monitor());
                    if (pStrip && pStrip->meter())
                        pStrip->meter()->updateGain();
                }
                sCtlText += tr("(track %1, gain %2)").arg(i).arg(fGain);
            }
        }
    }

    // handle pan controls
    if (pCtlEvent->controller() == 10)
    {
        for (int i = 0; i  m_pSession->tracks().count(); i++) {
            qtractorTrack* pTrack = m_pSession->tracks().at(i);
            if (pTrack && (pTrack->trackType() == qtractorTrack::Midi) &&
                    pTrack->midiChannel() == pCtlEvent->channel()) {
                float fPanning  = (float(pCtlEvent->value()) - 63.0f) / 64.0f;
                pTrack->setPanning(fPanning);
                qtractorMidiBus *pMidiBus
                    = static_cast (pTrack->outputBus());
                if (pMidiBus)
                    pMidiBus->setPanning(pTrack, fPanning);
                qtractorMixer *pMixer = mixer();
                if (pMixer) {
                    qtractorMixerStrip *pStrip
                        = pMixer->trackRack()->findStrip(pTrack->monitor());
                    if (pStrip && pStrip->meter())
                        pStrip->meter()->updatePanning();
                }
                sCtlText += tr("(track %1, panning %2)").arg(i).arg(fPanning);
            }
        }
    }
The content of this field is kept private and will not be shown publicly.

Markdown

  • Parses markdown and converts it to HTML.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <img src alt height width> <strike> <pre> <p> <br>
  • Lines and paragraphs break automatically.

Filtered HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <b> <i> <pre> <img src alt height width> <strike>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
File attachments
Unlimited number of files can be uploaded to this field.
2 MB limit.
Allowed types: jpg jpeg gif png txt doc docx xls xlsx pdf ppt pps odt ods odp zip gz bz2 xz patch diff wav ogg flac ogv mp4 qtz.