Browse code

Updating the VBA-M code to revision 1231.

Naram Qashat authored on 2014/09/08 12:20:28
Showing 1 changed files
... ...
@@ -1,5 +1,4 @@
1
-#ifndef SOUND_H
2
-#define SOUND_H
1
+#pragma once
3 2
 
4 3
 // Sound emulation setup/options and GBA sound emulation
5 4
 
... ...
@@ -37,11 +36,14 @@ extern bool soundInterpolation; // 1 if PCM should have low-pass filtering
37 36
 //// GBA sound emulation
38 37
 
39 38
 // GBA sound registers
40
-const uint32_t SGCNT0_H = 0x82;
41
-const uint32_t FIFOA_L = 0xa0;
42
-const uint32_t FIFOA_H = 0xa2;
43
-const uint32_t FIFOB_L = 0xa4;
44
-const uint32_t FIFOB_H = 0xa6;
39
+enum
40
+{
41
+	SGCNT0_H = 0x82,
42
+	FIFOA_L = 0xa0,
43
+	FIFOA_H = 0xa2,
44
+	FIFOB_L = 0xa4,
45
+	FIFOB_H = 0xa6
46
+};
45 47
 
46 48
 // Resets emulated sound hardware
47 49
 void soundReset();
... ...
@@ -61,5 +63,3 @@ extern int soundTicks; // Number of 16.8 MHz clocks until soundTick() will be ca
61 63
 class Multi_Buffer;
62 64
 
63 65
 void flush_samples(Multi_Buffer *buffer);
64
-
65
-#endif // SOUND_H
Browse code

[GSF] Massive code cleanup.

