bool CAudio_AL::init() { m_device = ::alcOpenDevice(nullptr); if (!m_device) { return false; } m_context = ::alcCreateContext(m_device, nullptr); if (!m_context) { return false; } if (!::alcMakeContextCurrent(m_context)) { return false; } ::alListener3f(AL_POSITION, 0, 0, 1.0f); ::alListener3f(AL_VELOCITY, 0, 0, 0); const ALfloat listenerOri[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }; ::alListenerfv(AL_ORIENTATION, listenerOri); const auto nullAudio = std::make_shared<Audio_AL>( Wave(SecondsF(0.5), Arg::generator = [](double t) { return 0.5 * std::sin(t * Math::TwoPi) * std::sin(t * Math::TwoPi * 220.0 * (t * 4.0 + 1.0)); })); if (!nullAudio->isInitialized()) { return false; } m_audios.setNullData(nullAudio); LOG_INFO(U"ℹ️ Audio initialized"); return true; }
explicit constexpr Transition(const MillisecondsF& inDuration = SecondsF(0.2), const MillisecondsF& outDuration = SecondsF(0.1), double initialValue = 0.0) noexcept : m_inDurationMillisec(static_cast<double>(inDuration.count())) , m_outDurationMillisec(static_cast<double>(outDuration.count())) , m_value(initialValue) {}