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

« back to all changes in this revision

Viewing changes to muse/mixer/amixer.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:
11
11
 
12
12
#include <qapplication.h>
13
13
#include <qmenubar.h>
 
14
#include <qaction.h>
14
15
 
15
16
#include "app.h"
16
17
#include "amixer.h"
19
20
#include "astrip.h"
20
21
#include "mstrip.h"
21
22
 
 
23
#include "gconfig.h"
 
24
#include "xml.h"
 
25
 
22
26
extern void populateAddTrack(QPopupMenu* addTrack);
23
27
 
24
 
typedef std::list<Strip*> StripList;
25
 
static StripList stripList;
 
28
#define __WIDTH_COMPENSATION 4
 
29
 
 
30
//typedef std::list<Strip*> StripList;
 
31
//static StripList stripList;
26
32
 
27
33
//---------------------------------------------------------
28
34
//   AudioMixer
30
36
//    inputs | synthis | tracks | groups | master
31
37
//---------------------------------------------------------
32
38
 
33
 
AudioMixerApp::AudioMixerApp(QWidget* parent)
 
39
//AudioMixerApp::AudioMixerApp(QWidget* parent)
 
40
AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c)
34
41
   : QMainWindow(parent, "mixer")
35
42
      {
 
43
      cfg = c;
36
44
      oldAuxsSize = 0;
37
45
      routingDialog = 0;
38
 
      setCaption(tr("MusE: Mixer"));
 
46
      //setCaption(tr("MusE: Mixer"));
 
47
      //name = cfg->name;
 
48
      //setCaption(name);
 
49
      //printf("AudioMixerApp::AudioMixerApp setting caption:%s\n", cfg->name.latin1());
 
50
      setCaption(cfg->name);
39
51
 
40
52
      QPopupMenu* menuConfig = new QPopupMenu(this);
41
53
      menuBar()->insertItem(tr("&Create"), menuConfig);
45
57
      menuBar()->insertItem(tr("&View"), menuView);
46
58
      routingId = menuView->insertItem(tr("Routing"), this, SLOT(toggleRouteDialog()));
47
59
 
 
60
      menuView->insertSeparator();
 
61
      
 
62
      QActionGroup* actionItems = new QActionGroup(this, "actionItems", false);
 
63
      
 
64
      /*
 
65
      showMidiTracksId = new QAction(tr("Show Midi Tracks"), 0, menuView);
 
66
      showDrumTracksId = new QAction(tr("Show Drum Tracks"), 0, menuView);
 
67
      showWaveTracksId = new QAction(tr("Show Wave Tracks"), 0, menuView);
 
68
      */
 
69
      showMidiTracksId = new QAction(tr("Show Midi Tracks"), 0, actionItems);
 
70
      showDrumTracksId = new QAction(tr("Show Drum Tracks"), 0, actionItems);
 
71
      showWaveTracksId = new QAction(tr("Show Wave Tracks"), 0, actionItems);
 
72
      //showMidiTracksId->addTo(menuView);
 
73
      //showDrumTracksId->addTo(menuView);
 
74
      //showWaveTracksId->addTo(menuView);
 
75
 
 
76
      //menuView->insertSeparator();
 
77
      actionItems->addSeparator();
 
78
 
 
79
      /*
 
80
      showInputTracksId= new QAction(tr("Show Inputs"), 0, menuView);
 
81
      showOutputTracksId = new QAction(tr("Show Outputs"), 0, menuView);
 
82
      showGroupTracksId = new QAction(tr("Show Groups"), 0, menuView);
 
83
      showAuxTracksId = new QAction(tr("Show Auxs"), 0, menuView);
 
84
      showSyntiTracksId = new QAction(tr("Show Synthesizers"), 0, menuView);
 
85
      */
 
86
      showInputTracksId = new QAction(tr("Show Inputs"), 0, actionItems);
 
87
      showOutputTracksId = new QAction(tr("Show Outputs"), 0, actionItems);
 
88
      showGroupTracksId = new QAction(tr("Show Groups"), 0, actionItems);
 
89
      showAuxTracksId = new QAction(tr("Show Auxs"), 0, actionItems);
 
90
      showSyntiTracksId = new QAction(tr("Show Synthesizers"), 0, actionItems);
 
91
      //showInputTracksId->addTo(menuView);
 
92
      //showOutputTracksId->addTo(menuView);
 
93
      //showGroupTracksId->addTo(menuView);
 
94
      //showAuxTracksId->addTo(menuView);
 
95
      //showSyntiTracksId->addTo(menuView);
 
96
      
 
97
      showMidiTracksId->setToggleAction(true);
 
98
      showDrumTracksId->setToggleAction(true);
 
99
      showWaveTracksId->setToggleAction(true);
 
100
      showInputTracksId->setToggleAction(true);
 
101
      showOutputTracksId->setToggleAction(true);
 
102
      showGroupTracksId->setToggleAction(true);
 
103
      showAuxTracksId->setToggleAction(true);
 
104
      showSyntiTracksId->setToggleAction(true);
 
105
 
 
106
      //connect(menuView, SIGNAL(triggered(QAction*)), SLOT(showTracksChanged(QAction*)));
 
107
      //connect(actionItems, SIGNAL(selected(QAction*)), this, SLOT(showTracksChanged(QAction*)));
 
108
      connect(showMidiTracksId, SIGNAL(toggled(bool)), SLOT(showMidiTracksChanged(bool)));
 
109
      connect(showDrumTracksId, SIGNAL(toggled(bool)), SLOT(showDrumTracksChanged(bool)));      
 
110
      connect(showWaveTracksId, SIGNAL(toggled(bool)), SLOT(showWaveTracksChanged(bool)));      
 
111
      connect(showInputTracksId, SIGNAL(toggled(bool)), SLOT(showInputTracksChanged(bool)));      
 
112
      connect(showOutputTracksId, SIGNAL(toggled(bool)), SLOT(showOutputTracksChanged(bool)));      
 
113
      connect(showGroupTracksId, SIGNAL(toggled(bool)), SLOT(showGroupTracksChanged(bool)));      
 
114
      connect(showAuxTracksId, SIGNAL(toggled(bool)), SLOT(showAuxTracksChanged(bool)));      
 
115
      connect(showSyntiTracksId, SIGNAL(toggled(bool)), SLOT(showSyntiTracksChanged(bool)));      
 
116
              
 
117
      actionItems->addTo(menuView);
48
118
      view = new QScrollView(this);
49
119
      setCentralWidget(view);
50
120
      central = new QWidget(view);
113
183
 
114
184
void AudioMixerApp::updateMixer(UpdateAction action)
115
185
      {
 
186
      //printf("AudioMixerApp::updateMixer action:%d\n", action);
 
187
      
 
188
      //name = cfg->name;
 
189
      //setCaption(name);
 
190
      setCaption(cfg->name);
 
191
      
 
192
      showMidiTracksId->setOn(cfg->showMidiTracks);
 
193
      showDrumTracksId->setOn(cfg->showDrumTracks);
 
194
      showInputTracksId->setOn(cfg->showInputTracks);
 
195
      showOutputTracksId->setOn(cfg->showOutputTracks);
 
196
      showWaveTracksId->setOn(cfg->showWaveTracks);
 
197
      showGroupTracksId->setOn(cfg->showGroupTracks);
 
198
      showAuxTracksId->setOn(cfg->showAuxTracks);
 
199
      showSyntiTracksId->setOn(cfg->showSyntiTracks);
 
200
 
116
201
      int auxsSize = song->auxs()->size();
117
202
      if ((action == UPDATE_ALL) || (auxsSize != oldAuxsSize)) {
118
203
            clear();
137
222
                  delete *ssi;
138
223
                  stripList.erase(ssi);
139
224
                  }
140
 
            setMaximumWidth(STRIP_WIDTH * stripList.size());
 
225
            setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
141
226
            // Added by Tim. p3.3.7
142
227
            if (stripList.size() < 8)
143
 
                  view->setMinimumWidth(stripList.size() * STRIP_WIDTH);
 
228
                  view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
144
229
                  
145
230
            return;
146
231
      }
194
279
            MidiTrackList* mtl = song->midis();
195
280
            for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) 
