~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to muse/arranger/trackinfo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-11-17 21:43:38 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101117214338-1hvfl7oo2dsqnvrb
Tags: 1.1-0ubuntu1
* New upstream release (LP: #668631)
* Switch to dpkg-source 3.0 (quilt) format
* Switch to dh7 short form
* debian/rules:
  - added --enable-dssi and --enable-osc to conf flags for dssi support
  - added -ljackserver to LDFLAGS to fix a FTBFS because of --as-needed
* debian/control:
  - added build build dependency on liblo-dev and dssi-dev for dssi support
  - bump Standards-version to 3.9.1. No changes required.
* debian/muse.desktop, debian/muse.xpm: dropped as desktop file and icon is
  now shipped upstream.
* fix-desktop-categories.patch: fix Categories tag in upstream desktop file
* 10_es_locale_fix.dpatch: refreshed and converted to quilt as
  fix_es_locale.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "mixer/astrip.h"
41
41
#include "icons.h"
42
42
#include "app.h"
 
43
#include "route.h"
 
44
#include "popupmenu.h"
43
45
 
44
46
 
45
47
//---------------------------------------------------------
59
61
      
60
62
      int outChannel = track->outChannel();
61
63
      int outPort    = track->outPort();
62
 
      int ichMask    = track->inChannelMask();
 
64
      ///int ichMask    = track->inChannelMask();
63
65
      //int iptMask    = track->inPortMask();
64
 
      unsigned int iptMask    = track->inPortMask();
 
66
      ///unsigned int iptMask    = track->inPortMask();
65
67
      
66
68
      MidiPort* mp = &midiPorts[outPort];
67
69
      
76
78
      // Check for detection of midi general activity on chosen channels...
77
79
      int mpt = 0;
78
80
      //int mch = 0;
79
 
      for(; mpt < MIDI_PORTS; ++mpt)
 
81
      RouteList* rl = track->inRoutes();
 
82
      
 
83
      ciRoute r = rl->begin();
 
84
      //for( ; mpt < MIDI_PORTS; ++mpt)
 
85
      for( ; r != rl->end(); ++r)
80
86
      {
 
87
        //if(!r->isValid() || ((r->type != Route::ALSA_MIDI_ROUTE) && (r->type != Route::JACK_MIDI_ROUTE)))
 
88
        //if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE))
 
89
        if(!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE))   // p3.3.49
 
90
          continue;
 
91
        
 
92
        // NOTE: TODO: Code for channelless events like sysex, ** IF we end up using the 'special channel 17' method.
 
93
        //if(r->channel == -1)
 
94
        if(r->channel == -1 || r->channel == 0)  // p3.3.50
 
95
          continue;
 
96
        
 
97
        // No port assigned to the device?
 
98
        //mpt = r->device->midiPort();
 
99
        mpt = r->midiPort;              // p3.3.49
 
100
        if(mpt < 0 || mpt >= MIDI_PORTS)
 
101
          continue;
 
102
        
81
103
        //for(; mch < MIDI_CHANNELS; ++mch)
82
104
        //{
83
105
          //if(midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) )
84
 
          if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) )
 
106
          //if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) )
 
107
          //if(midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel]) 
 
108
          if(midiPorts[mpt].syncInfo().actDetectBits() & r->channel)          // p3.3.50 Use new channel mask.
