~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to kmidi/kmidi.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*   
 
2
   kmidi - a midi to wav converter
 
3
   
 
4
   Copyright 1997 Bernd Johannes Wuebben math.cornell.edu
 
5
  
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 2, or (at your option)
 
9
   any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 
 
20
 
 
21
 */
 
22
 
 
23
#ifndef KMIDI_PLAYER_H
 
24
#define KMIDI_PLAYER_H
 
25
 
 
26
#include "version.h"
 
27
#include "bwlednum.h"
 
28
 
 
29
#include <qfileinfo.h>
 
30
#include <qdatastream.h> 
 
31
#include <qfile.h> 
 
32
#include <qtabdialog.h> 
 
33
#include <qfiledialog.h>
 
34
#include <qpushbutton.h>
 
35
#include <qradiobutton.h>
 
36
#include <qlabel.h>
 
37
#include <qlistbox.h>
 
38
#include <qtimer.h>
 
39
#include <qbitmap.h>
 
40
#include <qslider.h>
 
41
#include <qgroupbox.h>
 
42
#include <qcombobox.h>
 
43
#include <qscrollbar.h>
 
44
#include <qspinbox.h>
 
45
#include <qbuttongroup.h>
 
46
#include <qcheckbox.h>
 
47
#include <qtooltip.h>
 
48
#include <qregexp.h>
 
49
#include <qgroupbox.h>
 
50
#include <qwidget.h>
 
51
#include <qpainter.h>
 
52
#include <qdragobject.h>
 
53
#include <qwhatsthis.h>
 
54
 
 
55
#include <pwd.h>
 
56
#include <stdlib.h>
 
57
#include <stdio.h>
 
58
#include <string.h>
 
59
#include <sys/types.h>
 
60
#include <sys/time.h>
 
61
#include <signal.h>
 
62
#include <sys/utsname.h>
 
63
#include <unistd.h>
 
64
#include <sys/types.h>
 
65
#include <sys/stat.h>
 
66
#include <fcntl.h>
 
67
#include <sys/ioctl.h>
 
68
 
 
69
#include <kapp.h>
 
70
#include <kled.h>
 
71
#include <kmenubar.h>
 
72
#include <krandomsequence.h>
 
73
 
 
74
#define PLAYLIST_WIDTH  550
 
75
#define PLAYLIST_HEIGHT 440
 
76
 
 
77
 
 
78
 
 
79
#include "configdlg.h"
 
80
#include "log.h"
 
81
 
 
82
class PlaylistEdit;
 
83
class ConfigDlg;
 
84
//
 
85
// MeterWidget - draws meter
 
86
//
 
87
 
 
88
class MeterWidget : public QWidget {
 
89
 
 
90
        Q_OBJECT
 
91
public:
 
92
    MeterWidget( QWidget *parent=0, const char *name=0 );
 
93
   ~MeterWidget();
 
94
    QTimer     *metertimer;
 
95
    QColor      led_color;
 
96
    QColor      background_color;
 
97
public slots:
 
98
    void        remeter();
 
99
protected:
 
100
    void        paintEvent( QPaintEvent * );
 
101
private:
 
102
 
 
103
};
 
