annotate music2/music.h @ 36:6d1a5b7f0838

* Updated copyright/license information
author thib
date Sun, 15 Mar 2009 18:47:02 +0000
parents 5ae5533b3a9a
children 15a18fbe6f21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
1 /*
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
3 * All rights reserved.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
4 *
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
5 * Redistribution and use in source and binary forms, with or without
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
6 * modification, are permitted provided that the following conditions
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
7 * are met:
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
9 * notice, this list of conditions and the following disclaimer.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
12 * documentation and/or other materials provided with the distribution.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
13 * 3. The name of the author may not be used to endorse or promote products
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
14 * derived from this software without specific prior written permission.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
15 *
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
26 */
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
27
5ae5533b3a9a * Added some license headers
thib
parents: 26
diff changeset
28
0
223b71206888 Initial import
thib
parents:
diff changeset
29 #ifndef __MUSIC__ /* __MUSIC__ */
223b71206888 Initial import
thib
parents:
diff changeset
30 #define __MUSIC__
223b71206888 Initial import
thib
parents:
diff changeset
31
223b71206888 Initial import
thib
parents:
diff changeset
32 #ifdef HAVE_CONFIG_H
223b71206888 Initial import
thib
parents:
diff changeset
33 # include "config.h"
223b71206888 Initial import
thib
parents:
diff changeset
34 #endif
223b71206888 Initial import
thib
parents:
diff changeset
35
223b71206888 Initial import
thib
parents:
diff changeset
36 #include<sys/types.h>
223b71206888 Initial import
thib
parents:
diff changeset
37 #include<sys/time.h>
223b71206888 Initial import
thib
parents:
diff changeset
38
223b71206888 Initial import
thib
parents:
diff changeset
39 #define MIX_PCM_BGM 4
223b71206888 Initial import
thib
parents:
diff changeset
40 #define MIX_PCM_EFFEC 5
223b71206888 Initial import
thib
parents:
diff changeset
41 #define MIX_PCM_KOE 6
223b71206888 Initial import
thib
parents:
diff changeset
42 #define MIX_PCM_SIZE 8
223b71206888 Initial import
thib
parents:
diff changeset
43
223b71206888 Initial import
thib
parents:
diff changeset
44 #define DEFAULT_AUDIOBUF 4096
223b71206888 Initial import
thib
parents:
diff changeset
45
2
422f3cb3614b Enabled voice playing with "%04d/%04d%05d.ogg" format. Don't use a cache for this
thib
parents: 0
diff changeset
46 enum KoeType { koe_unknown, koe_nwk, koe_ovk, koe_ogg};
0
223b71206888 Initial import
thib
parents:
diff changeset
47 typedef struct {
223b71206888 Initial import
thib
parents:
diff changeset
48 FILE* stream;
223b71206888 Initial import
thib
parents:
diff changeset
49 int length;
223b71206888 Initial import
thib
parents:
diff changeset
50 int offset;
223b71206888 Initial import
thib
parents:
diff changeset
51 int rate;
223b71206888 Initial import
thib
parents:
diff changeset
52 KoeType type;
223b71206888 Initial import
thib
parents:
diff changeset
53 }AvgKoeInfo;
223b71206888 Initial import
thib
parents:
diff changeset
54
223b71206888 Initial import
thib
parents:
diff changeset
55 extern int pcm_enable;
223b71206888 Initial import
thib
parents:
diff changeset
56
223b71206888 Initial import
thib
parents:
diff changeset
57 /* koedec.cc */
223b71206888 Initial import
thib
parents:
diff changeset
58 extern AvgKoeInfo OpenKoeFile(const char* path);
223b71206888 Initial import
thib
parents:
diff changeset
59 extern char* decode_koe(AvgKoeInfo info, int* len);
223b71206888 Initial import
thib
parents:
diff changeset
60 extern char* decode_koe_nwa(AvgKoeInfo info, int* len);
223b71206888 Initial import
thib
parents:
diff changeset
61 extern const char* MakeWavHeader(int rate, int ch, int bps, int size);
223b71206888 Initial import
thib
parents:
diff changeset
62 extern AvgKoeInfo FindKoe(int file_number, int index);
223b71206888 Initial import
thib
parents:
diff changeset
63
223b71206888 Initial import
thib
parents:
diff changeset
64 #include<unistd.h>
223b71206888 Initial import
thib
parents:
diff changeset
65 struct MuSys {
223b71206888 Initial import
thib
parents:
diff changeset
66 class AyuSysConfig& config;
223b71206888 Initial import
thib
parents:
diff changeset
67 char cdrom_track[128]; char effec_track[128];
223b71206888 Initial import
thib
parents:
diff changeset
68 int movie_id;
223b71206888 Initial import
thib
parents:
diff changeset
69 int music_enable;
26
f45da03ca631 * Corrected --disable-vorbis in configure.ac
thib
parents: 2
diff changeset
70 int volmod[4]; // BGM, KOE, PCM, Se
0
223b71206888 Initial import
thib
parents:
diff changeset
71 MuSys(AyuSysConfig& _config);
223b71206888 Initial import
thib
parents:
diff changeset
72
223b71206888 Initial import
thib
parents:
diff changeset
73 void PlayCDROM(char* name, int play_count);
223b71206888 Initial import
thib
parents:
diff changeset
74 void StopCDROM(int time);
223b71206888 Initial import
thib
parents:
diff changeset
75 void PlaySE(const char* name, int loop_flag=0, int channel=0);
223b71206888 Initial import
thib
parents:
diff changeset
76 void PlaySE(int number);
223b71206888 Initial import
thib
parents:
diff changeset
77 void StopSE(int time = 0);
223b71206888 Initial import
thib
parents:
diff changeset
78 bool IsStopSE(void);
223b71206888 Initial import
thib
parents:
diff changeset
79 void PlayKoe(const char* fname);
223b71206888 Initial import
thib
parents:
diff changeset
80 void StopKoe(int time);
223b71206888 Initial import
thib
parents:
diff changeset
81 void PlayMovie(const char* fname, int x1, int y1, int x2, int y2, int loop_count);
223b71206888 Initial import
thib
parents:
diff changeset
82 void StopMovie(void);
223b71206888 Initial import
thib
parents:
diff changeset
83 bool IsStopMovie(void);
223b71206888 Initial import
thib
parents:
diff changeset
84 void InitMusic(void);
223b71206888 Initial import
thib
parents:
diff changeset
85 void FinalizeMusic(void);
223b71206888 Initial import
thib
parents:
diff changeset
86 };
223b71206888 Initial import
thib
parents:
diff changeset
87
223b71206888 Initial import
thib
parents:
diff changeset
88 #endif /* __MUSIC__ */