85
109
          {
86
110
            //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != green)
87
111
            //  midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(green);
88
112
            //if(midiTrackInfo->iChanDetectLabel->pixmap() != greendotIcon)
89
113
            if(!midiTrackInfo->_midiDetect)
90
114
            {
91
 
              // Added by Tim. p3.3.6
92
115
              //printf("Arranger::midiTrackInfoHeartBeat setting green icon\n");
93
116
          
94
117
              midiTrackInfo->_midiDetect = true;
101
124
      }
102
125
      // No activity detected?
103
126
      //if(mch == MIDI_CHANNELS)
104
 
      if(mpt == MIDI_PORTS)
 
127
      //if(mpt == MIDI_PORTS)
 
128
      if(r == rl->end())
105
129
      {
106
130
        //if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != darkGreen)
107
131
        //  midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(darkGreen);
108
132
        //if(midiTrackInfo->iChanDetectLabel->pixmap() != darkgreendotIcon)
109
133
        if(midiTrackInfo->_midiDetect)
110
134
        {
111
 
          // Added by Tim. p3.3.6
112
135
          //printf("Arranger::midiTrackInfoHeartBeat setting darkgreen icon\n");
113
136
          
114
137
          midiTrackInfo->_midiDetect = false;
122
145
      {
123
146
        if(program != CTRL_VAL_UNKNOWN)
124
147
        {
125
 
          // Added by Tim. p3.3.6
126
148
          //printf("Arranger::midiTrackInfoHeartBeat setting program to unknown\n");
127
149
          
128
150
          program = CTRL_VAL_UNKNOWN;
154
176
          //if(strcmp(midiTrackInfo->iPatch->text().latin1(), n) != 0)
155
177
          if(midiTrackInfo->iPatch->text() != n)
156
178
          {
157
 
            // Added by Tim. p3.3.6
158
179
            //printf("Arranger::midiTrackInfoHeartBeat setting patch <unknown>\n");
159
180
          
160
181
            midiTrackInfo->iPatch->setText(n);
172
193
          else
173
194
          if(strcmp(midiTrackInfo->iPatch->text().latin1(), name) != 0)
174
195
          {
175
 
            // Added by Tim. p3.3.6
176
196
            //printf("Arranger::midiTrackInfoHeartBeat setting patch name\n");
177
197
          
178
198
            midiTrackInfo->iPatch->setText(name);
207
227
                        pr = 0;
208
228
            //}
209
229
            
210
 
            // Added by Tim. p3.3.6
211
230
            //printf("Arranger::midiTrackInfoHeartBeat setting program\n");
212
231
          
213
232
            if(midiTrackInfo->iHBank->value() != hb)
249
268
        volume = v;
250
269
        if(midiTrackInfo->iLautst->value() != v)
251
270
        {
252
 
          // Added by Tim. p3.3.6
253
271
          //printf("Arranger::midiTrackInfoHeartBeat setting volume\n");
254
272
          
255
273
          midiTrackInfo->iLautst->blockSignals(true);
277
295
        pan = v;
278
296
        if(midiTrackInfo->iPan->value() != v)
279
297
        {
280
 
          // Added by Tim. p3.3.6
281
298
          //printf("Arranger::midiTrackInfoHeartBeat setting pan\n");
282
299
          
283
300
          midiTrackInfo->iPan->blockSignals(true);
405
422
//---------------------------------------------------------
406
423
//   setTrackInfoLabelText
407
424
//---------------------------------------------------------
408
 
// Added by Tim. p3.3.9
409
425
 
410
426
void Arranger::setTrackInfoLabelText()
411
427
{
419
435
//---------------------------------------------------------
420
436
//   setTrackInfoLabelFont
421
437
//---------------------------------------------------------
422
 
// Added by Tim. p3.3.9
423
438
 
424
439
void Arranger::setTrackInfoLabelFont()
425
440
{
498
513
            }
499
514
      }
500
515
 
 
516
/*
501
517
//---------------------------------------------------------
502
518
//   iKanalChanged
503
519
//---------------------------------------------------------
511
527
            list->redraw();
512
528
            }
513
529
      }
 
530
*/
514
531
 
515
532
//---------------------------------------------------------
516
533
//   iOutputPortChanged
531
548
      list->redraw();
532
549
      }
533
550
 
 
551
/*
534
552
//---------------------------------------------------------
535
553
//   iInputPortChanged
536
554
//---------------------------------------------------------
547
565
      track->setInPortMask(val);
548
566
      list->redraw();
549
567
      }
 
568
*/
 
569
 
 
570
//---------------------------------------------------------
 
571
//   routingPopupMenuActivated
 
572
//---------------------------------------------------------
 
573
 
 
574
void Arranger::routingPopupMenuActivated(int n)
 
575
{
 
576
  //if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
 
577
  if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack())
 
578
    return;
 
579
  //if (n > 999) {
 
580
  //if (n >= MIDI_PORTS * MIDI_CHANNELS) {    // p3.3.50
 
581
  //  for (int i = 0; i < MIDI_CHANNELS; i++)
 
582
      //muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
 
583
  //    muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS));   // p3.3.50
 
584
  //}
 
585
  //else {
 
586
    muse->routingPopupMenuActivated(selected, n);
 
587
  //}
 
588
}
 
589
 
 
590
//---------------------------------------------------------
 
591
//   inRoutesPressed
 
592
//---------------------------------------------------------
 
593
 
 
594
void Arranger::inRoutesPressed()
 
595
{
 
596
  if(!selected)
 
597
    return;
 
598
    
 
599
  ///song->chooseMidiRoutes(midiTrackInfo->iRButton, (MidiTrack*)selected, false);
 
600
  
 
601
  if(!selected->isMidiTrack())
 
602
    return;
 
603
  
 
604
  //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
 
605
  PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, false);
 
606
  if(!pup)
 
607
    return;
 
608
  
 
609
  //pup->disconnect();
 
610
  //gRoutingPopupMenuMaster = this;
 
611
  gRoutingPopupMenuMaster = midiTrackInfo;
 
612
  connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
 
613
  // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
 
614
  connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
 
615
  pup->popup(QCursor::pos(), 0);
 
616
  midiTrackInfo->iRButton->setDown(false);     
 
617
  return;
 
618
}
 
619
 
 
620
//---------------------------------------------------------
 
621
//   outRoutesPressed
 
622
//---------------------------------------------------------
 
623
 
 
624
void Arranger::outRoutesPressed()
 
625
{
 
626
  if(!selected)
 
627
    return;
 
628
    
 
629
  ///song->chooseMidiRoutes(midiTrackInfo->oRButton, (MidiTrack*)selected, true);
 
630
  
 
631
  if(!selected->isMidiTrack())
 
632
    return;
 
633
  
 
634
  //song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
 
635
  PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, true);
 
636
  if(!pup)
 
637
    return;
 
638
  
 
639
  //pup->disconnect();
 
640
  //gRoutingPopupMenuMaster = this;
 
641
  gRoutingPopupMenuMaster = midiTrackInfo;
 
642
  connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
 
643
  // Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
 
644
  connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
 
645
  pup->popup(QCursor::pos(), 0);
 
646
  midiTrackInfo->oRButton->setDown(false);     
 
647
  return;
 
648
}
550
649
 
551
650
//---------------------------------------------------------
552
651
//   iProgHBankChanged
1124
1223
      //connect(midiTrackInfo->iName, SIGNAL(returnPressed()), SLOT(iNameChanged()));
1125
1224
      
1126
1225
      connect(midiTrackInfo->iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int)));
1127
 
      connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));
 
1226
      ///connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));
1128
1227
      connect(midiTrackInfo->iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged()));
