Ignore:
Timestamp:
Oct 25, 2006, 11:44:19 PM (19 years ago)
Author:
dmik
Message:

Kernel: QSound: Due to problems with the most commonly used uniaud driver when it comes to play too many (>10) sound files simultaneously in shareable mode sound files are now opened in exclusive mode by default. It is necessary to set the QT_PM_SOUND_SHARE environment variable in order to switch back to shareable mode (QT_PM_NO_SOUND_SHARE is still there and has precedence).

File:
1 edited

Legend:

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

    r122 r144  
    406406    openParams.pszElementName = (PSZ) fileHandle;
    407407    ULONG params = MCI_WAIT | MCI_OPEN_MMIO | MCI_READONLY | MCI_OPEN_TYPE_ID;
    408         if ( getenv( "QT_PM_NO_SOUND_SHARE" ) != NULL ) {
     408    if ( getenv( "QT_PM_NO_SOUND_SHARE" ) != NULL ) {
    409409#if defined(QT_DEBUG)
    410410        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         }
     411                "exclusive mode due to QT_PM_NO_SOUND_SHARE=%s",
     412                fName.data(), getenv( "QT_PM_NO_SOUND_SHARE" ) );
     413#endif
     414    } else if ( getenv( "QT_PM_SOUND_SHARE" ) != NULL ) {
     415#if defined(QT_DEBUG)
     416        qDebug( "QAuBucketMMPM: WARNING: opening device for sound file [%s] in "
     417                "shareable mode due to QT_PM_SOUND_SHARE=%s",
     418                fName.data(), getenv( "QT_PM_SOUND_SHARE" ) );
     419#endif
     420        params |= MCI_OPEN_SHAREABLE;
     421    } else {
     422        // Too pity, but we have to use exclusive mode by default due to
     423        // problems with the uniaud driver that is most commonly used nowadays.
     424        // In non-exclusive (shared) mode, we will hang up in mmpm.dll doing
     425        // mciSendCommand( MCI_CLOSE ) in close() for the last played sound if
     426        // we start playing 10 or more sounds simultaneously (i.e. w/o waiting
     427        // until the previous one completely finishes playing).
     428    }
    417429    ULONG rc = mciSendCommand( 0, MCI_OPEN, params, &openParams, 0 );               
    418430    if ( rc != MCIERR_SUCCESS ) {
     
    441453   
    442454#if defined(QT_QSOUND_DEBUG)   
    443     qDebug( "QAuBucketMMPM()::close(): {%p} [%s]", this, fName.data() );
     455    qDebug( "QAuBucketMMPM::close(): {%p} [%s] atExit=%d",
     456            this, fName.data(), atExit );
    444457#endif   
    445458
     
    448461
    449462    // Use MCI_CLOSE_EXIT to tell the media control driver it should
    450     // close immediately, w/o doing for any notifications, etc.
     463    // close immediately, w/o waiting or doing any notifications, etc.
    451464    ULONG param = atExit ? MCI_CLOSE_EXIT : 0;
    452465   
     
    467480{
    468481#if defined(QT_QSOUND_DEBUG)   
    469     qDebug( "QAuBucketMMPM()::play(): {%p} [%s]", this, fName.data() );
     482    qDebug( "QAuBucketMMPM::play(): {%p} [%s]", this, fName.data() );
    470483#endif   
    471484   
Note: See TracChangeset for help on using the changeset viewer.