Bromeon
Static Public Member Functions | Public Member Functions | Related Functions
thor::Resources::SoundBufferKey Class Reference

Predefined key class for sf::SoundBuffer resources. More...

List of all members.

Static Public Member Functions

static SoundBufferKey FromFile (const std::string &fileName, const std::string &tag="")
 Load sf::SoundBuffer from file name.
static SoundBufferKey FromMemory (const void *data, std::size_t size, const std::string &tag="")
 Load sf::SoundBuffer from file in memory.
static SoundBufferKey FromSamples (const sf::Int16 *samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate, const std::string &tag="")
 Load sf::SoundBuffer from array of audio samples in memory.
static SoundBufferKey FromStream (sf::InputStream &stream, const std::string &tag="")
 Load sf::SoundBuffer from input stream.

Public Member Functions

MovedPtr< sf::SoundBuffer, NoCopyLoad () const
 Loads the sound buffer as specified by the static functions.
void Swap (SoundBufferKey &other)
 Exchanges the contents of *this with other.

Related Functions

bool thor::Resources::operator< (const SoundBufferKey &lhs, const SoundBufferKey &rhs)
 Comparison operator for strict weak ordering.
void thor::Resources::swap (SoundBufferKey &lhs, SoundBufferKey &rhs)
 Swaps two sf::SoundBuffer resource keys.

Detailed Description

Predefined key class for sf::SoundBuffer resources.

You can use this class to specifiy the access and loading of sf::SoundBuffer resources in a ResourceManager.


Member Function Documentation

static SoundBufferKey thor::Resources::SoundBufferKey::FromFile ( const std::string &  fileName,
const std::string &  tag = "" 
) [static]

Load sf::SoundBuffer from file name.

Parameters:
fileNameThe name of the file from which you want to load the sf::SoundBuffer.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::SoundBuffer::LoadFromFile()
static SoundBufferKey thor::Resources::SoundBufferKey::FromMemory ( const void *  data,
std::size_t  size,
const std::string &  tag = "" 
) [static]

Load sf::SoundBuffer from file in memory.

Parameters:
dataPointer to the file data in memory.
sizeSize of the data to load, in bytes.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::SoundBuffer::LoadFromMemory()
static SoundBufferKey thor::Resources::SoundBufferKey::FromSamples ( const sf::Int16 *  samples,
std::size_t  samplesCount,
unsigned int  channelsCount,
unsigned int  sampleRate,
const std::string &  tag = "" 
) [static]

Load sf::SoundBuffer from array of audio samples in memory.

Parameters:
samplesPointer to the samples array
samplesCountNumber of samples in the array
channelsCountNumber of channels (1 = mono, 2 = stereo, ...)
sampleRateSample rate (number of samples to play per second)
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::Soundbuffer::LoadFromSamples()
static SoundBufferKey thor::Resources::SoundBufferKey::FromStream ( sf::InputStream &  stream,
const std::string &  tag = "" 
) [static]

Load sf::SoundBuffer from input stream.

Parameters:
streamSource stream to read from.
tagIf an existing key has the same loading parameters, you can use this ID to create a distinct key.
See also:
sf::SoundBuffer::LoadFromStream()

Loads the sound buffer as specified by the static functions.

This function is mainly provided for ResourceManager, you don't need to call it directly.

Returns:
Movable smart pointer to the allocated sf::SoundBuffer, or null pointer at loading failure.

The documentation for this class was generated from the following file: