-
Notifications
You must be signed in to change notification settings - Fork 2
/
WSFGlob.h
151 lines (111 loc) · 4.24 KB
/
WSFGlob.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
Whelchel Sound Format
Based on MODs
Josh Whelchel 2003
www.syntesis.ath.cx
*/
/***************************************************************************
* Copyright (C) 2005 by Josh Whelchel *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
///
/// \file WSFGlob.h Global WSF stuff
#ifndef __WSFGLOBH__
#define __WSFGLOBH__
#include <stdio.h>
/// 'SNES' Echo value.
/// WSFTool and WinWSFTool both feature a option to tag WSF files as
/// 'SNES'-echo'd. This naming is simply a reference to how the results,
/// if the track suits it, will sound like it is being played on an SNES.
/// This macro simply defines how much echo we want to tag for.
/// This is the equiv. of saying "SEcho=DEFNESECHO"
#define DEFSNESECHO "64"
/// Used to test version through bHi and bLo
#define TESTVER(x,y) (bHi > x || (bHi == x && bLo >= y))
/// WSF Byte
typedef unsigned char wsfb;
/// Unsigned Short Typedef
typedef unsigned short wsus;
/// Unsigned Long Typedef
typedef unsigned int wsul;
/// Sample Output for use with CWSFPack::GetSamp
typedef struct wsf_sampout_s
{
unsigned int nSize; ///< Size of sample
wsfb *bSampData; ///< Sample Data
wsus nCh; ///< Number of Channels
wsus nBit; ///< Bit Rate (8/16)
wsfb nOgg; ///< Ogg Compression?
wsul nStoredSize; ///< Stored Size
wsul nFreq; ///< An Okay Freq
} wsf_sampout;
/// Sample Storage
typedef struct wsf_sample_s
{
wsul nSize; ///< Sample Size (in Bytes)
wsfb *bSampData; ///< Sample Data
char cSignature[31]; ///< Sample Signature (size = 30)
wsus nCh; ///< Number of Channels
wsul nSamps; ///< Number of Samples
wsus nBit; ///< Bit Rate (8/16)
wsfb nOgg; ///< Ogg Compression?
wsul nRawSize; ///< Internal Raw Size to be used in CWSFPack
wsul nStoredSize; ///< Stored Sample Size
char cName[27]; ///< Sample Name
wsul nFreq; ///< Sample Frequency (An okay one)
} wsf_sample;
#define WSF_ID(a,b,c,d) (((unsigned int)(a) << 24) | \
((unsigned int)(b) << 16) | \
((unsigned int)(c) << 8) | \
((unsigned int)(d) ))
#define WSFERR 16661 ///< Value used for returning errors with wsul return values
/// For use with loading mods in memory easily :D
typedef struct wsf_file_s
{
wsfb *bData;
wsul nSize;
wsfb *bPos;
wsul nPos;
char *cF;
wsfb bW;
wsfb nFree;
FILE *hFile;
} wsf_file;
wsf_file *wsfopenfile( char *cFile );
wsf_file *wsfopenmem( wsfb *bData, wsul nSize, wsfb nFree = 0 ); // nFree states that wsfclose should free the memory.
wsf_file *wsfcreatefile( char *cFile );
wsf_file *wsfcreatemem( void );
wsul wsfwrite( void *bData, wsul nSize, wsf_file *wf );
wsul wsfread( void *bData, wsul nSize, wsf_file *wf );
void wsfseek( wsul nPos, wsf_file *wf );
void wsfbegin( wsul nOff, wsf_file *wf );
void wsfend( int nOff, wsf_file *wf );
void wsfclose( wsf_file *wf );
/// Structure for MiniWSF
typedef struct miniwsfdata_s
{
char cTitle[31];
char cMessage[256];
wsul nMods;
wsul *nModSizes;
wsfb **bMods;
char **cFiles;
wsul nPackSize;
wsfb *bPack;
} MiniWSFData;
#endif