Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

SoundUI.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Sound user interface, header
00004     Copyright (C) 2000-2001 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include <pthread.h>
00024 #include <limits.h>
00025 #include <gtk/gtk.h>
00026 
00027 #include <Condition.hh>
00028 #include <Mutex.hh>
00029 #include <Semaphore.hh>
00030 #include <dsp/DSPOp.hh>
00031 #include <dsp/Filter.hh>
00032 
00033 #include "Config.h"
00034 #ifndef __QNX__
00035 #include "Audio.hh"
00036 #endif
00037 #ifndef BSDSYS
00038 #ifdef USE_ALSA05
00039 #include "AudioA.hh"
00040 #else
00041 #include "AudioA2.hh"
00042 #endif
00043 #endif
00044 #include "CfgFile.hh"
00045 #include "GtkUtils.hh"
00046 #include "Messages.hh"
00047 #include "SockClie.hh"
00048 #include "SockOp.hh"
00049 
00050 
00051 #ifndef SOUNDUI_HH
00052     #define SOUNDUI_HH
00053 
00054 
00055     #define SUI_VER_MAJ         GLOBAL_VERSMAJ
00056     #define SUI_VER_MIN         GLOBAL_VERSMIN
00057     #define SUI_VER_PL          GLOBAL_VERSPL
00058     #define SUI_PADDING         8
00059     #define SUI_CONV_LEN        256
00060     #define SUI_SERV_MAXLEN     255
00061     #define SUI_CH_VALUE        1.0
00062     #define SUI_CH_LOWER        1.0
00063     #define SUI_CH_HIGHER       16.0
00064     #define SUI_IN_VALUE        0.0
00065     #define SUI_IN_LOWER        -72.0
00066     #define SUI_IN_HIGHER       0.0
00067     #define SUI_OUT_VALUE       0.0
00068     #define SUI_OUT_LOWER       -72.0
00069     #define SUI_OUT_HIGHER      0.0
00070     #define SUI_OUT_RANGE       12.0
00071     #define SUI_OUT_STEP        0.1
00072     #define SUI_EQ_RANGE        12.0
00073     #define SUI_EQ_STEP         0.1
00074     #define SUI_EQ_MAXOCTS      15
00075     #define SUI_FILTER_WINDOW   true
00076     
00077 
00081     class clSoundChGUI
00082     {
00083             clGtkUtils GtkUtils;
00084         public:
00085             clSoundChGUI (GtkWidget *, int, int, long);
00086             ~clSoundChGUI ();
00087             // glib types
00088             GList *glServers;
00089             // gtk+ types
00090             GtkWidget *gwFrame;
00091             GtkWidget *gwVBox;
00092             // Table 1
00093             GtkWidget *gwTable1;
00094             GtkWidget *gwLServer;
00095             GtkWidget *gwCServer;
00096             GtkWidget *gwLChannel;
00097             GtkObject *goAChannel;
00098             GtkWidget *gwSBChannel;
00099             GtkWidget *gwBConnect;
00100             // -
00101             GtkWidget *gwLInputLevel;
00102             GtkWidget *gwPBInputLevel;
00103             GtkWidget *gwCBEq;
00104             // Table Eq
00105             GtkWidget *gwTableEq;
00106             GtkWidget *gwLOutputLevel;
00107             GtkObject *goAOutputLevel;
00108             GtkWidget *gwVSOutputLevel;
00109             GtkWidget *gwPBOutputLevel;
00110             GtkWidget *gwaLEqLevel[SUI_EQ_MAXOCTS];
00111             GtkObject *goaAEqLevel[SUI_EQ_MAXOCTS];
00112             GtkWidget *gwaVSEqLevel[SUI_EQ_MAXOCTS];
00113             // Curve Eq
00114             GtkWidget *gwCurveEq;
00115             GtkWidget *gwBApplyCurve;
00116     };
00117     
00118 
00122     class clSoundUI
00123     {
00124             bool bALSA;
00125             bool bFirstTimeout;
00126             int iVuTimeout;
00127             // These are read-only after startup, thus not protected
00128             int iALSACard;
00129             int iALSADevice;
00130             int iALSASubDevice;
00131             int iDeviceBase;
00132             int iDCBlock;
00133             char cpDevice[_POSIX_PATH_MAX];
00134             // -
00135             pthread_t ptidSoundOut;
00136             pthread_t ptidSoundIn[SUI_MAX_CHANNELS];
00137             // Thread communication, protected
00138             volatile bool bRun;
00139             volatile int iChCount;
00140             volatile int iSampleRate;
00141             volatile int iOctaveCount;
00142             volatile long lDataRefCount;
00143             volatile long lSampleCount;
00144             volatile bool bpConnected[SUI_MAX_CHANNELS];
00145             volatile bool bpEqEnabled[SUI_MAX_CHANNELS];
00146             volatile int ipSockH[SUI_MAX_CHANNELS];
00147             GDT fpLevelCoeff[SUI_MAX_CHANNELS];
00148             clDSPAlloc ChData[SUI_MAX_CHANNELS];
00149             clDSPAlloc EqCoeffs[SUI_MAX_CHANNELS];  // Non-protected
00150             // glib types
00151             guint guiStatusbarCtxt;
00152             gfloat fpInputLevel[SUI_MAX_CHANNELS];  // Protected
00153             gfloat fpOutputLevel[SUI_MAX_CHANNELS];  // Protected
00154             // Gtk+ types
00155             GtkWidget *gwWindow;
00156             GtkWidget *gwVBox;
00157             GtkWidget *gwHBox;
00158             GtkWidget *gwStatusbar;
00159             // Classes
00160             #ifndef __QNX__
00161             clAudio Audio;
00162             #endif
00163             #ifndef BSDSYS
00164             #ifdef USE_ALSA05
00165             clAudioA AudioA;
00166             #else
00167             clAudioA2 AudioA;
00168             #endif
00169             #endif
00170             clCfgFile Cfg;
00171             clCondition CondData[SUI_MAX_CHANNELS];
00172             clFilter Filters[SUI_MAX_CHANNELS];  // Protected, MutexFilter
00173             clGtkUtils GtkUtils;
00174             clMutex MutexData;
00175             clMutex MutexLevel;
00176             clMutex MutexChData[SUI_MAX_CHANNELS];
00177             clMutex MutexFilter[SUI_MAX_CHANNELS];
00178             clSemaphore SemStart1;
00179             clSemaphore SemStart2;
00180             clSockClie SClient;
00181             clSoundChGUI *SoundChGUI[SUI_MAX_CHANNELS];
00182             // Methods
00183             void GetCfg ();
00184             void BuildGUI ();
00185             void ConnectSignals ();
00186             bool ParseServerStr (char *, int *, const char *);
00187         public:
00188             clSoundUI (int *, char ***);
00189             ~clSoundUI ();
00190             int Exec ();
00191             gboolean OnDeleteEvent (GtkWidget *gwSender, GdkEvent *geEvent,
00192                 gpointer gpData);
00193             void OnClickedEvent (GtkButton *, gpointer);
00194             gint OnTimeoutEvent (gpointer);
00195             void OnToggledEvent (GtkToggleButton *, gpointer);
00196             void OnValueChangedEvent (GtkAdjustment *, gpointer);
00197             void OnApplyCurveClicked (GtkButton *, gpointer);
00198             void OnMotionCurve (GtkWidget *, GdkEventMotion *, gpointer);
00199             void *SoundOutThread (void *vpData);
00200             void *SoundInThread (void *vpData);
00201     };
00202 
00203 
00204 #endif
00205 

Generated on Sun Oct 26 19:11:22 2003 for HASAS by doxygen 1.3.3