Implement sound
This commit is contained in:
parent
f1098d0acc
commit
3df40f58a5
|
@ -22,10 +22,6 @@ which maps to
|
|||
7 8 9 E
|
||||
A 0 B F
|
||||
|
||||
Sound
|
||||
-----
|
||||
Not yet implemented
|
||||
|
||||
Games
|
||||
-----
|
||||
Get some [here](http://www.pong-story.com/chip8/) or [here](https://github.com/dmatlack/chip8/tree/master/roms)
|
||||
|
|
11
sipsi-8.py
11
sipsi-8.py
|
@ -357,7 +357,15 @@ def tick_timers():
|
|||
# The timer should tick down at 60Hz
|
||||
delay_timer -= 1
|
||||
|
||||
# TODO: Do sth about the sound timer
|
||||
# Play a sound using pyglet if we have a non-zero sound timer
|
||||
# It will run asynchronously from the other parts, which means it
|
||||
# won't experience slowdown similarily to the delay timer
|
||||
# Unsure if this is good or bad
|
||||
if sound_timer > 0:
|
||||
# sound_timer is in the unit of 1/60th of a second, while
|
||||
# Square takes length in seconds
|
||||
pyglet.media.procedural.Square(sound_timer/60).play()
|
||||
sound_timer = 0
|
||||
|
||||
def advance_interpreter(dt):
|
||||
global cpu_speed
|
||||
|
@ -610,7 +618,6 @@ def initialize_screen():
|
|||
|
||||
def initialize_timers():
|
||||
global delay_timer, sound_timer
|
||||
# Tick timers down at 60Hz
|
||||
delay_timer = 0
|
||||
sound_timer = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue