Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a814982
reg 1 sound
nbennett320 Jul 30, 2021
6ddb106
left sound2 implementation
nbennett320 Aug 17, 2021
59c951b
sound2 h reg implementation
nbennett320 Aug 17, 2021
3f57049
wave cycle duty
nbennett320 Aug 17, 2021
b0fc795
defining more in apu
nbennett320 Aug 18, 2021
62df06a
apu getter & setter inline functs
nbennett320 Aug 18, 2021
ebaf63c
moving sound channel streams to apu
nbennett320 Aug 18, 2021
07dbb7b
weird bug ? seems to b fixeed
nbennett320 Aug 18, 2021
55c7bfa
sound working again :D
nbennett320 Aug 18, 2021
ff238eb
freq shifting working again :D
nbennett320 Aug 19, 2021
8f93043
cleaning up
nbennett320 Aug 19, 2021
78f5aeb
moving to other computer
nbennett320 Aug 26, 2021
912a2c0
rm mac ish
nbennett320 Sep 15, 2021
689fa2c
rename stuff
nbennett320 Sep 15, 2021
c98f1a5
reworking apu
nbennett320 Sep 16, 2021
05e1672
timing apu
nbennett320 Sep 16, 2021
2e446b9
timing modes (kinda a wip)
nbennett320 Sep 16, 2021
f985914
apu
nbennett320 Sep 23, 2021
0d2031d
merge w main
nbennett320 Sep 25, 2021
c65aedc
branching to watcher
nbennett320 Sep 25, 2021
ed7b79d
implement watcher class
nbennett320 Sep 25, 2021
18b1df3
sound callback working
nbennett320 Sep 25, 2021
e556063
Fix mode 4 graphics indexing
samkravitz Sep 26, 2021
dbbca40
wip: fourier transform
nbennett320 Sep 26, 2021
06218bb
initialize output control registers
nbennett320 Sep 26, 2021
3856606
wip: extend buffer in apu
nbennett320 Sep 26, 2021
9e6b18c
WIP: working on sound
nbennett320 Sep 30, 2021
46f37ac
Merge branch 'main' of github.com:samkravitz/discovery into implement…
nbennett320 Oct 1, 2021
14d6d3d
circular queue and fourier transform implementations
nbennett320 Oct 18, 2021
a831e28
implementing circular buffer
nbennett320 Oct 21, 2021
8b2e79f
wip: circular buffer in apu
nbennett320 Oct 21, 2021
c2b30aa
fix makefile double include
nbennett320 Oct 21, 2021
d1d4eba
wip: audiobuffer in apu
nbennett320 Oct 21, 2021
f1b185c
wip: audiobuffer in apu 2
nbennett320 Oct 21, 2021
5a723d5
audiobuffer in apu
nbennett320 Oct 21, 2021
0765930
circular buffer in apu
nbennett320 Oct 21, 2021
bc34583
buffering audio in apu before callback
nbennett320 Oct 21, 2021
cf2028e
resetting cursor in buffer
nbennett320 Oct 22, 2021
9fc8103
square wave playing at different frequencies
nbennett320 Oct 24, 2021
ce1df24
queue audio
nbennett320 Nov 9, 2021
dbdeb8b
Add AudioStat data structure
samkravitz Nov 9, 2021
803262c
Hard code a volume envelope for channel 2
samkravitz Nov 9, 2021
d15d120
Get frequency from register instead of hard coding
samkravitz Nov 10, 2021
537a25e
Calculates when to stop sound if timed mode is on
samkravitz Nov 14, 2021
b3c5784
Add wave duty cycle
samkravitz Nov 14, 2021
479b2df
Add volume envelope
samkravitz Nov 14, 2021
214b205
Sepparate each channel into its own method
samkravitz Nov 14, 2021
46a97e8
init sound1cnt registers
nbennett320 Nov 14, 2021
96e31e5
update doc page
nbennett320 Nov 14, 2021
e156239
remove watcher and old AudioStat
nbennett320 Nov 14, 2021
3b8655e
remove watcher from makefile
nbennett320 Nov 14, 2021
633f869
remove circular buffer class
nbennett320 Nov 14, 2021
5559190
add raw variables to audiostat struct
nbennett320 Nov 14, 2021
043bd54
sound1 pitch shifting
nbennett320 Nov 14, 2021
8e997ec
pulling channel 3 changes
nbennett320 Nov 19, 2021
e441414
add tags to git ignore
nbennett320 Nov 19, 2021
cb1906d
remove discovery.dSYM/
nbennett320 Nov 19, 2021
5560976
parse discovery config file
nbennett320 Nov 19, 2021
39e0c68
gitignore
nbennett320 Nov 19, 2021
bc376f9
reading keymaps in discovery.config
nbennett320 Nov 20, 2021
ee1f464
remapping keys works
nbennett320 Nov 20, 2021
bd5633b
cleaning up comments
nbennett320 Nov 20, 2021
c28fdd1
clean up logs
nbennett320 Nov 20, 2021
b485078
fix default select key, adjust default discovery.config, -c/--config …
nbennett320 Nov 20, 2021
52fa81e
update help output log
nbennett320 Nov 20, 2021
bc9132e
fix indentation
nbennett320 Nov 20, 2021
b1c7ba5
fix indentation
nbennett320 Nov 20, 2021
936b977
add support for space, tab, left and right shift and controls, period…
nbennett320 Nov 22, 2021
c7e1b17
listen for window resize
nbennett320 Nov 22, 2021
5adddd8
Make it possible to resize window
samkravitz Nov 22, 2021
418ea4b
maintain aspect ratio on window resize
nbennett320 Nov 25, 2021
9ab1b58
clean up
nbennett320 Nov 25, 2021
f286883
centering output
nbennett320 Nov 25, 2021
915dd9d
Merge pull request #19 from nbennett320/output-resolution
nbennett320 Nov 25, 2021
b69f459
add config settings to readme
nbennett320 Nov 25, 2021
45a853f
add example config to readme
nbennett320 Nov 25, 2021
e323525
clean up
nbennett320 Nov 25, 2021
94ae841
clean up
nbennett320 Nov 25, 2021
fcd2342
clean up
nbennett320 Nov 25, 2021
03a2cf7
clean up
nbennett320 Nov 25, 2021
103d836
clean up
nbennett320 Nov 25, 2021
c9108ca
fix conflict & merge with main
nbennett320 Nov 25, 2021
3efef0a
Merge pull request #18 from nbennett320/user-config
nbennett320 Nov 26, 2021
f5c0e4e
sound channels 1 and 2 bug fix: timing registers
nbennett320 Mar 22, 2022
9d137f8
Merge branch 'main' into implement-sound
nbennett320 Mar 22, 2022
49a723b
merge with main
nbennett320 Mar 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ a.out
roms/
third_party/fmt
bios.bin
*.sav
*.sav
*.swp
./.tags