196
281
            {
197
 
              addStrip(*i, idx++);
 
282
              MidiTrack* mt = *i;
 
283
              if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks)) 
 
284
                addStrip(*i, idx++);
198
285
            }
199
286
      
200
 
            setMaximumWidth(STRIP_WIDTH * stripList.size());
 
287
            setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
201
288
            if (stripList.size() < 8)
202
 
                  view->setMinimumWidth(stripList.size() * STRIP_WIDTH);
 
289
                  view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
203
290
            return;
204
291
      }
205
292
 
208
295
      //  generate Input Strips
209
296
      //---------------------------------------------------
210
297
 
211
 
      InputList* itl = song->inputs();
212
 
      for (iAudioInput i = itl->begin(); i != itl->end(); ++i)
 
298
      if(cfg->showInputTracks)
 
299
      {
 
300
        InputList* itl = song->inputs();
 
301
        for (iAudioInput i = itl->begin(); i != itl->end(); ++i)
213
302
            addStrip(*i, idx++);
214
 
 
 
303
      }
 
304
      
215
305
      //---------------------------------------------------
216
306
      //  Synthesizer Strips
217
307
      //---------------------------------------------------
218
308
 
219
 
      SynthIList* sl = song->syntis();
220
 
      for (iSynthI i = sl->begin(); i != sl->end(); ++i)
 
