{
bytesAvailable = 0;
handle = 0;
- ahandler = 0;
access = SND_PCM_ACCESS_RW_INTERLEAVED;
pcmformat = SND_PCM_FORMAT_S16;
buffer_frames = 0;
return deviceState;
}
-void QAlsaAudioOutput::async_callback(snd_async_handler_t *ahandler)
-{
- QAlsaAudioOutput* audioOut;
-
- audioOut = static_cast<QAlsaAudioOutput*>
- (snd_async_handler_get_callback_private(ahandler));
-
- if (audioOut && (audioOut->deviceState == QAudio::ActiveState || audioOut->resuming))
- audioOut->feedback();
-}
-
int QAlsaAudioOutput::xrun_recovery(int err)
{
int count = 0;
snd_pcm_prepare( handle );
snd_pcm_start(handle);
- // Step 5: Setup callback and timer fallback
- snd_async_add_pcm_handler(&ahandler, handle, async_callback, this);
+ // Step 5: Setup timer
bytesAvailable = bytesFree();
// Step 6: Start audio processing
deviceReady();
}
-void QAlsaAudioOutput::feedback()
-{
- updateAvailable();
-}
-
-
-void QAlsaAudioOutput::updateAvailable()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :updateAvailable()";
-#endif
- bytesAvailable = bytesFree();
-}
-
bool QAlsaAudioOutput::deviceReady()
{
if(pullMode) {
private slots:
void userFeed();
- void feedback();
- void updateAvailable();
bool deviceReady();
signals:
unsigned int period_time;
snd_pcm_uframes_t buffer_frames;
snd_pcm_uframes_t period_frames;
- static void async_callback(snd_async_handler_t *ahandler);
int xrun_recovery(int err);
int setFormat();
qint64 elapsedTimeOffset;
char* audioBuffer;
snd_pcm_t* handle;
- snd_async_handler_t* ahandler;
snd_pcm_access_t access;
snd_pcm_format_t pcmformat;
snd_timestamp_t* timestamp;