8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ SOURCE = src
INCLUDE = include
BACKUPDIR = $(INCLUDE)/backup
OBJ = \
config.o \
APU.o \
Arm7.o \
arm_isa.o \
config.o \
Discovery.o \
Flash.o \
Gamepad.o \
Expand All @@ -33,6 +33,12 @@ ifdef opt
CXXFLAGS += -Ofast
endif

# Use verbose output
# run `make verbose=1`
ifdef verbose
CXXFLAGS += -Wall -pedantic
endif

all: discovery
discovery: $(LIST) main.cpp
$(CXX) $(CXXFLAGS) -o discovery $(SOURCE)/main.cpp $(LIST) $(LIBS)
Expand Down
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,65 @@ Discovery will attempt to load a BIOS in the same directory as the executable ca

`./discovery path/to/rom -b path/to/bios`

### Flags

| Flag | | Type | Description|
|----|----|----|----|
`-i` | `--input` | `string` | Specify the input ROM
`-b` | `--bios` | `string` | Specify the BIOS Discovery will use
`-c` | `--config` | `string` | Specify the config file Discovery will use
`-h` | `--help` | `boolean` | Print Discovery help

## Configuration

By default Discovery will load and read settings from a file named `discovery.config`. Alternatively, you can load from a different config file
using:

`./discovery -c my_alt_config.file`

The syntax for a config file is very simple. Key-value pairs are set like so:

```
# this is a comment
set_key = values_like_this
```

Below is a table describing the keys Discovery will recognize.

### Configuration options

|Key | Description|
|----|----|
`gba_a ` | Map the A button to the specified key
`gba_b ` | Map the B button to the specified key
`gba_sel ` | Map the Select button to the specified key
`gba_start ` | Map the Start button to the specified key
`gba_dpad_right` | Map right on the dpad to the specified key
`gba_dpad_left ` | Map left on the dpad to the specified key
`gba_dpad_up ` | Map up on the dpad to the specified key
`gba_dpad_down ` | Map down on the dpad the specified key
`gba_r ` | Map the R button to the specified key
`gba_l ` | Map the L button to the specified key

#### Example

This example config file will map controls to WASD keys, using the k, l, o, and p
keys for the A, B, L and R buttons, respectively:

```
# map buttons to WASD controls
gba_dpad_up = w
gba_dpad_down = s
gba_dpad_left = a
gba_dpad_right = d
gba_a = k
gba_b = l
gba_r = o
gba_l = p
gba_start = cr
gba_sel = bs
```

## Building on Linux based systems
Discovery has the following dependencies:
- make
Expand Down
12 changes: 12 additions & 0 deletions discovery.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# map keys
gba_dpad_up = up
gba_dpad_down = down
gba_dpad_left = left
gba_dpad_right = right
gba_a = x
gba_b = z
gba_r = s
gba_l = a
gba_start = cr
gba_sel = bs

Binary file added docs/assets/9600204_orig.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/Minimoog_1979_left_2017_right.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,24 @@ hr {
.bl {
margin-bottom: 16px;
}

.figure {
display: flex;
flex-direction: column;
margin-top: 2rem;
margin-bottom: 2rem;
}

.figure-text {
margin-left: auto;
margin-right: auto;
max-width: 66.66666%;
margin-top: .5rem;
}

.figure-image {
margin-left: auto;
margin-right: auto;
max-width: 81.33333%;
max-height: 81.33333%;
}
53 changes: 41 additions & 12 deletions docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,49 @@ <h5 class="toc-header"> Table of contents </h5>
<a href="#sound-resources" class="section"><li>Sound resources</li></a>
<ul>
<li>Register details:
<a href=">http://www.belogic.com/gba/registers.shtml">http://www.belogic.com/gba/registers.shtml></a></li>
<a href="http://www.belogic.com/gba/registers.shtml">http://www.belogic.com/gba/registers.shtml></a></li>

<li>SDL sound spec:
<a href=">https://wiki.libsdl.org/SDL_AudioSpec">https://wiki.libsdl.org/SDL_AudioSpec></a></li>
<a href="https://wiki.libsdl.org/SDL_AudioSpec">https://wiki.libsdl.org/SDL_AudioSpec></a></li>

<li>Sound generator:
<a href=">https://stackoverflow.com/questions/10110905/simple-sound-wave-generator-with-sdl-in-c">https://stackoverflow.com/questions/10110905/simple-sound-wave-generator-with-sdl-in-c></a></li>
<a href="https://stackoverflow.com/questions/10110905/simple-sound-wave-generator-with-sdl-in-c">https://stackoverflow.com/questions/10110905/simple-sound-wave-generator-with-sdl-in-c></a></li>

<li>Sound / opening the audio device:
<a href=">https://web.archive.org/web/20130724194546/http://www.libsdl.org:80/intro.en/usingsound.html">https://web.archive.org/web/20130724194546/http://www.libsdl.org:80/intro.en/usingsound.html></a></li>
<a href="https://web.archive.org/web/20130724194546/http://www.libsdl.org:80/intro.en/usingsound.html">https://web.archive.org/web/20130724194546/http://www.libsdl.org:80/intro.en/usingsound.html></a></li>

<li>Tone generator reference:
<a href=">https://github.com/psycotica0/tone-generator/blob/master/generator.c">https://github.com/psycotica0/tone-generator/blob/master/generator.c></a></li>
<a href="https://github.com/psycotica0/tone-generator/blob/master/generator.c">https://github.com/psycotica0/tone-generator/blob/master/generator.c></a></li>

<li>GBA audio in depth:
<a href=">https://www.coranac.com/tonc/text/sndsqr.htm#sec-intro">https://www.coranac.com/tonc/text/sndsqr.htm#sec-intro></a></li>
<a href="https://www.coranac.com/tonc/text/sndsqr.htm#sec-intro">https://www.coranac.com/tonc/text/sndsqr.htm#sec-intro></a></li>

<li>SDL sine wave generator:
<a href=">https://gist.github.com/MasterQ32/46ffd78a6cf261c73a1fddb93a478ebe">https://gist.github.com/MasterQ32/46ffd78a6cf261c73a1fddb93a478ebe></a></li>
<a href="https://gist.github.com/MasterQ32/46ffd78a6cf261c73a1fddb93a478ebe">https://gist.github.com/MasterQ32/46ffd78a6cf261c73a1fddb93a478ebe></a></li>

<li>Spongebob square wave:
<a href=">https://davidgow.net/handmadepenguin/ch8.html">https://davidgow.net/handmadepenguin/ch8.html></a></li>
<a href="https://davidgow.net/handmadepenguin/ch8.html">https://davidgow.net/handmadepenguin/ch8.html></a></li>

<li>More details :
<a href=">https://www.problemkaputt.de/gbatek.htm#gbasoundchannel1tonesweep">https://www.problemkaputt.de/gbatek.htm#gbasoundchannel1tonesweep></a></li>
<a href="https://www.problemkaputt.de/gbatek.htm#gbasoundchannel1tonesweep">https://www.problemkaputt.de/gbatek.htm#gbasoundchannel1tonesweep></a></li>

<li>Sound timing:
<a href=">http://ianfinlayson.net/class/cpsc305/notes/19-sound">http://ianfinlayson.net/class/cpsc305/notes/19-sound></a></li>
<a href="http://ianfinlayson.net/class/cpsc305/notes/19-sound">http://ianfinlayson.net/class/cpsc305/notes/19-sound></a></li>

<li>
Fourier transform within window function:
<a href="https://stackoverflow.com/questions/43479528/how-can-i-perform-a-realtime-fft-on-sdl2-audio-stream-data">https://stackoverflow.com/questions/43479528/how-can-i-perform-a-realtime-fft-on-sdl2-audio-stream-data</a>
</li>
<li>SDL Audio callback locking:
<a href="https://wiki.libsdl.org/SDL_LockAudioDevice">https://wiki.libsdl.org/SDL_LockAudioDevice</a>i
</li>
<li>
Nyquist-Shannon sampling theorem for brudging between continuous-time
signals and discrete-time signals
<a href="https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem">
https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
</a>
</li>
</ul>
</div>

Expand All @@ -111,13 +126,27 @@ <h5 class="toc-header"> Table of contents </h5>
<div class="bl">
<a href="#fourier" class="section"><li>Fourier transform</li></a>

<div class="equation" id="eq1.0"></div>
<script>
// fourier
el = document.getElementById("eq1.0")
eq = `
\\hat{f}(\\xi) = \\int_{-\\infty}^{\\infty}f(x)e^{-2 \\pi i x \\xi}\\, dx
\\hat{f}(\\xi) = \\int_{t_0}^{t_1}f(t)e^{-2 \\pi i t \\xi}\\, dt
`
this.latex.render(eq, el)

// xi
el = [...document.getElementsByClassName("xi")]
eq = `
\\xi
`
this.latex.render(eq, el, false)

// t
el = [...document.getElementsByClassName("t")]
eq = `
t
`
this.latex.render(eq, el, false)
</script>
Just trying out <span id="latex0"></span> in HTML
<script>
Expand Down
11 changes: 6 additions & 5 deletions docs/js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ const renderEl = (str, el, displayMode, handleErr) => {
const render = (str, el, displayMode=true, handleErr=false) => {
if(window.katex) {
if(el instanceof Array) {
if(str instanceof String) {
el.forEach((e, i) => {
renderEl(str[i], e, displayMode, handleErr)
})
} else {
if(typeof str === "string") {
el.forEach((e) => {
console.log(e)
renderEl(str, e, displayMode, handleErr)
})
} else {
el.forEach((e, i) => {
renderEl(str[i], e, displayMode, handleErr)
})
}
} else if(str && el) {
renderEl(str, el, displayMode, handleErr)
Expand Down
4 changes: 4 additions & 0 deletions docs/scripts/fourier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from matplotlib import pyplot as plt
arr = [0,0,1,0,0,5,1,0,2,0,0,0,1,0,1,1,3,0,2,1,0,1,0,4,3,5,5,6,0,2,1,2,2,3,1,5,1,3,13,10,0,2,2,1,0,2,1,0,0,3,1,3,2,2,0,2,5,5,2,8,0,0,0,2,1,1,1,8,4,14,2,5,7,1,3,0,4,1,1,3,12,19,2,6,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,3,2,5,10,1,0,1,0,1,2,0,8,5,2,1,4,3,1,1,0,0,4,2,5,5,19,7,3,1,2,0,1,1,2,0,4,2,2,0,0,0,1,0,3,0,13,19,3,1,2,2,1,5,1,12,5,2,0,6,0,5,0,1,0,9,3,12,6,24,9,2,2,3,0,0,1,1,0,0,0,1,0,0,0,0,0,2,1,6,11,1,0,1,0,1,2,0,8,5,1,2,3,2,2,1,0,0,5,3,6,3,19,8,2,2,2,0,0,1,1,0,1,1,1,0,0,0,1,0,2,0,10,15,2,0,2,1,1,4,0,10,5,3,1,5,0,3,0,0,0,7,4,9,4,21,9,2,2,3,0,0,1,1,0,0,0,1,1,0,0,1,0,2,0,8,13,2,0,1,1,1,3,0,8,5,3,2,4,1,2,1,0,0,6,4,8,2,20,9,1,2,3,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,8,12,2,0,2,1,1,3,1,8,5,6,4,3,0,2,0,0,1,6,5,7,0,19,11,0,3,3,0,0,1,0,0,4,7,3,0,0,1,0,0,0,0,1,4,7,3,0,1,0,0,0,0,0,3,6,5,2,0,1,1,0,0,1,2,3,7,1,1,2,1,1,2,0,2,0,1,0,4,1,1,0,3,1,4,8,7,8,1,0,0,3,0,2,3,12,5,14,18,9,7,7,3,1,2,8,4,1,12,30,2,0,5,1,0,0,1,1,0,0,0,2,0,0,0,1,0,3,2,7,10,2,0,1,0,1,2,0,8,4,2,2,2,1,3,1,0,0,5,0,6,4,21,5,2,3,1,0,0,0,2,0,3,6,0,2,0,1,1,0,4,0,11,25,11,4,4,3,3,5,1,12,7,4,5,3,0,2,2,0,1,9,7,14,1,23,12,4,3,4,1,0,1,1,0,0,0,1,0,0,0,1,0,2,1,6,11,2,0,1,0,1,2,0,7,4,0,2,1,0,1,0,0,0,5,2,7,2,18,6,2,3,2,0,0,1,2,0,1,3,0,1,0,0,1,0,3,0,8,17,6,2,2,2,2,3,0,9,5,4,6,1,0,1,1,0,1,6,5,11,0,19,9,3,3,3,1,0,1,1,0,0,1,0,1,0,0,0,0,2,0,7,13,4,1,2,1,2,3,0,7,4,4,6,0,0,1,0,0,0,5,4,9,0,17,8,3,3,3,0,0,1,1,0,0,0,0,2,0,0,0,0,1,1,6,11,2,0,2,1,2,2,1,5,3,6,9,1,2,0,0,1,1,4,4,10,1,14,8,3,2,3,0,16,5,2,4,1,6,42,1,46,31,20,3,16,26,45,76,68,26,4,24,35,5,24,36,27,21,191,62,1,61,15,15,6,54,60,70,55,97,63,105,49,43,17,7,18,6,26,8,130,52,21,23,7,19,26,30,23,18,142,181,38,52,1,44,3,63,91,88,27,40,87,69,29,91,46,61,48,88,28,130,117,93,42,35,10,9,2,6,0,7,1,45,17,5,10,1,6,6,11,2,9,35,41,11,18,2,14,4,16,33,13,19,17,31,14,14,26,19,21,18,18,16,33,34,7,31,9,8,0,13,5,8,0,4,4,35,7,35,24,19,2,16,38,47,23,3,16,5,12,27,3,3,27,26,11,155,51,27,64,2,21,5,43,15,43,13,103,58,42,50,22,3,0,2,2,2,0,21,8,0,6,0,2,1,5,3,6,4,1,3,9,3,5,4,2,16,8,17,11,15,1,9,8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,2,0,6,3,2,4,0,0,1,0,0,0,4,3,8,0,15,6,2,3,2,0,0,1,2,0,1,3,0,2,0,0,0,0,2,0,7,16,7,2,3,2,2,3,1,7,5,6,8,0,1,0,0,0,1,5,6,11,2,16,10,3,3,3,0,0,1,1,0,0,1,0,1,0,0,0,0,1,0,6,13,4,1,2,1,2,2,1,6,4,5,8,1,1,0,0,0,1,4,4,10,1,14,8,3,2,3,0,0,1,1,0,0,0,0,2,0,0,0,0,1,1,5,10,3,0,2,2,2,2,2,4,3,7,11,3,3,0,0,1,1,2,5,10,2,11,7,3,2,3,0,3,9,4,13,6,79,30,13,16,5,13,20,16,29,2,102,128,17,30,1,23,1,48,60,84,4,43,82,71,3,67,20,39,34,76,25,81,93,121,15,22,0,2,21,10,10,0,4,6,60,8,60,44,30,3,25,41,67,83,51,26,7,26,46,2,27,43,16,10,253,60,0,89,17,24,6,71,72,75,47,141,32,110,80,54,9,6,4,4,2,1,1,19,3,18,15,9,3,8,8,19,32,17,4,2,7,14,1,12,10,15,5,73,1,13,24,11,5,0,20,33,17,11,38,30,34,28,20,1,6,11,6,18,5,65,29,14,7,4,8,12,15,6,13,80,110,28,26,5,27,0,32,38,44,8,4,13,23,22,44,26,28,17,43,4,84,48,50,2,21,2,15,2,3,2,3,0,0,8,2,6,7,3,2,3,1,5,17,8,1,1,2,4,1,8,0,15,3,22,15,17,5,9,0,1,6,22,0,1,8,29,12,14,10,4,3,6,3,10,2,29,14,7,1,1,3,4,7,2,9,35,51,17,12,3,14,1,12,13,12,5,13,9,0,16,16,14,12,4,13,9,43,13,8,2,10,2,11,2,3,2,6,0,9,6,3,1,0,0,0,3,7,7,9,18,10,4,2,7,1,1,0,5,3,19,23,13,12,0,8,2,2,3,12,19,6,15,4,4,2,8,5,0,0,4,1,2,10,0,12,5,5,2,4,17,16,6,7,11,1,6,10,0,1,14,15,1,61,43,23,24,6,8,3,17,3,26,15,39,28,22,9,5,9,0,2,5,4,1,6,10,6,0,4,0,2,2,3,1,2,3,1,3,1,1,0,4,5,7,2,6,32,20,3,6,2,3,0,11,9,12,1,1,7,10,1,10,1,6,5,10,1,15,8,10,0,3,1,5,2,0,1,31,48,16,6,5,7,0,9,5,20,6,7,4,3,4,14,5,6,1,15,12,34,13,40,16,8,6,10,1,3,4,7,0,3,4,6,4,1,0,0,0,3,2,17,32,13,2,6,6,1,3,4,6,6,22,27,10,8,2,3,0,5,4,18,27,5,18,20,6,4,12,3,1,3,7,0,0,13,1,11,4,2,0,2,7,11,20,40,23,4,10,11,4,4,13,5,10,51,46,14,16,2,3,4,15,7,32,33,29,14,37,1,8,15,0,2,4,7,0,0,3,5,5,0,0,0,0,4,4,13,27,12,1,6,5,1,2,7,3,6,26,34,13,9,1,3,2,6,1,20,25,10,12,22,6,4,12,2,1,3,7,0,0,7,3,8,1,1,0,1,6,7,14,31,17,2,8,8,3,2,11,2,8,40,43,15,13,3,3,3,11,2,27,28,21,10,29,3,5,14,1,2,3,6,0,1,3,3,7,0,1,1,0,5,6,11,26,13,1,6,6,2,1,10,0,7,33,41,16,11,4,3,3,9,0,23,25,17,8,25,4,4,13,1,1,3,5,0,4,1,3,7,0,1,2,0,6,6,6,19,11,0,6,5,2,0,12,3,6,33,45,20,11,7,2,5,9,3,23,21,18,2,24,5,3,13,1,0,0,1,1,0,0,1,1,2,1,0,1,0,1,0,9,12,1,0,2,1,1,3,1,9,5,7,2,4,0,2,1,0,2,7,5,7,0,21,11,0,3,2,0,0,1,0,0,3,1,0,1,0,0,0,1,2,1,3,6,0,1,1,0,1,1,3,6,5,3,3,2,2,0,2,1,1,4,4,2,0,17,9,0,2,2,0,0,1,0,0,1,0,1,1,0,0,0,0,2,1,6,9,0,0,1,0,1,2,1,8,5,2,1,4,2,1,1,0,1,5,3,5,2,19,9,1,2,2,0,0,1,0,0,0,0,1,0,0,0,1,0,3,2,6,11,0,0,1,0,1,2,0,9,5,1,0,5,3,2,1,0,0,5,2,5,5,20,7,2,2,2,0,0,1,0,0,0,0,1,1,0,0,0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,6,6,2,5,9,6,13,0,47,60,8,12,1,10,1,22,25,40,1,16,34,32,0,29,7,16,14,36,8,37,41,62,1,10,1,2,9,4,3,0,1,3,25,2,26,19,12,2,10,15,27,39,28,11,3,12,20,1,13,18,11,7,108,25,2,36,8,9,2,30,34,33,23,57,25,51,33,24,5,2,1,1,0,0,0,8,0,8,7,4,1,3,1,7,17,14,2,0,4,6,1,7,4,11,5,32,1,8,9,6,1,0,9,17,9,8,14,24,19,11,10,0,2,4,2,7,1,27,12,5,3,1,3,4,6,1,6,29,40,11,11,1,11,1,12,16,13,6,0,6,7,10,17,11,12,7,14,0,31,18,9,6,8,2,5,1,1,0,0,0,0,3,0,3,3,1,1,1,2,1,11,10,0,0,1,2,1,5,0,11,4,10,6,9,1,5,0,0,3,12,2,4,1,23,10,5,5,0,1,2,0,3,0,12,5,2,1,0,1,1,3,2,4,10,15,6,5,0,5,1,3,6,0,5,4,3,2,7,5,7,5,2,2,2,14,3,8,4,3,2,3,0,1,0,1,0,4,2,0,0,0,0,0,1,4,3,0,1,3,2,0,2,1,1,0,7,4,6,9,8,6,1,4,1,0,4,3,4,4,18,3,1,2,2,1,0,0,1,0,1,4,0,4,2,2,1,2,8,7,1,3,4,0,1,4,1,2,5,11,3,24,17,12,11,4,4,1,6,5,9,2,18,23,4,4,0,2,0,1,3,2,1,5,8,4,0,2,0,1,1,1,1,0,0,5,3,0,1,0,1,3,3,0,4,18,12,2,3,2,2,0,5,3,7,2,3,3,5,0,5,0,4,2,6,0,7,3,7,0,2,0,4,0,2,5,18,26,8,2,2,1,0,5,4,16,6,4,8,6,2,10,0,3,2,11,3,16,12,35,8,4,5,4,0,2,2,4,0,1,2,4,2,0,0,1,0,0,0,11,20,7,1,3,2,1,3,1,8,5,8,11,3,2,2,1,0,2,5,8,15,0,20,12,4,4,6,1,0,1,5,0,2,9,0,6,2,0,1,1,1,5,15,32,17,4,7,7,4,5,6,9,8,25,24,4,7,0,0,2,7,8,19,23,14,19,23,3,5,9,0,1,2,4,0,0,1,3,2,0,0,0,0,0,1,9,18,7,1,3,3,1,2,3,5,5,12,16,5,4,0,1,1,3,3,10,15,3,15,13,4,3,6,0,0,2,4,0,0,4,1,4,1,0,0,0,1,3,11,24,11,2,5,5,2,3,5,6,6,20,23,6,6,0,0,2,5,5,15,19,10,15,18,3,4,8,0,1,2,3,0,0,2,2,4,0,0,0,0,1,2,9,19,8,1,4,3,2,2,5,4,5,17,22,7,5,1,1,2,4,3,13,16,7,13,16,4,3,7,0,0,2,3,0,2,]
plt.plot(arr)
plt.show()
5 changes: 3 additions & 2 deletions include/APU.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class APU

private:
AudioStat *stat;
int driver_id; // SDL audio device driver
int driver_id; // SDL audio device driver
u64 ticks;
u64 ticks_until_next_buffer = 0;
};
};

Loading