38 , mMaxNumberOfFrames(4096)
54 const int minimal = 1;
55 const int maximal = 1000000;
105 const double pi = 3.141592655;
106 quint16* buffer = (quint16*)data;
110 if (maxSize<4)
return 0;
112 const double amplitude = 1024;
113 for (
size_t i=0; i<N; i++)
124 if (maxSize<6)
return 0;
126 const double amplitude = 1024*256;
127 for (
size_t i=0; i<N; i++)
131 buffer[3*i]=
static_cast<quint16
>(left&0xFFFFU);
132 buffer[3*i+1]=
static_cast<quint16
>(((left>>16)|(right<<16))&0xFFFFU);
133 buffer[3*i+2]=
static_cast<quint16
>((right>>8)&0xFFFFU);
138 else qDebug() <<
"AudioGenerator::generateSound: Sample size " AudioGenerator()
Constructor.
int sampleSize
Sample size (16 or 24)
AudioParameters mParameters
Local copy of the audio parameters.
Structure holding the parameters and status of an audio device.
virtual size_t generateSound(char *data, size_t maxSize)
Virtual function for sound generation. This function generates an A440 on the right and an A220 on th...
int sampleRate
Actual sample rate.
void setParameters(const AudioParameters ¶meters)
Set audio device parameters.
int bufferSize
Buffer size of the device if applicable.
size_t mMaxNumberOfFrames
Maximal number of frames per buffer.