Sound utility methods. More...
Public Member Functions | |
SoundUtility () | |
Static Public Member Functions | |
static int | calculateDataLength (int duration, int clockRate, int channelCount) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLength (int duration, fm.liveswitch.AudioConfig config) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthFloat (int duration, int clockRate, int channelCount) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthFloat (int duration, fm.liveswitch.AudioConfig config) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthFloatPrecise (double duration, int clockRate, int channelCount) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthFloatPrecise (double duration, fm.liveswitch.AudioConfig config) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthFromTimestampDelta (int timestampDelta, int channelCount) |
Calculates a data length in bytes given a timestamp delta and channel count. More... | |
static int | calculateDataLengthFromTimestampDelta (int timestampDelta, int channelCount, int bytesPerSample) |
Calculates a data length in bytes given a timestamp delta, channel count, and number of bytes per sample. More... | |
static int | calculateDataLengthPrecise (double duration, int clockRate, int channelCount) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDataLengthPrecise (double duration, fm.liveswitch.AudioConfig config) |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count. More... | |
static int | calculateDuration (int dataLength, int clockRate, int channelCount) |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More... | |
static int | calculateDuration (int dataLength, fm.liveswitch.AudioConfig config) |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More... | |
static int | calculateDurationFloat (int dataLength, int clockRate, int channelCount) |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More... | |
static int | calculateDurationFloat (int dataLength, fm.liveswitch.AudioConfig config) |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count. More... | |
static int | calculateDurationFromSystemTimestampDelta (int systemTimestampDelta) |
Calculates a duration in milliseconds given a system timestamp delta in ticks. More... | |
static int | calculateDurationFromTimestampDelta (int timestampDelta, int clockRate) |
Calculates a duration in milliseconds given a timestamp delta and its clock rate. More... | |
static int | calculateOutputLengthForChannelCount (int inputLength, int inputChannelCount, int outputChannelCount) |
Calculates the length of an output data buffer after conversion from an input to an output channel count. More... | |
static int | calculateSystemTimestampDeltaFromDuration (int duration) |
Calculates a system timestamp delta in ticks given a duration in milliseconds. More... | |
static long | calculateSystemTimestampDeltaFromTimestampDelta (long timestampDelta, int clockRate) |
Calculates a system timestamp delta given a timestamp delta and its clock rate. More... | |
static int | calculateTimestampDeltaFromDataLength (int dataLength, int channelCount) |
Calculates a timestamp delta given a data length and channel count. More... | |
static int | calculateTimestampDeltaFromDataLength (int dataLength, int channelCount, int bytesPerSample) |
Calculates a timestamp delta given a data length in bytes, channel count, and number of bytes per sample. More... | |
static int | calculateTimestampDeltaFromDuration (int duration, int clockRate) |
Calculates a timestamp delta given its clock rate and a duration in milliseconds. More... | |
static long | calculateTimestampDeltaFromSystemTimestampDelta (long systemTimestampDelta, int clockRate) |
Calculates a timestamp delta given its clock rate and a system timestamp delta. More... | |
static fm.liveswitch.DataBuffer | convertChannelCount (fm.liveswitch.DataBuffer input, int inputChannelCount, fm.liveswitch.DataBuffer output, int outputChannelCount) |
Converts a data buffer to a new channel count. More... | |
static float | floatFromShort (short value) |
Converts a short value to a floating-point value. More... | |
static fm.liveswitch.DataBuffer | monoToStereo (fm.liveswitch.DataBuffer mono, fm.liveswitch.DataBuffer stereo) |
Converts each sample into two identical samples. More... | |
static short | readPcmShort (byte[] input, int index) |
Reads a PCM short value from a byte array. More... | |
static short | shortFromFloat (float value) |
Converts a floating-point value to a short value. More... | |
static fm.liveswitch.DataBuffer | stereoToMono (fm.liveswitch.DataBuffer stereo, fm.liveswitch.DataBuffer mono) |
Converts each pair of samples into one mixed sample. More... | |
static void | writePcmShort (short input, byte[] output, int index) |
Writes a PCM short value to a byte array. More... | |
Sound utility methods.
fm.liveswitch.SoundUtility.SoundUtility | ( | ) |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
config | The configuration. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
config | The configuration. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
config | The configuration. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates a data length in bytes given a timestamp delta and channel count.
timestampDelta | The timestamp delta. |
channelCount | The channel count. |
|
static |
Calculates a data length in bytes given a timestamp delta, channel count, and number of bytes per sample.
timestampDelta | The timestamp delta. |
channelCount | The channel count. |
bytesPerSample | The number of bytes per sample. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
config | The configuration. |
|
static |
Calculates the number of bytes in a given audio chunk given its duration (ms), clock rate, and channel count.
duration | The duration in ms. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
dataLength | The length of the audio chunk. |
config | The configuration. |
|
static |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
dataLength | The length of the audio chunk. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
dataLength | The length of the audio chunk. |
config | The configuration. |
|
static |
Calculates the duration of an audio chunk given its data length (the number of bytes), clock rate, and channel count.
dataLength | The length of the audio chunk. |
clockRate | The clock rate. |
channelCount | The channel count. |
|
static |
Calculates a duration in milliseconds given a system timestamp delta in ticks.
systemTimestampDelta | The system timestamp delta. |
|
static |
Calculates a duration in milliseconds given a timestamp delta and its clock rate.
timestampDelta | The timestamp delta. |
clockRate | The clock rate. |
|
static |
Calculates the length of an output data buffer after conversion from an input to an output channel count.
inputLength | The input data buffer length. |
inputChannelCount | The input channel count. |
outputChannelCount | The output channel count. |
|
static |
Calculates a system timestamp delta in ticks given a duration in milliseconds.
duration | The duration in milliseconds. |
|
static |
Calculates a system timestamp delta given a timestamp delta and its clock rate.
timestampDelta | The timestamp delta. |
clockRate | The clock rate. |
|
static |
Calculates a timestamp delta given a data length and channel count.
dataLength | The data length in bytes. |
channelCount | The channel count. |
|
static |
Calculates a timestamp delta given a data length in bytes, channel count, and number of bytes per sample.
dataLength | The data length in bytes. |
channelCount | The channel count. |
bytesPerSample | The number of bytes per sample. |
|
static |
Calculates a timestamp delta given its clock rate and a duration in milliseconds.
duration | The duration in milliseconds. |
clockRate | The clock rate. |
|
static |
Calculates a timestamp delta given its clock rate and a system timestamp delta.
systemTimestampDelta | The system timestamp delta. |
clockRate | The clock rate. |
|
static |
Converts a data buffer to a new channel count.
The input data buffer length must be a multiple of the input frame size. If the input channel count is greater than the output channel count, the input channel count must divide evenly into the output channel count, and vice versa if the output channel count is greater than the input channel count.
input | The input data buffer. |
inputChannelCount | The input channel count. |
output | The output data buffer. |
outputChannelCount | The output channel count. |
|
static |
Converts a short value to a floating-point value.
value | The short value. |
|
static |
Converts each sample into two identical samples.
|
static |
Reads a PCM short value from a byte array.
input | The source byte array. |
index | The source index in the byte array. |
|
static |
Converts a floating-point value to a short value.
value | The floating-point value. |
|
static |
Converts each pair of samples into one mixed sample.
|
static |
Writes a PCM short value to a byte array.
input | The short value to write. |
output | The target byte array. |
index | The target index in the byte array. |