1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-02 05:15:33 +00:00

Rename some Sound class member functions

This commit is contained in:
Chris Robinson 2012-03-18 12:03:15 -07:00
parent 403e51cef3
commit 1965b5bc79
3 changed files with 16 additions and 20 deletions

View file

@ -93,10 +93,10 @@ public:
OpenAL_SoundStream(DecoderPtr decoder); OpenAL_SoundStream(DecoderPtr decoder);
virtual ~OpenAL_SoundStream(); virtual ~OpenAL_SoundStream();
void Play(float volume, float pitch); void play(float volume, float pitch);
virtual void Stop(); virtual void stop();
virtual bool isPlaying(); virtual bool isPlaying();
virtual void Update(const float *pos); virtual void update(const float *pos);
}; };
class OpenAL_Sound : public Sound class OpenAL_Sound : public Sound
@ -108,9 +108,9 @@ public:
OpenAL_Sound(ALuint src, ALuint buf); OpenAL_Sound(ALuint src, ALuint buf);
virtual ~OpenAL_Sound(); virtual ~OpenAL_Sound();
virtual void Stop(); virtual void stop();
virtual bool isPlaying(); virtual bool isPlaying();
virtual void Update(const float *pos); virtual void update(const float *pos);
}; };
@ -159,7 +159,7 @@ OpenAL_SoundStream::~OpenAL_SoundStream()
mDecoder->close(); mDecoder->close();
} }
void OpenAL_SoundStream::Play(float volume, float pitch) void OpenAL_SoundStream::play(float volume, float pitch)
{ {
std::vector<char> data(sBufferSize); std::vector<char> data(sBufferSize);
@ -182,7 +182,7 @@ void OpenAL_SoundStream::Play(float volume, float pitch)
throwALerror(); throwALerror();
} }
void OpenAL_SoundStream::Stop() void OpenAL_SoundStream::stop()
{ {
alSourceStop(mSource); alSourceStop(mSource);
alSourcei(mSource, AL_BUFFER, 0); alSourcei(mSource, AL_BUFFER, 0);
@ -234,7 +234,7 @@ bool OpenAL_SoundStream::isPlaying()
return true; return true;
} }
void OpenAL_SoundStream::Update(const float *pos) void OpenAL_SoundStream::update(const float *pos)
{ {
alSource3f(mSource, AL_POSITION, pos[0], pos[2], -pos[1]); alSource3f(mSource, AL_POSITION, pos[0], pos[2], -pos[1]);
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f); alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
@ -254,7 +254,7 @@ OpenAL_Sound::~OpenAL_Sound()
alGetError(); alGetError();
} }
void OpenAL_Sound::Stop() void OpenAL_Sound::stop()
{ {
alSourceStop(mSource); alSourceStop(mSource);
throwALerror(); throwALerror();
@ -270,7 +270,7 @@ bool OpenAL_Sound::isPlaying()
return state==AL_PLAYING; return state==AL_PLAYING;
} }
void OpenAL_Sound::Update(const float *pos) void OpenAL_Sound::update(const float *pos)
{ {
alSource3f(mSource, AL_POSITION, pos[0], pos[2], -pos[1]); alSource3f(mSource, AL_POSITION, pos[0], pos[2], -pos[1]);
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f); alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
@ -427,7 +427,7 @@ Sound* OpenAL_Output::streamSound(const std::string &fname, float volume, float
decoder->open(fname); decoder->open(fname);
sound.reset(new OpenAL_SoundStream(decoder)); sound.reset(new OpenAL_SoundStream(decoder));
sound->Play(volume, pitch); sound->play(volume, pitch);
return sound.release(); return sound.release();
} }

View file

@ -1,17 +1,13 @@
#ifndef GAME_SOUND_SOUND_H #ifndef GAME_SOUND_SOUND_H
#define GAME_SOUND_SOUND_H #define GAME_SOUND_SOUND_H
#include <string>
#include "../mwworld/ptr.hpp"
namespace MWSound namespace MWSound
{ {
class Sound class Sound
{ {
virtual void Stop() = 0; virtual void stop() = 0;
virtual bool isPlaying() = 0; virtual bool isPlaying() = 0;
virtual void Update(const float *pos) = 0; virtual void update(const float *pos) = 0;
public: public:
virtual ~Sound() { } virtual ~Sound() { }

View file

@ -159,14 +159,14 @@ namespace MWSound
void SoundManager::stopMusic() void SoundManager::stopMusic()
{ {
if(mMusic) if(mMusic)
mMusic->Stop(); mMusic->stop();
setPlaylist(); setPlaylist();
} }
void SoundManager::streamMusicFull(const std::string& filename) void SoundManager::streamMusicFull(const std::string& filename)
{ {
if(mMusic) if(mMusic)
mMusic->Stop(); mMusic->stop();
mMusic.reset(mOutput->streamSound(filename, 0.4f, 1.0f)); mMusic.reset(mOutput->streamSound(filename, 0.4f, 1.0f));
} }
@ -358,7 +358,7 @@ namespace MWSound
while(iditer != snditer->second.end()) while(iditer != snditer->second.end())
{ {
const ESM::Position &pos = ptr.getCellRef().pos; const ESM::Position &pos = ptr.getCellRef().pos;
iditer->second->Update(pos.pos); iditer->second->update(pos.pos);
iditer++; iditer++;
} }
} }