By the way, when you say "calling resetForwardMemory(int forwardMemSize) will wipe out all data in your forwardMemory array." do u mean it will do that everytime initialiseForward is called? because i need to add the forwardMemory (which is essentially an 'echo')to the next chunk of data (otherwise you won't hear the echo)
04-06-2004, 07:47 PM
Sharky
Hi. I'll post the method. I've cut bits out but this could get very longwinded pretty quickly as i have to post the preProcess method too :) :eek:
Code:
public short[] singleDelayProcessChunked(short input[]){
// inserts current data into array which comprises of current data + forward data
super.preProcess(input);
short[] forwardBuffer = new short[delaySamples];
short[] output = new short [input.length + delaySamples];
// For each sample in the output array
for (int n=0; n < output.length; n++){
// This adds together the input sample plus the attenuated delayedInput.
int outputSample = (int)((inputSample) + (feedbackFactor*delayedInput/100));
}
}// End of for loop
try {
super.initialiseForward(forwardBuffer);
// this will set up the forward data so that it gets added to the 'allData' in AudioEffect16bit
// next time preProcess is called
}
catch (Exception ee) {
ee.printStackTrace();
}
return output;
}
}
Would you like to see the code for postProcess() (which is also in audioeffect16bit)? what it does is inserts the given data into an array which comprises of the previous data, the given data and the forward data (respectively).
Sorry for posting so much i feel bad :(
04-06-2004, 08:05 PM
reinkesm
I think my level of help is diminishing heh. I also have to head out, hopefully you can make some progress on your own.
Find out why the array you are passing in to initializeForward (in that method it's forwardBuffer) is not the same length as forwardMemory. Them being different length is what triggers the exception.
04-08-2004, 07:05 AM
cjard
arrays in java, cannot be resized. if you plan on resizing the data array often, you should use another container, such as a linked list. if resizing occurs infrequently, it is acceptable to declare a larger array, copy the contents of the smaller array into it, and then assign the new larger array to the variable of the older one:
int[] myArray = new int[10];
int[] myLargerArray = new int[100];
System.arrayCopy(myArray,0,myLargerArray,0,myArray.length);
myArray = myLargerArray;
the small array is lost, and myArray becomes an array of 100 length..
dont do this often, it takes too much time to shift massive amounts of data around..