309
      if(cfg->showSyntiTracks)
 
310
      {
 
311
        SynthIList* sl = song->syntis();
 
312
        for (iSynthI i = sl->begin(); i != sl->end(); ++i)
221
313
            addStrip(*i, idx++);
222
 
 
 
314
      }
 
315
      
223
316
      //---------------------------------------------------
224
317
      //  generate Wave Track Strips
225
318
      //---------------------------------------------------
226
319
 
227
 
      WaveTrackList* wtl = song->waves();
228
 
      for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i)
 
320
      if(cfg->showWaveTracks)
 
321
      {
 
322
        WaveTrackList* wtl = song->waves();
 
323
        for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i)
229
324
            addStrip(*i, idx++);
230
 
 
 
325
      }
 
326
      
231
327
      //---------------------------------------------------
232
328
      //  generate Midi channel/port Strips
233
329
      //---------------------------------------------------
250
346
      MidiTrackList* mtl = song->midis();
251
347
      for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) 
252
348
      {
253
 
        addStrip(*i, idx++);
 
349
        MidiTrack* mt = *i;
 
350
        if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks)) 
 
351
          addStrip(*i, idx++);
254
352
      }
255
353
 
256
354
      //---------------------------------------------------
257
355
      //  Groups
258
356
      //---------------------------------------------------
259
357
 
260
 
      GroupList* gtl = song->groups();
261
 
      for (iAudioGroup i = gtl->begin(); i != gtl->end(); ++i)
 
358
      if(cfg->showGroupTracks)
 
359
      {
 
360
        GroupList* gtl = song->groups();
 
361
        for (iAudioGroup i = gtl->begin(); i != gtl->end(); ++i)
262
362
            addStrip(*i, idx++);
263
 
 
 
363
      }
 
364
      
264
365
      //---------------------------------------------------
265
366
      //  Aux
266
367
      //---------------------------------------------------
267
368
 
268
 
      AuxList* al = song->auxs();
269
 
      for (iAudioAux i = al->begin(); i != al->end(); ++i)
 
369
      if(cfg->showAuxTracks)
 
370
      {
 
371
        AuxList* al = song->auxs();
 
372
        for (iAudioAux i = al->begin(); i != al->end(); ++i)
270
373
            addStrip(*i, idx++);
271
 
 
 
374
      }
 
375
      
272
376
      //---------------------------------------------------
273
377
      //    Master
274
378
      //---------------------------------------------------
275
379
 
276
 
      OutputList* otl = song->outputs();
277
 
      for (iAudioOutput i = otl->begin(); i != otl->end(); ++i)
 
380
      if(cfg->showOutputTracks)
 
381
      {
 
382
        OutputList* otl = song->outputs();
 
383
        for (iAudioOutput i = otl->begin(); i != otl->end(); ++i)
278
384
            addStrip(*i, idx++);
279
 
 
280
 
      setMaximumWidth(STRIP_WIDTH * idx);
 
385
      }
 
386
      
 
387
      //printf("AudioMixerApp::updateMixer setting maximum width:%d\n", STRIP_WIDTH * idx + __WIDTH_COMPENSATION);
 
388
      setMaximumWidth(STRIP_WIDTH * idx + __WIDTH_COMPENSATION);
281
389
      if (idx < 8)
282
 
            view->setMinimumWidth(idx * STRIP_WIDTH);
 
390
      {
 
391
            //printf("AudioMixerApp::updateMixer setting minimum width:%d\n", idx * STRIP_WIDTH + __WIDTH_COMPENSATION);
 
392
            view->setMinimumWidth(idx * STRIP_WIDTH + __WIDTH_COMPENSATION);
 
393
      }      
283
394
      }
284
395
 
285
396
//---------------------------------------------------------
288
399
 
289
400
void AudioMixerApp::configChanged()    
290
401
291
 
  // Added by Tim. p3.3.6
292
402
  //printf("AudioMixerApp::configChanged\n");
293
403
      
294
404
  songChanged(SC_CONFIG); 
367
477
      menuView->setItemChecked(routingId, false);
368
478
      }
369
479
 
 
480
//---------------------------------------------------------
 
481
//   showTracksChanged
 
