|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread jass.engine.In jass.render.SourcePlayer
public class SourcePlayer
Renders Sources to audio card using JavaSound or native methods, or out to file. To write to file manually call advanceTime(), see renderToFile example. Can't add rendered objects after starting it.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected boolean |
pushIsInitialized
Push a buffer out if you want to manually "render" sound |
Fields inherited from class jass.engine.In |
---|
sourceContainer |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SourcePlayer(int bufferSize,
float srate)
Create Source Player intended to real-time audio output. |
|
SourcePlayer(int bufferSize,
float srate,
java.lang.String fn)
Create Source Player intended for audio-file output. |
|
SourcePlayer(int bufferSize,
int bufferSizeJavaSound,
float srate)
Create Source Player intended to real-time audio output. |
|
SourcePlayer(int bufferSize,
int bufferSizeJavaSound,
float srate,
Source src)
Create Source Player intended to real-time audio output. |
|
SourcePlayer(int bufferSize,
int bufferSizeJavaSound,
float srate,
java.lang.String preferredMixer)
Create Source Player intended to real-time audio output. |
Method Summary | |
---|---|
void |
advanceTime(double realTime)
Advance time and process audio till then. |
void |
advanceTime(double realTime,
boolean ascii)
Advance time and process audio till then. |
void |
AGCOff()
Disable AGC |
void |
AGCOn()
Enable AGC |
void |
cleanupASIO()
Shut down the ASIO libraries. |
void |
closeASIO()
Stop the ASIO streaming process and clean up. |
float |
getAGC()
Get value used by AGC. |
java.lang.String |
getAudioAPI()
Get method for audioAPI string |
int |
getInputChannelNum()
Get method for returning the selected output channel for ASIO |
boolean |
getMute()
Get Mute/unmute state |
void |
getNextBuffer(short[] myData)
Retrieve the next available audio buffer. |
int |
getNumRtAudioBuffersNative()
Get RtAudio latency parameter if using native sound. |
int |
getOutputChannelNum()
Get method for output channel number. |
RTAudioFullDuplexRtAudio |
getRTAudioFullDuplexRtAudio()
Get render object when using full duplex with RtAudio native libs Needs rtaudio.dll or librtaudio.so and works on Windows/LINUX/MAXOSX only. |
boolean |
getUseNativeSound()
Get method for useNativeSound flag |
boolean |
getUseNativeSoundFullDuplex()
Get method for useNativeSoundFullDuplex flag |
float |
getVolume()
Get volume (used if ACG is off) |
void |
initASIO()
Initialize the ASIO system and start it up. |
int |
initAsioJass(int srate,
int bufferSize,
int outputchannelNum,
int inputchannelNum,
AudioIn myInput)
Initialize the ASIO libraries this is done in JassASIO.dll The system will begin running once the initialization has occurred The buffers will be retrieved from the getNextBuffer(short[]) method |
protected void |
initPush()
|
void |
push(float[] buf)
|
void |
resetAGC()
Reset AGC state |
void |
run()
Start thread which obtains buffers form sources and writes to audio out. |
void |
setAGC(float maxSignal)
Set AGC maximum signal seen. |
void |
setASIOInput(AudioIn commingIn)
Set this AudioIn object so that we can use ASIO input. |
void |
setInputChannelNum(int channel)
Set method for Input channel Number |
void |
setMute(boolean muted)
Set mute/unmute |
void |
setNChannels(int n)
set nchannels 1 for mone 2 for stereo |
void |
setNumRtAudioBuffersNative(int numRtAudioBuffers)
Set RtAudio latency parameter if using native sound. |
void |
setOutputChannelNum(int channel)
Set method for output channel Number |
void |
setUseNativeSound(boolean value)
Set method to make it use/not use RtAudio based native sound. |
void |
setUseNativeSound(boolean value,
java.lang.String audioAPI)
Determine the use of Native Methods, either ASIO (needs JassASIO.dll) or something else (will be chosen later at run time depending on which shared library is found: rtaudio.dll (ASIO or DX version) or librtaudio.so (OSS or ALSA version). |
void |
setUseNativeSoundFullDuplex(boolean value)
Set method to make it use RtAudio based native sound with full duplex Needs rtaudio.dll or librtaudio.so and works on Windows/LINUX/MAX OSX only. |
void |
setVolume(float v)
Set volume (if ACG is off) |
void |
stopPlaying()
Call to stop player |
void |
stopPushing()
|
Methods inherited from class jass.engine.In |
---|
addSource, getSources, removeSource |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean pushIsInitialized
Constructor Detail |
---|
public SourcePlayer(int bufferSize, int bufferSizeJavaSound, float srate)
bufferSize
- Buffersize used for blocks in filter graphbufferSizeJavaSound
- buffer size used by Java Sound. Use 0 for default.srate
- sampling rate in Hzpublic SourcePlayer(int bufferSize, float srate)
bufferSize
- Buffersize used for blocks in filter graphsrate
- sampling rate in Hzpublic SourcePlayer(int bufferSize, int bufferSizeJavaSound, float srate, java.lang.String preferredMixer)
bufferSize
- Buffersize used for blocks in filter graphbufferSizeJavaSound
- buffer size used by Java Sound. Use 0 for default.srate
- sampling rate in HzpreferredMixer
- preferred Mixer (e.g., "Esd Mixer").public SourcePlayer(int bufferSize, int bufferSizeJavaSound, float srate, Source src) throws SinkIsFullException
bufferSize
- Buffersize used for blocks in filter graphbufferSizeJavaSound
- buffer size used by Java Sound. Use 0 for default.srate
- sampling rate in Hzsrc
- Source to play.
SinkIsFullException
public SourcePlayer(int bufferSize, float srate, java.lang.String fn)
bufferSize
- Buffersize used for blocks in filter graphsrate
- sampling rate in Hzfn
- file name for raw audio dataMethod Detail |
---|
public int initAsioJass(int srate, int bufferSize, int outputchannelNum, int inputchannelNum, AudioIn myInput)
srate
- is the smapling ratebufferSize
- is the size of the output buffer to be used in ASIOoutputchannelNum
- selects the output channelsinputchannelNum
- select the input channel (if desired)myInput
- is used to give access to an input device if ASIO input-output is desiredpublic void cleanupASIO()
public void setASIOInput(AudioIn commingIn)
commingIn
- audio input through ASIOpublic void setUseNativeSound(boolean value, java.lang.String audioAPI)
value
- - true to use native methods, false otherwiseaudioAPI
- - either "something", or "ASIO".public RTAudioFullDuplexRtAudio getRTAudioFullDuplexRtAudio()
public void setUseNativeSound(boolean value)
value
- valuepublic void setUseNativeSoundFullDuplex(boolean value)
value
- valuepublic int getOutputChannelNum()
public void setOutputChannelNum(int channel)
channel
- - the selected channel. Output will be done through the selected
channel and the chennel at the next largest location. This will create matched
stereo sound.channel
- the channel to usepublic int getInputChannelNum()
public void setInputChannelNum(int channel)
channel
- - the desired Input channel. This must be set before the InitASIO method is calledpublic boolean getUseNativeSound()
public boolean getUseNativeSoundFullDuplex()
public java.lang.String getAudioAPI()
public void setNumRtAudioBuffersNative(int numRtAudioBuffers)
numRtAudioBuffer
- rtaudio parameter influences latency. 0 will choose minimumpublic int getNumRtAudioBuffersNative()
public void setNChannels(int n)
n
- # channelspublic void setMute(boolean muted)
muted
- false if unmute, true if mutepublic boolean getMute()
public float getAGC()
public void setAGC(float maxSignal)
maxSignal
- maximum value of signal seen.public void resetAGC()
public void setVolume(float v)
public float getVolume()
v
- volume (scales the output)public void AGCOn()
public void AGCOff()
public void advanceTime(double realTime) throws BufferNotAvailableException, java.io.IOException
realTime
- real-time in seconds.
BufferNotAvailableException
java.io.IOException
public void advanceTime(double realTime, boolean ascii) throws BufferNotAvailableException, java.io.IOException
realTime
- real-time in seconds.
BufferNotAvailableException
java.io.IOException
public void getNextBuffer(short[] myData) throws BufferNotAvailableException
myData
- an array to be filled with the data elements
BufferNotAvailableException
public void stopPlaying()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void initASIO()
public void closeASIO()
public void stopPushing()
protected void initPush()
public void push(float[] buf)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |