add memory card insert/remove sound

This commit is contained in:
Chris Danford
2003-12-18 04:24:25 +00:00
parent 799a3062ca
commit 1c44cd23c8
3 changed files with 15 additions and 0 deletions
+11
View File
@@ -15,6 +15,7 @@
#include "arch/MemoryCard/MemoryCardDriver.h" // for UsbStorageDevice #include "arch/MemoryCard/MemoryCardDriver.h" // for UsbStorageDevice
#include "arch/arch.h" #include "arch/arch.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ThemeManager.h"
MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program
@@ -29,6 +30,10 @@ MemoryCardManager::MemoryCardManager()
m_bTooLate[NUM_PLAYERS] = false; m_bTooLate[NUM_PLAYERS] = false;
m_bWriteError[NUM_PLAYERS] = false; m_bWriteError[NUM_PLAYERS] = false;
} }
m_pDriver->GetStorageDevices( g_StorageDevices );
m_soundConnect.Load( THEME->GetPathToS("MemoryCardManager connect") );
m_soundDisconnect.Load( THEME->GetPathToS("MemoryCardManager disconnect") );
} }
MemoryCardManager::~MemoryCardManager() MemoryCardManager::~MemoryCardManager()
@@ -51,7 +56,10 @@ void MemoryCardManager::Update( float fDelta )
{ {
const UsbStorageDevice old = vOld[i]; const UsbStorageDevice old = vOld[i];
if( find(vNew.begin(),vNew.end(),old) == vNew.end() ) if( find(vNew.begin(),vNew.end(),old) == vNew.end() )
{
SCREENMAN->SystemMessage( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPortOnHub, old.iDeviceOnBus, old.sOsMountDir.c_str()) ); SCREENMAN->SystemMessage( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPortOnHub, old.iDeviceOnBus, old.sOsMountDir.c_str()) );
m_soundDisconnect.Play();
}
} }
// check for connects // check for connects
@@ -59,7 +67,10 @@ void MemoryCardManager::Update( float fDelta )
{ {
const UsbStorageDevice newd = vNew[i]; const UsbStorageDevice newd = vNew[i];
if( find(vOld.begin(),vOld.end(),newd) == vOld.end() ) if( find(vOld.begin(),vOld.end(),newd) == vOld.end() )
{
SCREENMAN->SystemMessage( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPortOnHub, newd.iDeviceOnBus, newd.sOsMountDir.c_str()) ); SCREENMAN->SystemMessage( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPortOnHub, newd.iDeviceOnBus, newd.sOsMountDir.c_str()) );
m_soundConnect.Play();
}
} }
} }
} }
+4
View File
@@ -11,6 +11,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "RageSound.h"
struct UsbStorageDevice; struct UsbStorageDevice;
class MemoryCardDriver; class MemoryCardDriver;
@@ -38,6 +39,9 @@ protected:
bool m_bTooLate[NUM_PLAYERS]; // card was inserted after lock bool m_bTooLate[NUM_PLAYERS]; // card was inserted after lock
bool m_bWriteError[NUM_PLAYERS]; // couldn't write to the card bool m_bWriteError[NUM_PLAYERS]; // couldn't write to the card
UsbStorageDevice* m_pDevice[NUM_PLAYERS]; // device in the memory card slot, NULL if none UsbStorageDevice* m_pDevice[NUM_PLAYERS]; // device in the memory card slot, NULL if none
RageSound m_soundConnect;
RageSound m_soundDisconnect;
}; };
extern MemoryCardManager* MEMCARDMAN; // global and accessable from anywhere in our program extern MemoryCardManager* MEMCARDMAN; // global and accessable from anywhere in our program