///////////////////////////////////////////////////////
| 36 | { |
| 37 | //////////////////////////////////////////////////////////// |
| 38 | AudioResource::AudioResource() : |
| 39 | m_device( |
| 40 | [] |
| 41 | { |
| 42 | // Ensure we only ever create a single instance of an |
| 43 | // AudioDevice that is shared between all AudioResources |
| 44 | static std::mutex mutex; |
| 45 | static std::weak_ptr<priv::AudioDevice> weakAudioDevice; |
| 46 | |
| 47 | const std::lock_guard lock(mutex); |
| 48 | |
| 49 | auto audioDevice = weakAudioDevice.lock(); |
| 50 | |
| 51 | if (audioDevice == nullptr) |
| 52 | { |
| 53 | audioDevice = std::make_shared<priv::AudioDevice>(); |
| 54 | weakAudioDevice = audioDevice; |
| 55 | } |
| 56 | |
| 57 | return audioDevice; |
| 58 | }()) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | } // namespace sf |
nothing calls this directly
no outgoing calls
no test coverage detected