shithub: pokecrystal

Download patch

ref: 12f0be8cccac814811a2e2e75dd6a9f97210db7a
parent: b2dd26c8a04016e565b5cd6ef841a5a0ba64c034
author: yenatch <[email protected]>
date: Tue Nov 5 10:04:26 EST 2013

recomment ReadNoiseSample

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1060,27 +1060,28 @@
 ; sample struct:
 ;	[wx] [yy] [zz]
 ;	w: ? either 2 or 3
-;	x: ? 0-7
-;	zzyy: pointer to sample data
-;		NOTE: these seem to have $4000 added to them later
+;	x: duration
+;	zz: intensity
+;       yy: frequency
 
-	; de = NoiseSampleAddress
+	; de = [NoiseSampleAddress]
 	ld hl, NoiseSampleAddress
 	ld e, [hl]
 	inc hl
 	ld d, [hl]
+
 	; is it empty?
 	ld a, e
 	or d
 	jr z, .quit
-	; get the noise sample
+
 	ld a, [de]
 	inc de
-	; are we done?
-	cp a, $ff
+
+	cp $ff
 	jr z, .quit
-	;
-	and a, $0f ; bottom nybble
+
+	and $f
 	inc a
 	ld [$c2a2], a
 	ld a, [de]
@@ -1091,11 +1092,12 @@
 	ld [$c294], a
 	xor a
 	ld [$c295], a
-	;
+
 	ld hl, NoiseSampleAddress
 	ld [hl], e
 	inc hl
 	ld [hl], d
+
 	ld hl, Channel1NoteFlags - Channel1
 	add hl, bc
 	set 4, [hl]