Fixed non-positional bridge sound in canyon

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8338 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-04-13 20:59:22 +00:00
parent ef35220f48
commit cdc61fda1e
4 changed files with 19 additions and 7 deletions

View File

@ -43,7 +43,6 @@ SFXBuffer::SFXBuffer(const std::string& file,
m_buffer = 0;
m_gain = 1.0f;
m_rolloff = 0.1f;
m_positional = false;
m_loaded = false;
m_file = file;

View File

@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "audio/music_manager.hpp"
#include "audio/sfx_buffer.hpp"
#include <sstream>
#include <stdexcept>
@ -264,12 +265,14 @@ SFXBase* SFXManager::createSoundSource(SFXBuffer* buffer,
positional = buffer->isPositional();
}
//printf("CREATING %s (%x), positional = %i (race_manager->getNumLocalPlayers() = %i, buffer->isPositional() = %i)\n",
// buffer->getFileName().c_str(), (unsigned int)buffer,
// positional,
// race_manager->getNumLocalPlayers(), buffer->isPositional());
assert( alIsBuffer(buffer->getBuffer()) );
SFXBase* sfx = new SFXOpenAL(buffer, positional, buffer->getGain());
// debugging
/*printf("newSfx(): id:%d buffer:%p, rolloff:%f, gain:%f %p\n", id, m_sfx_buffers[id], m_sfx_rolloff[id], m_sfx_gain[id], p);*/
sfx->volume(m_master_gain);
if (add_to_SFX_list) m_all_sfx.push_back(sfx);

View File

@ -20,7 +20,6 @@
#ifndef HEADER_SFX_MANAGER_HPP
#define HEADER_SFX_MANAGER_HPP
#include "audio/sfx_buffer.hpp"
#include <string>
#include <vector>
@ -35,6 +34,7 @@
#include "utils/vec3.hpp"
class SFXBase;
class SFXBuffer;
class XMLNode;
/**

View File

@ -2,6 +2,7 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Patrick Ammann <pammann@aro.ch>
// 2009-2011 Marianne Gagnon
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -20,7 +21,7 @@
#if HAVE_OGGVORBIS
#include "audio/sfx_openal.hpp"
#include "audio/sfx_buffer.hpp"
#include <assert.h>
#include <stdio.h>
#include <string>
@ -219,7 +220,16 @@ void SFXOpenAL::play()
*/
void SFXOpenAL::position(const Vec3 &position)
{
if(!m_ok||!m_positional) return;
if (!m_ok)
{
fprintf(stderr, "WARNING, position called on non-ok SFX\n");
return;
}
if (!m_positional)
{
fprintf(stderr, "WARNING, position called on non-positional SFX\n");
return;
}
alSource3f(m_soundSource, AL_POSITION,
(float)position.getX(), (float)position.getY(), (float)position.getZ());