Difference between revisions of "SpecDrum/DAC"

From SpecNext official Wiki
Jump to: navigation, search
Line 36: Line 36:
 
}}
 
}}
  
The frequency that the DAC play audio is based upon the rate at which audio data is sent to the port. For most purposes you will likely want to be running other code along with driving sound so a way of off loading feeding the DACs can be done with either the DMA, the COPPER or CTC interrupts. Depending on your base code the most suitable method will need to be analysed.
+
The frequency that the DAC can play audio is based upon the rate at which audio data is sent to the port. For most purposes you will likely want to be running other code along with driving sound so a way of off loading feeding the DACs can be done with either the DMA, the COPPER or CTC interrupts. Depending on your base code the most suitable method will need to be analysed.
  
 
'''DMA''' play back is possibly the simplest method but this also requires exclusive use of the DMA and a section of memory for the DMA to play.  
 
'''DMA''' play back is possibly the simplest method but this also requires exclusive use of the DMA and a section of memory for the DMA to play.  

Revision as of 13:59, 25 March 2022

The Spectrum Next has 4 8-bit DAC ports which you can use for playing audio. Driving the DAC is done by outputting a byte of audio data to one of the ports below. The Next also supports slight improvements over the original SpecDrum which only had one output. SoundDrive is a term that means 4 8-bit DAC channels, 2 x Left 2 x Right and some Russian software supports this mode.

Data can be sent to the DACs either via NextRegs or OUTTING to a port.

Panning Port DAC
Left 0x1f DAC A
Left 0xf1 DAC A
Left 0x3f DAC A
Left 0x0f DAC B
Left 0xf3 DAC B
Centre 0xdf DAC A,D
Centre 0xfb DAC A,D
Centre 0xb3 DAC B,C
Right 0x4f DAC C
Right 0xf9 DAC C
Right 0x5f DAC D
 NumberReadableWritableDescription
Keymap High Address Register$28YesYesPS/2 Keymap address MSB, read (pending) first byte of palette colour
Keymap Low Address Register$29NoYesPS/2 Keymap address LSB.
Keymap High Data Register$2ANoYesHigh data to PS/2 Keymap (MSB of data in bit 0)
... further results

The frequency that the DAC can play audio is based upon the rate at which audio data is sent to the port. For most purposes you will likely want to be running other code along with driving sound so a way of off loading feeding the DACs can be done with either the DMA, the COPPER or CTC interrupts. Depending on your base code the most suitable method will need to be analysed.

DMA play back is possibly the simplest method but this also requires exclusive use of the DMA and a section of memory for the DMA to play.

- Example of DMA audio playback https://github.com/em00k/zxnext-simple-dma

COPPER has the least CPU requirements but a more complicated to set up. The COPPER will need to be fed each frame.

- Example of COPPER audio playback TBC

CTC timers are a good mix of easy setup and drive leaving the DMA and COPPER free for other purposes.

- Example of settings up the CTC timers to playback audio https://github.com/em00k/playwav32