loadListOffset method
void
loadListOffset(
- List<int> src,
- int offsetInShort,
- int sizeInShort
)
Implementation
void loadListOffset(List<int> src, int offsetInShort, int sizeInShort) {
checkArgument(
offsetInShort + sizeInShort <= src.length,
message: "Index out of range. offset ($offsetInShort) + size ($sizeInShort) should <= newData.length (${src
.length})");
List<double> floatData = List.filled(sizeInShort, 0.0);
for (int i = offsetInShort; i < sizeInShort; i++) {
// Convert the data to PCM Float encoding i.e. values between -1 and 1
floatData[i] = src[i] / (pow(2, 15) - 1);
}
loadDoubleList(floatData);
}