2001-11-03 10:52:42 +00:00
|
|
|
#include "stdafx.h"
|
2001-11-04 19:34:28 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: RageSound.cpp
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2001-11-04 19:34:28 +00:00
|
|
|
Desc: Sound effects library (currently a wrapper around Bass Sound Library).
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2001-11-03 10:52:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "RageSound.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
|
|
|
|
|
#include "bass/bass.h"
|
|
|
|
|
#pragma comment(lib, "bass/bass.lib")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LPRageSound SOUND = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RageSound::RageSound( HWND hWnd )
|
|
|
|
|
{
|
|
|
|
|
// save the HWND
|
|
|
|
|
if( !hWnd )
|
|
|
|
|
RageError( "RageSound called with NULL hWnd." );
|
|
|
|
|
m_hWndApp = hWnd;
|
|
|
|
|
|
2001-12-11 11:25:37 +00:00
|
|
|
if( BASS_GetVersion() != MAKELONG(1,3) )
|
|
|
|
|
RageError( "BASS version 1.3 DLL could not be loaded. Verify that Bass.dll exists in the program directory.");
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2002-01-17 19:59:06 +00:00
|
|
|
if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL, m_hWndApp ) )
|
2001-12-11 11:25:37 +00:00
|
|
|
{
|
2002-01-17 19:59:06 +00:00
|
|
|
MessageBox( NULL,
|
|
|
|
|
"There was an error while initializing your sound card.\n\n"
|
|
|
|
|
"The most likely cause of this problem is that you do not have a sound card\n"
|
|
|
|
|
"installed, or that you have not yet installed a driver for your sound card.\n"
|
|
|
|
|
"Before running this program again, please verify that your sound card is\n"
|
|
|
|
|
"is working in other Windows applications.",
|
|
|
|
|
"Sound error",
|
|
|
|
|
MB_ICONSTOP );
|
2001-11-03 10:52:42 +00:00
|
|
|
RageError( "BASS can't initialize sound device." );
|
2001-12-11 11:25:37 +00:00
|
|
|
}
|
2001-11-03 10:52:42 +00:00
|
|
|
|
|
|
|
|
BASS_Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RageSound::~RageSound()
|
|
|
|
|
{
|
|
|
|
|
BASS_Free();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|