482
//---------------------------------------------------------
 
483
 
 
484
/*
 
485
void AudioMixerApp::showTracksChanged(QAction* id)
 
486
      {
 
487
      bool val = id->isOn();
 
488
      if (id == showMidiTracksId)
 
489
            cfg->showMidiTracks = val;
 
490
      else if (id == showDrumTracksId)
 
491
            cfg->showDrumTracks = val;
 
492
      else if (id == showInputTracksId)
 
493
            cfg->showInputTracks = val;
 
494
      else if (id == showOutputTracksId)
 
495
            cfg->showOutputTracks = val;
 
496
      else if (id == showWaveTracksId)
 
497
            cfg->showWaveTracks = val;
 
498
      else if (id == showGroupTracksId)
 
499
            cfg->showGroupTracks = val;
 
500
      else if (id == showAuxTracksId)
 
501
            cfg->showAuxTracks = val;
 
502
      else if (id == showSyntiTracksId)
 
503
            cfg->showSyntiTracks = val;
 
504
      updateMixer(UPDATE_ALL);
 
505
      }
 
506
*/
 
507
 
 
508
void AudioMixerApp::showMidiTracksChanged(bool v)
 
509
{
 
510
      cfg->showMidiTracks = v;
 
511
      updateMixer(UPDATE_ALL);
 
512
}
 
513
 
 
514
void AudioMixerApp::showDrumTracksChanged(bool v)
 
515
{
 
516
      cfg->showDrumTracks = v;
 
517
      updateMixer(UPDATE_ALL);
 
518
}
 
519
 
 
520
void AudioMixerApp::showWaveTracksChanged(bool v)
 
521
{
 
522
      cfg->showWaveTracks = v;
 
523
      updateMixer(UPDATE_ALL);
 
524
}
 
525
 
 
526
void AudioMixerApp::showInputTracksChanged(bool v)
 
527
{
 
528
      cfg->showInputTracks = v;
 
529
      updateMixer(UPDATE_ALL);
 
530
}
 
531
 
 
532
void AudioMixerApp::showOutputTracksChanged(bool v)
 
533
{
 
534
      cfg->showOutputTracks = v;
 
535
      updateMixer(UPDATE_ALL);
 
536
}
 
537
 
 
538
void AudioMixerApp::showGroupTracksChanged(bool v)
 
539
{
 
540
      cfg->showGroupTracks = v;
 
541
      updateMixer(UPDATE_ALL);
 
542
}
 
543
 
 
544
void AudioMixerApp::showAuxTracksChanged(bool v)
 
545
{
 
546
      cfg->showAuxTracks = v;
 
547
      updateMixer(UPDATE_ALL);
 
548
}
 
549
 
 
550
void AudioMixerApp::showSyntiTracksChanged(bool v)
 
551
{
 
552
      cfg->showSyntiTracks = v;
 
553
      updateMixer(UPDATE_ALL);
 
554
}
 
555
 
 
556
//---------------------------------------------------------
 
557
//   write
 
558
//---------------------------------------------------------
 
559
 
 
560
//void AudioMixerApp::write(Xml& xml, const char* name)
 
561
void AudioMixerApp::write(int level, Xml& xml)
 
562
//void AudioMixerApp::write(int level, Xml& xml, const char* name)
 
563
      {
 
564
      //xml.stag(QString(name));
 
565
      //xml.tag(level++, name.latin1());
 
566
      xml.tag(level++, "Mixer");
 
567
      
 
568
      xml.strTag(level, "name", cfg->name);
 
569
      
 
570
      //xml.tag("geometry",       geometry());
 
571
      xml.qrectTag(level, "geometry", geometry());
 
572
      
 
573
      xml.intTag(level, "showMidiTracks",   cfg->showMidiTracks);
 
574
      xml.intTag(level, "showDrumTracks",   cfg->showDrumTracks);
 
575
      xml.intTag(level, "showInputTracks",  cfg->showInputTracks);
 
576
      xml.intTag(level, "showOutputTracks", cfg->showOutputTracks);
 
577
      xml.intTag(level, "showWaveTracks",   cfg->showWaveTracks);
 
578
      xml.intTag(level, "showGroupTracks",  cfg->showGroupTracks);
 
579
      xml.intTag(level, "showAuxTracks",    cfg->showAuxTracks);
 
580
      xml.intTag(level, "showSyntiTracks",  cfg->showSyntiTracks);
 
581
      
 
582
      //xml.etag(name);
 
583
      //xml.etag(level, name.latin1());
 
584
      xml.etag(level, "Mixer");
 
585
      }
 
586