|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.beadsproject.beads.core.AudioContext
public class AudioContext
AudioContext provides the core audio set up for running audio in a Beads
project. An AudioContext determines the JavaSound IOAudioFormat
used,
the IO device, the audio buffer size and the system IO buffer size. An
AudioContext also provides a UGen
called out
, which is
the output point for networks of UGens in a Beads project.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
|
Gain |
out
The root UGen . |
Constructor Summary | |
---|---|
AudioContext()
This constructor creates the default AudioContext, which means org.jaudiolibs.beads.AudioServerIO$JavaSound if it can find it, or net.beadsproject.beads.core.io.NonrealtimeIO otherwise. |
|
AudioContext(AudioIO ioSystem)
Creates a new AudioContext with default audio format and buffer size and the specified AudioIO . |
|
AudioContext(AudioIO ioSystem,
int bufferSizeInFrames)
Creates a new AudioContext with default audio format and the specified buffer size and AudioIO . |
|
AudioContext(AudioIO ioSystem,
int bufferSizeInFrames,
IOAudioFormat audioFormat)
Creates a new AudioContext with the specified buffer size, AudioIO and audio format. |
Method Summary | |
---|---|
static IOAudioFormat |
defaultAudioFormat(int inputs,
int outputs)
Generates the default IOAudioFormat for AudioContext, with the
given number of channels. |
TimeStamp |
generateTimeStamp(int index)
Generates a TimeStamp with the current time step and the given index into the time step. |
IOAudioFormat |
getAudioFormat()
Gets the AudioFormat for this AudioContext. |
IOAudioFormat |
getAudioFormat(int inputs,
int outputs)
Generates a new AudioFormat with the same everything as the AudioContext's AudioFormat except for the number of channels. |
UGen |
getAudioInput()
Returns a UGen which can be used to grab audio from the audio input, as specified by the AudioIO. |
UGen |
getAudioInput(int[] channels)
Returns a UGen which can be used to grab audio from the audio input, as specified by the AudioIO. |
AudioIO |
getAudioIO()
|
float[] |
getBuf()
Gets a buffer from the buffer reserve. |
int |
getBufferSize()
Gets the buffer size for this AudioContext. |
float[] |
getCleanBuf()
Gets a zero initialised buffer from the buffer reserve. |
float |
getSampleRate()
Gets the sample rate for this AudioContext. |
double |
getTime()
Get the runtime (in ms) since starting. |
long |
getTimeStep()
Gets the current time step of this AudioContext. |
float[] |
getZeroBuf()
Gets a pointer to a buffer of length bufferSize, full of zeros. |
boolean |
isRunning()
Checks if this AudioContext is running. |
void |
logTime(boolean logTime)
Switch on/off logging of time when running in realtime. |
double |
msToSamples(double msTime)
Converts samples to milliseconds at the current sample rate. |
void |
postAudioFormatInfo()
Prints AudioFormat information to System.out. |
void |
printCallChain()
Prints the entire call chain to System.out (equivalent to AudioContext.printCallChain(this.out, 0);) |
static void |
printCallChain(UGen current,
int depth)
Prints a representation of the audio signal chain stemming upwards from the specified UGen to System.out, indented by the specified depth. |
void |
quickie(UGen ugen)
Convenience method to quickly audition a UGen . |
void |
record(double timeMS,
java.lang.String filename)
Tells the AudioContext to record all output for the given millisecond duration, kill the AudioContext, and save the recording to the given file path. |
void |
reset()
Simply resets the timeStep to zero. |
void |
runForNMillisecondsNonRealTime(double n)
Runs the AudioContext in non-realtime for n milliseconds (that's n non-realtime milliseconds). |
void |
runNonRealTime()
Starts the AudioContext running in non-realtime. |
double |
samplesToMs(double sampleTime)
Converts milliseconds to samples at the current sample rate. |
void |
start()
Starts the AudioContext running in realtime. |
void |
stop()
Stops the AudioContext if running either in realtime or non-realtime. |
protected void |
update()
callback from AudioIO. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
public final Gain out
UGen
.
Constructor Detail |
---|
public AudioContext()
public AudioContext(AudioIO ioSystem)
AudioIO
. The default audio format is 44.1Khz,
16 bit, stereo, signed, bigEndian.
ioSystem
- the AudioIO system.public AudioContext(AudioIO ioSystem, int bufferSizeInFrames)
AudioIO
. The default audio format is 44.1Khz,
16 bit, stereo, signed, bigEndian.
bufferSizeInFrames
- the buffer size in samples.ioSystem
- the AudioIO system.public AudioContext(AudioIO ioSystem, int bufferSizeInFrames, IOAudioFormat audioFormat)
bufferSizeInFrames
- the buffer size in samples.ioSystem
- the AudioIO system.audioFormat
- the audio format, which specifies sample rate, bit depth,
number of channels, signedness and byte order.Method Detail |
---|
public UGen getAudioInput(int[] channels)
channels
- an array of ints indicating which channels are required.
public UGen getAudioInput()
getAudioInput(int[])
.
protected void update()
public float[] getBuf()
public float[] getCleanBuf()
public float[] getZeroBuf()
getCleanBuf()
.
public void runNonRealTime()
public void runForNMillisecondsNonRealTime(double n)
n
- number of milliseconds.public int getBufferSize()
public float getSampleRate()
public IOAudioFormat getAudioFormat()
public IOAudioFormat getAudioFormat(int inputs, int outputs)
numChannels
- the number of channels.
public static IOAudioFormat defaultAudioFormat(int inputs, int outputs)
IOAudioFormat
for AudioContext, with the
given number of channels. The default values are: sampleRate=44100,
sampleSizeInBits=16, signed=true, bigEndian=true.
numChannels
- the number of channels to use.
public void postAudioFormatInfo()
public static void printCallChain(UGen current, int depth)
current
- UGen to start from.depth
- depth by which to indent.public void printCallChain()
public double msToSamples(double msTime)
msTime
- duration in milliseconds.
public double samplesToMs(double sampleTime)
sampleTime
- number of samples.
public long getTimeStep()
public TimeStamp generateTimeStamp(int index)
index
- the index into the current time step.
public double getTime()
public void logTime(boolean logTime)
logTime
- set true to log time.public void record(double timeMS, java.lang.String filename) throws java.lang.Exception
timeMS
- the time in milliseconds to record for.filename
- the filename to save the recording to.
java.io.IOException
- Signals that an I/O exception has occurred.
java.lang.Exception
recorder
,
sample
public void quickie(UGen ugen)
UGen
.
ugen
- the UGen
to audition.public void start()
public void reset()
public void stop()
public boolean isRunning()
public AudioIO getAudioIO()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |