~ubuntu-branches/ubuntu/breezy/muse/breezy

« back to all changes in this revision

Viewing changes to synti/synthconfig.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-02-07 15:18:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040207151822-es27xxkzbcxkebjm
Tags: 0.6.3-1
* New upstream version.
* Added patches:
  + [10_alsa_init_fix] New, from upstream CVS.
    Initialize direction variable when setting Alsa parameters.
  + [10_canvas_translation_fix] New, from upstream CVS.
    Do not translate tooltips twice in canvas popup.
  + [10_checkbox_fix] New, from upstream CVS.
    Use proper set/test methods on metronome checkboxes.
  + [10_html_doc_cleanup] New.
    Fix links and HTML errors in documentation.
  + [20_allow_system_timer] New.
    The new upstream version fails by default if the real-time clock
    could not be accessed (usually the case when not running suid-root).
    This patch reverts the old behaviour of falling back to the more
    inaccurate system timer.
* Updated patches:
  + [11_PIC_fixes_fixup] Rediffed.
* Removed patches:
  + [20_no_atomic_asm] Merged upstream.
* debian/compat: Splice out debhelper compatibility level from rules file.
* debian/control: Build-depend on latest jack release by default.
  Closes: #228788
* debian/control: Bump standards version.
* debian/control: Use auto-generated debconf dependency via misc:Depends.
* debian/control: Minor tweaks to the long description.
* debian/control: Tighten fluidsynth build dependency to sane version.
* debian/muse.doc-base: New. Register HTML documentation with doc-base.
* debian/templates: Tiny rewording, and typo fix.
* debian/templates, debian/po/*: Switch to po-debconf for translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//=========================================================
2
 
//  MusE
3
 
//  Linux Music Editor
4
 
//  $Id: synthconfig.cpp,v 1.3 2002/02/08 09:56:29 muse Exp $
5
 
//
6
 
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
7
 
//=========================================================
8
 
 
9
 
#include <qlayout.h>
10
 
#include <qlistview.h>
11
 
#include <qpushbutton.h>
12
 
#include "synthconfig.h"
13
 
#include "app.h"
14
 
#include "synth.h"
15
 
#include "mess.h"
16
 
#include "driver/mididev.h"
17
 
#include "midiport.h"
18
 
#include "song.h"
19
 
#include "midithread.h"
20
 
#include "audiothread.h"
21
 
 
22
 
//---------------------------------------------------------
23
 
//   configSoftSynthesizer
24
 
//---------------------------------------------------------
25
 
 
26
 
void MusE::configSoftSynthesizer()
27
 
      {
28
 
      if (!softSynthesizerConfig)
29
 
            softSynthesizerConfig = new SynthesizerConfig();
30
 
      softSynthesizerConfig->show();
31
 
      }
32
 
 
33
 
//---------------------------------------------------------
34
 
//   SynthesizerConfig
35
 
//---------------------------------------------------------
36
 
 
37
 
SynthesizerConfig::SynthesizerConfig()
38
 
   : SynthConfigBase(0, "synthiTable")
39
 
      {
40
 
      songChanged(0);
41
 
 
42
 
      connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
43
 
      connect(addInstance, SIGNAL(clicked()), SLOT(addInstanceClicked()));
44
 
      connect(removeInstance, SIGNAL(clicked()), SLOT(removeInstanceClicked()));
45
 
      }
46
 
 
47
 
//---------------------------------------------------------
48
 
//   songChanged
49
 
//---------------------------------------------------------
50
 
 
51
 
void SynthesizerConfig::songChanged(int)
52
 
      {
53
 
      synthList->clear();
54
 
      for (int i = 0; i < nsynthis; ++i) {
55
 
            if (synthis[i] == 0)    //DEBUG
56
 
                  continue;
57
 
            QString s = synthis[i]->baseName();
58
 
            QListViewItem* item = new QListViewItem(synthList);
59
 
            item->setText(0, s);
60
 
            s.setNum(synthis[i]->instances());
61
 
            item->setText(1, s);
62
 
            item->setText(2, synthis[i]->label());
63
 
            }
64
 
      instanceList->clear();
65
 
      for (iSynthI si = synthiInstances.begin(); si != synthiInstances.end(); ++si) {
66
 
            QListViewItem* iitem = new QListViewItem(instanceList);
67
 
            iitem->setText(0, (*si)->iname());
68
 
            QString port;
69
 
            port.sprintf("%d:%d",
70
 
               (*si)->mess()->alsaClient(),
71
 
               (*si)->mess()->alsaPort());
72
 
            iitem->setText(1, port);
73
 
            }
74
 
      }
75
 
 
76
 
//---------------------------------------------------------
77
 
//   addInstanceClicked
78
 
//---------------------------------------------------------
79
 
 
80
 
void SynthesizerConfig::addInstanceClicked()
81
 
      {
82
 
      QListViewItem* item = synthList->selectedItem();
83
 
      if (item == 0)
84
 
            return;
85
 
      SynthI* si = song->createSynthI(item->text(2));
86
 
      audioThread->msgAddSynthI(si);
87
 
      midiThread->msgAddSynthI(si);
88
 
 
89
 
      QString name(si->iname());
90
 
      QListViewItem* iitem = new QListViewItem(instanceList);
91
 
      iitem->setText(0, name);
92
 
      QString port;
93
 
      port.sprintf("%d:%d", si->mess()->alsaClient(), si->mess()->alsaPort());
94
 
 
95
 
      iitem->setText(1, port);
96
 
 
97
 
      song->updateAudioMixer();
98
 
 
99
 
      QString inst;
100
 
      inst.setNum(si->synth()->instances());
101
 
      item->setText(1, inst);
102
 
      }
103
 
 
104
 
//---------------------------------------------------------
105
 
//   removeInstanceClicked
106
 
//---------------------------------------------------------
107
 
 
108
 
void SynthesizerConfig::removeInstanceClicked()
109
 
      {
110
 
      QListViewItem* item = instanceList->selectedItem();
111
 
      if (item == 0)
112
 
            return;
113
 
      iSynthI ii;
114
 
      for (ii = synthiInstances.begin(); ii != synthiInstances.end(); ++ii) {
115
 
            if ((*ii)->iname() == item->text(0))
116
 
                  break;
117
 
            }
118
 
      if (ii == synthiInstances.end()) {
119
 
            printf("synthesizerConfig::removeInstanceClicked(): synthi not found\n");
120
 
            return;
121
 
            }
122
 
      int port;
123
 
      for (port = 0; port < MIDI_PORTS; ++port) {
124
 
            if (midiPorts[port].instrument() == *ii)
125
 
                  break;
126
 
            }
127
 
      if (port != MIDI_PORTS) {
128
 
            // synthi is attached
129
 
            midiThread->setMidiDevice(&midiPorts[port], 0);
130
 
            midiPorts[port].setInstrument(genericMidiInstrument);
131
 
#if 0
132
 
            for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) {
133
 
                  MidiDevice* d = *i;
134
 
                  if (d->name() == (*ii)->iname()) {
135
 
                        printf("midi device %s found\n", d->name().latin1());
136
 
                        }
137
 
                  }
138
 
#endif
139
 
            }
140
 
      audioThread->msgRemoveSynthI(*ii);
141
 
      song->updateAudioMixer();
142
 
      song->update();
143
 
      }