Showing changes from revision #0 to #1:
Added | Removed | Changed
Entry | |
---|---|
R0 | Workspace (as specified in R2 to Sound_LinearHandler 1) |
R1 | Base of buffer |
R2 | End of buffer (exclusive) |
R3 | Flags: |
Bits 0-2: Buffer state: | |
0 → Data in buffer is invalid and must be completely overwritten | |
1 → Buffer contains 8-bit mu-law data that has been converted to 16 bit linear | |
2 → Data in buffer is all zeroes | |
3-7 → Reserved | |
Bits 3-31: Reserved | |
R4 | Sample rate in units of 1/1024Hz |
Processor may be in IRQ or SVC mode.
Implementation is free to enable interrupts.
Exit | |
---|---|
R0-R10 | Corruptible |
R11-R13 | Preserved |
The 16 bit linear sound handler is the main point of entry for 16 bit sounds within the sound system. Without it, the only sound which will be output will be that produced by the 8 bit sound system.
Each time SoundDMA processes a buffer fill interrupt from the hardware, the 16 bit handler will be called in order to allow it to mix its data into the buffer.
On entry R1 will point to the base of a 16 byte aligned buffer. Depending on the value in R3 this buffer may:
For each word in the buffer, the low 16 bits provide the right sample and the high 16 bits provide the left sample. Data is signed 2’s complement, i.e. &0000 corresponds to silence.
In addition to being 16 byte aligned, the buffer is also a multiple of 16 bytes in length.
It’s recommended that software which wishes to implement its own 16 bit linear handler first tries to register a handler with SharedSound before falling back to replacing the default 16 bit sound handler. SharedSound allows for a much better user experience, by allowing multiple 16 bit sound sources to be mixed together, along with the legacy 8 bit sound output.
The 16 bit linear handler is called before any oversampling or mono-conversion is applied to the sound output.