diff --git a/docs/_audio_stream_8hpp_source.html b/docs/_audio_stream_8hpp_source.html index fecc32d..655f164 100644 --- a/docs/_audio_stream_8hpp_source.html +++ b/docs/_audio_stream_8hpp_source.html @@ -84,101 +84,130 @@ $(function() {
14  set(music);
15  }
16 
-
20  AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels) {
-
21  set(InitAudioStream(SampleRate, SampleSize, Channels));
+
20  AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels = 2) {
+
21  set(LoadAudioStream(SampleRate, SampleSize, Channels));
22  }
23 
-
24  ~AudioStream() {
-
25  Close();
-
26  }
-
27 
-
28  GETTERSETTER(rAudioBuffer *, Buffer, buffer)
-
29  GETTERSETTER(unsigned int, SampleRate, sampleRate)
-
30  GETTERSETTER(unsigned int, SampleSize, sampleSize)
-
31  GETTERSETTER(unsigned int, Channels, channels)
-
32 
-
33  AudioStream& operator=(const ::AudioStream& stream) {
-
34  set(stream);
-
35  return *this;
-
36  }
-
37 
-
41  inline AudioStream& Update(const void *data, int samplesCount) {
-
42  ::UpdateAudioStream(*this, data, samplesCount);
-
43  return *this;
-
44  }
-
45 
-
49  inline void Close() {
-
50  ::CloseAudioStream(*this);
-
51  }
-
52 
-
56  inline bool IsProcessed() const {
-
57  return ::IsAudioStreamProcessed(*this);
-
58  }
-
59 
-
63  inline AudioStream& Play() {
-
64  ::PlayAudioStream(*this);
-
65  return *this;
-
66  }
-
67 
-
71  inline AudioStream& Pause() {
-
72  ::PauseAudioStream(*this);
-
73  return *this;
-
74  }
-
75 
-
79  inline AudioStream& Resume() {
-
80  ::ResumeAudioStream(*this);
-
81  return *this;
-
82  }
-
83 
-
87  inline bool IsPlaying() const {
-
88  return ::IsAudioStreamPlaying(*this);
-
89  }
-
90 
-
94  inline AudioStream& Stop() {
-
95  ::StopAudioStream(*this);
-
96  return *this;
-
97  }
-
98 
-
102  inline AudioStream& SetVolume(float volume) {
-
103  ::SetAudioStreamVolume(*this, volume);
-
104  return *this;
-
105  }
-
106 
-
110  inline AudioStream& SetPitch(float pitch) {
-
111  ::SetAudioStreamPitch(*this, pitch);
-
112  return *this;
-
113  }
-
114 
-
118  inline static void SetBufferSizeDefault(int size) {
-
119  ::SetAudioStreamBufferSizeDefault(size);
-
120  }
-
121 
-
122  private:
-
123  inline void set(const ::AudioStream& stream) {
-
124  buffer = stream.buffer;
-
125  sampleRate = stream.sampleRate;
-
126  sampleSize = stream.sampleSize;
-
127  channels = stream.channels;
-
128  }
-
129 };
-
130 } // namespace raylib
-
131 
-
132 #endif // RAYLIB_CPP_INCLUDE_AUDIOSTREAM_HPP_
+
24  AudioStream(const AudioStream&) = delete;
+
25 
+
26  AudioStream(AudioStream&& other) {
+
27  set(other);
+
28 
+
29  other.buffer = nullptr;
+
30  other.sampleRate = 0;
+
31  other.sampleSize = 0;
+
32  other.channels = 0;
+
33  }
+
34 
+
35  ~AudioStream() {
+
36  Unload();
+
37  }
+
38 
+
39  GETTERSETTER(rAudioBuffer *, Buffer, buffer)
+
40  GETTERSETTER(unsigned int, SampleRate, sampleRate)
+
41  GETTERSETTER(unsigned int, SampleSize, sampleSize)
+
42  GETTERSETTER(unsigned int, Channels, channels)
+
43 
+
44  AudioStream& operator=(const ::AudioStream& stream) {
+
45  set(stream);
+
46  return *this;
+
47  }
+
48 
+
49  AudioStream& operator=(const AudioStream&) = delete;
+
50 
+
51  AudioStream& operator=(AudioStream&& other) {
+
52  if (this == &other) {
+
53  return *this;
+
54  }
+
55 
+
56  Unload();
+
57  set(other);
+
58 
+
59  other.buffer = nullptr;
+
60  other.sampleRate = 0;
+
61  other.sampleSize = 0;
+
62  other.channels = 0;
+
63 
+
64  return *this;
+
65  }
+
66 
+
70  inline AudioStream& Update(const void *data, int samplesCount) {
+
71  ::UpdateAudioStream(*this, data, samplesCount);
+
72  return *this;
+
73  }
+
74 
+
78  inline void Unload() {
+
79  ::UnloadAudioStream(*this);
+
80  }
+
81 
+
85  inline bool IsProcessed() const {
+
86  return ::IsAudioStreamProcessed(*this);
+
87  }
+
88 
+
92  inline AudioStream& Play() {
+
93  ::PlayAudioStream(*this);
+
94  return *this;
+
95  }
+
96 
+
100  inline AudioStream& Pause() {
+
101  ::PauseAudioStream(*this);
+
102  return *this;
+
103  }
+
104 
+
108  inline AudioStream& Resume() {
+
109  ::ResumeAudioStream(*this);
+
110  return *this;
+
111  }
+
112 
+
116  inline bool IsPlaying() const {
+
117  return ::IsAudioStreamPlaying(*this);
+
118  }
+
119 
+
123  inline AudioStream& Stop() {
+
124  ::StopAudioStream(*this);
+
125  return *this;
+
126  }
+
127 
+
131  inline AudioStream& SetVolume(float volume) {
+
132  ::SetAudioStreamVolume(*this, volume);
+
133  return *this;
+
134  }
+
135 
+
139  inline AudioStream& SetPitch(float pitch) {
+
140  ::SetAudioStreamPitch(*this, pitch);
+
141  return *this;
+
142  }
+
143 
+
147  inline static void SetBufferSizeDefault(int size) {
+
148  ::SetAudioStreamBufferSizeDefault(size);
+
149  }
+
150 
+
151  private:
+
152  inline void set(const ::AudioStream& stream) {
+
153  buffer = stream.buffer;
+
154  sampleRate = stream.sampleRate;
+
155  sampleSize = stream.sampleSize;
+
156  channels = stream.channels;
+
157  }
+
158 };
+
159 } // namespace raylib
+
160 
+
161 #endif // RAYLIB_CPP_INCLUDE_AUDIOSTREAM_HPP_
raylib
All raylib-cpp classes and functions appear in the raylib namespace.
Definition: AudioDevice.hpp:7
-
raylib::AudioStream::IsPlaying
bool IsPlaying() const
Check if audio stream is playing.
Definition: AudioStream.hpp:87
-
raylib::AudioStream::Stop
AudioStream & Stop()
Stop audio stream.
Definition: AudioStream.hpp:94
-
raylib::AudioStream::Update
AudioStream & Update(const void *data, int samplesCount)
Update audio stream buffers with data.
Definition: AudioStream.hpp:41
-
raylib::AudioStream::Close
void Close()
Close audio stream and free memory.
Definition: AudioStream.hpp:49
-
raylib::AudioStream::Resume
AudioStream & Resume()
Resume audio stream.
Definition: AudioStream.hpp:79
-
raylib::AudioStream::SetBufferSizeDefault
static void SetBufferSizeDefault(int size)
Default size for new audio streams.
Definition: AudioStream.hpp:118
-
raylib::AudioStream::Play
AudioStream & Play()
Play audio stream.
Definition: AudioStream.hpp:63
-
raylib::AudioStream::IsProcessed
bool IsProcessed() const
Check if any audio stream buffers requires refill.
Definition: AudioStream.hpp:56
-
raylib::AudioStream::Pause
AudioStream & Pause()
Pause audio stream.
Definition: AudioStream.hpp:71
-
raylib::AudioStream::SetPitch
AudioStream & SetPitch(float pitch)
Set pitch for audio stream (1.0 is base level)
Definition: AudioStream.hpp:110
+
raylib::AudioStream::IsPlaying
bool IsPlaying() const
Check if audio stream is playing.
Definition: AudioStream.hpp:116
+
raylib::AudioStream::Stop
AudioStream & Stop()
Stop audio stream.
Definition: AudioStream.hpp:123
+
raylib::AudioStream::Update
AudioStream & Update(const void *data, int samplesCount)
Update audio stream buffers with data.
Definition: AudioStream.hpp:70
+
raylib::AudioStream::Resume
AudioStream & Resume()
Resume audio stream.
Definition: AudioStream.hpp:108
+
raylib::AudioStream::SetBufferSizeDefault
static void SetBufferSizeDefault(int size)
Default size for new audio streams.
Definition: AudioStream.hpp:147
+
raylib::AudioStream::AudioStream
AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels=2)
Init audio stream (to stream raw audio pcm data)
Definition: AudioStream.hpp:20
+
raylib::AudioStream::Play
AudioStream & Play()
Play audio stream.
Definition: AudioStream.hpp:92
+
raylib::AudioStream::IsProcessed
bool IsProcessed() const
Check if any audio stream buffers requires refill.
Definition: AudioStream.hpp:85
+
raylib::AudioStream::Pause
AudioStream & Pause()
Pause audio stream.
Definition: AudioStream.hpp:100
+
raylib::AudioStream::SetPitch
AudioStream & SetPitch(float pitch)
Set pitch for audio stream (1.0 is base level)
Definition: AudioStream.hpp:139
raylib::AudioStream
AudioStream management functions.
Definition: AudioStream.hpp:11
-
raylib::AudioStream::SetVolume
AudioStream & SetVolume(float volume)
Set volume for audio stream (1.0 is max level)
Definition: AudioStream.hpp:102
-
raylib::AudioStream::AudioStream
AudioStream(unsigned int SampleRate, unsigned int SampleSize, unsigned int Channels)
Init audio stream (to stream raw audio pcm data)
Definition: AudioStream.hpp:20
+
raylib::AudioStream::SetVolume
AudioStream & SetVolume(float volume)
Set volume for audio stream (1.0 is max level)
Definition: AudioStream.hpp:131
+
raylib::AudioStream::Unload
void Unload()
Unload audio stream and free memory.
Definition: AudioStream.hpp:78