mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
FS#113 - Copy Attenuation and MinDistance members in sf::Sound's copy constructor
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1175 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
ed0cf87e28
commit
8e90f147e4
@ -46,15 +46,15 @@ Sound::Sound()
|
|||||||
/// Construct the sound from its parameters
|
/// Construct the sound from its parameters
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Sound::Sound(const SoundBuffer& Buffer, bool Loop, float Pitch, float Volume, const Vector3f& Position) :
|
Sound::Sound(const SoundBuffer& Buffer, bool Loop, float Pitch, float Volume, const Vector3f& Position) :
|
||||||
myBuffer(&Buffer)
|
myBuffer(NULL)
|
||||||
{
|
{
|
||||||
ALCheck(alGenSources(1, &mySource));
|
ALCheck(alGenSources(1, &mySource));
|
||||||
|
|
||||||
ALCheck(alSourcei (mySource, AL_BUFFER, Buffer.myBuffer));
|
SetBuffer(Buffer);
|
||||||
ALCheck(alSourcei (mySource, AL_LOOPING, Loop));
|
SetLoop(Loop);
|
||||||
ALCheck(alSourcef (mySource, AL_PITCH, Pitch));
|
SetPitch(Pitch);
|
||||||
ALCheck(alSourcef (mySource, AL_GAIN, Volume * 0.01f));
|
SetVolume(Volume);
|
||||||
ALCheck(alSource3f(mySource, AL_POSITION, Position.x, Position.y, Position.z));
|
SetPosition(Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,15 +63,19 @@ myBuffer(&Buffer)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Sound::Sound(const Sound& Copy) :
|
Sound::Sound(const Sound& Copy) :
|
||||||
AudioResource(Copy),
|
AudioResource(Copy),
|
||||||
myBuffer (Copy.myBuffer)
|
myBuffer(NULL)
|
||||||
{
|
{
|
||||||
ALCheck(alGenSources(1, &mySource));
|
ALCheck(alGenSources(1, &mySource));
|
||||||
|
|
||||||
ALCheck(alSourcei (mySource, AL_BUFFER, myBuffer ? myBuffer->myBuffer : 0));
|
if (Copy.myBuffer)
|
||||||
ALCheck(alSourcei (mySource, AL_LOOPING, Copy.GetLoop()));
|
SetBuffer(*Copy.myBuffer);
|
||||||
ALCheck(alSourcef (mySource, AL_PITCH, Copy.GetPitch()));
|
SetLoop(Copy.GetLoop());
|
||||||
ALCheck(alSourcef (mySource, AL_GAIN, Copy.GetVolume() * 0.01f));
|
SetPitch(Copy.GetPitch());
|
||||||
ALCheck(alSource3f(mySource, AL_POSITION, Copy.GetPosition().x, Copy.GetPosition().y, Copy.GetPosition().z));
|
SetVolume(Copy.GetVolume());
|
||||||
|
SetPosition(Copy.GetPosition());
|
||||||
|
SetRelativeToListener(Copy.IsRelativeToListener());
|
||||||
|
SetMinDistance(Copy.GetMinDistance());
|
||||||
|
SetAttenuation(Copy.GetAttenuation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user