Showing changes from revision #1 to #2:
Added | Removed | Changed
Entry | |
---|---|
R0 | 3 (Reason code) |
R1 | Sample rate index (1+) |
Exit | |
---|---|
R1 | Previous sample rate index (1+) |
R2 | Previous sample rate value (1/1024Hz) |
All other registers preserved |
This call can be used to set the current sound system sample rate. Rather than specifying the sample rate value directly you must use Sound_SampleRate 0 and Sound_SampleRate 2 to find the index that’s closest to your desired sample rate, and then set the rate using that index.
The previously set sample rate index and value will be returned by the call.
This SWI should only be used if Sound_Mode 0 indicates that 16 bit sound output is supported.
Sample rate indices are 1-based.
Sample rates are measured in units of 1/1024Hz. E.g. 22050Hz would be represented as 22050*1024 = 22579200.
Sound_SampleRate 1 can be used to read the current sample rate setting without altering it.
It is also possible to alter the sample rate of the sound system by passing a sample period to Sound_Configure. However when the 16 bit sound system is in use this behaviour is discouraged; all that will happen is that SoundDMA will pick the closest available rate out of the list of rates supported by the hardware and then use that. In some cases this may be an exact match for the requested rate, while in other cases it may differ significantly.