1129
1228
      connect(midiTrackInfo->iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged()));
1130
1229
      connect(midiTrackInfo->iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged()));
1141
1240
      connect(midiTrackInfo->iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int)));
1142
1241
      connect(midiTrackInfo->iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked()));
1143
1242
      connect(midiTrackInfo->iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int)));
1144
 
      connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));
 
1243
      ///connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));
1145
1244
      connect(midiTrackInfo->recordButton, SIGNAL(clicked()), SLOT(recordClicked()));
1146
1245
      connect(midiTrackInfo->progRecButton, SIGNAL(clicked()), SLOT(progRecClicked()));
1147
1246
      connect(midiTrackInfo->volRecButton, SIGNAL(clicked()), SLOT(volRecClicked()));
1148
1247
      connect(midiTrackInfo->panRecButton, SIGNAL(clicked()), SLOT(panRecClicked()));
1149
1248
      connect(midiTrackInfo->recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool)));
 
1249
      connect(midiTrackInfo->iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed()));
 
1250
      
 
1251
      // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
 
1252
      midiTrackInfo->oRButton->setEnabled(false);
 
1253
      connect(midiTrackInfo->oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed()));
1150
1254
      
1151
1255
      connect(heartBeatTimer, SIGNAL(timeout()), SLOT(midiTrackInfoHeartBeat()));
1152
1256
      }
1163
1267
      if(flags == SC_MIDI_CONTROLLER)
1164
1268
        return;
1165
1269
        
 
1270
      // p3.3.47 Update the routing popup menu if anything relevant changes.
 
1271
      //if(gRoutingPopupMenuMaster == midiTrackInfo && selected && (flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG))) 
 
1272
      if(flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG))     // p3.3.50
 
1273
        // Use this handy shared routine.
 
1274
        //muse->updateRouteMenus(selected);
 
1275
        muse->updateRouteMenus(selected, midiTrackInfo);   // p3.3.50
 
1276
      
1166
1277
      // Added by Tim. p3.3.9
1167
1278
      setTrackInfoLabelText();
1168
1279
      setTrackInfoLabelFont();
1169
1280
        
1170
1281
      //{
1171
1282
        int outChannel = track->outChannel();
1172
 
        int inChannel  = track->inChannelMask();
 
1283
        ///int inChannel  = track->inChannelMask();
1173
1284
        int outPort    = track->outPort();
1174
1285
        //int inPort     = track->inPortMask();
1175
 
        unsigned int inPort     = track->inPortMask();
 
1286
        ///unsigned int inPort     = track->inPortMask();
1176
1287
  
1177
 
        midiTrackInfo->iInput->clear();
 
1288
        //midiTrackInfo->iInput->clear();
1178
1289
        midiTrackInfo->iOutput->clear();
1179
1290
  
1180
1291
        for (int i = 0; i < MIDI_PORTS; ++i) {
1185
1296
                    midiTrackInfo->iOutput->setCurrentItem(i);
1186
1297
              }
1187
1298
        //midiTrackInfo->iInput->setText(bitmap2String(inPort));
1188
 
        midiTrackInfo->iInput->setText(u32bitmap2String(inPort));
 
1299
        ///midiTrackInfo->iInput->setText(u32bitmap2String(inPort));
 
1300
        
1189
1301
        //midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel));
1190
1302
  
1191
1303
        // Removed by Tim. p3.3.9
1195
1307
        //      }
1196
1308
        
1197
1309
        midiTrackInfo->iOutputChannel->setValue(outChannel+1);
1198
 
        midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel));
 
1310
        ///midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel));
1199
1311
        
1200
1312
        // Set record echo.
1201
1313
        if(midiTrackInfo->recEchoButton->isOn() != track->recEcho())