|
|||||||||
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 AudioFormat
used, the IO device, the
audio buffer size and the system IO buffer size. An AudioContext also has 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
|
static int |
DEFAULT_SYSTEM_BUFFER_SIZE
|
Gain |
out
The root UGen . |
Constructor Summary | |
---|---|
AudioContext()
Creates a new AudioContext with default settings. |
|
AudioContext(int bufferSizeInFrames)
Creates a new AudioContext with default settings and the specified buffer size. |
|
AudioContext(int bufferSizeInFrames,
int systemBufferSizeInFrames)
Creates a new AudioContext with default audio format and the specified buffer size and system buffer size. |
|
AudioContext(int bufferSizeInFrames,
int systemBufferSizeInFrames,
javax.sound.sampled.AudioFormat audioFormat)
Creates a new AudioContext with the specified buffer size, system buffer size and audio format. |
Method Summary | |
---|---|
void |
checkForDroppedFrames(boolean checkForDroppedFrames)
Switch on/off checking for dropped frames when running in realtime. |
void |
chooseMixerCommandLine()
Presents a choice of mixers on the commandline. |
static javax.sound.sampled.AudioFormat |
defaultAudioFormat(int numChannels)
Generates the default AudioFormat 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. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Gets the AudioFormat for this AudioContext. |
javax.sound.sampled.AudioFormat |
getAudioFormat(int numChannels)
Generates a new AudioFormat with the same everything as the AudioContext's AudioFormat except for the number of channels. |
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. |
int |
getSystemBufferSize()
Gets the system buffer size for this AudioContext. |
int |
getThreadPriority()
|
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 |
postSourceDataLineInfo()
Prints SourceDataLine info to System.out. |
void |
printCallChain()
|
static void |
printCallChain(UGen current,
int depth)
|
static void |
printMixerInfo()
Prints information about the current Mixer to System.out. |
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 and save the recording to the given file path. |
void |
runForNMillisecondsNonRealTime(float 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 |
selectMixer(int i)
Select a mixer by index. |
void |
setThreadPriority(int priority)
Sets the priority of the audio thread. |
void |
start()
Starts the AudioContext running in realtime. |
void |
stop()
Stops the AudioContext if running either in realtime or non-realtime. |
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 static final int DEFAULT_SYSTEM_BUFFER_SIZE
public final Gain out
UGen
.
Constructor Detail |
---|
public AudioContext()
public AudioContext(int bufferSizeInFrames)
bufferSizeInFrames
- the buffer size in samples.public AudioContext(int bufferSizeInFrames, int systemBufferSizeInFrames)
bufferSizeInFrames
- the buffer size in samples.systemBufferSizeInFrames
- the system buffer size in samples.public AudioContext(int bufferSizeInFrames, int systemBufferSizeInFrames, javax.sound.sampled.AudioFormat audioFormat)
bufferSizeInFrames
- the buffer size in samples.systemBufferSizeInFrames
- the system buffer size in samples.audioFormat
- the audio format, which specifies sample rate, bit depth,
number of channels, signedness and byte order.Method Detail |
---|
public void chooseMixerCommandLine()
public void selectMixer(int i)
i
- the index of the selected mixer.public static void printMixerInfo()
public void setThreadPriority(int priority)
priority
- public int getThreadPriority()
public float[] getBuf()
public float[] getCleanBuf()
public float[] getZeroBuf()
getCleanBuf()
.
public boolean isRunning()
public void start()
public void runNonRealTime()
public void runForNMillisecondsNonRealTime(float n)
n
- number of milliseconds.public int getBufferSize()
public int getSystemBufferSize()
public float getSampleRate()
public javax.sound.sampled.AudioFormat getAudioFormat()
public javax.sound.sampled.AudioFormat getAudioFormat(int numChannels)
numChannels
- the number of channels.
public static javax.sound.sampled.AudioFormat defaultAudioFormat(int numChannels)
AudioFormat
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 stop()
public void postAudioFormatInfo()
public void postSourceDataLineInfo()
public static void printCallChain(UGen current, int depth)
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 checkForDroppedFrames(boolean checkForDroppedFrames)
checkForDroppedFrames
- set true to check for dropped frames.public void record(double timeMS, java.lang.String filename) throws java.io.IOException
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.recorder
,
sample
public void quickie(UGen ugen)
UGen
.
ugen
- the UGen
to audition.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |