| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- #ifndef Header_SuperpoweredSimple
- #define Header_SuperpoweredSimple
- /**
- @file SuperpoweredSimple.h
- @brief Simple fast utility functions for transforming audio.
- */
- /**
- @fn SuperpoweredVolume(float *input, float *output, float volumeStart, float volumeEnd, unsigned int numberOfSamples);
- @brief Applies volume on a single stereo interleaved buffer.
- @param input Input buffer.
- @param output Output buffer. Can be equal to input (in-place processing).
- @param volumeStart Volume for the first sample.
- @param volumeEnd Volume for the last sample. Volume will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredVolume(float *input, float *output, float volumeStart, float volumeEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredChangeVolume(float *input, float *output, float volumeStart, float volumeChange, unsigned int numberOfSamples);
- @brief Applies volume on a single stereo interleaved buffer.
- @param input Input buffer.
- @param output Output buffer. Can be equal to input (in-place processing).
- @param volumeStart Voume for the first sample.
- @param volumeChange Change volume by this amount for every sample.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredChangeVolume(float *input, float *output, float volumeStart, float volumeChange, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredVolumeAdd(float *input, float *output, float volumeStart, float volumeEnd, unsigned int numberOfSamples);
- @brief Applies volume on a single stereo interleaved buffer and adds it to the audio in the output buffer.
- @param input Input buffer.
- @param output Output buffer.
- @param volumeStart Volume for the first sample.
- @param volumeEnd Volume for the last sample. Volume will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredVolumeAdd(float *input, float *output, float volumeStart, float volumeEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredChangeVolumeAdd(float *input, float *output, float volumeStart, float volumeChange, unsigned int numberOfSamples);
- @brief Applies volume on a single stereo interleaved buffer and adds it to the audio in the output buffer.
- @param input Input buffer.
- @param output Output buffer.
- @param volumeStart Volume for the first sample.
- @param volumeChange Change volume by this amount for every sample.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredChangeVolumeAdd(float *input, float *output, float volumeStart, float volumeChange, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredPeak(float *input, unsigned int numberOfValues);
- @return Returns with the peak value.
- @param input An array of floating point values.
- @param numberOfValues The number of values to process. (2 * numberOfSamples for stereo input) Must be a multiply of 8.
- */
- float SuperpoweredPeak(float *input, unsigned int numberOfValues);
- /**
- @fn SuperpoweredFloatToShortInt(float *input, short int *output, unsigned int numberOfSamples);
- @brief Converts a stereo interleaved 32-bit float input to stereo interleaved 16-bit signed integer output.
- @param input Stereo interleaved 32-bit input. Should be numberOfSamples * 2 + 16 big minimum.
- @param output Stereo interleaved 16-bit output. Should be numberOfSamples * 2 + 16 big minimum.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredFloatToShortInt(float *input, short int *output, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredFloatToShortInt(float *inputLeft, float *inputRight, short int *output, unsigned int numberOfSamples);
- @brief Converts two 32-bit float input channels to stereo interleaved 16-bit signed integer output.
- @param inputLeft 32-bit input for the left side. Should be numberOfSamples + 8 big minimum.
- @param inputRight 32-bit input for the right side. Should be numberOfSamples + 8 big minimum.
- @param output Stereo interleaved 16-bit output. Should be numberOfSamples * 2 + 16 big minimum.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredFloatToShortInt(float *inputLeft, float *inputRight, short int *output, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredShortIntToFloat(short int *input, float *output, unsigned int numberOfSamples, float *peaks);
- @brief Converts a stereo interleaved 16-bit signed integer input to stereo interleaved 32-bit float output.
- @param input Stereo interleaved 16-bit input. Should be numberOfSamples + 8 big minimum.
- @param output Stereo interleaved 32-bit output. Should be numberOfSamples + 8 big minimum.
- @param numberOfSamples The number of samples to process.
- @param peaks Peak value result (2 floats: left peak, right peak). Can be NULL if you are not interested.
- */
- void SuperpoweredShortIntToFloat(short int *input, float *output, unsigned int numberOfSamples, float *peaks = 0);
- /**
- @fn SuperpoweredInterleave(float *left, float *right, float *output, unsigned int numberOfSamples);
- @brief Makes an interleaved output from two input channels.
-
- @param left Input for left channel.
- @param right Input for right channel.
- @param output Interleaved output.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredInterleave(float *left, float *right, float *output, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredInterleaveAndGetPeaks(float *left, float *right, float *output, unsigned int numberOfSamples, float *peaks);
- @brief Makes an interleaved output from two input channels, and measures the input volume.
- @param left Input for left channel.
- @param right Input for right channel.
- @param output Interleaved output.
- @param numberOfSamples The number of samples to process.
- @param peaks Peak value result (2 floats: left peak, right peak).
- */
- void SuperpoweredInterleaveAndGetPeaks(float *left, float *right, float *output, unsigned int numberOfSamples, float *peaks);
- /**
- @fn SuperpoweredDeInterleave(float *input, float *left, float *right, unsigned int numberOfSamples);
- @brief Deinterleaves an interleaved input.
- @param input Interleaved input.
- @param left Output for left channel.
- @param right Output for right channel.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredDeInterleave(float *input, float *left, float *right, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredDeInterleaveAdd(float *input, float *left, float *right, unsigned int numberOfSamples);
- @brief Deinterleaves an interleaved input and adds the results to the output channels.
- @param input Interleaved input.
- @param left Output for left channel.
- @param right Output for right channel.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredDeInterleaveAdd(float *input, float *left, float *right, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredHasNonFinite(float *buffer, unsigned int numberOfValues);
- @brief Checks if the samples has non-valid samples, such as infinity or NaN (not a number).
-
- @param buffer The buffer to check.
- @param numberOfValues Number of values in buffer. For stereo buffers, multiply by two!
- */
- bool SuperpoweredHasNonFinite(float *buffer, unsigned int numberOfValues);
- /**
- @fn SuperpoweredStereoToMono(float *input, float *output, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- @brief Makes mono output from stereo input.
- @param input Stereo interleaved input.
- @param output Output.
- @param leftGainStart Gain of the first sample on the left channel.
- @param leftGainEnd Gain for the last sample on the left channel. Gain will be smoothly calculated between start end end.
- @param rightGainStart Gain of the first sample on the right channel.
- @param rightGainEnd Gain for the last sample on the right channel. Gain will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredStereoToMono(float *input, float *output, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredStereoToMono2(float *input, float *output0, float *output1, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- @brief Makes two mono outputs from stereo input.
- @param input Stereo interleaved input.
- @param output0 Output.
- @param output1 Output.
- @param leftGainStart Gain of the first sample on the left channel.
- @param leftGainEnd Gain for the last sample on the left channel. Gain will be smoothly calculated between start end end.
- @param rightGainStart Gain of the first sample on the right channel.
- @param rightGainEnd Gain for the last sample on the right channel. Gain will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredStereoToMono2(float *input, float *output0, float *output1, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredCrossMono(float *left, float *right, float *output, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- @brief Makes mono output from two separate input channels.
-
- @param left Input for left channel.
- @param right Input for right channel.
- @param output Output.
- @param leftGainStart Gain of the first sample on the left channel.
- @param leftGainEnd Gain for the last sample on the left channel. Gain will be smoothly calculated between start end end.
- @param rightGainStart Gain of the first sample on the right channel.
- @param rightGainEnd Gain for the last sample on the right channel. Gain will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredCrossMono(float *left, float *right, float *output, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredCrossMono2(float *left, float *right, float *output0, float *output1, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- @brief Makes two mono outputs from two separate input channels.
- @param left Input for left channel.
- @param right Input for right channel.
- @param output0 Output.
- @param output1 Output.
- @param leftGainStart Gain of the first sample on the left channel.
- @param leftGainEnd Gain for the last sample on the left channel. Gain will be smoothly calculated between start end end.
- @param rightGainStart Gain of the first sample on the right channel.
- @param rightGainEnd Gain for the last sample on the right channel. Gain will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredCrossMono2(float *left, float *right, float *output0, float *output1, float leftGainStart, float leftGainEnd, float rightGainStart, float rightGainEnd, unsigned int numberOfSamples);
- /**
- @fn SuperpoweredCrossStereo(float *inputA, float *inputB, float *output, float gainStart[4], float gainEnd[4], unsigned int numberOfSamples);
- @brief Crossfades two separate input channels.
- @param inputA Interleaved stereo input (first).
- @param inputB Interleaved stereo input (second).
- @param output Interleaved stereo output.
- @param gainStart Gain of the first sample (first left, first right, second left, second right).
- @param gainEnd Gain for the last sample (first left, first right, second left, second right). Gain will be smoothly calculated between start end end.
- @param numberOfSamples The number of samples to process.
- */
- void SuperpoweredCrossStereo(float *inputA, float *inputB, float *output, float gainStart[4], float gainEnd[4], unsigned int numberOfSamples);
- /**
- @fn SuperpoweredVersion()
- @return Returns with the current version of the Superpowered SDK.
-
- The returned value is 3 unsigned chars: major,minor,revision Example: 1,0,0 means 1.0.0
- */
- const unsigned char *SuperpoweredVersion();
- #endif
|