src/multimedia/audio/qaudiooutput_alsa_p.cpp
branchRCL_3
changeset 14 c0432d11811c
parent 8 3f74d0d4af4c
equal deleted inserted replaced
13:cc75c76972ee 14:c0432d11811c
    82     audioSource = 0;
    82     audioSource = 0;
    83     pullMode = true;
    83     pullMode = true;
    84     resuming = false;
    84     resuming = false;
    85     opened = false;
    85     opened = false;
    86 
    86 
    87     QStringList list1 = QString(QLatin1String(device)).split(QLatin1String(":"));
    87     m_device = device;
    88     m_device = QByteArray(list1.at(0).toLocal8Bit().constData());
       
    89 
    88 
    90     timer = new QTimer(this);
    89     timer = new QTimer(this);
    91     connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
    90     connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
    92 }
    91 }
    93 
    92 
   280     int dir;
   279     int dir;
   281     int err=-1;
   280     int err=-1;
   282     int count=0;
   281     int count=0;
   283     unsigned int freakuency=settings.frequency();
   282     unsigned int freakuency=settings.frequency();
   284 
   283 
   285     QString dev = QLatin1String(m_device.constData());
   284     QString dev = QString(QLatin1String(m_device.constData()));
   286     QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
   285     QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
   287     if(dev.compare(QLatin1String("default")) == 0) {
   286     if(dev.compare(QLatin1String("default")) == 0) {
   288 #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
   287 #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
   289         dev = QLatin1String(devices.first().constData());
   288         dev = QLatin1String(devices.first());
   290 #else
   289 #else
   291         dev = QLatin1String("hw:0,0");
   290         dev = QLatin1String("hw:0,0");
   292 #endif
   291 #endif
   293     } else {
   292     } else {
   294 #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
   293 #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
   483     return true;
   482     return true;
   484 }
   483 }
   485 
   484 
   486 void QAudioOutputPrivate::close()
   485 void QAudioOutputPrivate::close()
   487 {
   486 {
   488     deviceState = QAudio::StoppedState;
       
   489     timer->stop();
   487     timer->stop();
   490 
   488 
   491     if ( handle ) {
   489     if ( handle ) {
   492         snd_pcm_drain( handle );
   490         snd_pcm_drain( handle );
   493         snd_pcm_close( handle );
   491         snd_pcm_close( handle );
   699                 }
   697                 }
   700             }
   698             }
   701 
   699 
   702         } else if(l < 0) {
   700         } else if(l < 0) {
   703             close();
   701             close();
       
   702             deviceState = QAudio::StoppedState;
   704             errorState = QAudio::IOError;
   703             errorState = QAudio::IOError;
   705             emit stateChanged(deviceState);
   704             emit stateChanged(deviceState);
   706         }
   705         }
   707     } else {
   706     } else {
   708         bytesAvailable = bytesFree();
   707         bytesAvailable = bytesFree();