1
0
forked from 0ad/0ad

sound/music player now responsible for calling oal_Init, due to delay-loading.

This was SVN commit r985.
This commit is contained in:
janwas 2004-08-12 17:32:37 +00:00
parent 6637011982
commit 4e7b132bfd
3 changed files with 13 additions and 10 deletions

View File

@ -10,15 +10,18 @@
#endif
// called as late as possible, i.e. the first time sound/music is played
// (either from module init there, or from the play routine itself).
// this delays library load, leading to faster perceived app startup.
// registers an atexit routine for cleanup.
// no harm if called more than once.
int oal_Init()
{
ONCE(alutInit(0, 0));
return 0;
}
int oal_Shutdown()
{
alutExit();
ONCE({
alutInit(0, 0);
atexit(alutExit);
});
return 0;
}

View File

@ -6,5 +6,3 @@
#endif
extern int oal_Init();
extern int oal_Shutdown();

View File

@ -112,6 +112,8 @@ CMusicPlayer::~CMusicPlayer(void)
void CMusicPlayer::open(char *filename)
{
oal_Init();
// If a new file is opened while another is already in memory,
// close the old one first.
if (is_open)