Removed the rest of plib sound support; note that OpenAL was obligatory before this patch, so I just added a message to the configure.ac to stop configure when OpenAL isn't present.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2060 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-25 20:30:25 +00:00
parent 8dd4d52006
commit b5d4930f87
8 changed files with 30 additions and 185 deletions

View File

@ -10,7 +10,10 @@ Some short instruction on how to compile supertuxkart with cygwin:
3) Compile and install plib 3) Compile and install plib
This should work straight out of the box. This should work straight out of the box.
4) Unpack supteruxkart and run ./configure and make. 4) Install OpenAL
We have had some problems with this, so this might be the most difficult stage.
4) Unpack superuxkart and run ./configure and make.
That should be all. That should be all.

View File

@ -28,7 +28,10 @@ Cygwin
2) Compile and install plib 2) Compile and install plib
This should work straight out of the box. This should work straight out of the box.
3) Unpack supertuxkart and run ./configure and make. 3) Install OpenAL
We have had some problems with this in the past, so it might be tricky.
4) Unpack supertuxkart and run ./configure and make.
That should be all. That should be all.

View File

@ -160,6 +160,15 @@ if test x$have_al_lib = xyes; then
esac esac
fi fi
if test x$have_al_hdr != xyes; then
echo ""
echo "You need to install OpenAL"
echo "Configure aborted"
echo ""
exit
fi
case "${host}" in case "${host}" in
*) *)
dnl default unix style machines dnl default unix style machines
@ -176,29 +185,18 @@ case "${host}" in
AC_CHECK_HEADER(ogg/ogg.h, have_ogg_hdr=yes) AC_CHECK_HEADER(ogg/ogg.h, have_ogg_hdr=yes)
fi fi
dnl create OpenAL defines and a summary of the optional sound components
SUMMARY="$SUMMARY\n" SUMMARY="$SUMMARY\n"
if test x$have_al_hdr != xyes; then
SUMMARY="$SUMMARY You DO NOT have OpenAL."
fi
if test x$have_al_hdr = xyes ; then openal_LIBS="$LIBS"
openal_LIBS="$LIBS" if test x$have_vorbisfile_hdr = xyes -a x$have_ogg_hdr = xyes; then
AC_DEFINE([HAVE_OPENAL], 1, [Defined when OpenAL is available]) AC_DEFINE([HAVE_OGGVORBIS], 1, [Defined when Ogg Vorbis is available])
SUMMARY="$SUMMARY\nUsing OpenAL for sound." SUMMARY="$SUMMARY\nWe have Ogg Vorbis support."
# ov_read for ogg music needs endianness flag. This macro defines
if test x$have_vorbisfile_hdr = xyes -a x$have_ogg_hdr = xyes; then # WORDS_BIGENDIAN if it's a big endian machine. See music_ogg.cpp
AC_DEFINE([HAVE_OGGVORBIS], 1, [Defined when Ogg Vorbis is available]) AC_C_BIGENDIAN
SUMMARY="$SUMMARY\nWe have Ogg Vorbis support."
# ov_read for ogg music needs endianness flag. This macro defines
# WORDS_BIGENDIAN if it's a big endian machine. See music_ogg.cpp
AC_C_BIGENDIAN
else
SUMMARY="$SUMMARY\nNo Ogg Vorbis support - the game will play with sound effects, but without music."
SUMMARY="$SUMMARY\nPlease install ogg vorbis!"
fi
else else
SUMMARY="$SUMMARY\nInstall OpenAL for music!" SUMMARY="$SUMMARY\nNo Ogg Vorbis support - the game will play with sound effects, but without music."
SUMMARY="$SUMMARY\nPlease install ogg vorbis!"
fi fi
LIBS=$save_LIBS LIBS=$save_LIBS

View File

