spAudio
読み取り中…
検索中…
一致する文字列を見つけられません
spWave.h
[詳解]
1
4#ifndef __SPWAVE_H
5#define __SPWAVE_H
6
7#include <sp/spDefs.h>
8#include <sp/spAudioDefs.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
19#define SP_WAVE_WAV_ID "wav"
20#define SP_WAVE_AIFF_ID "aiff"
21#define SP_WAVE_AIFC_ID "aifc"
22
23#if BYTE_ORDER == BIG_ENDIAN
24#define SP_WAV_NEED_SWAP 1
25#else
26#define SP_WAV_NEED_SWAP 0
27#endif
28
29#if BYTE_ORDER == BIG_ENDIAN
30#define SP_AIFF_NEED_SWAP 0
31#else
32#define SP_AIFF_NEED_SWAP 1
33#endif
34
35#define SP_WAVE_FORMAT_SIZE 32
36#define SP_WAVE_FILE_TYPE_SIZE 32
37#define SP_WAVE_FILE_DESC_SIZE 128
38#define SP_WAVE_FILE_FILTER_SIZE 32
43typedef struct _spWaveInfo {
44 char file_type[SP_WAVE_FILE_TYPE_SIZE];
45 char file_desc[SP_WAVE_FILE_DESC_SIZE];
46 char file_filter[SP_WAVE_FILE_FILTER_SIZE];
48 spLong header_size;
51 double samp_rate;
52 long bit_rate;
53 spLong length;
55
56#define SP_SONG_NO_INFO 0
57#define SP_SONG_TRACK_MASK (1L<<0)
58#define SP_SONG_TITLE_MASK (1L<<1)
59#define SP_SONG_ARTIST_MASK (1L<<2)
60#define SP_SONG_ALBUM_MASK (1L<<3)
61#define SP_SONG_GENRE_MASK (1L<<4)
62#define SP_SONG_RELEASE_MASK (1L<<5)
63#define SP_SONG_COPYRIGHT_MASK (1L<<6)
64#define SP_SONG_ENGINEER_MASK (1L<<7)
65#define SP_SONG_SOURCE_MASK (1L<<8)
66#define SP_SONG_SOFTWARE_MASK (1L<<9)
67#define SP_SONG_SUBJECT_MASK (1L<<10)
68#define SP_SONG_COMMENT_MASK (1L<<11)
69#define SP_SONG_ALBUM_ARTIST_MASK (1L<<12)
70#define SP_SONG_COMPOSER_MASK (1L<<13)
71#define SP_SONG_LYRICIST_MASK (1L<<14)
72#define SP_SONG_PRODUCER_MASK (1L<<15)
73#define SP_SONG_ISRC_MASK (1L<<16)
74#define SP_SONG_TRACK_TOTAL_MASK (1L<<17)
75#define SP_SONG_DISC_MASK (1L<<18)
76#define SP_SONG_DISC_TOTAL_MASK (1L<<19)
77#define SP_SONG_TEMPO_MASK (1L<<20)
78#define SP_SONG_ID3V1_MASK (1L<<24)
79#define SP_SONG_ID3V2_2_MASK (1L<<25)
80#define SP_SONG_ID3V2_3_MASK (1L<<26)
81#define SP_SONG_ID3V2_4_MASK (1L<<27)
82#define SP_SONG_UTF8_STRING_IN_FILE_MASK (1L<<28)
83#define SP_SONG_ISO8859_1_STRING_IN_FILE_MASK (1L<<29)
86#define SP_SONG_ID3V2_SUPPORT_MASK (SP_SONG_TRACK_MASK|SP_SONG_TITLE_MASK|SP_SONG_ARTIST_MASK|SP_SONG_ALBUM_MASK|SP_SONG_GENRE_MASK|SP_SONG_RELEASE_MASK|SP_SONG_COPYRIGHT_MASK|SP_SONG_ENGINEER_MASK|SP_SONG_SOURCE_MASK|SP_SONG_SOFTWARE_MASK|SP_SONG_COMMENT_MASK|SP_SONG_ALBUM_ARTIST_MASK|SP_SONG_COMPOSER_MASK|SP_SONG_LYRICIST_MASK|SP_SONG_ISRC_MASK|SP_SONG_TRACK_TOTAL_MASK|SP_SONG_DISC_MASK|SP_SONG_DISC_TOTAL_MASK|SP_SONG_TEMPO_MASK)
88#define SP_SONG_ID3V2_2_SUPPORT_MASK (SP_SONG_ID3V2_SUPPORT_MASK|SP_SONG_ID3V2_2_MASK)
90#define SP_SONG_ID3V2_3_SUPPORT_MASK (SP_SONG_ID3V2_SUPPORT_MASK|SP_SONG_ID3V2_3_MASK)
92#define SP_SONG_ID3V2_4_SUPPORT_MASK (SP_SONG_ID3V2_SUPPORT_MASK|SP_SONG_ID3V2_4_MASK)
94#define SP_SONG_ID3V2_ALL_SUPPORT_MASK (SP_SONG_ID3V2_SUPPORT_MASK|SP_SONG_ID3V2_2_MASK|SP_SONG_ID3V2_3_MASK|SP_SONG_ID3V2_4_MASK)
95
96#define SP_SONG_INFO_SIZE 128
98#define SP_SONG_INFO_GENRE_SIZE 32
99#define SP_SONG_INFO_ALBUM_ARTIST_SIZE 96
101#define SP_SONG_INFO_RELEASE_SIZE 48
102#define SP_SONG_INFO_PRODUCER_SIZE 64
104#define SP_SONG_INFO_SOURCE_SIZE 48
105#define SP_SONG_INFO_COMPOSER_SIZE 80
107#define SP_SONG_INFO_SOFTWARE_SIZE 48
108#define SP_SONG_INFO_LYRICIST_SIZE 80
110#define SP_SONG_INFO_SUBJECT_SIZE 104
111#define SP_SONG_INFO_ISRC_SIZE 24
117typedef struct _spSongInfo {
118 unsigned long info_mask;
119 spLong32 track;
120 char title[SP_SONG_INFO_SIZE];
121 char artist[SP_SONG_INFO_SIZE];
122 char album[SP_SONG_INFO_SIZE];
123 char genre[SP_SONG_INFO_SIZE];
124 char release[SP_SONG_INFO_SIZE];
125 char copyright[SP_SONG_INFO_SIZE];
126 char engineer[SP_SONG_INFO_SIZE];
127 char source[SP_SONG_INFO_SIZE];
128 char software[SP_SONG_INFO_SIZE];
129 char subject[SP_SONG_INFO_SIZE];
130 char comment[SP_SONG_INFO_SIZE];
131} spSongInfo;
132
133/* 0.7.12+ */
138typedef struct _spSongInfoV2 {
139 unsigned long info_mask;
140 spLong32 track;
141 char title[SP_SONG_INFO_SIZE];
142 char artist[SP_SONG_INFO_SIZE];
143 char album[SP_SONG_INFO_SIZE];
148 spLong32 track_total;
149 spLong32 disc;
150 spLong32 disc_total;
151 spLong32 tempo;
152 char copyright[SP_SONG_INFO_SIZE];
153 char engineer[SP_SONG_INFO_SIZE];
160 char comment[SP_SONG_INFO_SIZE];
162
163typedef struct _spSongInfo *spSongInfoPtr;
164typedef struct _spSongInfoV2 *spSongInfoV2Ptr;
165
168#if defined(MACOS)
169#pragma import on
170#endif
171
172extern spBool spIsWavFile(const char *filename);
173extern spBool spReadWavInfo(spWaveInfo *wave_info, FILE *fp);
174extern spBool spWriteWavInfo(spWaveInfo *wave_info, FILE *fp);
175extern long _spReadWavData(spWaveInfo *wave_info, char *data, long length, FILE *fp);
176extern long _spWriteWavData(spWaveInfo *wave_info, char *data, long length, FILE *fp);
177extern unsigned long spGetWavSongInfoMask(void);
178extern spBool spGetWavSongInfo(spSongInfo *song_info, FILE *fp); /* fp must be located at file start or data end */
179extern spBool spReadWavSongInfo(spWaveInfo *wave_info, spSongInfo *song_info, FILE *fp);
180extern spBool spAddWavSongInfo(spSongInfo *song_info, FILE *fp); /* fp must be located at file start or data end */
181extern spBool spWriteWavSongInfo(spWaveInfo *wave_info, spSongInfo *song_info, FILE *fp);
182
183/* (data buffer size) = length * sizeof(short), (samp_bit <= 16)
184 (data buffer size) = length * sizeof(long), (16 < samp_bit <= 32) */
185#define spReadWavData(wave_info, data, length, fp) _spReadWavData(wave_info, (char *)(data), length, fp)
186#define spWriteWavData(wave_info, data, length, fp) _spWriteWavData(wave_info, (char *)(data), length, fp)
187
188extern spBool spIsAiffFile(const char *filename);
189extern spBool spReadAiffInfo(spWaveInfo *wave_info, FILE *fp);
190extern spBool spWriteAiffInfo(spWaveInfo *wave_info, FILE *fp);
191extern long _spReadAiffData(spWaveInfo *wave_info, char *data, long length, FILE *fp);
192extern long _spWriteAiffData(spWaveInfo *wave_info, char *data, long length, FILE *fp);
193extern unsigned long spGetAiffSongInfoMask(void);
194extern spBool spGetAiffSongInfo(spSongInfo *song_info, FILE *fp); /* location of fp is not restricted */
195extern spBool spReadAiffSongInfo(spWaveInfo *wave_info, spSongInfo *song_info, FILE *fp);
196extern spBool spAddAiffSongInfo(spSongInfo *song_info, FILE *fp); /* fp must be located at file start or data end */
197extern spBool spWriteAiffSongInfo(spWaveInfo *wave_info, spSongInfo *song_info, FILE *fp);
198
199#define spReadAiffData(wave_info, data, length, fp) _spReadAiffData(wave_info, (char *)(data), length, fp)
200#define spWriteAiffData(wave_info, data, length, fp) _spWriteAiffData(wave_info, (char *)(data), length, fp)
201
205extern spBool spCopyWaveInfo(spWaveInfo *dest_info, spWaveInfo *src_info);
211extern spBool spCopySongInfo(spSongInfo *dest_info, spSongInfo *src_info);
213extern spBool spCopySongInfoV2(spSongInfoV2 *dest_info, spSongInfoV2 *src_info);
219extern spBool spShowSongInfo(spSongInfo *song_info, const char *indent, FILE *fp);
221extern spBool spShowSongInfoV2(spSongInfoV2 *song_info, const char *indent, FILE *fp);
222
223/* the following functions may remove in future release */
224extern void spPlayFileUseDatLink(spBool flag);
225extern void spPlayFileUseWav(spBool flag);
226extern spBool spSetPlayCommand(const char *format);
227extern spBool spPlayFile(const char *filename, int num_channel, double samp_rate);
228extern spBool spPlayFileAsync(const char *filename, int num_channel, double samp_rate);
229
230#if defined(MACOS)
231#pragma import off
232#endif
233
234#ifdef __cplusplus
235} /* Close scope of 'extern "C"' declaration */
236#endif
237
238#endif /* __SPWAVE_H */
int spBool
#define SP_SONG_INFO_RELEASE_SIZE
Definition spWave.h:101
#define SP_SONG_INFO_SIZE
Definition spWave.h:96
#define SP_WAVE_FILE_TYPE_SIZE
Definition spWave.h:36
#define SP_SONG_INFO_PRODUCER_SIZE
Definition spWave.h:102
#define SP_SONG_INFO_LYRICIST_SIZE
Definition spWave.h:108
#define SP_SONG_INFO_SOFTWARE_SIZE
Definition spWave.h:107
#define SP_WAVE_FILE_FILTER_SIZE
Definition spWave.h:38
#define SP_SONG_INFO_ISRC_SIZE
Definition spWave.h:111
#define SP_SONG_INFO_SOURCE_SIZE
Definition spWave.h:104
#define SP_SONG_INFO_GENRE_SIZE
Definition spWave.h:98
#define SP_SONG_INFO_COMPOSER_SIZE
Definition spWave.h:105
#define SP_WAVE_FILE_DESC_SIZE
Definition spWave.h:37
#define SP_SONG_INFO_ALBUM_ARTIST_SIZE
Definition spWave.h:99
#define SP_SONG_INFO_SUBJECT_SIZE
Definition spWave.h:110
spBool spShowSongInfo(spSongInfo *song_info, const char *indent, FILE *fp)
spBool spInitSongInfo(spSongInfo *song_info)
spBool spInitWaveInfo(spWaveInfo *wave_info)
spBool spInitSongInfoV2(spSongInfoV2 *song_info)
spBool spEqSongInfo(spSongInfo *info1, spSongInfo *info2)
spBool spShowSongInfoV2(spSongInfoV2 *song_info, const char *indent, FILE *fp)
spBool spCopySongInfo(spSongInfo *dest_info, spSongInfo *src_info)
spBool spEqSongInfoV2(spSongInfoV2 *info1, spSongInfoV2 *info2)
spBool spCopySongInfoV2(spSongInfoV2 *dest_info, spSongInfoV2 *src_info)
spBool spCopyWaveInfo(spWaveInfo *dest_info, spWaveInfo *src_info)
Definition spWave.h:117
unsigned long info_mask
Definition spWave.h:118
spLong32 track
Definition spWave.h:119
Definition spWave.h:138
unsigned long info_mask
Definition spWave.h:139
spLong32 track
Definition spWave.h:140
spLong32 track_total
Definition spWave.h:148
spLong32 disc_total
Definition spWave.h:150
spLong32 disc
Definition spWave.h:149
spLong32 tempo
Definition spWave.h:151
Definition spWave.h:43
int samp_bit
Definition spWave.h:49
spLong length
Definition spWave.h:53
double samp_rate
Definition spWave.h:51
long bit_rate
Definition spWave.h:52
int num_channel
Definition spWave.h:50
spLong header_size
Definition spWave.h:48
int buffer_size
Definition spWave.h:47