annotate music2/music.h @ 7:fa8511a21d05

Fixes somes memory leaks
author thib
date Tue, 05 Aug 2008 10:06:04 +0000
parents 422f3cb3614b
children f45da03ca631
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 #ifndef __MUSIC__ /* __MUSIC__ */
223b71206888 Initial import
thib
parents:
diff changeset
2 #define __MUSIC__
223b71206888 Initial import
thib
parents:
diff changeset
3
223b71206888 Initial import
thib
parents:
diff changeset
4 #ifdef HAVE_CONFIG_H
223b71206888 Initial import
thib
parents:
diff changeset
5 # include "config.h"
223b71206888 Initial import
thib
parents:
diff changeset
6 #endif
223b71206888 Initial import
thib
parents:
diff changeset
7
223b71206888 Initial import
thib
parents:
diff changeset
8 #include<sys/types.h>
223b71206888 Initial import
thib
parents:
diff changeset
9 #include<sys/time.h>
223b71206888 Initial import
thib
parents:
diff changeset
10
223b71206888 Initial import
thib
parents:
diff changeset
11 #define MIX_PCM_BGM 4
223b71206888 Initial import
thib
parents:
diff changeset
12 #define MIX_PCM_EFFEC 5
223b71206888 Initial import
thib
parents:
diff changeset
13 #define MIX_PCM_KOE 6
223b71206888 Initial import
thib
parents:
diff changeset
14 #define MIX_PCM_SIZE 8
223b71206888 Initial import
thib
parents:
diff changeset
15
223b71206888 Initial import
thib
parents:
diff changeset
16 #define DEFAULT_AUDIOBUF 4096
223b71206888 Initial import
thib
parents:
diff changeset
17
2
422f3cb3614b Enabled voice playing with "%04d/%04d%05d.ogg" format. Don't use a cache for this
thib
parents: 0
diff changeset
18 enum KoeType { koe_unknown, koe_nwk, koe_ovk, koe_ogg};
0
223b71206888 Initial import
thib
parents:
diff changeset
19 typedef struct {
223b71206888 Initial import
thib
parents:
diff changeset
20 FILE* stream;
223b71206888 Initial import
thib
parents:
diff changeset
21 int length;
223b71206888 Initial import
thib
parents:
diff changeset
22 int offset;
223b71206888 Initial import
thib
parents:
diff changeset
23 int rate;
223b71206888 Initial import
thib
parents:
diff changeset
24 KoeType type;
223b71206888 Initial import
thib
parents:
diff changeset
25 }AvgKoeInfo;
223b71206888 Initial import
thib
parents:
diff changeset
26
223b71206888 Initial import
thib
parents:
diff changeset
27 extern int pcm_enable;
223b71206888 Initial import
thib
parents:
diff changeset
28
223b71206888 Initial import
thib
parents:
diff changeset
29 /* koedec.cc */
223b71206888 Initial import
thib
parents:
diff changeset
30 extern AvgKoeInfo OpenKoeFile(const char* path);
223b71206888 Initial import
thib
parents:
diff changeset
31 extern char* decode_koe(AvgKoeInfo info, int* len);
223b71206888 Initial import
thib
parents:
diff changeset
32 extern char* decode_koe_nwa(AvgKoeInfo info, int* len);
223b71206888 Initial import
thib
parents:
diff changeset
33 extern const char* MakeWavHeader(int rate, int ch, int bps, int size);
223b71206888 Initial import
thib
parents:
diff changeset
34 extern AvgKoeInfo FindKoe(int file_number, int index);
223b71206888 Initial import
thib
parents:
diff changeset
35
223b71206888 Initial import
thib
parents:
diff changeset
36 #include<unistd.h>
223b71206888 Initial import
thib
parents:
diff changeset
37 struct MuSys {
223b71206888 Initial import
thib
parents:
diff changeset
38 class AyuSysConfig& config;
223b71206888 Initial import
thib
parents:
diff changeset
39 char cdrom_track[128]; char effec_track[128];
223b71206888 Initial import
thib
parents:
diff changeset
40 int movie_id;
223b71206888 Initial import
thib
parents:
diff changeset
41 int music_enable;
223b71206888 Initial import
thib
parents:
diff changeset
42 MuSys(AyuSysConfig& _config);
223b71206888 Initial import
thib
parents:
diff changeset
43
223b71206888 Initial import
thib
parents:
diff changeset
44 void PlayCDROM(char* name, int play_count);
223b71206888 Initial import
thib
parents:
diff changeset
45 void StopCDROM(int time);
223b71206888 Initial import
thib
parents:
diff changeset
46 void PlaySE(const char* name, int loop_flag=0, int channel=0);
223b71206888 Initial import
thib
parents:
diff changeset
47 void PlaySE(int number);
223b71206888 Initial import
thib
parents:
diff changeset
48 void StopSE(int time = 0);
223b71206888 Initial import
thib
parents:
diff changeset
49 bool IsStopSE(void);
223b71206888 Initial import
thib
parents:
diff changeset
50 void PlayKoe(const char* fname);
223b71206888 Initial import
thib
parents:
diff changeset
51 void StopKoe(int time);
223b71206888 Initial import
thib
parents:
diff changeset
52 void PlayMovie(const char* fname, int x1, int y1, int x2, int y2, int loop_count);
223b71206888 Initial import
thib
parents:
diff changeset
53 void StopMovie(void);
223b71206888 Initial import
thib
parents:
diff changeset
54 bool IsStopMovie(void);
223b71206888 Initial import
thib
parents:
diff changeset
55 void InitMusic(void);
223b71206888 Initial import
thib
parents:
diff changeset
56 void FinalizeMusic(void);
223b71206888 Initial import
thib
parents:
diff changeset
57 };
223b71206888 Initial import
thib
parents:
diff changeset
58
223b71206888 Initial import
thib
parents:
diff changeset
59 #endif /* __MUSIC__ */