///////////////////////////////////////////////////////
| 133 | |
| 134 | //////////////////////////////////////////////////////////// |
| 135 | bool Music::openFromMemory(const void* data, std::size_t sizeInBytes) |
| 136 | { |
| 137 | // First stop the music if it was already running |
| 138 | stop(); |
| 139 | |
| 140 | // Open the underlying sound file |
| 141 | if (!m_impl->file.openFromMemory(data, sizeInBytes)) |
| 142 | { |
| 143 | err() << "Failed to open music from memory" << std::endl; |
| 144 | return false; |
| 145 | } |
| 146 | |
| 147 | // Perform common initializations |
| 148 | m_impl->initialize(); |
| 149 | |
| 150 | // Initialize the stream |
| 151 | SoundStream::initialize(m_impl->file.getChannelCount(), m_impl->file.getSampleRate(), m_impl->file.getChannelMap()); |
| 152 | |
| 153 | return true; |
| 154 | } |
| 155 | |
| 156 | |
| 157 | //////////////////////////////////////////////////////////// |
no test coverage detected