Java Media Framework problemi

molim vas ako neko zna nesto o procesiranju audi u javi???

programiranje mi nije jaca strana ali se trudim nesto da naucim :slight_smile:

imam slijedeci problem. Pravim player u javi. tacnije pod JMF. trenutno sam napravio player. Teba da moze da pusta streaming rtp da cita iz fajla ali ono sto ne mogu da nadem je kako da pustim fajl a preko njega neki efekat. Napravio sam klasu efekat i nakon sto sam ispitao podrazene ulazne i izlazne formate, ucitao kontrole (kojima upravljamo iz GUI-a) stigao sam do
srca efekta. metode process (Buffer in , Buffer out) u njoj se sve odigrava a ja ne razumijem citav tok stvari.

ovako to izgleda unutar metode

izvinite ako je nekom nejasan komentar, mijesao sam sta sam stigao ne bi li shvatio o cemu se radi

[code]/**
* procesing
* ---------------------------------------------------------------------------------------------------------------------------

public int process(Buffer input, Buffer output)
 
       *    Performs the media processing defined by this codec.
 *
       *   Parameters:
      *          input - The Buffer that contains the media data to be processed.
      *           output - The Buffer in which to store the processed media data.
      *  Returns:
      *           BUFFER_PROCESSED_OK if the processing is successful. Other possible return codes are defined in PlugIn.
 */
public int process(Buffer input, Buffer output)
{

//

	//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
	   // variable inData ima tip >>ist array<< i cuva byte-Elemente
	byte[] inData = (byte[]) input.getData(); //Data - The object that actually holds the media data chunk for this Buffer. //getData()- Gets the internal data object that holds the media chunk contained in this Buffer.
	int offset = input.getOffset(); // For array data type, points to the starting point (offset) into the array where the valid data begins.
	//length je jedna public final int varijabla koja ima ili pozitivnu vrijednost ili 0. Velicinu ne mozemo poslije mijenjati
	int length = input.getLength();//For array data type, states how many samples are valid in the array.
         
	//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 	output.setFormat(this.outputFormat); //Format - The Format of the chunk of data in this Buffer. // setFormat() - Set the Format of the data in this Buffer.
 	outputFormat = (AudioFormat) output.getFormat();
 	output.setFlags(input.getFlags());  //flags [protected int flags]. A flag mask that describes the boolean attributes enabled for this Buffer. //This mask is set to the logical sum of all of the flags that are set.
	ensureByteArraySize(output, length);
	byte[] outputData = (byte[]) output.getData();	
	outputFormat = (AudioFormat) output.getFormat();
    
	int numOfChannels = this.outputFormat.getChannels();
    int inChannels[] = new int[numOfChannels];
    int outChannels[] = new int[numOfChannels];
    int sampleEffect[] = new int[numOfChannels];
    int numOfSamples = length / (2 * numOfChannels);
    
    int inputIndex = offset;
    int outputIndex = 0;
    int inLength = input.getLength();  

    int outLength = inLength;
    int outOffset = output.getOffset();	  
  
    // Lesen von AudioInputSream (File wurde zuvor erfolgreich geladen)
    byte[] screamData = new byte[inLength]; //ovdje mu znamo duzinu
    
    try{	    	
    	pssScream.read(screamData, 0, inLength);	//arrey + pocni od pocetka pa do kraja   
    }
	catch (Exception E) {}	
	
	for (int i = 0; i < numOfSamples; i++) {            
        for (int k = 0; k < numOfChannels; k++) {
            inChannels[k] = readSample(inData, inputIndex);
            sampleEffect[k] = readSample(screamData, inputIndex);
            inputIndex += 2;
        }

// ucito je za jedan pa za drugi kanal i to samo za jedan sample
// Frequenz

// Frequenz
// if ((outputIndex == inLength) && (reachedFreq < frequency)) {
outputIndex = 0;
// reachedFreq++;
// }

		//////////////////////////////////////////////////////////////
			
		
        for (int m = 0; m < inChannels.length; m++) {
        	//sampleEffect[m] *= effectSetting.setGain(((float) source.getValue()) / 10);
        	//sampleEffect[m] *= (float)effectSetting .volume_ / 100;	//volume of horn
        	inChannels[m] += sampleEffect[m];		//mix sound and horn
        	outChannels[m] = (saturate(inChannels[m]));		//inChannels is filled with samples
        } 
        
        for (int l = 0; l < numOfChannels; l++) { 
        	writeSample(outputData, outputIndex, outChannels[l]);
            outputIndex -= 2;
        }
	}

    output.setData(outputData);
    output.setLength(outLength);//88200 sto 8800 audio je 44100
    output.setOffset(outOffset);
    output.setFormat(outputFormat); //kanali
    return (BUFFER_PROCESSED_OK);
}[/code]

malo vas zamaram zar ne :))