This repository has been archived by the owner on Dec 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbin_cue.h
90 lines (71 loc) · 1.71 KB
/
bin_cue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef BIN_CUE_H
#define BIN_CUE_H
typedef enum
{
TRACK_FILE_TYPE_BINARY,
TRACK_FILE_TYPE_WAVE,
TRACK_FILE_TYPE_NULL,
#ifdef OGG_SUPPORT
TRACK_FILE_TYPE_OGG
#endif
} track_file_type_enum;
// 28B
typedef struct
{
u32 file_number;
u32 physical_offset;
u32 sector_offset;
u32 sector_count;
u32 pregap_offset;
u32 sector_size;
u32 format_type;
} cd_track_struct;
// 20B
typedef struct
{
u32 channels;
u32 frequency;
u32 frequency_div;
u32 bytes_per_sample;
u32 bytes_per_sector;
} wav_info_struct;
// w/o OGG support: 23B
typedef struct
{
track_file_type_enum type;
FILE *file_handle;
u32 current_offset;
union
{
wav_info_struct *wav_info;
#ifdef OGG_SUPPORT
OggVorbis_File *ov_file;
#endif
} ext_info;
} cd_track_file_struct;
// 7B + 2300B + 2800B + 400B
typedef struct
{
FILE *bin_file;
cd_track_file_struct track_files[100];
u32 num_files;
s32 first_track;
s32 last_track;
u32 num_physical_tracks;
u32 num_sectors;
s32 last_seek_track;
cd_track_struct physical_tracks[100];
cd_track_struct *logical_tracks[100];
} cd_bin_struct;
s32 load_bin_cue(char *cue_file_name);
u32 bin_cue_get_first_track();
u32 bin_cue_get_last_track();
u32 bin_cue_get_sector_count();
s32 bin_cue_get_track_offset(u32 track_number);
u32 bin_cue_get_track_format(u32 track_number);
s32 bin_cue_get_current_track(u32 sector_offset, u32 *_track_number,
u32 *index_number, u32 *relative_offset);
s32 bin_cue_read_sector_audio(s16 *sector_buffer, u32 sector_offset);
s32 bin_cue_read_sector_data(u8 *sector_buffer, u32 sector_offset);
void bin_cue_preload_audio_sector(u32 sector_offset);
#endif