PROGRAMMER'S GUIDEPCM / ADPCM playback library
BackForward
PCM / ADPCM playback library

2. Specifications


The specifications of this library are shown in the following table.

Table 2.1 Library specifications
 Item
 specification
 remarks
 Sampling frequency
 Up to 44.1kHz
 Number of quantization bits
 8bit, 16bit
 Number of channels
 Monaural, stereo
 file format
 AIFF format specification ADPCM format 1)
CD-ROM XA Audio format 2)
Saturn PCM format 3)
PCM uncompressed
ADPCM compression
ADPCM compression
PCM uncompressed
 CD-ROM format
 For CD-ROM XA Audio format
Mode2Form2,
Otherwise Model or
Mode2Form1
 Playback mode
 Memory playback mode (play back data in memory)
File playback mode (read from CD and play)
Stream playback mode (read from CD and play)
Four)
Use file system Use stream system
 function
 Branch playback, continuous playback, loop playback 5)
Multi-playback (up to 4 lines can be played back at the same time)
Pause, interrupt, volume / pan specification
 Only one ADPCM
 Continuous playback time
 Up to 1 hour
 Library used
 File system, stream system, DMA library,
ADPCM decompression library
Link these at the same time as this library 6)
 CPU timer
Use of (FRT)
 This library uses the CPU timer (FRT) with a frequency division of 128. Initialize only once in the PCM_Init function. FRT initialization and settings on the user side are prohibited.
It is possible to get the value with TIM_FRT_GET_16 etc.
 Use of DMA
 CPU-DMA (channel 1), or
Uses SCU-DMA (channel 0).
 7)
 Sound driver
The user makes the initial settings (68000 reset, sound driver transfer, etc.) in advance. This library issues commands related to PCM playback (PCM start, stop, parameter change). All commands to the sound driver are issued using the sound I / F library. See Sega Saturn Sound Driver 2.20 Programmer's Guide.
 Securing buffer
 Work buffer: Work structure (approx. 530 bytes)
Extended work buffer: 2048 bytes
Ring buffer: Sector size * 10 bytes ~
PCM buffer: 4096 * 2 to 4096 * 4sample / 1ch
Work for pause processing: 4096sample ~ PCM buffer size
 Fixed size
8) Only in Saturn PCM format
9)
Ten)
Required only when performing a pause
 CPU load
| After playback starts |
| Task function |
| CPU occupancy |
11)
 PCM uncompressed 44kHz stereo 16bit: 10%
PCM uncompressed 44kHz monaural 16bit: 6%
ADPCM compression 44kHz stereo 16bit: 33%
ADPCM compression 37.8kHz stereo 16bit: 29%
ADPCM compression 22kHz stereo 16bit: 17%
ADPCM compression 11kHz stereo 16bit: 8%
ADPCM compression 11kHz monaural 16bit: 4%
This is the measured value of all processing time including decompression processing in the case of ADPCM, such as data transfer of CD → work memory → sound memory.
 PCM_Task (task function) specifications
· V blank interrupt frequency (once / 16ms) to call in equal or greater frequency.
Maximum processing time of one task function PCM uncompressed stereo 16bit: 15ms
PCM uncompressed monaural 16bit: 8ms
ADPCM compression stereo 16bit: 34ms
ADPCM compression monaural 16bit: 15ms
If you call it at a reasonable frequency, the processing time will be long once every few times.

1)
The specified ADPCM format corresponds to the data output by a tool called Audio Starck (AIFF → ADPCM conversion tool) of CRC Research Institute.

2)
CD-ROM XA Audio has 16-bit PCM data ADPCM-compressed to 4 bits and has the following formats. See the CD-ROM XA standard for more information.
When playing CD-ROM XA Audio, only stream playback mode is available.

3) Saturn PCM format
SaturnPCM format files are created by converting AIFF files with the conversion tool AIF2SAP.
The features of the Saturn PCM format are as follows.

* Refer to "4. Programming Precautions / (8) " for how to use the Saturn PCM format.

Four)
There are two ways to use the memory playback mode.
Resident playback:
Play a small file with the entire file preloaded in memory
Sequential supply playback:
Playback while sequentially supplying the data read from the CD by the user to the ring buffer

Five)
The loop playback function can be used only in memory playback mode (resident playback method) or file playback mode.

6)
Some functions may not be linked.
If you do not declare ADPCM usage PCM_DeclareUseAdpcm, the ADPCM decompression library will not be linked.
In memory playback mode, the file system and stream system are not linked.
In file playback mode, the stream system is not linked.
In stream playback mode, both the file system and the stream system are linked.

7)
The default setting is to use CPU-DMA to transfer data from the CD block to the ring buffer (other than SaturnPCM format. In SaturnPCM format, the default setting is to use SCU-DMA to transfer data from the CD block to the sound memory. increase).
The function PCM_SetTrModeCd allows you to specify either program transfer, CPU-DMA, or SCU-DMA.

8)
The extended work buffer is required only when using the Saturn PCM format.
The SaturnPCM format uses an extended work buffer but does not require a ring buffer.

9)
When the user supplies data to the ring buffer during branch playback or memory playback, increasing the ring buffer reduces the risk of interruption.
The larger it is, the more secure it is for PCM playback, but it has the disadvantage that the processing time of one task becomes a little unstable.
If the entire file is available in memory for memory playback, specify its address and file size. At this time, it does not have to be an integral multiple of the sector size.

Ten)
For the PCM buffer size, 4096 * 2 [sample / 1ch] is sufficient unless there is a special reason.
By taking this large, playback may not be disturbed even if the task function cannot be called at the specified frequency.

11)
The definition of CPU load (CPU occupancy of task function after start of playback) is shown below.
R = (100 × Ttask) / Tplay
┌ ┐
│ R: CPU load [%] │
│ Ttask: Total processing time of PCM_Task from the start of playback to the end of playback │
│ Tplay: Playback time │
└ ┘

BackForward
PROGRAMMER'S GUIDEPCM / ADPCM playback library
Copyright SEGA ENTERPRISES, LTD., 1997