00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00088 GList *glServers;
00089
00090 GtkWidget *gwFrame;
00091 GtkWidget *gwVBox;
00092
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
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
00114 GtkWidget *gwCurveEq;
00115 GtkWidget *gwBApplyCurve;
00116 };
00117
00118
00122 class clSoundUI
00123 {
00124 bool bALSA;
00125 bool bFirstTimeout;
00126 int iVuTimeout;
00127
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
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];
00150
00151 guint guiStatusbarCtxt;
00152 gfloat fpInputLevel[SUI_MAX_CHANNELS];
00153 gfloat fpOutputLevel[SUI_MAX_CHANNELS];
00154
00155 GtkWidget *gwWindow;
00156 GtkWidget *gwVBox;
00157 GtkWidget *gwHBox;
00158 GtkWidget *gwStatusbar;
00159
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];
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
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