Reading CDDA sound levels: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
m (5 revisions: Import from wikkii)
mNo edit summary
Line 19: Line 19:
==Demo==
==Demo==
[[File:screencap_cddaviz.png|right]]
[[File:screencap_cddaviz.png|right]]
This does NOT work on current emulators.


Uses:
Uses:
Line 26: Line 27:
*[[Palettes]]
*[[Palettes]]


[[http://furrtek.free.fr/noclass/neogeo/vumeter1.zip Source for AS and iso image]]
Source for AS and iso image: [[File:Vumeter1.zip]]


[[http://www.youtube.com/watch?v=JP5VAypJIYk Youtube video]]
[[http://www.youtube.com/watch?v=JP5VAypJIYk Youtube video]]


[[Category:Code]]
[[Category:Code]]

Revision as of 11:42, 13 December 2011

Registers REG_CDDALEFTL ($FF0188) and REG_CDDARIGHTL ($FF018A) hold the values of the currently streamed CD audio data, in a reversed 16bit 2's complement format suited for the LC78815 DAC (Sample rate =~ 100kHz ?).

The CD2 BIOS uses the following code to reverse the bits:

;D1:Input, D0:Output
reverse16bits:
        moveq	#16-1,d7
	moveq	#0,d0
rev:
	lsr	#1,d1
	bcc	zerobit
	bset	d7,d0
zerobit:
	dbf	d7,rev

The CD2 BIOS reads both registers multiple times during each frame (every 16 raster lines, by using the raster interrupt) to get an average value. The displayed vu-meters use a double buffer to avoid getting updated with the average of only the first few register reads (those that were made before the vu-meters were actually drawn to the screen).

Demo

File:Screencap cddaviz.png

This does NOT work on current emulators.

Uses:

Source for AS and iso image: File:Vumeter1.zip

[Youtube video]