25 #ifndef CPP3DS_SOUNDSTREAM_HPP
26 #define CPP3DS_SOUNDSTREAM_HPP
32 #include <cpp3ds/System/LinearAllocator.hpp>
34 #include <cpp3ds/Audio/SoundSource.hpp>
35 #include <cpp3ds/System/Thread.hpp>
36 #include <cpp3ds/System/Time.hpp>
37 #include <cpp3ds/System/Mutex.hpp>
208 void initialize(
unsigned int channelCount,
unsigned int sampleRate);
264 bool fillAndPushBuffer(
unsigned int bufferNum);
294 mutable Mutex m_threadMutex;
295 Status m_threadStartState;
297 unsigned int m_channelCount;
298 unsigned int m_sampleRate;
301 Uint64 m_samplesProcessed;
302 bool m_endBuffers[BufferCount];
304 ndspWaveBuf m_ndspWaveBuffers[BufferCount];
305 std::vector<Int16, LinearAllocator<Int16>> m_buffers[BufferCount];
307 unsigned int m_buffers[BufferCount];
314 #endif // CPP3DS_SOUNDSTREAM_HPP
Utility class to manipulate threads.
void setPlayingOffset(Time timeOffset)
Change the current playing position of the stream.
Base class defining a sound's properties.
Abstract base class for streamed audio sources.
void stop()
Stop playing the audio stream.
unsigned int getSampleRate() const
Get the stream sample rate of the stream.
virtual bool onGetData(Chunk &data)=0
Request a new chunk of audio samples from the stream source.
virtual void onSeek(Time timeOffset)=0
Change the current playing position in the stream source.
unsigned int getChannelCount() const
Return the number of channels of the stream.
void pause()
Pause the audio stream.
Status
Enumeration of the sound source states.
Status getStatus() const
Get the current status of the stream (stopped, paused, playing)
void initialize(unsigned int channelCount, unsigned int sampleRate)
Define the audio stream parameters.
bool getLoop() const
Tell whether or not the stream is in loop mode.
Blocks concurrent access to shared resources from multiple threads.
SoundStream()
Default constructor.
Structure defining a chunk of audio data to stream.
Time getPlayingOffset() const
Get the current playing position of the stream.
void play()
Start or resume playing the audio stream.
void setLoop(bool loop)
Set whether or not the stream should loop after reaching the end.
std::size_t sampleCount
Number of samples pointed by Samples.
const Int16 * samples
Pointer to the audio samples.
virtual ~SoundStream()
Destructor.