|
From: Florian B. <fl...@us...> - 2008-02-27 15:00:29
|
Update of /cvsroot/tritonus/tritonus/src/classes/org/tritonus/share/sampled In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26472/src/classes/org/tritonus/share/sampled Modified Files: FloatSampleBuffer.java Log Message: - added FloatSampleBuffer.setRawChannel() - improved docs and comments Direct links to online-CVS: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tritonus/tritonus/src/classes/org/tritonus/share/sampled/FloatSampleBuffer.java Index: FloatSampleBuffer.java =================================================================== RCS file: /cvsroot/tritonus/tritonus/src/classes/org/tritonus/share/sampled/FloatSampleBuffer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** FloatSampleBuffer.java 7 Jan 2008 15:59:42 -0000 1.9 --- FloatSampleBuffer.java 27 Feb 2008 15:00:32 -0000 1.10 *************** *** 1073,1078 **** --- 1073,1082 ---- /** + * Get the actual audio data of one channel.<br> + * Modifying this array will modify the audio samples of this + * FloatSampleBuffer. <br> * NOTE: the returned array may be larger than sampleCount. So in any case, * sampleCount is to be respected. + * @throws IllegalArgumentException if channel is out of bounds */ public float[] getChannel(int channel) { *************** *** 1085,1088 **** --- 1089,1114 ---- /** + * Low-level method to directly set the array for the given channel. + * Normally, you do not need this method, as you can conveniently + * resize the array with <code>changeSampleCount()</code>. This method + * may be useful for advanced optimization techniques. + * @param channel the channel to replace + * @param data the audio sample array + * @return the audio data array that was replaced + * @throws IllegalArgumentException if channel is out of bounds or data is null + * @see #changeSampleCount(int, boolean) + */ + public float[] setRawChannel(int channel, float[] data) { + if (data == null) { + throw new IllegalArgumentException( + "cannot set a channel to a null array"); + } + float[] ret = getChannel(channel); + channels[channel] = data; + return ret; + } + + /** + * Get an array of all channels. * @return all channels as array */ |