OSDN Git Service

[cmake] Prefer `string APPEND`
[timidity41/timidity41.git] / kbtim / kbtim.h
1 #ifndef KBTIM_H
2 #define KBTIM_H
3
4 class KbTimDecoder
5 {
6 private:
7     PlayMode    m_pm;
8     ControlMode m_cm;
9
10     CRITICAL_SECTION m_cs;
11     HANDLE m_hThread;    //timidity \82Ì\8aÖ\90\94\82ð\8cÄ\82Ñ\8fo\82·\83X\83\8c\83b\83h
12     DWORD  m_dwThreadId; //\81ª\82Ì\83X\83\8c\83b\83h ID
13     HANDLE m_hEventOpen; //\83X\83\8c\83b\83h\8f\89\8aú\89»\8a®\97¹\91Ò\82¿\97p
14                          //\83t\83@\83C\83\8b\83I\81[\83v\83\93\91Ò\82¿\97p
15                          //\83V\81[\83N\8a®\97¹\91Ò\82¿\97p
16                          //\8f\89\89ñ output_data() \8cÄ\82Ñ\8fo\82µ\91Ò\82¿\97p
17     HANDLE m_hEventWrite;    //\95K\97v\82È\83o\83C\83g\90\94\82¾\82¯\83f\83R\81[\83h\82µ\82½\82ç\83V\83O\83i\83\8b\8fó\91Ô
18                              //\89\89\91t\8fI\97¹\82µ\82½\8fê\8d\87\82à\83V\83O\83i\83\8b\8fó\91Ô
19     HANDLE m_hEventCanWrite; //\83f\83R\81[\83h\97v\8b\81\82ª\82 \82Á\82½\82ç\83V\83O\83i\83\8b\8fó\91Ô
20                              //\89\89\91t\8fI\97¹\82µ\82½\8fê\8d\87\82à\83V\83O\83i\83\8b\8fó\91Ô
21
22     KbRingBuffer m_PreloadBuffer;//\90æ\93Ç\82Ý\83f\83R\81[\83h\83o\83b\83t\83@
23     BYTE* m_pRequest;    //\90æ\93Ç\82Ý\82ª\8aÔ\82É\8d\87\82í\82È\82¢\8fê\8d\87\82Í\82±\82Ì\83o\83b\83t\83@\82É\92¼\90Ú\8f\91\82«\8d\9e\82Þ
24     int   m_nRequest;    //m_pRequest \82Ì\83o\83b\83t\83@\83T\83C\83Y
25 ///r
26     DWORD cdwPreloadMS; // \90æ\93Ç\82Ý\8e\9e\8aÔ (\83\8a\83\93\83O\83o\83b\83t\83@
27
28     BOOL  m_bEOF;  //\89\89\91t\8fI\97¹\82µ\82½\82ç TRUE
29                    //\8fI\97¹\97v\8b\81\82ª\82 \82Á\82½\8fê\8d\87\82à TRUE
30     int   m_nStart;//output_data() \82ª\8cÄ\82Î\82ê\82½\82ç 1, \8f\89\89ñ\82Ì Render \82ª\8cÄ\82Î\82ê\82½\82ç 2
31     DWORD m_dwSeek;//\83V\81[\83N(ms)\81i\83V\81[\83N\97v\8b\81\82³\82ê\82Ä\82¢\82È\82¢\8fê\8d\87\82Í 0xFFFFFFFF\81j
32
33     KbTimSetting m_Setting;
34     char m_szIniFile[FILEPATH_MAX];
35
36     SOUNDINFO m_SoundInfo;
37     char m_szFileName[FILEPATH_MAX];
38 //
39 //ControlMode/static
40     static int  s_ctl_open(int using_stdin, int using_stdout) {
41         return g_pDecoder->ctl_open(using_stdin,using_stdout);
42     }
43     static void s_ctl_close(void) {
44         g_pDecoder->ctl_close();
45     }
46     static int s_ctl_pass_playing_list(int number_of_files, char *list_of_files[]) {
47         return 0;
48         //return g_pDecoder->ctl_pass_playing_list(number_of_files,list_of_files);
49     }
50     static void s_ctl_event(CtlEvent *e) {
51         g_pDecoder->ctl_event(e);
52     }
53     static int  s_ctl_read(ptr_size_t *valp) {
54         return g_pDecoder->ctl_read(valp);
55     }
56     static int  s_ctl_write(const uint8 *buf, int32 size) { return 0; }
57     static int  s_ctl_cmsg(int type, int verbosity_level, const char *fmt, ...) {
58 #if 0
59         int ret;
60         va_list ap;
61         va_start(ap, fmt);
62         ret = g_pDecoder->ctl_cmsg(type, verbosity_level, fmt, ap);
63         va_end(ap);
64         return ret;
65 #else
66         return 0;
67 #endif
68     }
69 //ControlMode
70     int  __fastcall ctl_open(int using_stdin, int using_stdout) { return 0; }
71     void __fastcall ctl_close(void) {}
72     int  __fastcall ctl_pass_playing_list(int number_of_files, char *list_of_files[]) { return 0; }
73     void __fastcall ctl_event(CtlEvent *e);
74     int  __fastcall ctl_read(ptr_size_t *valp);
75     int32 __fastcall ctl_write(const uint8 *buf, int32 size) { return 0; }
76     int  __cdecl ctl_cmsg(int type, int verbosity_level, const char *fmt, ...);
77 //PlayMode/static
78     static int  s_open_output(void) {
79         return g_pDecoder->open_output();
80     }
81     static void s_close_output(void) {
82         g_pDecoder->close_output();
83     }
84     static int32  s_output_data(const uint8 * Data, int32 Size) {
85         return g_pDecoder->output_data(Data, Size);
86     }
87     static int  s_acntl(int request, void * arg) {
88         return g_pDecoder->acntl(request, arg);
89     }
90     static int  s_detect(void) {
91         return g_pDecoder->detect();
92     }
93 //PlayMode
94     int  __fastcall open_output (void);
95     void __fastcall close_output(void);
96     int32  __fastcall output_data (const uint8 * Data, int32 Size);
97     int  __fastcall acntl       (int request, void * arg);
98     int  __fastcall detect(void) { return 1; }
99 ///r
100     void __fastcall calc_preload_time(void);
101 //
102     static unsigned __stdcall ThreadProc(void* pv);
103     unsigned __fastcall ThreadProc(void);
104     DWORD __fastcall InternalSetPosition(DWORD dwPos);
105 public:
106     BOOL  __fastcall Open(const char *cszFileName, SOUNDINFO *pInfo);
107     DWORD __fastcall Render(BYTE *Buffer, DWORD dwSize);
108     DWORD __fastcall SetPosition(DWORD dwPos);
109     void  __fastcall Close(void);
110     KbTimDecoder(void);
111     ~KbTimDecoder(void);
112     static KbTimDecoder* g_pDecoder;
113 };
114
115 #endif