diff java/src/com/aurellem/send/AudioSend.java @ 19:22ac5a0367cd

finally, a first pass at ear.org
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 14:54:45 -0700
parents 92b416b4e027
children
line wrap: on
line diff
     1.1 --- a/java/src/com/aurellem/send/AudioSend.java	Thu Nov 03 13:32:27 2011 -0700
     1.2 +++ b/java/src/com/aurellem/send/AudioSend.java	Thu Nov 03 14:54:45 2011 -0700
     1.3 @@ -6,86 +6,102 @@
     1.4  
     1.5  public class AudioSend {
     1.6  
     1.7 -	private final long deviceID;
     1.8 +    private final long deviceID;
     1.9  	
    1.10 -	public AudioSend(long deviceID){
    1.11 -		this.deviceID = deviceID;
    1.12 -	}
    1.13 +    public AudioSend(long deviceID){
    1.14 +	this.deviceID = deviceID;
    1.15 +    }
    1.16  	
    1.17 -	/** This establishes the LWJGL context as the context which will be copies to all 
    1.18 -	 *  other contexts.  It must be called before any calls to <code>addListener();</code>
    1.19 -	 */
    1.20 -	public void initDevice(){
    1.21 -		ninitDevice(this.deviceID);}
    1.22 -	public static native void ninitDevice(long device);
    1.23 +    /** This establishes the LWJGL context as the context which
    1.24 +     *  will be copies to all other contexts.  It must be called
    1.25 +     *  before any calls to <code>addListener();</code>
    1.26 +     */
    1.27 +    public void initDevice(){
    1.28 +	ninitDevice(this.deviceID);}
    1.29 +    public static native void ninitDevice(long device);
    1.30  	
    1.31 -	/**
    1.32 -	 * The send device does not automatically process sound.  This step function will cause 
    1.33 -	 * the desired number of samples to be processed for each listener.  The results will then 
    1.34 -	 * be available via calls to <code>getSamples()</code> for each listener.
    1.35 -	 * @param samples
    1.36 -	 */
    1.37 -	public void step(int samples){
    1.38 -		nstep(this.deviceID, samples);}
    1.39 -	public static native void nstep(long device, int samples);
    1.40 +    /**
    1.41 +     * The send device does not automatically process sound.  This
    1.42 +     * step function will cause the desired number of samples to
    1.43 +     * be processed for each listener.  The results will then be
    1.44 +     * available via calls to <code>getSamples()</code> for each
    1.45 +     * listener.
    1.46 +     * @param samples
    1.47 +     */
    1.48 +    public void step(int samples){
    1.49 +	nstep(this.deviceID, samples);}
    1.50 +    public static native void nstep(long device, int samples);
    1.51  
    1.52 -	/**
    1.53 -	 * Retrieve the final rendered sound for a particular listener.  <code>contextNum == 0</code>
    1.54 -	 * is the main LWJGL context.
    1.55 -	 * @param buffer
    1.56 -	 * @param samples
    1.57 -	 * @param contextNum
    1.58 -	 */
    1.59 -	public void getSamples(ByteBuffer buffer, int samples, int contextNum){
    1.60 -		ngetSamples(this.deviceID, buffer, buffer.position(), samples, contextNum);}
    1.61 -	public static native void ngetSamples(
    1.62 -			long device, ByteBuffer buffer, int position, int samples, int contextNum);
    1.63 +    /**
    1.64 +     * Retrieve the final rendered sound for a particular
    1.65 +     * listener.  <code>contextNum == 0</code> is the main LWJGL
    1.66 +     * context.
    1.67 +     * @param buffer
    1.68 +     * @param samples
    1.69 +     * @param contextNum
    1.70 +     */
    1.71 +    public void getSamples(ByteBuffer buffer, 
    1.72 +			   int samples, int contextNum){
    1.73 +	ngetSamples(this.deviceID, buffer, 
    1.74 +		    buffer.position(), samples, contextNum);}
    1.75 +    public static native void 
    1.76 +	ngetSamples(long device, ByteBuffer buffer, 
    1.77 +		    int position, int samples, int contextNum);
    1.78  	
    1.79 -	/**
    1.80 -	 * Create an additional listener on the recorder device.  The device itself will manage 
    1.81 -	 * this listener and synchronize it with the main LWJGL context. Processed sound samples
    1.82 -	 * for this listener will be available via a call to <code>getSamples()</code> with 
    1.83 -	 * <code>contextNum</code> equal to the number of times this method has been called. 
    1.84 -	 */
    1.85 -	public void addListener(){naddListener(this.deviceID);}
    1.86 -	public static native void naddListener(long device);
    1.87 +    /**
    1.88 +     * Create an additional listener on the recorder device.  The
    1.89 +     * device itself will manage this listener and synchronize it
    1.90 +     * with the main LWJGL context. Processed sound samples for
    1.91 +     * this listener will be available via a call to
    1.92 +     * <code>getSamples()</code> with <code>contextNum</code>
    1.93 +     * equal to the number of times this method has been called.
    1.94 +     */
    1.95 +    public void addListener(){naddListener(this.deviceID);}
    1.96 +    public static native void naddListener(long device);
    1.97  	
    1.98 -	/**
    1.99 -	 * This will internally call <code>alListener3f<code> in the appropriate slave context and update
   1.100 -	 * that context's listener's parameters. Calling this for a number greater than the current 
   1.101 -	 * number of slave contexts will have no effect.
   1.102 -	 * @param pname
   1.103 -	 * @param v1
   1.104 -	 * @param v2
   1.105 -	 * @param v3
   1.106 -	 * @param contextNum
   1.107 -	 */
   1.108 -	public void setNthListener3f(int pname, float v1, float v2, float v3, int contextNum){
   1.109 -		nsetNthListener3f(pname, v1, v2, v3, this.deviceID, contextNum);}
   1.110 -	public static native void 
   1.111 -	nsetNthListener3f(int pname, float v1, float v2, float v3, long device, int contextNum);
   1.112 -	
   1.113 -	/**
   1.114 -	 * This will internally call <code>alListenerf<code> in the appropriate slave context and update
   1.115 -	 * that context's listener's parameters. Calling this for a number greater than the current 
   1.116 -	 * number of slave contexts will have no effect.
   1.117 -	 * @param pname
   1.118 -	 * @param v1
   1.119 -	 * @param contextNum
   1.120 -	 */
   1.121 -	public void setNthListenerf(int pname, float v1, int contextNum){
   1.122 -		nsetNthListenerf(pname, v1, this.deviceID, contextNum);}
   1.123 -	public static native void nsetNthListenerf(int pname, float v1, long device, int contextNum);
   1.124 -	
   1.125 -	
   1.126 -	/**
   1.127 -	 * Retrieve the AudioFormat which the device is using.  This format is itself derived
   1.128 -	 * from the OpenAL config file under the "format" variable.
   1.129 -	 */
   1.130 -	public AudioFormat getAudioFormat(){
   1.131 -		return ngetAudioFormat(this.deviceID);}
   1.132 -	public static native AudioFormat ngetAudioFormat(long device);
   1.133 -	
   1.134 -	
   1.135 -	
   1.136 +    /**
   1.137 +     * This will internally call <code>alListener3f<code> in the
   1.138 +     * appropriate slave context and update that context's
   1.139 +     * listener's parameters. Calling this for a number greater
   1.140 +     * than the current number of slave contexts will have no
   1.141 +     * effect.
   1.142 +     * @param pname
   1.143 +     * @param v1
   1.144 +     * @param v2
   1.145 +     * @param v3
   1.146 +     * @param contextNum
   1.147 +     */
   1.148 +    public void 
   1.149 +	setNthListener3f(int pname, float v1, 
   1.150 +			 float v2, float v3, int contextNum){
   1.151 +	nsetNthListener3f(pname, v1, v2, v3, 
   1.152 +			  this.deviceID, contextNum);}
   1.153 +    public static native void 
   1.154 +	nsetNthListener3f(int pname, float v1, float v2, 
   1.155 +			  float v3, long device, int contextNum);
   1.156 +    
   1.157 +    /**
   1.158 +     * This will internally call <code>alListenerf<code> in the
   1.159 +     * appropriate slave context and update that context's
   1.160 +     * listener's parameters. Calling this for a number greater
   1.161 +     * than the current number of slave contexts will have no
   1.162 +     * effect.
   1.163 +     * @param pname
   1.164 +     * @param v1
   1.165 +     * @param contextNum
   1.166 +     */
   1.167 +    public void setNthListenerf(int pname, float v1, int contextNum){
   1.168 +	nsetNthListenerf(pname, v1, this.deviceID, contextNum);}
   1.169 +    public static native void 
   1.170 +	nsetNthListenerf(int pname, float v1, 
   1.171 +			 long device, int contextNum);
   1.172 +		
   1.173 +    /**
   1.174 +     * Retrieve the AudioFormat which the device is using.  This
   1.175 +     * format is itself derived from the OpenAL config file under
   1.176 +     * the "format" variable.
   1.177 +     */
   1.178 +    public AudioFormat getAudioFormat(){
   1.179 +	return ngetAudioFormat(this.deviceID);}
   1.180 +    public static native AudioFormat ngetAudioFormat(long device);	
   1.181  }