mirror of
https://github.com/SFML/SFML.git
synced 2025-01-18 15:25:12 +08:00
Add additional documentation regarding channel maps
This commit is contained in:
parent
f734dec6fb
commit
03812a545d
@ -407,6 +407,12 @@ private:
|
|||||||
/// used by a `sf::Sound` (i.e. never write a function that
|
/// used by a `sf::Sound` (i.e. never write a function that
|
||||||
/// uses a local `sf::SoundBuffer` instance for loading a sound).
|
/// uses a local `sf::SoundBuffer` instance for loading a sound).
|
||||||
///
|
///
|
||||||
|
/// When loading sound samples from an array, a channel map needs to be
|
||||||
|
/// provided, which specifies the mapping of the position in the sample frame
|
||||||
|
/// to the sound channel. For example when you have six samples in a frame and
|
||||||
|
/// a 5.1 sound system, the channel map defines how each of those samples map
|
||||||
|
/// to which speaker channel.
|
||||||
|
///
|
||||||
/// Usage example:
|
/// Usage example:
|
||||||
/// \code
|
/// \code
|
||||||
/// // Load a new sound buffer from a file
|
/// // Load a new sound buffer from a file
|
||||||
@ -424,6 +430,21 @@ private:
|
|||||||
/// // Play it with a higher pitch -- the first sound remains unchanged
|
/// // Play it with a higher pitch -- the first sound remains unchanged
|
||||||
/// sound2.setPitch(2);
|
/// sound2.setPitch(2);
|
||||||
/// sound2.play();
|
/// sound2.play();
|
||||||
|
///
|
||||||
|
/// // Load samples with a channel map
|
||||||
|
/// auto samples = std::vector<std::int16_t>();
|
||||||
|
/// // ...
|
||||||
|
/// auto channelMap = std::vector<sf::SoundChannel>{
|
||||||
|
/// sf::SoundChannel::FrontLeft,
|
||||||
|
/// sf::SoundChannel::FrontCenter,
|
||||||
|
/// sf::SoundChannel::FrontRight,
|
||||||
|
/// sf::SoundChannel::BackRight,
|
||||||
|
/// sf::SoundChannel::BackCenter,
|
||||||
|
/// sf::SoundChannel::BackLeft,
|
||||||
|
/// sf::SoundChannel::LowFrequencyEffects
|
||||||
|
/// };
|
||||||
|
/// auto soundBuffer = sf::SoundBuffer(samples.data(), samples.size(), 6, 44100, channelMap);
|
||||||
|
/// auto sound = sf::Sound(soundBuffer);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
/// \see `sf::Sound`, `sf::SoundBufferRecorder`
|
/// \see `sf::Sound`, `sf::SoundBufferRecorder`
|
||||||
|
Loading…
Reference in New Issue
Block a user