Changeset 120 for trunk


Ignore:
Timestamp:
Sep 2, 2006, 8:01:56 PM (19 years ago)
Author:
dmik
Message:

Kernel: QSound: Added a workaround to solve 100% CPU load followed by UI freeze when playing too many sounds simultaneously (most likely caused by badly written single-streamed audio card drivers, such as ESS688): when the QT_PM_NO_SOUND_SHARE variable is defined in the environment, Qt will open sound devices in exclusive mode instead of shared.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qsound_pm.cpp

    r112 r120  
    4949#include <qt_os2.h>
    5050
    51 //#define QT_QSOUND_DEBUG
     51#include <stdlib.h> // for getenv()
     52
     53#define QT_QSOUND_DEBUG
    5254
    5355// local QT_DEBUG override, must be placed *after* all includes
     
    403405    openParams.pszDeviceType = (PSZ) MAKEULONG( MCI_DEVTYPE_WAVEFORM_AUDIO, 0 );
    404406    openParams.pszElementName = (PSZ) fileHandle;
    405     ULONG rc = mciSendCommand( 0, MCI_OPEN, MCI_WAIT | MCI_OPEN_MMIO | MCI_READONLY |
    406                                   MCI_OPEN_SHAREABLE | MCI_OPEN_TYPE_ID,
    407                                &openParams, 0 );               
     407    ULONG params = MCI_WAIT | MCI_OPEN_MMIO | MCI_READONLY | MCI_OPEN_TYPE_ID;
     408        if ( getenv( "QT_PM_NO_SOUND_SHARE" ) != NULL ) {
     409#if defined(QT_DEBUG)
     410        qDebug( "QAuBucketMMPM: WARNING: opening device for sound file [%s] in "
     411                                "exclusive mode due to QT_PM_NO_SOUND_SHARE=%s",
     412                                fName.data(), getenv( "QT_PM_NO_SOUND_SHARE" ) );
     413#endif
     414        } else {
     415                params |= MCI_OPEN_SHAREABLE;
     416        }
     417    ULONG rc = mciSendCommand( 0, MCI_OPEN, params, &openParams, 0 );               
    408418    if ( rc != MCIERR_SUCCESS ) {
    409419#if defined(QT_DEBUG)
Note: See TracChangeset for help on using the changeset viewer.