java分别乘以负音值和正音值
我需要创建一个方法,将声音数组中的所有正值乘以某个数字,然后将所有负值乘以另一个数字。到目前为止,我只能将数组中的所有值乘以某个数字。下面是我的代码
public void soundNormalized() // max you can divide by is 0.81231 // max value can be seen at index 2497
{
SoundSample[] sampleArray = this.getSamples();
SoundSample sample = null;
int value = 0;
double factor = 0.8123159884711935;
// loop through the samples in the array
for (int i = 0; i < sampleArray.length; i++)
{
sample = sampleArray[i];
value = sample.getValue();
sample.setValue((int) (value / factor));
}
}
这很好,但我不知道如何在我的一生中分别乘以负数和正数
共 (0) 个答案