(As an aside, blargg's code style makes me go blarg myself.)

Naram Qashat authored on 2013/05/14 01:07:18
Showing 1 changed files
... ...
@@ -5,21 +5,12 @@
5 5
 
6 6
 #include <cstdint>
7 7
 
8
-extern bool soundDeclicking;
9
-
10 8
 //// Setup/options (these affect GBA and GB sound)
11 9
 
12 10
 // Initializes sound and returns true if successful. Sets sound quality to
13 11
 // current value in soundQuality global.
14 12
 bool soundInit();
15 13
 
16
-// sets the Sound throttle
17
-void soundSetThrottle(unsigned short throttle);
18
-
19
-// Manages sound volume, where 1.0 is normal
20
-void soundSetVolume( float );
21
-float soundGetVolume();
22
-
23 14
 // Manages muting bitmask. The bits control the following channels:
24 15
 // 0x001 Pulse 1
25 16
 // 0x002 Pulse 2
... ...
@@ -27,60 +18,48 @@ float soundGetVolume();
27 18
 // 0x008 Noise
28 19
 // 0x100 PCM 1
29 20
 // 0x200 PCM 2
30
-void soundSetEnable( int mask );
31
-int  soundGetEnable();
21
+void soundSetEnable(int mask);
32 22
 
33 23
 // Pauses/resumes system sound output
34 24
 void soundPause();
35 25
 void soundResume();
36
-extern bool soundPaused; // current paused state
37 26
 
38 27
 // Cleans up sound. Afterwards, soundInit() can be called again.
39 28
 void soundShutdown();
40 29
 
41 30
 //// GBA sound options
42 31
 
43
-long soundGetSampleRate();
44 32
 void soundSetSampleRate(long sampleRate);
45 33
 
46 34
 // Sound settings
47 35
 extern bool soundInterpolation; // 1 if PCM should have low-pass filtering
48
-extern float soundFiltering;    // 0.0 = none, 1.0 = max
49
-
50 36
 
51 37
 //// GBA sound emulation
52 38
 
53 39
 // GBA sound registers
54
-#define SGCNT0_H 0x82
55
-#define FIFOA_L 0xa0
56
-#define FIFOA_H 0xa2
57
-#define FIFOB_L 0xa4
58
-#define FIFOB_H 0xa6
40
+const uint32_t SGCNT0_H = 0x82;
41
+const uint32_t FIFOA_L = 0xa0;
42
+const uint32_t FIFOA_H = 0xa2;
43
+const uint32_t FIFOB_L = 0xa4;
44
+const uint32_t FIFOB_H = 0xa6;
59 45
 
60 46
 // Resets emulated sound hardware
61 47
 void soundReset();
62 48
 
63 49
 // Emulates write to sound hardware
64
-void soundEvent( uint32_t addr, uint8_t  data );
65
-void soundEvent( uint32_t addr, uint16_t data ); // TODO: error-prone to overload like this
50
+void soundEvent(uint32_t addr, uint8_t data);
51
+void soundEvent(uint32_t addr, uint16_t data); // TODO: error-prone to overload like this
66 52
 
67 53
 // Notifies emulator that a timer has overflowed
68
-void soundTimerOverflow( int which );
69
-
70
-// Notifies emulator that PCM rate may have changed
71
-void interp_rate();
54
+void soundTimerOverflow(int which);
72 55
 
73 56
 // Notifies emulator that SOUND_CLOCK_TICKS clocks have passed
74 57
 void psoundTickfn();
75
-extern int SOUND_CLOCK_TICKS;   // Number of 16.8 MHz clocks between calls to soundTick()
76
-extern int soundTicks;          // Number of 16.8 MHz clocks until soundTick() will be called
77
-
78
-// Saves/loads emulator state
79
-//void soundSaveGame( gzFile );
80
-//void soundReadGame( gzFile, int version );
58
+extern int SOUND_CLOCK_TICKS; // Number of 16.8 MHz clocks between calls to soundTick()
59
+extern int soundTicks; // Number of 16.8 MHz clocks until soundTick() will be called
81 60
 
82 61
 class Multi_Buffer;
83 62
 
84
-void flush_samples(Multi_Buffer * buffer);
63
+void flush_samples(Multi_Buffer *buffer);
85 64
 
86 65
 #endif // SOUND_H
Browse code

[GSF] Removed Types.h because all it really was doing now was including stdint.

Naram Qashat authored on 2013/05/10 19:31:06
Showing 1 changed files
... ...
@@ -3,8 +3,7 @@
3 3
 
4 4
 // Sound emulation setup/options and GBA sound emulation
5 5
 
6
-//#include "../System.h"
7
-#include "../common/Types.h"
6
+#include <cstdint>
8 7
 
9 8
 extern bool soundDeclicking;
10 9
 
Browse code

[GSF] Cleanup, a tiny bit of making sure it was like viogsf, also used the standard integer types and not VBA-M's typedefs.

Naram Qashat authored on 2013/05/10 17:45:36
Showing 1 changed files
... ...
@@ -6,6 +6,8 @@
6 6
 //#include "../System.h"
7 7
 #include "../common/Types.h"
8 8
 
9
+extern bool soundDeclicking;
10
+
9 11
 //// Setup/options (these affect GBA and GB sound)
10 12
 
11 13
 // Initializes sound and returns true if successful. Sets sound quality to
... ...
@@ -60,8 +62,8 @@ extern float soundFiltering;    // 0.0 = none, 1.0 = max
60 62
 void soundReset();
61 63
 
62 64
 // Emulates write to sound hardware
63
-void soundEvent( u32 addr, u8  data );
64
-void soundEvent( u32 addr, u16 data ); // TODO: error-prone to overload like this
65
+void soundEvent( uint32_t addr, uint8_t  data );
66
+void soundEvent( uint32_t addr, uint16_t data ); // TODO: error-prone to overload like this
65 67
 
66 68
 // Notifies emulator that a timer has overflowed
67 69
 void soundTimerOverflow( int which );
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,85 @@
1
+#ifndef SOUND_H
2
+#define SOUND_H
3
+
4
+// Sound emulation setup/options and GBA sound emulation
5
+
6
+//#include "../System.h"
7
+#include "../common/Types.h"
8
+
9
+//// Setup/options (these affect GBA and GB sound)
10
+
11
+// Initializes sound and returns true if successful. Sets sound quality to
12
+// current value in soundQuality global.
13
+bool soundInit();
14
+
15
+// sets the Sound throttle
16
+void soundSetThrottle(unsigned short throttle);
17
+
18
+// Manages sound volume, where 1.0 is normal
19
+void soundSetVolume( float );
20
+float soundGetVolume();
21
+
22
+// Manages muting bitmask. The bits control the following channels:
23
+// 0x001 Pulse 1
24
+// 0x002 Pulse 2
25
+// 0x004 Wave
26
+// 0x008 Noise
27
+// 0x100 PCM 1
28
+// 0x200 PCM 2
29
+void soundSetEnable( int mask );
30
+int  soundGetEnable();
31
+
32
+// Pauses/resumes system sound output
33
+void soundPause();
34
+void soundResume();
35
+extern bool soundPaused; // current paused state
36
+
37
+// Cleans up sound. Afterwards, soundInit() can be called again.
38
+void soundShutdown();
39
+
40
+//// GBA sound options
41
+
42
+long soundGetSampleRate();
43
+void soundSetSampleRate(long sampleRate);
44
+
45
+// Sound settings
46
+extern bool soundInterpolation; // 1 if PCM should have low-pass filtering
47
+extern float soundFiltering;    // 0.0 = none, 1.0 = max
48
+
49
+
50
+//// GBA sound emulation
51
+
52
+// GBA sound registers
53
+#define SGCNT0_H 0x82
54
+#define FIFOA_L 0xa0
55
+#define FIFOA_H 0xa2
56
+#define FIFOB_L 0xa4
57
+#define FIFOB_H 0xa6
58
+
59
+// Resets emulated sound hardware
60
+void soundReset();
61
+
62
+// Emulates write to sound hardware
63
+void soundEvent( u32 addr, u8  data );
64
+void soundEvent( u32 addr, u16 data ); // TODO: error-prone to overload like this
65
+
66
+// Notifies emulator that a timer has overflowed
67
+void soundTimerOverflow( int which );
68
+
69
+// Notifies emulator that PCM rate may have changed
70
+void interp_rate();
71
+
72
+// Notifies emulator that SOUND_CLOCK_TICKS clocks have passed
73
+void psoundTickfn();
74
+extern int SOUND_CLOCK_TICKS;   // Number of 16.8 MHz clocks between calls to soundTick()
75
+extern int soundTicks;          // Number of 16.8 MHz clocks until soundTick() will be called
76
+
77
+// Saves/loads emulator state
78
+//void soundSaveGame( gzFile );
79
+//void soundReadGame( gzFile, int version );
80
+
81
+class Multi_Buffer;
82
+
83
+void flush_samples(Multi_Buffer * buffer);
84
+
85
+#endif // SOUND_H