104
 
 
105
 
 
106
class KMidi : public QWidget {
 
107
 
 
108
        Q_OBJECT
 
109
public:
 
110
 
 
111
        ~KMidi();
 
112
        
 
113
 
 
114
        QPushButton     *playPB;
 
115
        QPushButton     *stopPB;
 
116
        QPushButton     *prevPB;
 
117
        QPushButton     *nextPB;
 
118
        QPushButton     *fwdPB;
 
119
        QPushButton     *bwdPB;
 
120
        QPushButton     *quitPB;
 
121
        QPushButton     *whatbutton;
 
122
        QPushButton     *replayPB;
 
123
        QPushButton     *ejectPB;
 
124
        QPushButton     *aboutPB;
 
125
        QPushButton     *shufflebutton;
 
126
        QPushButton     *configurebutton;
 
127
        QTabDialog      *tabdialog;
 
128
        QPushButton     *infobutton;
 
129
        BW_LED_Number   *trackTimeLED[9];
 
130
 
 
131
        KLed            *led[18];
 
132
 
 
133
        QComboBox       *patchbox;
 
134
        QComboBox       *playbox;
 
135
        QComboBox       *playlistbox;
 
136
        //Table         *channelwindow;
 
137
        QButtonGroup    *ichecks;
 
138
        QCheckBox       *ich[4];
 
139
        QButtonGroup    *rchecks;
 
140
        QCheckBox       *rcb1;
 
141
        QCheckBox       *rcb2;
 
142
        QCheckBox       *rcb3;
 
143
        QCheckBox       *rcb4;
 
144
        QPushButton     *effectbutton;
 
145
        QSpinBox        *meterspin;
 
146
        QSpinBox        *voicespin;
 
147
        QPushButton     *filterbutton;
 
148
        MeterWidget     *meter;
 
149
        QSize           regularsize;
 
150
        QSize           extendedsize;
 
151
        QSize           topbarssize;
 
152
    
 
153
        QPixmap folder_pixmap;
 
154
        QPixmap file_pixmap;
 
155
        QPixmap cdup_pixmap;
 
156
 
 
157
        QTimer*  readtimer;
 
158
        
 
159
 
 
160
        QLabel  *statusLA;
 
161
        QLabel  *volLA;
 
162
        QLabel  *titleLA;
 
163
        QLabel  *propertiesLA;
 
164
        QLabel  *properties2LA;
 
165
        QLabel  *modlabel;
 
166
        QLabel  *totaltimelabel;
 
167
        QLabel  *looplabel;
 
168
        QLabel  *speedLA;
 
169
        QLabel  *song_count_label;
 
170
 
 
171
        QTimer          *timer;
 
172
 
 
173
        QComboBox       *songListCB;
 
174
 
 
175
        QSlider         *volSB;
 
176
        QSlider         *timeSB;
 
177
        QWidget         *backdrop;
 
178
        QPushButton     *makeButton( int, int, int, int, const QString & );
 
179
 
 
180
        int             mixerFd;
 
181
        bool            StopRequested;
 
182
        bool            loop;
 
183
        int             init_volume;
 
184
        int             Child;
 
185
        bool            driver_error;
 
186
        bool            tooltips;
 
187
        bool            starting_up;
 
188
        bool            looping;
 
189
        int             timestopped;
 
190
        int             max_patch_megs;
 
191
        int             volume;
 
192
        int             current_voices;
 
193
        int             max_sec;
 
194
        int             song_number;
 
195
        int             last_sec;
 
196
        int             fastforward;
 
197
        int             fastrewind;
 
198
 
 
199
        bool            randomplay;
 
200
        bool            singleplay;
 
201
        QColor          background_color;
 
202
        QColor          led_color;
 
203
        bool            playing;
 
204
        bool            blink;
 
205
        bool            flag_new_playlist;
 
206
 
 
207
        bool            showmeterrequest;
 
208
        bool            showinforequest;
 
209
        bool            lpfilterrequest;
 
210
        bool            effectsrequest;
 
211
        int             infowindowheight;
 
212
        int             interpolationrequest;
 
213
 
 
214
        int             stereo_state;
 
215
        int             reverb_state;
 
216
        int             chorus_state;
 
217
        int             echo_state;
 
218
        bool            dry_state;
 
219
        int             detune_state;
 
220
        int             verbosity_state;
 
221
        int             evs_state;
 
222
 
 
223
        QString         fileName;
 
224
        QStringList     *playlist;
 
225
        int             current_playlist_num;
 
226
        QStringList     *listplaylists;
 
227
 
 
228
        QStringList     *errorlist;
 
229
 
 
230
        LogWindow       *logwindow;
 
231
        ConfigDlg       *configdlg;
 
232
        PlaylistEdit    *playlistdlg;
 
233
        KConfig         *config;
 
234
        KRandomSequence randomSeq;
 
235
        QDir            current_dir;
 
236
 
 
237
private:
 
238
        int             smallPtSize();
 
239
        void            display_playmode();
 
240
        int             randomSong();
 
241
        void            resetPos();
 
242
        void            setLEDs(const QString &);
 
243
        void            drawPanel();
 
244
        void            cleanUp();
 
245
        void            loadBitmaps();
 
246
        //void          initMixer( const char *mixer = "/dev/mixer" );
 
247
        void            playthemod(QString );
 
248
        void            redoplaylistbox();
 
249
        void            myresize(int w, int h);
 
250
        void            myresize(QSize newsize);
 
251
        void            enableLowerPanel(bool on);
 
252
 
 
253
protected:
 
254
        void            resizeEvent(QResizeEvent *e);
 
255
        QWhatsThis      *what;
 
256
 
 
257
public:
 
258
        KMidi( QWidget *parent=0, const char *name=0 );
 
259
 
 
260
        void            redoplaybox();
 
261
        void            restartPlaybox();
 
262
        void            restartPlayboxWith(const QString &songpath);
 
263
        void            setDry(bool);
 
264
        void            setReverb(int level);
 
265
        void            setChorus(int level);
 
266
        void            setExpressionCurve( int curve );
 
267
        void            setVolumeCurve( int curve );
 
268
        void            setSurround( int yesno );
 
269
        void            postError(const QString& s);
 
270
        void            set_current_dir(const QString &dir);
 
271
 
 
272
signals:        
 
273
        void            play();
 
274
 
 
275
public slots:
 
276
        void            loadplaylist(int);
 
277
        void            randomPlay();
 
278
        void            updateUI();
 
279
        void            randomClicked();
 
280
        void            ReadPipe();
 
281
        void            setToolTips();
 
282
        void            PlayCommandlineMods();
 
283
        void            PlayMOD();
 
284
        void            readconfig();
 
285
        void            writeconfig();
 
286
        void            setColors();
 
287
        void            playClicked();
 
288
        void            stopClicked();
 
289
        void            infoslot();
 
290
        void            prevClicked();
 
291
        void            nextClicked();
 
292
        void            fwdPressed();
 
293
        void            bwdPressed();
 
294
        void            fwdReleased();
 
295
        void            bwdReleased();
 
296
        void            quitClicked();
 
297
        void            replayClicked();
 
298
        void            ejectClicked();
 
299
        void            aboutClicked();
 
300
        void            logoClicked();
 
301
        void            check_meter_visible();
 
302
        void            volChanged( int );
 
303
        void            timeStart();
 
304
        void            timeStop();
 
305
        void            setPatch( int );
 
306
        void            setEffects( bool );
 
307
        void            setFilter( bool );
 
308
        void            setSong( int );
 
309
        void            resetSong();
 
310
        void            voicesChanged( int );
 
311
        void            meterfudgeChanged( int );
 
312
        void            updateRChecks( int );
 
313
        void            updateIChecks( int );
 
314
        void            dropEvent( QDropEvent * );
 
315
        void            dragEnterEvent( QDragEnterEvent *e );
 
316
        void            plActivated( int );
 
317
        void            acceptPlaylist();
 
318
        void            invokeWhatsThis();
 
319
};
 
320
 
 
321
extern KMidi *kmidi;
 
322
 
 
323
#endif