Files
itgmania212121/stepmania/src/arch/arch.cpp
T

64 lines
1.5 KiB
C++
Raw Normal View History

/*
* This file provides functions to create driver objects.
*/
#include "../stdafx.h"
2002-12-13 08:33:25 +00:00
#include "../RageLog.h"
#include "../RageUtil.h"
2002-12-13 08:33:25 +00:00
#include "../PrefsManager.h"
#include "arch.h"
/* Load default drivers. */
#include "arch_default.h"
/* Override them with arch-specific drivers, as available. */
#if defined(WIN32)
#include "arch_Win32.h"
#endif
LoadingWindow *MakeLoadingWindow() { return new ARCH_LOADING_WINDOW; }
2002-12-16 02:09:08 +00:00
ErrorDialog *MakeErrorDialog() { return new ARCH_ERROR_DIALOG; }
2002-12-13 08:33:25 +00:00
/* Err, this is ugly--breaks arch encapsulation. Hmm. */
RageSoundDriver *MakeRageSoundDriver(CString drivers)
{
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
2003-01-19 05:00:51 +00:00
CString Driver;
2003-01-19 21:24:37 +00:00
RageSoundDriver *ret = NULL;
2003-01-19 05:00:51 +00:00
for(unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i)
2002-12-13 08:33:25 +00:00
{
try {
2003-01-19 05:00:51 +00:00
Driver = DriversToTry[i];
2002-12-13 08:33:25 +00:00
LOG->Trace("Initializing driver: %s", DriversToTry[i].GetString());
#if defined(WIN32)
2003-01-19 05:00:51 +00:00
if(DriversToTry[i] == "DirectSound") ret = new RageSound_DSound;
else if(DriversToTry[i] == "DirectSound-sw") ret = new RageSound_DSound_Software;
else if(DriversToTry[i] == "WaveOut") ret = new RageSound_WaveOut;
#else
#error No sound drivers defined!
2002-12-13 08:33:25 +00:00
#endif
2003-01-19 05:00:51 +00:00
else
LOG->Warn("Unknown sound driver name: %s", DriversToTry[i].GetString());
2002-12-13 08:33:25 +00:00
}
2002-12-21 08:15:35 +00:00
catch(const RageException &e) {
2003-01-19 21:25:06 +00:00
LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].GetString(), e.what());
2002-12-13 08:33:25 +00:00
}
}
2003-01-19 05:00:51 +00:00
if(ret)
LOG->Info("Sound driver: %s", Driver.GetString());
return ret;
2002-12-13 08:33:25 +00:00
}
/*
* Copyright (c) 2002 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/