! * \brief Loads the sound from memory * \return true if loading is successful * * \param data Raw memory * \param size Size of the memory * \param params Parameters for the sound * * \remark Produces a NazaraError if loading failed */
| 166 | * \remark Produces a NazaraError if loading failed |
| 167 | */ |
| 168 | bool Sound::LoadFromMemory(const void* data, std::size_t size, const SoundBufferParams& params) |
| 169 | { |
| 170 | SoundBufferRef buffer = SoundBuffer::New(); |
| 171 | if (!buffer->LoadFromMemory(data, size, params)) |
| 172 | { |
| 173 | NazaraError("Failed to load buffer from memory (" + String::Pointer(data) + ')'); |
| 174 | return false; |
| 175 | } |
| 176 | |
| 177 | SetBuffer(buffer); |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | /*! |
| 182 | * \brief Loads the sound from stream |