DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Apr 2004
    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)

  2. #17
    Join Date
    Apr 2004
    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
    	public short[] singleDelayProcessChunked(short input[]){
    		// inserts current data into array which comprises of current data + forward data
    		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++){
    			int delayedPosition = n-delaySamples;
    			if (delayedPosition < 0)
    				delayedInput = 0;
    				delayedOutput = 0;
    			else {
    				delayedInput = input[delayedPosition];
    				delayedOutput = output[delayedPosition];
    			short inputSample =0;
    			if (n<input.length){
    			   inputSample = input[n];
    			// This adds together the input sample plus the attenuated delayedInput.
    			int outputSample = (int)((inputSample) + (feedbackFactor*delayedInput/100));
    		}// End of for loop
    		try {
    			// 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) {
    		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

  3. #18
    Join Date
    Dec 2002
    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.
    -- Steven

  4. #19
    Join Date
    Feb 2004
    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];
    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..
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.