Changeset 545:69f705dbe971 in qutecom-2.2


Ignore:
Timestamp:
Feb 27, 2010 4:51:52 PM (3 years ago)
Author:
laurent@…
Branch:
default
Children:
546:1da8a70fd465, 558:30b0989e5b4e
Message:

bug fix : audio crash

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • libs/sound/src/win32/SoundThread.cpp

    r0 r545  
    5858 
    5959        int i = 0; 
    60         while ((i < _loops || _loops == -1) && !_stop) { 
     60        while ((i < _loops || _loops == -1) && !_stop)  
     61        { 
    6162                if (!_soundFile.play(_filename)) { 
    6263                        //If the file cannot be played, stop the thread 
    6364                        _stop = true; 
    6465                } 
     66                _soundFile.stop(); 
    6567                i++; 
    6668        } 
  • wengophone/src/model/phonecall/PhoneCall.cpp

    r522 r545  
    109109 
    110110void PhoneCall::accept() { 
    111         PhoneCallState::stopSoundIncomingCall(); 
     111        PhoneCallState::stopSound(); 
    112112        _phoneLine.acceptCall(_callId); 
    113113} 
  • wengophone/src/model/phonecall/PhoneCallState.cpp

    r328 r545  
    2727#include <util/Logger.h> 
    2828 
    29 Sound * PhoneCallState::_soundIncomingCall = NULL; 
    30 Sound * PhoneCallState::_soundCallClosed = NULL; 
     29Sound * PhoneCallState::_sound = NULL; 
     30static RecursiveMutex _mutexSound; 
    3131 
    3232PhoneCallState::PhoneCallState() { 
    3333} 
    3434 
    35 void PhoneCallState::stopSoundIncomingCall() { 
    36         if (_soundIncomingCall) { 
    37                 _soundIncomingCall->stop(); 
    38                 delete _soundIncomingCall; 
    39                 _soundIncomingCall = NULL; 
     35void PhoneCallState::stopSound() { 
     36        RecursiveMutex::ScopedLock scopedLock(_mutexSound); 
     37        if (_sound) { 
     38                _sound->stop(); 
     39                delete _sound; 
     40                _sound = NULL; 
    4041        } 
    4142} 
    4243 
    43 void PhoneCallState::stopSoundCallClosed() { 
    44         if (_soundCallClosed) { 
    45                 _soundCallClosed->stop(); 
    46                 delete _soundCallClosed; 
    47                 _soundCallClosed = NULL; 
     44void PhoneCallState::playSoundIncomingCall() { 
     45        RecursiveMutex::ScopedLock scopedLock(_mutexSound); 
     46        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
     47        stopSound(); 
     48 
     49        if (config.getAudioRingingEnable()) 
     50        { 
     51                _sound = new Sound(config.getAudioIncomingCallFile()); 
     52                _sound->setWaveOutDevice(getRingerAudioDevice()); 
     53                _sound->setLoops(-1); 
     54                _sound->play();  
    4855        } 
    4956} 
    5057 
    51 std::string PhoneCallState::getSoundIncomingCallFile() { 
     58void PhoneCallState::playSoundOutgoingCall() { 
     59        RecursiveMutex::ScopedLock scopedLock(_mutexSound); 
    5260        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    53         return config.getAudioIncomingCallFile(); 
     61 
     62        stopSound(); 
     63        if (config.getAudioRingingEnable()) 
     64        { 
     65                _sound = new Sound(config.getAudioOutgoingCallFile()); 
     66                _sound->setWaveOutDevice(getRingerAudioDevice()); 
     67                _sound->setLoops(-1); 
     68                _sound->play(); 
     69        } 
    5470} 
    5571 
    56 std::string PhoneCallState::getSoundOutgoingCallFile() { 
     72void PhoneCallState::playSoundDoubleCall() { 
     73        RecursiveMutex::ScopedLock scopedLock(_mutexSound); 
    5774        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    58         return config.getAudioOutgoingCallFile(); 
     75 
     76        stopSound(); 
     77        if (config.getAudioRingingEnable()) 
     78        { 
     79                _sound = new Sound(config.getAudioDoubleCallFile()); 
     80                _sound->setWaveOutDevice(getRingerAudioDevice()); 
     81                _sound->setLoops(1); 
     82                _sound->play(); 
     83        } 
    5984} 
    6085 
    61 std::string PhoneCallState::getSoundDoubleCallFile() { 
     86void PhoneCallState::playSoundCallClosed() { 
     87        RecursiveMutex::ScopedLock scopedLock(_mutexSound); 
    6288        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    63         return config.getAudioDoubleCallFile(); 
    64 } 
    6589 
    66 std::string PhoneCallState::getSoundCallClosedFile() { 
    67         Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    68         return config.getAudioCallClosedFile(); 
     90        stopSound(); 
     91        if (config.getAudioRingingEnable()) 
     92        { 
     93                _sound = new Sound(config.getAudioCallClosedFile()); 
     94                _sound->setWaveOutDevice(getRingerAudioDevice()); 
     95                _sound->setLoops(4); 
     96                _sound->play(); 
     97        } 
    6998} 
    7099 
  • wengophone/src/model/phonecall/PhoneCallState.h

    r328 r545  
    5555         * Stops the incoming phone call ringtone. 
    5656         */ 
    57         static void stopSoundIncomingCall(); 
    58  
    59 protected: 
     57        //static void stopSoundIncomingCall(); 
    6058 
    6159        static AudioDevice getRingerAudioDevice(); 
    6260 
    63         static std::string getSoundIncomingCallFile(); 
     61        static void playSoundIncomingCall(); 
    6462 
    65         static std::string getSoundOutgoingCallFile(); 
     63        static void playSoundOutgoingCall(); 
    6664 
    67         static std::string getSoundDoubleCallFile(); 
     65        static void playSoundDoubleCall(); 
    6866 
    69         static std::string getSoundCallClosedFile(); 
     67        static void playSoundCallClosed(); 
    7068 
    71         static void stopSoundCallClosed(); 
     69        static void stopSound(); 
    7270 
    73         static Sound * _soundIncomingCall; 
    74  
    75         static Sound * _soundCallClosed; 
     71protected: 
     72        static Sound * _sound; 
    7673}; 
    7774 
  • wengophone/src/model/phonecall/PhoneCallStateClosed.cpp

    r522 r545  
    2525 
    2626void PhoneCallStateClosed::execute(PhoneCall & phoneCall,bool) { 
    27         stopSoundIncomingCall(); 
    28  
    29         //Call closed tonality 
    30         _soundCallClosed = new Sound(getSoundCallClosedFile()); 
    31         _soundCallClosed->setWaveOutDevice(getRingerAudioDevice()); 
    32         //Play the sound 4 times 
    33         _soundCallClosed->setLoops(4); 
    34         _soundCallClosed->play(); 
     27        playSoundCallClosed(); 
    3528} 
  • wengophone/src/model/phonecall/PhoneCallStateError.cpp

    r522 r545  
    2323 
    2424void PhoneCallStateError::execute(PhoneCall & phoneCall,bool) { 
    25         stopSoundIncomingCall(); 
     25        stopSound(); 
    2626} 
  • wengophone/src/model/phonecall/PhoneCallStateIncoming.cpp

    r522 r545  
    3434                //Ringin tonality 
    3535                if(doublecall) 
    36                         _soundIncomingCall = new Sound(getSoundDoubleCallFile()); 
     36                        playSoundDoubleCall(); 
    3737                else 
    38                         _soundIncomingCall = new Sound(getSoundIncomingCallFile()); 
    39  
    40                 _soundIncomingCall->setWaveOutDevice(getRingerAudioDevice()); 
    41                 //Play the sound indefinitely 
    42                 _soundIncomingCall->setLoops(-1); 
    43                 _soundIncomingCall->play(); 
     38                        playSoundIncomingCall(); 
    4439        } 
    4540} 
  • wengophone/src/model/phonecall/PhoneCallStateResumed.cpp

    r10 r545  
    2323 
    2424void PhoneCallStateResumed::execute(PhoneCall & phoneCall,bool) { 
    25         stopSoundIncomingCall(); 
     25        stopSound(); 
    2626} 
  • wengophone/src/model/phonecall/PhoneCallStateRingingStart.cpp

    r522 r545  
    2828 
    2929void PhoneCallStateRingingStart::execute(PhoneCall & phoneCall,bool) { 
    30  
    31         Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    32         if (config.getAudioRingingEnable()) { 
    33                 //Ringin tonality 
    34                 _soundIncomingCall = new Sound(getSoundOutgoingCallFile()); 
    35  
    36                 _soundIncomingCall->setWaveOutDevice(getRingerAudioDevice()); 
    37                 //Play the sound indefinitely 
    38                 _soundIncomingCall->setLoops(-1); 
    39                 _soundIncomingCall->play(); 
    40         } 
     30        playSoundOutgoingCall(); 
    4131} 
  • wengophone/src/model/phonecall/PhoneCallStateRingingStop.cpp

    r522 r545  
    2929void PhoneCallStateRingingStop::execute(PhoneCall & phoneCall,bool) { 
    3030 
    31         stopSoundIncomingCall(); 
     31        stopSound(); 
    3232} 
  • wengophone/src/model/phonecall/PhoneCallStateTalking.cpp

    r522 r545  
    2323 
    2424void PhoneCallStateTalking::execute(PhoneCall & phoneCall,bool) { 
    25         stopSoundIncomingCall(); 
     25        stopSound(); 
    2626} 
Note: See TracChangeset for help on using the changeset viewer.