Java 类com.badlogic.gdx.audio.AudioRecorder 实例源码

项目:Undertailor    文件:OpenALAudio.java   
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    if (noDevice) return new AudioRecorder() {
        @Override
        public void read (short[] samples, int offset, int numSamples) {
        }

        @Override
        public void dispose () {
        }
    };
    return new JavaSoundAudioRecorder(samplingRate, isMono);
}
项目:gdx-backend-jglfw    文件:OpenALAudio.java   
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    if (noDevice) return new AudioRecorder() {
        @Override
        public void read (short[] samples, int offset, int numSamples) {
        }

        @Override
        public void dispose () {
        }
    };
    return new JavaSoundAudioRecorder(samplingRate, isMono);
}
项目:libgdxcn    文件:OpenALAudio.java   
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    if (noDevice) return new AudioRecorder() {
        @Override
        public void read (short[] samples, int offset, int numSamples) {
        }

        @Override
        public void dispose () {
        }
    };
    return new JavaSoundAudioRecorder(samplingRate, isMono);
}
项目:libgdxcn    文件:AndroidAudio.java   
/** {@inheritDoc} */
@Override
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    if (soundPool == null) {
        throw new GdxRuntimeException("Android audio is not enabled by the application config.");
    }
    return new AndroidAudioRecorder(samplingRate, isMono);
}
项目:libGDX-LWJGL-Audio    文件:OpenALAudio.java   
@Override
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) {
    if (noDevice) {
        return new AudioRecorder() {
            @Override
            public void read(short[] samples, int offset, int numSamples) {
            }

            @Override
            public void dispose() {
            }
        };
    }
    return new JavaSoundAudioRecorder(samplingRate, isMono);
}
项目:gdx-pd    文件:PdAudioThread.java   
@Override
public void run() 
{
    int ticks = Math.max(1, config.bufferSize / PdBase.blockSize());

    short [] inBuffer = new short[config.bufferSize * config.inputChannels];
    short [] outBuffer = new short[config.bufferSize * config.outputChannels];

    AudioDevice device = createAudioDevice();

    AudioRecorder recorder = null;
    if(config.inputChannels > 0){
        recorder = Gdx.audio.newAudioRecorder(config.sampleRate, config.inputChannels < 2);
    }
    PdBase.openAudio(config.inputChannels, config.outputChannels, config.sampleRate);
    PdBase.computeAudio(true);

    final Runnable pollRunnable = new Runnable() {

        @Override
        public void run() {
            PdBase.pollPdMessageQueue();
            PdBase.pollMidiQueue();
            requirePolling = true;
        }
    };

    long nanoDuration = (long)(1e9 * (double)config.bufferSize / (double)config.sampleRate);

    long realTime = System.nanoTime();
    long logicTime = realTime;

    while(processing){
        if(recorder != null){
            recorder.read(inBuffer, 0, inBuffer.length);
        }

        realTime = System.nanoTime();
        long waitTime = (logicTime - realTime) / 1000000;
        if(waitTime > 0){
            try {
                Thread.sleep(waitTime);
            } catch (InterruptedException e) {
            }
        }else{
            logicTime = realTime;
        }
        logicTime += nanoDuration;

        PdBase.process(ticks, inBuffer, outBuffer);

        device.writeSamples(outBuffer, 0, outBuffer.length);

        if(requirePolling){
            Gdx.app.postRunnable(pollRunnable);
        }
    }

    device.dispose();

    if(recorder != null){
        recorder.dispose();
    }
}
项目:teavm-libgdx    文件:TeaVMAudio.java   
@Override
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) {
    throw new GdxRuntimeException("AudioDevice not supported by TeaVM backend");
}
项目:libgdxcn    文件:GwtAudio.java   
@Override
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    throw new GdxRuntimeException("AudioRecorder not supported by GWT backend");
}
项目:libgdxcn    文件:MockAudio.java   
@Override
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) {
    return new MockAudioRecorder();
}
项目:libgdxcn    文件:IOSAudio.java   
@Override
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono) {
    // TODO Auto-generated method stub
    return null;
}
项目:ead    文件:MockAudio.java   
@Override
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) {
    return new TestAudioRecorder();
}
项目:LibGDXServer    文件:ServerAudio.java   
@Override
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) {
    throw new ServerAudioException();
}
项目:ingress-indonesia-dev    文件:AndroidAudio.java   
public final AudioRecorder newAudioRecorder(int paramInt, boolean paramBoolean)
{
  return new AndroidAudioRecorder(paramInt, paramBoolean);
}
项目:libgdxcn    文件:Audio.java   
/** Creates a new {@link AudioRecorder}. The AudioRecorder has to be disposed after it is no longer used.
 * 
 * @param samplingRate the sampling rate in Hertz
 * @param isMono whether the recorder records in mono or stereo
 * @return the AudioRecorder
 * 
 * @throws GdxRuntimeException in case the recorder could not be created */
public AudioRecorder newAudioRecorder (int samplingRate, boolean isMono);
项目:libGDX-LWJGL-Audio    文件:Audio.java   
/**
 * Creates a new {@link AudioRecorder}. The AudioRecorder has to be disposed after it is no longer used.
 *
 * @param samplingRate the sampling rate in Hertz
 * @param isMono whether the recorder records in mono or stereo
 * @return the AudioRecorder
 *
 * @throws GdxRuntimeException in case the recorder could not be created
 */
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono);
项目:ingress-indonesia-dev    文件:Audio.java   
public abstract AudioRecorder newAudioRecorder(int paramInt, boolean paramBoolean);