From 9d1a89d0d54cfcc776306f2acb2495977104e30e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 3 May 2004 02:43:36 +0000 Subject: [PATCH] add hack to not play connect/disconnect sounds after resetting USB --- stepmania/src/MemoryCardManager.cpp | 23 ++++++++++++++++------- stepmania/src/MemoryCardManager.h | 3 +++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/stepmania/src/MemoryCardManager.cpp b/stepmania/src/MemoryCardManager.cpp index 10ccf63ab5..cb8d7ff9d5 100644 --- a/stepmania/src/MemoryCardManager.cpp +++ b/stepmania/src/MemoryCardManager.cpp @@ -35,6 +35,8 @@ MemoryCardManager::MemoryCardManager() } m_pDriver->GetStorageDevices( m_vStorageDevices ); + m_bDontPlaySoundsOnce = false; + m_soundReady.Load( THEME->GetPathToS("MemoryCardManager ready") ); m_soundError.Load( THEME->GetPathToS("MemoryCardManager error") ); m_soundTooLate.Load( THEME->GetPathToS("MemoryCardManager too late") ); @@ -248,15 +250,20 @@ match: } } - // play sound - if( m_bWriteError[p] ) - m_soundError.Play(); - else if( m_bTooLate[p] ) - m_soundTooLate.Play(); - else - m_soundReady.Play(); + if( !m_bDontPlaySoundsOnce ) + { + // play sound + if( m_bWriteError[p] ) + m_soundError.Play(); + else if( m_bTooLate[p] ) + m_soundTooLate.Play(); + else + m_soundReady.Play(); + } } } + + m_bDontPlaySoundsOnce = false; } void MemoryCardManager::FlushAndReset() @@ -271,6 +278,8 @@ void MemoryCardManager::FlushAndReset() } m_pDriver->ResetUsbStorage(); // forces cards to be re-detected + + m_bDontPlaySoundsOnce = true; } bool MemoryCardManager::PathIsMemCard( CString sDir ) const diff --git a/stepmania/src/MemoryCardManager.h b/stepmania/src/MemoryCardManager.h index 27a2359be0..0e1113cf40 100644 --- a/stepmania/src/MemoryCardManager.h +++ b/stepmania/src/MemoryCardManager.h @@ -55,6 +55,9 @@ protected: bool m_bWriteError[NUM_PLAYERS]; // couldn't write to the card UsbStorageDevice m_Device[NUM_PLAYERS]; // device in the memory card slot, NULL if none + // don't play sounds on the first assign after resetting the driver + bool m_bDontPlaySoundsOnce; + RageSound m_soundReady; RageSound m_soundError; RageSound m_soundTooLate;