Mercurial > audlegacy
annotate Plugins/Input/console/notes.txt @ 98:e42694a28331 trunk
[svn] More progress -- now loads as an audacious module. :)
author | nenolod |
---|---|
date | Tue, 01 Nov 2005 21:34:11 -0800 |
parents | 252843aac42f |
children | 7c5e886205ef |
rev | line source |
---|---|
90
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
1 Game_Music_Emu Notes |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
2 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
3 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
4 Architecture |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
5 ------------ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
6 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
7 This library has several emulator classes derived from common interface |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
8 classes. Music_Emu specifies the main interface, and Classic_Emu adds |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
9 features available only for "classic" systems (frequency equalization |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
10 and customizable multi-channel sound buffer). |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
11 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
12 To play a given game music file, do the following: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
13 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
14 - Determine its file type |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
15 - Create and set up an appropriate emulator |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
16 - Load file header and file data into emulator |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
17 - Start desired track |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
18 - When samples are needed, call play() |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
19 - When done, delete emulator |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
20 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
21 Each emulator type defines a nested header_t structure type with members |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
22 for the file header. When loading a file, the emulators expect the file |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
23 header to have already been loaded; this allows the caller to use header |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
24 fields like the game name and music author. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
25 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
26 See Music_Emu.h and Classic_Emu.h for reference. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
27 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
28 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
29 Error handling |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
30 -------------- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
31 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
32 Functions which can fail have a return type of blargg_err_t, which is a |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
33 pointer to an error string (const char*). If the function is successful |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
34 it returns blargg_success (NULL), otherwise it returns a pointer to an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
35 error string. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
36 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
37 To allow compatibility with older C++ compilers, no exceptions are |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
38 thrown by any of the modules. The library is exception-safe, and any |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
39 exceptions which occur are not intercepted. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
40 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
41 Due to the different ways compiler runtime libraries handle |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
42 out-of-memory errors, if the library encounters one it will be reported |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
43 in one of two ways: if the compiler is configured to throw an exception |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
44 when operator new can't satisfy a request (which is the case in ISO |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
45 C++), it is allowed to propagate normally, otherwise the error string |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
46 "Out of memory" is returned. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
47 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
48 Significant violations of the documented interface are flagged with |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
49 debug-only assertions. Failure of these usually indicates a caller error |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
50 rather than a defect in the library. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
51 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
52 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
53 Configuration |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
54 ------------- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
55 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
56 The header "blargg_common.h" is used to establish a common environment. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
57 It attempts to automatically determine the features of the environment, |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
58 but might need help. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
59 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
60 If HAVE_CONFIG_H is defined, the file "config.h" is included at the |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
61 beginning of each library header file, allowing configuration options |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
62 for the library to be set. It's fine if other libraries also use this |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
63 scheme, as they won't conflict. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
64 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
65 Some libraries depend on the order of bytes in multibyte types. These |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
66 will cause a compilation error if the order can't be determined. If this |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
67 occurs, define the appropriate symbol. For big-endian (most significant |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
68 byte first, i.e. Motorola 68000, PowerPC), #define BLARGG_BIG_ENDIAN to |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
69 1. For little-endian (least significant byte first, i.e. Intel x86), |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
70 #define BLARGG_LITTLE_ENDIAN to 1. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
71 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
72 Pre-ISO C++ compilers might not support bool. Support is provided where |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
73 bool is not available, but the compiler's support of bool might not be |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
74 properly determined. If errors occur in "blargg_common.h" in the bool |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
75 section, #define BLARGG_COMPILER_HAS_BOOL to 1 if your compiler supports |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
76 bool, otherwise 0. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
77 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
78 If your compiler supports namespaces, blargg_common.h uses standard |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
79 headers with the "c" prefix to avoid bringing names from std into the |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
80 global namespace. If your compiler supports namespaces but this isn't |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
81 being detected by blargg_common.h, #define BLARGG_COMPILER_HAS_NAMESPACE |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
82 to 1 in your config.h file. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
83 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
84 If you have any problems with "blargg_common.h", contact me. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
85 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
86 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
87 Game Music File Handling |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
88 ------------------------ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
89 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
90 Game music files include text fields with information about the game and |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
91 track. Each emulator's header_t defines the basic fields (game, song, |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
92 author, copyright, track_count) supported by that music type, or has an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
93 enum { field = 0 } if unsupported. This allows the same code to be used |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
94 for parsing each header if it checks that the field is non-zero. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
95 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
96 Text fields in most game music formats won't have a nul terminator if |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
97 the string completely fills the field. The demos show one way to handle |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
98 this. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
99 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
100 This library is focused on playback only and the emulators don't parse |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
101 extended text fields, since this can be complex for some formats and can |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
102 be done by the caller. To load the NSFE format, it must be parsed first |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
103 and an NSF header must be made in memory and passed Nsf_Emu. See the |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
104 Game Music Box source code for an example of this: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
105 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
106 http://www.slack.net/~ant/game-music-box/dev.html |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
107 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
108 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
109 Frequency equalization |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
110 ---------------------- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
111 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
112 The classic emulators allow frequency equalization to be adjusted; |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
113 Classic_Emu::equalizer_t( treble, cutoff, bass ) specifies low-pass and |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
114 high-pass filtering. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
115 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
116 Low-pass is an exponential rolloff beginning at 'cutoff' Hz and |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
117 attenuating by 'treble' dB at 22kHz. For example, with cutoff = 8000 Hz |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
118 and treble = -6 dB, the following results: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
119 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
120 cutoff = 8kHz |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
121 0dB -------*__ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
122 ~~--__ treble = -6dB |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
123 ~~-*__ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
124 ~~--__ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
125 ~~--__ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
126 ~~--__ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
127 -18dB - - - - - - - - - - - - - - - - - - - - - - |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
128 0 8kHz 22kHz 44kHz ... |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
129 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
130 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
131 High-pass is a steep rolloff which passes -3dB attenuation at |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
132 'breakpoint' Hz, where useful frequencies range from 0 to 6000 Hz. For |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
133 example, with breakpoint = 1000 Hz, the following results: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
134 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
135 breakpoint = 1000 Hz |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
136 0dB ___________ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
137 -3dB ,_*---~~~~~ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
138 _~ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
139 / |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
140 / |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
141 | |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
142 | |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
143 -21dB - - - - - - - - - - - - - |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
144 0 1000 Hz 4000 Hz |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
145 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
146 Each emulator defaults to a profile that approximates its particular |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
147 console's sound quality; this default can be determined by getting the |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
148 current equalization just after creating the emulator. See Classic_Emu.h |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
149 for reference. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
150 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
151 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
152 Emulator gain control |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
153 --------------------- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
154 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
155 Each emulator allows its gain to be adjusted. The default gains are |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
156 selected to give consistent relative volumes between emulators without |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
157 resulting in excessive clamping of samples that would otherwise go |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
158 beyond the 16-bit range. A gain of 1.0 results in a conservative volume |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
159 that rarely requires any clamping to stay within the 16-bit sample |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
160 range. Clamping samples to 16 bits is handled by the library. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
161 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
162 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
163 Output sample rate |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
164 ------------------ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
165 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
166 Each emulator has a way of specifying the output sample rate during |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
167 initialization. All the emulators use internal band-limiting, so there |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
168 is no reason to use a sample rate above 48kHz unless the sound hardware |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
169 demands it; 44-48kHz will yield the best results. You could use the |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
170 following code to choose a rate that is both near this range and an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
171 integral division of the native rate: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
172 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
173 long adjust_rate( double native ) |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
174 { |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
175 for ( double divider = 1; divider <= 4; divider++ ) |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
176 { |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
177 long adjusted = native / divider + 0.5; |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
178 if ( adjusted <= 56000 ) |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
179 return adjusted; |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
180 } |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
181 return 44100; // give up; CD rate probably works well enough |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
182 } |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
183 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
184 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
185 Interface conventions |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
186 ---------------------- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
187 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
188 If a function will keep a pointer to an object passed, to make this |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
189 clear in source code it takes a pointer rather than a reference. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
190 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
191 Multi-word names have an underscore '_' separator between individual |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
192 words. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
193 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
194 Functions are named with lowercase words. Functions which perform an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
195 action with side-effects are named with a verb phrase (i.e. load, move, |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
196 run). Functions which set or return the value of a piece of state are |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
197 named using a noun phrase (i.e. loaded, moved, running). |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
198 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
199 Classes are named with capitalized words. Only the first letter of an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
200 acronym is capitalized. Class names are nouns, sometimes suggestive of |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
201 what they do (i.e. File_Scanner). |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
202 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
203 Structure, enumeration, and typedefs to these and built-in types are |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
204 named using lowercase words with a _t suffix. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
205 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
206 Macros are named with all-uppercase words. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
207 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
208 Internal names which can't be hidden due to technical reasons have an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
209 underscore '_' suffix. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
210 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
211 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
212 Misc |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
213 ---- |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
214 |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
215 Special thanks to Chris Moeller (kode54) for help with library testing |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
216 and feedback. His openspc++ library in C++ was an essential starting |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
217 point and framework for developing the SPC emulator. Brad Martin's |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
218 excellent SNES DSP emulator (also part of openspc++) provided an |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
219 essential foundation for the DSP core. |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
220 |