Movatterモバイル変換


[0]ホーム

URL:


Loading...
Searching...
No Matches
Sound.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <SFML/Audio/Export.hpp>
31
33
34#include <memory>
35
36#include <cstdlib>
37
38namespacesf
39{
40classTime;
41classSoundBuffer;
42
48{
49public:
56explicitSound(constSoundBuffer& buffer);
57
62Sound(constSoundBuffer&& buffer) =delete;
63
70Sound(constSound& copy);
71
76~Sound()override;
77
90voidplay()override;
91
101voidpause()override;
102
113voidstop()override;
114
127voidsetBuffer(constSoundBuffer& buffer);
128
133voidsetBuffer(constSoundBuffer&& buffer) =delete;
134
148voidsetLooping(bool loop);
149
163voidsetPlayingOffset(Time timeOffset);
164
174voidsetEffectProcessor(EffectProcessor effectProcessor)override;
175
182 [[nodiscard]]constSoundBuffer&getBuffer()const;
183
192 [[nodiscard]]boolisLooping()const;
193
202 [[nodiscard]]TimegetPlayingOffset()const;
203
210 [[nodiscard]]StatusgetStatus()const override;
211
220Sound&operator=(constSound& right);
221
222private:
223friendclassSoundBuffer;
224
232void detachBuffer();
233
240 [[nodiscard]]void* getSound()const override;
241
243// Member data
245structImpl;
246const std::unique_ptr<Impl> m_impl;
247};
248
249}// namespace sf
250
251
#define SFML_AUDIO_API
Storage for audio samples defining a sound.
SoundSource(const SoundSource &)=default
Copy constructor.
std::function< void(const float *inputFrames, unsigned int &inputFrameCount, float *outputFrames, unsigned int &outputFrameCount, unsigned int frameChannelCount)> EffectProcessor
Callable that is provided with sound data for processing.
Status
Enumeration of the sound source states.
Status getStatus() const override
Get the current status of the sound (stopped, paused, playing)
void pause() override
Pause the sound.
~Sound() override
Destructor.
void setLooping(bool loop)
Set whether or not the sound should loop after reaching the end.
Sound(const SoundBuffer &buffer)
Construct the sound with a buffer.
Sound(const SoundBuffer &&buffer)=delete
Disallow construction from a temporary sound buffer.
bool isLooping() const
Tell whether or not the sound is in loop mode.
friend class SoundBuffer
DefinitionSound.hpp:223
Time getPlayingOffset() const
Get the current playing position of the sound.
void setBuffer(const SoundBuffer &buffer)
Set the source buffer containing the audio data to play.
Sound & operator=(const Sound &right)
Overload of assignment operator.
void stop() override
stop playing the sound
void play() override
Start or resume playing the sound.
void setBuffer(const SoundBuffer &&buffer)=delete
Disallow setting from a temporary sound buffer.
const SoundBuffer & getBuffer() const
Get the audio buffer attached to the sound.
void setPlayingOffset(Time timeOffset)
Change the current playing position of the sound.
void setEffectProcessor(EffectProcessor effectProcessor) override
Set the effect processor to be applied to the sound.
Sound(const Sound &copy)
Copy constructor.
Represents a time value.
DefinitionTime.hpp:42

[8]ページ先頭

©2009-2025 Movatter.jp