Class OfflineAudioContext
java.lang.Object
com.codename1.media.audio.BaseAudioContext
com.codename1.media.audio.OfflineAudioContext
Renders an audio graph to memory as fast as the device can, the Web Audio
OfflineAudioContext. It needs no audio hardware, so it works on every
platform: use it to bounce a mix, pre-render effects, or test a graph.
OfflineAudioContext audio = new OfflineAudioContext(2, 44100, 44100);
OscillatorNode osc = audio.createOscillator();
osc.connect(audio.getDestination());
osc.start();
AudioData oneSecond = audio.startRendering();
-
Constructor Summary
ConstructorsConstructorDescriptionOfflineAudioContext(int numberOfChannels, int length, float sampleRate) Creates an offline context. -
Method Summary
Modifier and TypeMethodDescriptionintThe number of framesstartRendering()produces.getState()The life cycle state.Renders the whole graph on the calling thread and returns the result.Methods inherited from class BaseAudioContext
createAnalyser, createAudioProcessor, createAudioProcessor, createBiquadFilter, createBuffer, createBufferSource, createChannelMerger, createChannelMerger, createChannelSplitter, createChannelSplitter, createConstantSource, createConvolver, createDelay, createDelay, createDynamicsCompressor, createGain, createIIRFilter, createMicrophoneSource, createOscillator, createPanner, createPeriodicWave, createPeriodicWave, createStereoPanner, createWaveShaper, decodeAudioData, getCurrentTime, getDestination, getListener, getSampleRate, isAudioProcessorSupported, isHrtfSupported, isMicrophoneSourceSupported
-
Constructor Details
-
OfflineAudioContext
public OfflineAudioContext(int numberOfChannels, int length, float sampleRate) Creates an offline context.
Parameters
-
numberOfChannels: channels of the result, 1 to 32 -
length: frames to render, at least 1 -
sampleRate: frames per second, 3000 to 768000
-
-
-
Method Details
-
getLength
public int getLength() -
getState
Description copied from class:BaseAudioContextThe life cycle state.
Returns
the state
- Specified by:
getStatein classBaseAudioContext
-
startRendering
Renders the whole graph on the calling thread and returns the result.
onendedcallbacks run on this thread between render quanta. Do not call it on the EDT for long renders.Returns
getLength()frames with the destination's channel countThrows
IllegalStateException: if rendering was already started
-