1 /* -*- c-basic-offset: 4 -*-  vi:set ts=8 sts=4 sw=4: */
2 
3 /* trivial_sampler_qt_gui.h
4 
5    DSSI Soft Synth Interface
6    Constructed by Chris Cannam, Steve Harris and Sean Bolton
7 
8    A straightforward DSSI plugin sampler Qt GUI.
9 
10    This example file is in the public domain.
11 */
12 
13 #ifndef _TRIVIAL_SAMPLER_QT_GUI_H_INCLUDED_
14 #define _TRIVIAL_SAMPLER_QT_GUI_H_INCLUDED_
15 
16 #include <QFrame>
17 #include <QCheckBox>
18 #include <QSpinBox>
19 #include <QLabel>
20 #include <QSlider>
21 #include <QLayout>
22 
23 extern "C" {
24 #include <lo/lo.h>
25 }
26 
27 class SamplerGUI : public QFrame
28 {
29     Q_OBJECT
30 
31 public:
32     SamplerGUI(bool stereo, const char * host, const char * port,
33 	       QByteArray controlPath, QByteArray midiPath, QByteArray programPath,
34 	       QByteArray exitingPath, QWidget *w = 0);
35     virtual ~SamplerGUI();
36 
ready()37     bool ready() const { return m_ready; }
setReady(bool ready)38     void setReady(bool ready) { m_ready = ready; }
39 
setHostRequestedQuit(bool r)40     void setHostRequestedQuit(bool r) { m_hostRequestedQuit = r; }
41 
42 public slots:
43     void setSampleFile(QString file);
44     void setRetune(bool retune);
45     void setBasePitch(int pitch);
46     void setSustain(bool sustain);
47     void setRelease(int ms);
48     void setBalance(int balance);
49     void setProjectDirectory(QString dir);
50     void aboutToQuit();
51 
52 protected slots:
53     void fileSelect();
54     void retuneChanged(bool);
55     void basePitchChanged(int);
56     void sustainChanged(bool);
57     void releaseChanged(int);
58     void balanceChanged(int);
59     void test_press();
60     void test_release();
61     void oscRecv();
62     void generatePreview(QString file);
63 
64 protected:
65     QLabel *m_sampleFile;
66     QLabel *m_duration;
67     QLabel *m_channels;
68     QLabel *m_sampleRate;
69     QLabel *m_preview;
70     QLabel *m_balanceLabel;
71     QCheckBox *m_retune;
72     QSpinBox *m_basePitch;
73     QCheckBox *m_sustain;
74     QSpinBox *m_release;
75     QSlider *m_balance;
76 
77     lo_address m_host;
78     QByteArray m_controlPath;
79     QByteArray m_midiPath;
80     QByteArray m_configurePath;
81     QByteArray m_exitingPath;
82 
83     QString m_file;
84     QString m_projectDir;
85     int m_previewWidth;
86     int m_previewHeight;
87 
88     bool m_suppressHostUpdate;
89     bool m_hostRequestedQuit;
90     bool m_ready;
91 };
92 
93 
94 #endif
95