csplugincommon/sndsys/convert.h File Reference
Some helper functions for sound elements. More...
|A PCMSampleConverter object converts PCM data from one format to another. More...|
Main namespace for CrystalSpace.
Sound system classes.
|This is the maximum number of channels we'll mix. |
|This setting controls how many steps are used internally between source samples. |
Some helper functions for sound elements.
Definition in file convert.h.
|#define CS_SOUND_ELEMENT_MAX_CHANNELS 8|
|#define CS_SOUND_INTERNAL_FREQUENCY_DIVISOR 1024|
This setting controls how many steps are used internally between source samples.
Time is steped along based on the ratio of the input frequency to the output frequency. If the output frequency is twice as fast as the input frequency, then two times as many sample points are needed in the output as in the input. In order to generate samples that sound appropriate when the time is between two actual source samples, the amplitude of the sound wave at the given time is approximated by interpolating between two adjacent source samples. The position in the source data is internally represented by a signed integer which can be thought of as the sample number multiplied by this divisor value. The first sample is at CS_SOUND_INTERNAL_FREQUENCY_DIVISOR, the second is at 2*CS_SOUND_INTERNAL_FREQUENCY_DIVISOR. A position mid way between the two is at 1.5 * CS_SOUND_INTERNAL_FREQUENCY_DIVISOR.
In order to keep things quick, use a power of 2 here (power of 2 division and multiplication will be optimized into a bit shift). This value is multiplied with frequency values and stored in a signed integer. Beware of making it too big!
Generated for Crystal Space 2.1 by doxygen 1.6.1