00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __JackMessageBuffer__
00031 #define __JackMessageBuffer__
00032
00033 #include "JackPlatformPlug.h"
00034 #include "JackMutex.h"
00035 #include "JackAtomic.h"
00036
00037 namespace Jack
00038 {
00039
00040
00041 #define MB_BUFFERS 128
00042 #define MB_NEXT(index) ((index+1) & (MB_BUFFERS-1))
00043 #define MB_BUFFERSIZE 256
00044
00045 struct JackMessage
00046 {
00047 int level;
00048 char message[MB_BUFFERSIZE];
00049 };
00050
00055 class JackMessageBuffer : public JackRunnableInterface
00056 {
00057
00058 private:
00059
00060 JackMessage fBuffers[MB_BUFFERS];
00061 JackThread fThread;
00062 JackProcessSync fGuard;
00063 volatile unsigned int fInBuffer;
00064 volatile unsigned int fOutBuffer;
00065 SInt32 fOverruns;
00066 bool fRunning;
00067
00068 void Flush();
00069
00070 void Start();
00071 void Stop();
00072
00073 public:
00074
00075 JackMessageBuffer();
00076 ~JackMessageBuffer();
00077
00078
00079 bool Execute();
00080
00081 void static Create();
00082 void static Destroy();
00083
00084 void AddMessage(int level, const char *message);
00085
00086 static JackMessageBuffer* fInstance;
00087 };
00088
00089 #ifdef __cplusplus
00090 extern "C"
00091 {
00092 #endif
00093
00094 void JackMessageBufferAdd(int level, const char *message);
00095
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099
00100 };
00101
00102 #endif