Skip to content

Commit

Permalink
add metronome volume control to synthesizer gui
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jan 2, 2015
1 parent 8cc7741 commit f471d31
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 17 deletions.
8 changes: 3 additions & 5 deletions awl/CMakeLists.txt
Expand Up @@ -75,8 +75,6 @@ xcode_pch(awl all)
ADD_DEPENDENCIES(awl mops1)
ADD_DEPENDENCIES(awl mops2)

# if (NOT MINGW AND NOT APPLE)
if (FALSE)
QT4_WRAP_CPP (mocs2
aslider.h
knob.h
Expand All @@ -94,6 +92,7 @@ QT4_WRAP_CPP (mocs2
awlplugin.h
)


add_library (
awlplugin SHARED
${PROJECT_BINARY_DIR}/all.h
Expand Down Expand Up @@ -126,11 +125,10 @@ set_target_properties(awlplugin
)

# dont install awlplugin on default
# install( TARGETS awlplugin DESTINATION ${QT_PLUGINS_DIR}/designer/ )
# install( TARGETS awlplugin DESTINATION ${designerPlugins}/plugins/designer/ )

#add_executable(ltest ltest.cpp)
#target_link_libraries (ltest awlplugin msynth al ${QT_LIBRARIES})

set_target_properties(awlplugin PROPERTIES EXCLUDE_FROM_ALL 1)

# endif (NOT MINGW AND NOT APPLE)
endif (FALSE)
2 changes: 1 addition & 1 deletion awl/awlplugin.cpp
Expand Up @@ -102,5 +102,5 @@ QList<QDesignerCustomWidgetInterface*> AwlPlugins::customWidgets() const
return plugins;
}

Q_EXPORT_PLUGIN(AwlPlugins)
// Q_EXPORT_PLUGIN(AwlPlugins)

1 change: 1 addition & 0 deletions awl/awlplugin.h
Expand Up @@ -207,6 +207,7 @@ class PitchEditPlugin : public QObject, public AwlPlugin {

class AwlPlugins : public QObject, public QDesignerCustomWidgetCollectionInterface {
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface")
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)

public:
Expand Down
14 changes: 10 additions & 4 deletions mscore/seq.h
Expand Up @@ -87,15 +87,19 @@ class SeqMsgFifo : public FifoBase {
SeqMsg dequeue(); // remove object from fifo
};

// this are also the jack audio transport states:
enum class Transport : char {
STOP=0,
PLAY=1,
STARTING=3,
NET_STARTING=4
};

//---------------------------------------------------------
// Seq
// sequencer
//---------------------------------------------------------

// this are also the jack audio transport states:
enum class Transport : char { STOP=0, PLAY=1, STARTING=3,
NET_STARTING=4 };

class Seq : public QObject, public Sequencer {
Q_OBJECT

Expand Down Expand Up @@ -173,6 +177,7 @@ class Seq : public QObject, public Sequencer {
void start();
void stop();
void setPos(POS, unsigned);
void setMetronomeGain(float val) { metronomeVolume = val; }

signals:
void started();
Expand Down Expand Up @@ -234,6 +239,7 @@ class Seq : public QObject, public Sequencer {
void eventToGui(NPlayEvent);
void stopNoteTimer();
void recomputeMaxMidiOutPort();
float metronomeGain() const { return metronomeVolume; }
};

extern Seq* seq;
Expand Down
16 changes: 15 additions & 1 deletion mscore/synthcontrol.cpp
Expand Up @@ -76,6 +76,9 @@ SynthControl::SynthControl(QWidget* parent)
settings.endGroup();
}

metronome->setDefaultAction(getAction("metronome"));
mgain->setValue(seq->metronomeGain());

updateGui();

tabWidget->setCurrentIndex(0);
Expand All @@ -86,6 +89,7 @@ SynthControl::SynthControl(QWidget* parent)
connect(effectA, SIGNAL(currentIndexChanged(int)), SLOT(effectAChanged(int)));
connect(effectB, SIGNAL(currentIndexChanged(int)), SLOT(effectBChanged(int)));
connect(gain, SIGNAL(valueChanged(double,int)), SLOT(gainChanged(double,int)));
connect(mgain, SIGNAL(valueChanged(double,int)), SLOT(metronomeGainChanged(double,int)));
connect(masterTuning, SIGNAL(valueChanged(double)), SLOT(masterTuningChanged(double)));
connect(changeTuningButton, SIGNAL(clicked()), SLOT(changeMasterTuning()));
connect(loadButton, SIGNAL(clicked()), SLOT(loadButtonClicked()));
Expand Down Expand Up @@ -124,11 +128,12 @@ void MuseScore::showSynthControl(bool val)
if (synthControl == 0) {
synthControl = new SynthControl(this);
synthControl->setScore(cs);
connect(synti, SIGNAL(gainChanged(float)), synthControl, SLOT(setGain(float)));
connect(synti, SIGNAL(gainChanged(float)), synthControl, SLOT(setGain(float)));
connect(synthControl, SIGNAL(gainChanged(float)), synti, SLOT(setGain(float)));
connect(synthControl, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
if (mixer)
connect(synthControl, SIGNAL(soundFontChanged()), mixer, SLOT(patchListChanged()));
connect(synthControl, SIGNAL(metronomeGainChanged(float)), seq, SLOT(setMetronomeGain(float)));
}
synthControl->setVisible(val);
}
Expand All @@ -142,6 +147,15 @@ void SynthControl::gainChanged(double val, int)
emit gainChanged(val);
}

//---------------------------------------------------------
// metronomeGainChanged
//---------------------------------------------------------

void SynthControl::metronomeGainChanged(double val, int)
{
emit metronomeGainChanged(val);
}

//---------------------------------------------------------
// masterTuningChanged
//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions mscore/synthcontrol.h
Expand Up @@ -40,6 +40,7 @@ class SynthControl : public QWidget, Ui::SynthControl {

private slots:
void gainChanged(double, int);
void metronomeGainChanged(double val, int);
void masterTuningChanged(double);
void changeMasterTuning();
void effectAChanged(int);
Expand All @@ -52,6 +53,7 @@ class SynthControl : public QWidget, Ui::SynthControl {

signals:
void gainChanged(float);
void metronomeGainChanged(float);
void soundFontChanged();
void closed(bool);

Expand Down
39 changes: 33 additions & 6 deletions mscore/synthcontrol.ui
Expand Up @@ -13,8 +13,14 @@
<property name="windowTitle">
<string>Synthesizer</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0">
<property name="leftMargin">
<number>10</number>
</property>
<property name="horizontalSpacing">
<number>10</number>
</property>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="3">
<widget class="QPushButton" name="storeButton">
Expand Down Expand Up @@ -65,7 +71,7 @@
</item>
</layout>
</item>
<item row="0" column="1" rowspan="2">
<item row="0" column="2" rowspan="3">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="Awl::MeterSlider" name="gain">
Expand Down Expand Up @@ -95,7 +101,20 @@
</item>
</layout>
</item>
<item row="0" column="0">
<item row="0" column="1">
<widget class="Awl::VolSlider" name="mgain">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="center">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
Expand Down Expand Up @@ -235,9 +254,15 @@
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="metronome">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<pixmapfunction>getIconPixmap</pixmapfunction>
<customwidgets>
<customwidget>
<class>Awl::Slider</class>
Expand All @@ -255,6 +280,8 @@
<header>awl/mslider.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="musescore.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit f471d31

Please sign in to comment.