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 <gtk/gtk.h>
00025
00026 #include <Alloc.hh>
00027 #include <Mutex.hh>
00028 #include <dsp/DSPOp.hh>
00029
00030 #include "Config.h"
00031 #ifndef __QNX__
00032 #include "Audio.hh"
00033 #endif
00034 #ifndef BSDSYS
00035 #ifdef USE_ALSA05
00036 #include "AudioA.hh"
00037 #else
00038 #include "AudioA2.hh"
00039 #endif
00040 #endif
00041 #include "Audio3D.hh"
00042 #include "CfgFile.hh"
00043 #include "GtkUtils.hh"
00044 #include "Messages.hh"
00045 #include "SockClie.hh"
00046 #include "SockOp.hh"
00047
00048
00049 #ifndef BEAMAUDIOUI_HH
00050 #define BEAMAUDIOUI_HH
00051
00052
00053 #define BAUI_VER_MAJ GLOBAL_VERSMAJ
00054 #define BAUI_VER_MIN GLOBAL_VERSMIN
00055 #define BAUI_VER_PL GLOBAL_VERSPL
00056 #define BAUI_PADDING 8
00057 #define BAUI_SERVER_MAXLEN 255
00058 #define BAUI_CONV_BUF_LEN 255
00059 #define BAUI_AUDIO_BUFCOUNT 10
00060
00061
00062 static const char *cpWindowTxt = "Beam audio UI";
00063 static const char *cpLServerTxt = "Server";
00064 static const char *cpBConnectTxt = "Connect";
00065 static const char *cpLSoundSpeedTxt = "Sound speed";
00066 static const char *cpCBHighFreqTxt = "High frequencies";
00067 static const char *cpCBDitherTxt = "Dither";
00068 static const char *cpCB3DAudioTxt = "3D";
00069 static const char *cpLDirectionTxt = "Direction";
00070
00071
00072
00076 class clBeamAudioUI
00077 {
00078 volatile bool bConnected;
00079 bool bDither;
00080 bool b3DAudio;
00081 bool bALSA;
00082 int iSampleRate;
00083 int iRandH;
00084 int iPrevHeading;
00085 long lFragSize;
00086 long lDataCount;
00087 long lMsgSize;
00088 long lClips;
00089 volatile long lBufIdx;
00090 GDT *fpInAudio;
00091 GDT *fpSrcAudio;
00092 BAUI_SND_DATATYPE *ipOutAudio[BAUI_AUDIO_BUFCOUNT];
00093 pthread_t ptidAudio;
00094 stBeamAudioReq sRequest;
00095
00096 guint guSbCtxt;
00097 gint giGdkTag;
00098 GList *glServer;
00099
00100 GtkWidget *gwWindow;
00101 GtkWidget *gwVBox;
00102
00103 GtkWidget *gwTable1;
00104 GtkWidget *gwLServer;
00105 GtkWidget *gwCServer;
00106 GtkWidget *gwBConnect;
00107
00108 GtkWidget *gwTable2;
00109 GtkWidget *gwLSoundSpeed;
00110 GtkWidget *gwESoundSpeed;
00111 GtkWidget *gwCBHighFreq;
00112 GtkWidget *gwCBDither;
00113 GtkWidget *gwCB3DAudio;
00114
00115 GtkWidget *gwLDirection;
00116 GtkObject *goADirection;
00117 GtkWidget *gwHSDirection;
00118
00119
00120
00121 GtkWidget *gwStatusBar;
00122
00123 clAlloc MessageBuf;
00124 clAlloc InAudioBuf;
00125 clAlloc SrcAudioBuf;
00126 clAlloc DitherBuf;
00127 clAlloc DitherRandBuf;
00128 clAlloc OutAudioBuf[BAUI_AUDIO_BUFCOUNT];
00129
00130 clAudio3D Audio3D;
00131 clCfgFile Cfg;
00132 clDSPOp DSP;
00133 clBeamAudioMsg Msg;
00134 clMutex OutBufMutex[BAUI_AUDIO_BUFCOUNT];
00135 clGtkUtils GtkUtils;
00136 clSockClie SClient;
00137 clSockOp SOp;
00138 void Build ();
00139 void BuildTable1 ();
00140 void BuildTable2 ();
00141 void ConnectSignals ();
00142 bool ParseServerStr (char *, int *, const char *);
00143 bool InitConnection (const char *, int);
00144 bool SendSettings ();
00145 void AllocateBuffers (const stpBeamAudioFirst);
00146 #if (!defined(BSDSYS) && !defined(__QNX__))
00147 #ifdef USE_ALSA05
00148 bool InitAudio (clAudio &, clAudioA &);
00149 #else
00150 bool InitAudio (clAudio &, clAudioA2 &);
00151 #endif
00152 #elif defined(BSDSYS)
00153 bool InitAudio (clAudio &);
00154 #elif defined(__QNX__)
00155 bool InitAudio (clAudioA &);
00156 #endif
00157 void UpdateSettings ();
00158 void ConvertMS ();
00159 void Process3D ();
00160 void Dither ();
00161 void ConvertFromDither();
00162 public:
00163 clBeamAudioUI (int *, char ***);
00164 ~clBeamAudioUI ();
00165 int Main ();
00166 gboolean OnDelete (GtkWidget *, GdkEvent *, gpointer);
00167 void OnConnectClick (GtkButton *, gpointer);
00168 void OnValueChanged (GtkAdjustment *, gpointer);
00169 void OnToggled (GtkToggleButton *, gpointer);
00170 void OnGdkInput (gpointer, gint, GdkInputCondition);
00171 void *AudioOutThread (void *);
00172 };
00173
00174 #endif