@ -35,7 +35,6 @@ supertuxkart_SOURCES = main.cpp \
collectable.cpp collectable.hpp \ collectable.cpp collectable.hpp \
collectable_manager.cpp collectable_manager.hpp \ collectable_manager.cpp collectable_manager.hpp \
sound_manager.cpp sound_manager.hpp \ sound_manager.cpp sound_manager.hpp \
sound_plib.cpp sound_plib.hpp \
music_ogg.cpp music_ogg.hpp \ music_ogg.cpp music_ogg.hpp \
music_information.cpp music_information.hpp \ music_information.cpp music_information.hpp \
sfx_openal.cpp sfx_openal.hpp \ sfx_openal.cpp sfx_openal.hpp \

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if HAVE_OPENAL && HAVE_OGGVORBIS #if HAVE_OGGVORBIS
#include <stdexcept> #include <stdexcept>
#ifdef __APPLE__ #ifdef __APPLE__
@ -346,4 +346,4 @@ string MusicOggStream::errorString(int code)
} }
} }
#endif // HAVE_OPENAL && HAVE_OGGVORBIS #endif // HAVE_OGGVORBIS

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if (HAVE_OPENAL && HAVE_OGGVORBIS) #if HAVE_OGGVORBIS
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
@ -143,5 +143,5 @@ bool SFXImpl::load(const char* filename)
return true; return true;
} }
#endif //if (HAVE_OPENAL && HAVE_OGGVORBIS) #endif //if HAVE_OGGVORBIS

View File

@ -1,94 +0,0 @@
// $Id$
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Patrick Ammann <pammann@aro.ch>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//The next #if *needs* double parenthesis
#if !(HAVE_OPENAL && HAVE_OGGVORBIS)
#include <string>
#include "sound_plib.hpp"
#include "sound_manager.hpp"
#include "loader.hpp"
slScheduler* plib_scheduler= NULL;
SFXImpl::SFXImpl(const char* filename)
{
std::string path = loader->getPath(filename);
m_sample= new slSample(path.c_str(), plib_scheduler);
}
//-----------------------------------------------------------------------------
SFXImpl::~SFXImpl()
{
delete m_sample;
}
//-----------------------------------------------------------------------------
void SFXImpl::play()
{
plib_scheduler->playSample(m_sample, 1, SL_SAMPLE_MUTE, 2, NULL);
}
//=============================================================================
void MusicPlib::update()
{
// Comment this next line out if the sound causes big glitches
// on your IRIX machine!
plib_scheduler->update();
}
//-----------------------------------------------------------------------------
bool MusicPlib::load(const std::string& filename)
{
m_filename= loader->getPath(filename);
return true;
}
//-----------------------------------------------------------------------------
bool MusicPlib::playMusic()
{
plib_scheduler->stopMusic();
plib_scheduler->loopMusic(m_filename.c_str());
return true;
}
//-----------------------------------------------------------------------------
bool MusicPlib::stopMusic()
{
plib_scheduler->stopMusic();
return true;
}
//-----------------------------------------------------------------------------
bool MusicPlib::pauseMusic()
{
plib_scheduler->stopMusic();
return true;
}
//-----------------------------------------------------------------------------
bool MusicPlib::resumeMusic()
{
plib_scheduler->loopMusic(m_filename.c_str());
return true;
}
#endif //!(HAVE_OPENAL && HAVE_OGGVORBIS)

View File

@ -1,64 +0,0 @@
// $Id$
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Patrick Ammann <pammann@aro.ch>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_SOUNDPLIB_H
#define HEADER_SOUNDPLIB_H
#include <string>
#include <plib/sl.h>
#include "music.hpp"
#include "sfx.hpp"
class SFXImpl : public SFX
{
public:
SFXImpl(const char* filename);
virtual ~SFXImpl();
virtual void play();
private:
slSample* m_sample;
};
class MusicPlib : public Music
{
public:
MusicPlib() {}
virtual ~MusicPlib() {}
virtual void update();
virtual bool load(const std::string &filename);
virtual bool playMusic();
virtual bool stopMusic();
virtual bool pauseMusic();
virtual bool resumeMusic();
private:
std::string m_filename;
};
extern slScheduler* plib_scheduler;
#endif // HEADER_SOUNDPLIB_H