Photon Voice  v2.12
English | 日本語 | 한국
Public Member Functions | Properties | List of all members
AudioUtil.ToneAudioReader< T > Class Template Reference

IAudioReader that provides a constant tone signal. More...

Inherits IAudioReader< T >.

Public Member Functions

 ToneAudioReader (Func< double > clockSec=null, double frequency=440, int samplingRate=441000, int channels=2)
 Create a new ToneAudioReader instance More...
 
void Dispose ()
 
bool Read (T[] buf)
 Fill full given frame buffer with source uncompressed data or return false if not enough such data. More...
 

Properties

int Channels [get]
 Number of channels in the audio signal. More...
 
int SamplingRate [get]
 Sampling rate of the audio signal (in Hz). More...
 
string Error [get]
 If not null, audio object is in invalid state. More...
 
- Properties inherited from IAudioDesc
int SamplingRate [get]
 Sampling rate of the audio signal (in Hz). More...
 
int Channels [get]
 Number of channels in the audio signal. More...
 
string Error [get]
 If not null, audio object is in invalid state. More...
 

Detailed Description

IAudioReader that provides a constant tone signal.

See also MicWrapper and AudioClipWrapper Because of current resampling algorithm, the tone is distorted if SamplingRate does not equal encoder sampling rate.

Constructor & Destructor Documentation

ToneAudioReader ( Func< double >  clockSec = null,
double  frequency = 440,
int  samplingRate = 441000,
int  channels = 2 
)

Create a new ToneAudioReader instance

Parameters
clockSecFunction to get current time in seconds. In Unity, pass in '() => AudioSettings.dspTime' for better results.
frequencyFrequency of the generated tone (in Hz).
samplingRateSampling rate of the audio signal (in Hz).
channelsNumber of channels in the audio signal.

Member Function Documentation

bool Read ( T[]  buffer)

Fill full given frame buffer with source uncompressed data or return false if not enough such data.

Parameters
bufferBuffer to fill.
Returns
True if buffer was filled successfully, false otherwise.

Implements IDataReader< T >.

Property Documentation

int Channels
get

Number of channels in the audio signal.

string Error
get

If not null, audio object is in invalid state.

int SamplingRate
get

Sampling rate of the audio signal (in Hz).