• R/O
  • SSH

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

VGM playback library for Common Lisp


コミットメタ情報

リビジョンc079b91d9219c21a4aefeab9d6e0fb4915325a53 (tree)
日時2023-08-18 19:04:31
作者Remilia Scarlet <remilia@post...>
コミッターRemilia Scarlet

ログメッセージ

Fix noise not being played correctly

変更サマリ

差分

diff -r 7411c8cb96fe -r c079b91d9219 src/chips/emu-huc6280-ootake.lisp
--- a/src/chips/emu-huc6280-ootake.lisp Wed Jun 14 13:49:37 2023 -0600
+++ b/src/chips/emu-huc6280-ootake.lisp Fri Aug 18 04:04:31 2023 -0600
@@ -312,7 +312,7 @@
312312 (setf bit1 (ash (logand reg 2) -1))
313313 (setf bit14 (logxor bit0 bit1))
314314 (setf reg (ash reg -1))
315- (setf reg (logior reg (coerce-to-uint32 (ash bit14 14))))
315+ (setf reg (coerce-to-uint32 (logior reg (ash bit14 14))))
316316 (setf (aref (%ootake-noise-table emu) i) (if (zerop bit0) -1 -18)))
317317 nil)
318318
@@ -364,7 +364,7 @@
364364
365365 (dotimes (j 32)
366366 ;; ch3は最大値で初期化。F1トリプルバトル。v2.65
367- (setf (aref (%psg-wave (aref (%ootake-psg emu) 3)) j) -17))
367+ (setf (aref (%psg-wave (aref (%ootake-psg emu) 3)) j) 17))
368368 nil)
369369
370370 (define-typed-fn ootake-read ((emu-ootake emu) (fixnum reg))
@@ -531,13 +531,14 @@
531531 (7 ;; Noise on, noise frequency
532532 (when (>= (%ootake-channel emu) 4)
533533 (let ((psg-chan (aref (%ootake-psg emu) (%ootake-channel emu))))
534- (setf (%psg-noise-on-p psg-chan) (/= (logand data #x80) 0))
534+ (setf (%psg-noise-on-p psg-chan) (flag? data #x80))
535535 (setf (%psg-noise-freq psg-chan) (- #x1F (logand data #x1F)))
536536 (setf (%psg-delta-noise-phase psg-chan)
537- (if (zerop (%psg-noise-freq psg-chan))
538- (coerce-to-uint32 (truncate (+ (* 2048.0d0 (%ootake-resample-rate emu)) 0.5d0)))
539- (coerce-to-uint32 (truncate (/ (* 2048.0d0 (%ootake-resample-rate emu))
540- (+ (%psg-noise-freq psg-chan) 0.5d0)))))))))
537+ (coerce-to-uint32
538+ (if (zerop (%psg-noise-freq psg-chan))
539+ (truncate (+ (* 2048.0d0 (%ootake-resample-rate emu)) 0.5d0))
540+ (truncate (/ (* 2048.0d0 (%ootake-resample-rate emu))
541+ (+ (%psg-noise-freq psg-chan) 0.5d0)))))))))
541542
542543 (8 ;; LFO frequency
543544 (setf (%ootake-lfo-freq emu) data))
@@ -557,7 +558,7 @@
557558 (define-typed-fn ootake-write ((emu-ootake emu) (fixnum reg) (fixnum data))
558559 (null t)
559560 (declare (optimize (speed 3) (debug 1) (safety 0) (compilation-speed 0)))
560- (ootake-write-reg emu reg data))
561+ (ootake-write-reg emu (logand reg #xFF) data))
561562
562563 (define-typed-fn ootake-update ((emu-ootake emu) (satou-chips::t/output-buffer outputs) (t/uint32 start samples))
563564 (null)
@@ -619,11 +620,11 @@
619620 ;; 1/16384 + 1/32768)。この"+1/32768"で絶妙(主観。大魔
620621 ;; 界村,ソルジャーブレイドなど)になる。v2.62更新
621622 (setf smp (* sample (%psg-out-volume-l psg-chan)))
622- (incf sample-all-l (+ (ash smp -11) (ash smp -14) (ash smp -15)))
623+ (incf sample-all-l (+ smp (ash smp -11) (ash smp -14) (ash smp -15)))
623624
624625 ;; Kitao更新。ノイズの音量を実機並みに調整
625626 (setf smp (* sample (%psg-out-volume-r psg-chan)))
626- (incf sample-all-r (+ (ash smp -11) (ash smp -14) (ash smp -15)))))
627+ (incf sample-all-r (+ smp (ash smp -11) (ash smp -14) (ash smp -15)))))
627628
628629 (setf (%psg-phase psg-chan)
629630 (coerce-to-uint32 (+ (%psg-phase psg-chan) (%psg-delta-noise-phase psg-chan)))))