Sound Blaster 16: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
No edit summary
Line 50: Line 50:


Because you only have a single DMA buffer to transfer data, it is recommended that you issue the Play PCM command with a sample count of half of the data buffer. This will fire an interrupt when the buffer is half played, allowing you to refill the segment that was just played, while the DSP continues playing the other half, and so on.
Because you only have a single DMA buffer to transfer data, it is recommended that you issue the Play PCM command with a sample count of half of the data buffer. This will fire an interrupt when the buffer is half played, allowing you to refill the segment that was just played, while the DSP continues playing the other half, and so on.

==Checking ports==
Until you write to the DSP write port, check in the DSP write port is 0x00. While reading the information from the DSP read port, check the DSP status for the port is 0x80.


==Detecting DSP==
==Detecting DSP==

Revision as of 18:06, 15 September 2018

This page is a work in progress.
This page may thus be incomplete. Its content may be changed in the near future.

The Sound Blaster series is a family of sound cards made by Creative. For many years they were the standard audio cards on IBM PC's.

Introduction

The Sound Blaster 16 is the successor to the Sound Blaster Pro audio card found in many older computers. It was first brought out in 1992. The main improvement over the Pro is its 16-bit digital audio sampling (hence the name). Most SB16 cards are PCI compatible, as Creative made this improvement shortly after releasing the card, upgrading from ISA.

Digital Signal Processor

The DSP built into the Sound Blaster 16 supports playing and recording audio in 8-bit and 16-bit PCM encoded samples, along with playing several other formats (ADPCM, etc.). The base I/O register address can be found using the PCI bus for PCI models, or by detecting the presence of an older ISA Sound Blaster by issuing a Get Version command to one of several common I/O port addresses (0x220, 0x240, etc.) and waiting for a response.

To play audio, the ISA DMA controller must be programmed, then the DSP must be issued a Set Output Sample Rate command, and a Play command that includes the format of the audio (mono/stereo, signed, etc.) and a sample count.

Base port for DSP ports is 0x220.

Offset Description
0x04 Mixer Port (Set to 0x82 for Interrupt Status)
0x05 Mixer Data (Read to get Interrupt Status)
0x06 DSP Reset
0x0a DSP Read
0x0c DSP Write (Read this port for Write Status)
0x0e DSP Read Status (Read this port to acknowledge 8-bit interrupt)
0x0f 16-bit Interrupt Acknowledge (Read this port to acknowledge 16-bit interrupt) (DSP Version 4.0+ Only)
Command Description
0x41 Set Output Sample Rate
0xa6 Play PCM (Auto Initialize DMA, FIFO Enabled)
0xd9 Stop PCM (Auto Initialize DMA)
0xe1 Get DSP Version

When the samples have been played, an interrupt will be fired, and the OS/Driver will have the chance to refill the buffer, or to issue a Stop command.

Because you only have a single DMA buffer to transfer data, it is recommended that you issue the Play PCM command with a sample count of half of the data buffer. This will fire an interrupt when the buffer is half played, allowing you to refill the segment that was just played, while the DSP continues playing the other half, and so on.

Checking ports

Until you write to the DSP write port, check in the DSP write port is 0x00. While reading the information from the DSP read port, check the DSP status for the port is 0x80.

Detecting DSP

Detecting DSP is really easy. You must send to DSP reset port 1, wait 3 microseconds, send to DSP reset 0 and read DSP read port. If in it is 0xAA, DSP exist.

See Also

External Links