From ec512490dd5cd3aadeaf4f027e51dd3b2c35392a Mon Sep 17 00:00:00 2001
From: Nomango <569629550@qq.com>
Date: Sun, 31 Mar 2019 01:42:46 +0800
Subject: [PATCH] case sensitive
---
easy2d-audio/Easy2D-Audio.vcxproj | 162 -
easy2d-audio/Easy2D-Audio.vcxproj.filters | 20 -
easy2d-audio/Music.cpp | 177 -
easy2d-audio/Music.h | 81 -
easy2d-audio/Player.cpp | 141 -
easy2d-audio/Player.h | 93 -
easy2d-audio/Transcoder.cpp | 267 -
easy2d-audio/Transcoder.h | 57 -
easy2d-audio/Voice.cpp | 148 -
easy2d-audio/Voice.h | 72 -
easy2d-audio/audio-modules.cpp | 97 -
easy2d-audio/audio-modules.h | 83 -
easy2d-audio/audio.cpp | 115 -
easy2d-audio/audio.h | 66 -
easy2d-audio/easy2d-audio.h | 26 -
easy2d-imgui/Easy2D-ImGui.vcxproj | 166 -
easy2d-imgui/Easy2D-ImGui.vcxproj.filters | 49 -
easy2d-imgui/ImGuiLayer.cpp | 183 -
easy2d-imgui/ImGuiLayer.h | 71 -
easy2d-imgui/ImGuiView.cpp | 83 -
easy2d-imgui/ImGuiView.h | 44 -
easy2d-imgui/easy2d-imgui.h | 27 -
easy2d-imgui/imgui_impl_dx11.cpp | 493 --
easy2d-imgui/imgui_impl_dx11.h | 15 -
easy2d-imgui/libs/ImGui/LICENSE.txt | 21 -
easy2d-imgui/libs/ImGui/imconfig.h | 73 -
easy2d-imgui/libs/ImGui/imgui.cpp | 9459 ---------------------
easy2d-imgui/libs/ImGui/imgui.h | 2137 -----
easy2d-imgui/libs/ImGui/imgui_demo.cpp | 4234 ---------
easy2d-imgui/libs/ImGui/imgui_draw.cpp | 3287 -------
easy2d-imgui/libs/ImGui/imgui_internal.h | 1490 ----
easy2d-imgui/libs/ImGui/imgui_widgets.cpp | 6572 --------------
easy2d-imgui/libs/ImGui/imstb_rectpack.h | 623 --
easy2d-imgui/libs/ImGui/imstb_textedit.h | 1408 ---
easy2d-imgui/libs/ImGui/imstb_truetype.h | 4860 -----------
easy2d/2d/Action.cpp | 102 -
easy2d/2d/Action.h | 124 -
easy2d/2d/ActionGroup.cpp | 147 -
easy2d/2d/ActionGroup.h | 103 -
easy2d/2d/ActionHelper.h | 232 -
easy2d/2d/ActionManager.cpp | 103 -
easy2d/2d/ActionManager.h | 59 -
easy2d/2d/ActionTween.cpp | 480 --
easy2d/2d/ActionTween.h | 478 --
easy2d/2d/Animation.cpp | 104 -
easy2d/2d/Animation.h | 63 -
easy2d/2d/Canvas.cpp | 505 --
easy2d/2d/Canvas.h | 243 -
easy2d/2d/Color.cpp | 75 -
easy2d/2d/Color.h | 110 -
easy2d/2d/DebugNode.cpp | 92 -
easy2d/2d/DebugNode.h | 42 -
easy2d/2d/Font.hpp | 63 -
easy2d/2d/Frames.cpp | 94 -
easy2d/2d/Frames.h | 61 -
easy2d/2d/Geometry.cpp | 442 -
easy2d/2d/Geometry.h | 304 -
easy2d/2d/GeometryNode.cpp | 87 -
easy2d/2d/GeometryNode.h | 89 -
easy2d/2d/Image.cpp | 182 -
easy2d/2d/Image.h | 104 -
easy2d/2d/Layer.cpp | 88 -
easy2d/2d/Layer.h | 49 -
easy2d/2d/Node.cpp | 594 --
easy2d/2d/Node.h | 411 -
easy2d/2d/Scene.cpp | 79 -
easy2d/2d/Scene.h | 52 -
easy2d/2d/Sprite.cpp | 105 -
easy2d/2d/Sprite.h | 73 -
easy2d/2d/Text.cpp | 347 -
easy2d/2d/Text.h | 221 -
easy2d/2d/TextStyle.hpp | 91 -
easy2d/2d/Transform.hpp | 59 -
easy2d/2d/Transition.cpp | 396 -
easy2d/2d/Transition.h | 181 -
easy2d/2d/include-forwards.h | 132 -
easy2d/Easy2D.vcxproj | 258 -
easy2d/Easy2D.vcxproj.filters | 378 -
easy2d/base/Component.h | 34 -
easy2d/base/Event.hpp | 179 -
easy2d/base/EventDispatcher.cpp | 135 -
easy2d/base/EventDispatcher.h | 78 -
easy2d/base/EventListener.cpp | 38 -
easy2d/base/EventListener.h | 65 -
easy2d/base/Input.cpp | 102 -
easy2d/base/Input.h | 87 -
easy2d/base/Object.cpp | 154 -
easy2d/base/Object.h | 75 -
easy2d/base/RefCounter.hpp | 52 -
easy2d/base/Resource.cpp | 134 -
easy2d/base/Resource.h | 88 -
easy2d/base/SmartPtr.hpp | 49 -
easy2d/base/Timer.cpp | 94 -
easy2d/base/Timer.h | 79 -
easy2d/base/TimerManager.cpp | 130 -
easy2d/base/TimerManager.h | 69 -
easy2d/base/keys.hpp | 125 -
easy2d/base/logs.cpp | 88 -
easy2d/base/logs.h | 231 -
easy2d/base/time.cpp | 453 -
easy2d/base/time.h | 220 -
easy2d/base/window.cpp | 393 -
easy2d/base/window.h | 87 -
easy2d/common/Array.h | 284 -
easy2d/common/ComPtr.hpp | 45 -
easy2d/common/IntrusiveList.hpp | 252 -
easy2d/common/IntrusivePtr.hpp | 217 -
easy2d/common/Json.h | 2467 ------
easy2d/common/Singleton.hpp | 51 -
easy2d/common/String.h | 1315 ---
easy2d/common/closure.hpp | 83 -
easy2d/common/helper.h | 55 -
easy2d/common/noncopyable.hpp | 35 -
easy2d/config.h | 21 -
easy2d/easy2d.h | 121 -
easy2d/macros.h | 118 -
easy2d/math/Matrix.hpp | 271 -
easy2d/math/Rect.hpp | 112 -
easy2d/math/Vec2.hpp | 91 -
easy2d/math/constants.hpp | 43 -
easy2d/math/ease.hpp | 286 -
easy2d/math/helper.h | 35 -
easy2d/math/rand.h | 126 -
easy2d/math/scalar.hpp | 82 -
easy2d/platform/Application.cpp | 600 --
easy2d/platform/Application.h | 168 -
easy2d/platform/modules.cpp | 46 -
easy2d/platform/modules.h | 53 -
easy2d/renderer/D2DDeviceResources.cpp | 516 --
easy2d/renderer/D2DDeviceResources.h | 118 -
easy2d/renderer/D3D10DeviceResources.cpp | 439 -
easy2d/renderer/D3D10DeviceResources.h | 87 -
easy2d/renderer/D3D11DeviceResources.cpp | 443 -
easy2d/renderer/D3D11DeviceResources.h | 92 -
easy2d/renderer/DeviceResources.h | 39 -
easy2d/renderer/TextRenderer.cpp | 525 --
easy2d/renderer/TextRenderer.h | 44 -
easy2d/renderer/helper.hpp | 73 -
easy2d/renderer/render.cpp | 456 -
easy2d/renderer/render.h | 188 -
easy2d/ui/Button.cpp | 139 -
easy2d/ui/Button.h | 94 -
easy2d/ui/Menu.cpp | 100 -
easy2d/ui/Menu.h | 66 -
easy2d/utils/DataUtil.cpp | 159 -
easy2d/utils/DataUtil.h | 130 -
easy2d/utils/File.cpp | 113 -
easy2d/utils/File.h | 66 -
easy2d/utils/Path.cpp | 104 -
easy2d/utils/Path.h | 40 -
easy2d/utils/ResLoader.cpp | 251 -
easy2d/utils/ResLoader.h | 88 -
152 files changed, 59488 deletions(-)
delete mode 100644 easy2d-audio/Easy2D-Audio.vcxproj
delete mode 100644 easy2d-audio/Easy2D-Audio.vcxproj.filters
delete mode 100644 easy2d-audio/Music.cpp
delete mode 100644 easy2d-audio/Music.h
delete mode 100644 easy2d-audio/Player.cpp
delete mode 100644 easy2d-audio/Player.h
delete mode 100644 easy2d-audio/Transcoder.cpp
delete mode 100644 easy2d-audio/Transcoder.h
delete mode 100644 easy2d-audio/Voice.cpp
delete mode 100644 easy2d-audio/Voice.h
delete mode 100644 easy2d-audio/audio-modules.cpp
delete mode 100644 easy2d-audio/audio-modules.h
delete mode 100644 easy2d-audio/audio.cpp
delete mode 100644 easy2d-audio/audio.h
delete mode 100644 easy2d-audio/easy2d-audio.h
delete mode 100644 easy2d-imgui/Easy2D-ImGui.vcxproj
delete mode 100644 easy2d-imgui/Easy2D-ImGui.vcxproj.filters
delete mode 100644 easy2d-imgui/ImGuiLayer.cpp
delete mode 100644 easy2d-imgui/ImGuiLayer.h
delete mode 100644 easy2d-imgui/ImGuiView.cpp
delete mode 100644 easy2d-imgui/ImGuiView.h
delete mode 100644 easy2d-imgui/easy2d-imgui.h
delete mode 100644 easy2d-imgui/imgui_impl_dx11.cpp
delete mode 100644 easy2d-imgui/imgui_impl_dx11.h
delete mode 100644 easy2d-imgui/libs/ImGui/LICENSE.txt
delete mode 100644 easy2d-imgui/libs/ImGui/imconfig.h
delete mode 100644 easy2d-imgui/libs/ImGui/imgui.cpp
delete mode 100644 easy2d-imgui/libs/ImGui/imgui.h
delete mode 100644 easy2d-imgui/libs/ImGui/imgui_demo.cpp
delete mode 100644 easy2d-imgui/libs/ImGui/imgui_draw.cpp
delete mode 100644 easy2d-imgui/libs/ImGui/imgui_internal.h
delete mode 100644 easy2d-imgui/libs/ImGui/imgui_widgets.cpp
delete mode 100644 easy2d-imgui/libs/ImGui/imstb_rectpack.h
delete mode 100644 easy2d-imgui/libs/ImGui/imstb_textedit.h
delete mode 100644 easy2d-imgui/libs/ImGui/imstb_truetype.h
delete mode 100644 easy2d/2d/Action.cpp
delete mode 100644 easy2d/2d/Action.h
delete mode 100644 easy2d/2d/ActionGroup.cpp
delete mode 100644 easy2d/2d/ActionGroup.h
delete mode 100644 easy2d/2d/ActionHelper.h
delete mode 100644 easy2d/2d/ActionManager.cpp
delete mode 100644 easy2d/2d/ActionManager.h
delete mode 100644 easy2d/2d/ActionTween.cpp
delete mode 100644 easy2d/2d/ActionTween.h
delete mode 100644 easy2d/2d/Animation.cpp
delete mode 100644 easy2d/2d/Animation.h
delete mode 100644 easy2d/2d/Canvas.cpp
delete mode 100644 easy2d/2d/Canvas.h
delete mode 100644 easy2d/2d/Color.cpp
delete mode 100644 easy2d/2d/Color.h
delete mode 100644 easy2d/2d/DebugNode.cpp
delete mode 100644 easy2d/2d/DebugNode.h
delete mode 100644 easy2d/2d/Font.hpp
delete mode 100644 easy2d/2d/Frames.cpp
delete mode 100644 easy2d/2d/Frames.h
delete mode 100644 easy2d/2d/Geometry.cpp
delete mode 100644 easy2d/2d/Geometry.h
delete mode 100644 easy2d/2d/GeometryNode.cpp
delete mode 100644 easy2d/2d/GeometryNode.h
delete mode 100644 easy2d/2d/Image.cpp
delete mode 100644 easy2d/2d/Image.h
delete mode 100644 easy2d/2d/Layer.cpp
delete mode 100644 easy2d/2d/Layer.h
delete mode 100644 easy2d/2d/Node.cpp
delete mode 100644 easy2d/2d/Node.h
delete mode 100644 easy2d/2d/Scene.cpp
delete mode 100644 easy2d/2d/Scene.h
delete mode 100644 easy2d/2d/Sprite.cpp
delete mode 100644 easy2d/2d/Sprite.h
delete mode 100644 easy2d/2d/Text.cpp
delete mode 100644 easy2d/2d/Text.h
delete mode 100644 easy2d/2d/TextStyle.hpp
delete mode 100644 easy2d/2d/Transform.hpp
delete mode 100644 easy2d/2d/Transition.cpp
delete mode 100644 easy2d/2d/Transition.h
delete mode 100644 easy2d/2d/include-forwards.h
delete mode 100644 easy2d/Easy2D.vcxproj
delete mode 100644 easy2d/Easy2D.vcxproj.filters
delete mode 100644 easy2d/base/Component.h
delete mode 100644 easy2d/base/Event.hpp
delete mode 100644 easy2d/base/EventDispatcher.cpp
delete mode 100644 easy2d/base/EventDispatcher.h
delete mode 100644 easy2d/base/EventListener.cpp
delete mode 100644 easy2d/base/EventListener.h
delete mode 100644 easy2d/base/Input.cpp
delete mode 100644 easy2d/base/Input.h
delete mode 100644 easy2d/base/Object.cpp
delete mode 100644 easy2d/base/Object.h
delete mode 100644 easy2d/base/RefCounter.hpp
delete mode 100644 easy2d/base/Resource.cpp
delete mode 100644 easy2d/base/Resource.h
delete mode 100644 easy2d/base/SmartPtr.hpp
delete mode 100644 easy2d/base/Timer.cpp
delete mode 100644 easy2d/base/Timer.h
delete mode 100644 easy2d/base/TimerManager.cpp
delete mode 100644 easy2d/base/TimerManager.h
delete mode 100644 easy2d/base/keys.hpp
delete mode 100644 easy2d/base/logs.cpp
delete mode 100644 easy2d/base/logs.h
delete mode 100644 easy2d/base/time.cpp
delete mode 100644 easy2d/base/time.h
delete mode 100644 easy2d/base/window.cpp
delete mode 100644 easy2d/base/window.h
delete mode 100644 easy2d/common/Array.h
delete mode 100644 easy2d/common/ComPtr.hpp
delete mode 100644 easy2d/common/IntrusiveList.hpp
delete mode 100644 easy2d/common/IntrusivePtr.hpp
delete mode 100644 easy2d/common/Json.h
delete mode 100644 easy2d/common/Singleton.hpp
delete mode 100644 easy2d/common/String.h
delete mode 100644 easy2d/common/closure.hpp
delete mode 100644 easy2d/common/helper.h
delete mode 100644 easy2d/common/noncopyable.hpp
delete mode 100644 easy2d/config.h
delete mode 100644 easy2d/easy2d.h
delete mode 100644 easy2d/macros.h
delete mode 100644 easy2d/math/Matrix.hpp
delete mode 100644 easy2d/math/Rect.hpp
delete mode 100644 easy2d/math/Vec2.hpp
delete mode 100644 easy2d/math/constants.hpp
delete mode 100644 easy2d/math/ease.hpp
delete mode 100644 easy2d/math/helper.h
delete mode 100644 easy2d/math/rand.h
delete mode 100644 easy2d/math/scalar.hpp
delete mode 100644 easy2d/platform/Application.cpp
delete mode 100644 easy2d/platform/Application.h
delete mode 100644 easy2d/platform/modules.cpp
delete mode 100644 easy2d/platform/modules.h
delete mode 100644 easy2d/renderer/D2DDeviceResources.cpp
delete mode 100644 easy2d/renderer/D2DDeviceResources.h
delete mode 100644 easy2d/renderer/D3D10DeviceResources.cpp
delete mode 100644 easy2d/renderer/D3D10DeviceResources.h
delete mode 100644 easy2d/renderer/D3D11DeviceResources.cpp
delete mode 100644 easy2d/renderer/D3D11DeviceResources.h
delete mode 100644 easy2d/renderer/DeviceResources.h
delete mode 100644 easy2d/renderer/TextRenderer.cpp
delete mode 100644 easy2d/renderer/TextRenderer.h
delete mode 100644 easy2d/renderer/helper.hpp
delete mode 100644 easy2d/renderer/render.cpp
delete mode 100644 easy2d/renderer/render.h
delete mode 100644 easy2d/ui/Button.cpp
delete mode 100644 easy2d/ui/Button.h
delete mode 100644 easy2d/ui/Menu.cpp
delete mode 100644 easy2d/ui/Menu.h
delete mode 100644 easy2d/utils/DataUtil.cpp
delete mode 100644 easy2d/utils/DataUtil.h
delete mode 100644 easy2d/utils/File.cpp
delete mode 100644 easy2d/utils/File.h
delete mode 100644 easy2d/utils/Path.cpp
delete mode 100644 easy2d/utils/Path.h
delete mode 100644 easy2d/utils/ResLoader.cpp
delete mode 100644 easy2d/utils/ResLoader.h
diff --git a/easy2d-audio/Easy2D-Audio.vcxproj b/easy2d-audio/Easy2D-Audio.vcxproj
deleted file mode 100644
index 2a78cd1b..00000000
--- a/easy2d-audio/Easy2D-Audio.vcxproj
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {5D45F66B-BECD-4909-BCFC-C0F3CED9D0A2}
- Easy2D-Audio
-
-
-
- StaticLibrary
- true
- Unicode
-
-
- StaticLibrary
- false
- true
- Unicode
-
-
- StaticLibrary
- true
- Unicode
-
-
- StaticLibrary
- false
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- true
- ../Easy2D
-
-
- Windows
- true
-
-
-
-
-
-
- Level3
- Disabled
- true
- ../Easy2D
-
-
- Windows
- true
-
-
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ../Easy2D
-
-
- Windows
- true
- true
- true
-
-
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
- ../Easy2D
-
-
- Windows
- true
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/easy2d-audio/Easy2D-Audio.vcxproj.filters b/easy2d-audio/Easy2D-Audio.vcxproj.filters
deleted file mode 100644
index 883e2fa0..00000000
--- a/easy2d-audio/Easy2D-Audio.vcxproj.filters
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/easy2d-audio/Music.cpp b/easy2d-audio/Music.cpp
deleted file mode 100644
index 002a6a1f..00000000
--- a/easy2d-audio/Music.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include "easy2d-audio.h"
-#include "Music.h"
-#include "Transcoder.h"
-
-namespace easy2d
-{
- Music::Music()
- : opened_(false)
- , playing_(false)
- , wave_data_(nullptr)
- , size_(0)
- , voice_(nullptr)
- {
- }
-
- Music::Music(Resource const& res)
- : Music()
- {
- Load(res);
- }
-
- Music::~Music()
- {
- Close();
- }
-
- bool Music::Load(Resource const& res)
- {
- if (opened_)
- {
- Close();
- }
-
- HRESULT hr = S_OK;
- Transcoder transcoder;
-
- if (res.IsFileType())
- {
- if (!modules::Shlwapi::Get().PathFileExistsW(res.GetFileName().c_str()))
- {
- E2D_WARNING_LOG(L"Media file '%s' not found", res.GetFileName().c_str());
- return false;
- }
- hr = transcoder.LoadMediaFile(res.GetFileName(), &wave_data_, &size_);
- }
- else
- {
- hr = transcoder.LoadMediaResource(res, &wave_data_, &size_);
- }
-
- if (FAILED(hr))
- {
- E2D_ERROR_LOG(L"Load media file failed with HRESULT of %08X", hr);
- return false;
- }
-
- hr = Audio::Instance().CreateVoice(voice_, transcoder.GetWaveFormatEx());
- if (FAILED(hr))
- {
- if (wave_data_)
- {
- delete[] wave_data_;
- wave_data_ = nullptr;
- }
- E2D_ERROR_LOG(L"Create source voice failed with HRESULT of %08X", hr);
- return false;
- }
-
- opened_ = true;
- return true;
- }
-
- bool Music::Play(int loop_count)
- {
- if (!opened_)
- {
- E2D_ERROR_LOG(L"Music must be opened first!");
- return false;
- }
-
- UINT32 buffers_queued = 0;
- voice_.GetBuffersQueued(&buffers_queued);
- if (buffers_queued)
- Stop();
-
- if (loop_count < 0)
- loop_count = XAUDIO2_LOOP_INFINITE;
- else
- loop_count = std::min(loop_count, XAUDIO2_LOOP_INFINITE - 1);
-
- HRESULT hr = voice_.Play(wave_data_, size_, static_cast(loop_count));
- if (FAILED(hr))
- {
- E2D_ERROR_LOG(L"Submitting source buffer failed with HRESULT of %08X", hr);
- }
-
- playing_ = SUCCEEDED(hr);
-
- return playing_;
- }
-
- void Music::Pause()
- {
- if (SUCCEEDED(voice_.Pause()))
- playing_ = false;
- }
-
- void Music::Resume()
- {
- if (SUCCEEDED(voice_.Resume()))
- playing_ = true;
- }
-
- void Music::Stop()
- {
- if (SUCCEEDED(voice_.Stop()))
- playing_ = false;
- }
-
- void Music::Close()
- {
- voice_.Destroy();
-
- if (wave_data_)
- {
- delete[] wave_data_;
- wave_data_ = nullptr;
- }
-
- opened_ = false;
- playing_ = false;
- }
-
- bool Music::IsPlaying() const
- {
- if (opened_)
- {
- UINT32 buffers_queued = 0;
- voice_.GetBuffersQueued(&buffers_queued);
- if (buffers_queued && playing_)
- return true;
- }
- return false;
- }
-
- float Music::GetVolume() const
- {
- float volume = 0.f;
- voice_.GetVolume(&volume);
- return volume;
- }
-
- bool Music::SetVolume(float volume)
- {
- return SUCCEEDED(voice_.SetVolume(volume));
- }
-}
\ No newline at end of file
diff --git a/easy2d-audio/Music.h b/easy2d-audio/Music.h
deleted file mode 100644
index 50db0a5a..00000000
--- a/easy2d-audio/Music.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include "Voice.h"
-
-namespace easy2d
-{
- E2D_DECLARE_SMART_PTR(Music);
-
- // ÒôÀÖ¶ÔÏó
- class E2D_API Music
- : public virtual Object
- {
- public:
- Music();
-
- Music(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- virtual ~Music();
-
- // ´ò¿ªÒôÀÖ×ÊÔ´
- bool Load(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // ²¥·Å
- bool Play(
- int loop_count = 0 /* ²¥·ÅÑ»·´ÎÊý (-1 Ϊѻ·²¥·Å) */
- );
-
- // ÔÝÍ£
- void Pause();
-
- // ¼ÌÐø
- void Resume();
-
- // ֹͣ
- void Stop();
-
- // ¹Ø±Õ²¢»ØÊÕ×ÊÔ´
- void Close();
-
- // ÊÇ·ñÕýÔÚ²¥·Å
- bool IsPlaying() const;
-
- // »ñÈ¡ÒôÁ¿
- float GetVolume() const;
-
- // ÉèÖÃÒôÁ¿
- bool SetVolume(
- float volume /* 1 ΪÔʼÒôÁ¿, ´óÓÚ 1 Ϊ·Å´óÒôÁ¿, 0 Ϊ×îСÒôÁ¿ */
- );
-
- protected:
- bool opened_;
- bool playing_;
- UINT32 size_;
- BYTE* wave_data_;
- Voice voice_;
- };
-}
diff --git a/easy2d-audio/Player.cpp b/easy2d-audio/Player.cpp
deleted file mode 100644
index e49e2469..00000000
--- a/easy2d-audio/Player.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include "easy2d-audio.h"
-#include "Player.h"
-
-namespace easy2d
-{
- Player::Player()
- : volume_(1.f)
- {
- }
-
- Player::~Player()
- {
- ClearCache();
- }
-
- bool Player::Load(Resource const& res)
- {
- size_t hash_code = res.GetHashCode();
- if (musics_cache_.end() != musics_cache_.find(hash_code))
- return true;
-
- MusicPtr music = new (std::nothrow) Music();
-
- if (music)
- {
- if (music->Load(res))
- {
- music->SetVolume(volume_);
- musics_cache_.insert(std::make_pair(hash_code, music));
- return true;
- }
- }
- return false;
- }
-
- bool Player::Play(Resource const& res, int loop_count)
- {
- if (Load(res))
- {
- size_t hash_code = res.GetHashCode();
- auto music = musics_cache_[hash_code];
- if (music->Play(loop_count))
- {
- return true;
- }
- }
- return false;
- }
-
- void Player::Pause(Resource const& res)
- {
- size_t hash_code = res.GetHashCode();
- if (musics_cache_.end() != musics_cache_.find(hash_code))
- musics_cache_[hash_code]->Pause();
- }
-
- void Player::Resume(Resource const& res)
- {
- size_t hash_code = res.GetHashCode();
- if (musics_cache_.end() != musics_cache_.find(hash_code))
- musics_cache_[hash_code]->Resume();
- }
-
- void Player::Stop(Resource const& res)
- {
- size_t hash_code = res.GetHashCode();
- if (musics_cache_.end() != musics_cache_.find(hash_code))
- musics_cache_[hash_code]->Stop();
- }
-
- bool Player::IsPlaying(Resource const& res)
- {
- size_t hash_code = res.GetHashCode();
- if (musics_cache_.end() != musics_cache_.find(hash_code))
- return musics_cache_[hash_code]->IsPlaying();
- return false;
- }
-
- float Player::GetVolume() const
- {
- return volume_;
- }
-
- void Player::SetVolume(float volume)
- {
- volume_ = std::min(std::max(volume, -224.f), 224.f);
- for (const auto& pair : musics_cache_)
- {
- pair.second->SetVolume(volume_);
- }
- }
-
- void Player::PauseAll()
- {
- for (const auto& pair : musics_cache_)
- {
- pair.second->Pause();
- }
- }
-
- void Player::ResumeAll()
- {
- for (const auto& pair : musics_cache_)
- {
- pair.second->Resume();
- }
- }
-
- void Player::StopAll()
- {
- for (const auto& pair : musics_cache_)
- {
- pair.second->Stop();
- }
- }
-
- void Player::ClearCache()
- {
- musics_cache_.clear();
- }
-}
\ No newline at end of file
diff --git a/easy2d-audio/Player.h b/easy2d-audio/Player.h
deleted file mode 100644
index 004310b9..00000000
--- a/easy2d-audio/Player.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-
-namespace easy2d
-{
- E2D_DECLARE_SMART_PTR(Player);
-
- // ÒôÀÖ²¥·ÅÆ÷
- class E2D_API Player
- : protected Object
- {
- using MusicMap = Map;
-
- public:
- Player();
-
- ~Player();
-
- // Ô¤¼ÓÔØÒôÀÖ×ÊÔ´
- bool Load(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // ²¥·ÅÒôÀÖ
- bool Play(
- Resource const& res, /* ÒôÀÖ×ÊÔ´ */
- int loop_count = 0 /* ²¥·ÅÑ»·´ÎÊý (-1 Ϊѻ·²¥·Å) */
- );
-
- // ÔÝÍ£ÒôÀÖ
- void Pause(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // ¼ÌÐø²¥·ÅÒôÀÖ
- void Resume(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // Í£Ö¹ÒôÀÖ
- void Stop(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // »ñÈ¡ÒôÀÖ²¥·Å״̬
- bool IsPlaying(
- Resource const& res /* ÒôÀÖ×ÊÔ´ */
- );
-
- // »ñÈ¡ÒôÁ¿
- float GetVolume() const;
-
- // ÉèÖÃÒôÁ¿
- void SetVolume(
- float volume /* 1.0 ΪÔʼÒôÁ¿ */
- );
-
- // ÔÝÍ£ËùÓÐÒôÀÖ
- void PauseAll();
-
- // ¼ÌÐø²¥·ÅËùÓÐÒôÀÖ
- void ResumeAll();
-
- // Í£Ö¹ËùÓÐÒôÀÖ
- void StopAll();
-
- // Çå³ý»º´æ
- void ClearCache();
-
- protected:
- float volume_;
- MusicMap musics_cache_;
- };
-}
diff --git a/easy2d-audio/Transcoder.cpp b/easy2d-audio/Transcoder.cpp
deleted file mode 100644
index 710af127..00000000
--- a/easy2d-audio/Transcoder.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#ifndef INITGUID
-# define INITGUID // MFAudioFormat_PCM, MF_MT_MAJOR_TYPE, MF_MT_SUBTYPE, MFMediaType_Audio
-#endif
-
-#include "easy2d-audio.h"
-#include "Transcoder.h"
-#include "audio-modules.h"
-
-namespace easy2d
-{
- Transcoder::Transcoder()
- : wave_format_(nullptr)
- {
- }
-
- Transcoder::~Transcoder()
- {
- if (wave_format_)
- {
- ::CoTaskMemFree(wave_format_);
- wave_format_ = nullptr;
- }
- }
-
- const WAVEFORMATEX* Transcoder::GetWaveFormatEx() const
- {
- return wave_format_;
- }
-
- HRESULT Transcoder::LoadMediaFile(String const& file_path, BYTE** wave_data, UINT32* wave_data_size)
- {
- HRESULT hr = S_OK;
-
- ComPtr reader;
-
- hr = modules::MediaFoundation::Get().MFCreateSourceReaderFromURL(
- file_path.c_str(),
- nullptr,
- &reader
- );
-
- if (SUCCEEDED(hr))
- {
- hr = ReadSource(reader.Get(), wave_data, wave_data_size);
- }
-
- return hr;
- }
-
- HRESULT Transcoder::LoadMediaResource(Resource const& res, BYTE** wave_data, UINT32* wave_data_size)
- {
- HRESULT hr = S_OK;
-
- ComPtr stream;
- ComPtr byte_stream;
- ComPtr reader;
-
- LPVOID buffer;
- DWORD buffer_size;
- if (!res.Load(buffer, buffer_size)) { return false; }
-
- stream = modules::Shlwapi::Get().SHCreateMemStream(
- static_cast(buffer),
- static_cast(buffer_size)
- );
-
- if (stream == nullptr)
- {
- E2D_ERROR_LOG(L"SHCreateMemStream failed");
- return E_OUTOFMEMORY;
- }
-
- if (SUCCEEDED(hr))
- {
- hr = modules::MediaFoundation::Get().MFCreateMFByteStreamOnStream(stream.Get(), &byte_stream);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = modules::MediaFoundation::Get().MFCreateSourceReaderFromByteStream(
- byte_stream.Get(),
- nullptr,
- &reader
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ReadSource(reader.Get(), wave_data, wave_data_size);
- }
-
- return hr;
- }
-
- HRESULT Transcoder::ReadSource(IMFSourceReader* reader, BYTE** wave_data, UINT32* wave_data_size)
- {
- HRESULT hr = S_OK;
- DWORD max_stream_size = 0;
-
- ComPtr partial_type;
- ComPtr uncompressed_type;
-
- hr = modules::MediaFoundation::Get().MFCreateMediaType(&partial_type);
-
- if (SUCCEEDED(hr))
- {
- hr = partial_type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = partial_type->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM);
- }
-
- // ÉèÖà source reader µÄýÌåÀàÐÍ£¬Ëü½«Ê¹ÓúÏÊʵĽâÂëÆ÷È¥½âÂëÕâ¸öÒôƵ
- if (SUCCEEDED(hr))
- {
- hr = reader->SetCurrentMediaType(
- (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM,
- 0,
- partial_type.Get()
- );
- }
-
- // ´Ó IMFMediaType ÖлñÈ¡ WAVEFORMAT ½á¹¹
- if (SUCCEEDED(hr))
- {
- hr = reader->GetCurrentMediaType(
- (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM,
- &uncompressed_type
- );
- }
-
- // Ö¸¶¨ÒôƵÁ÷
- if (SUCCEEDED(hr))
- {
- hr = reader->SetStreamSelection(
- (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM,
- true
- );
- }
-
- // »ñÈ¡ WAVEFORMAT Êý¾Ý
- if (SUCCEEDED(hr))
- {
- UINT32 size = 0;
- hr = modules::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType(
- uncompressed_type.Get(),
- &wave_format_,
- &size,
- (DWORD)MFWaveFormatExConvertFlag_Normal
- );
- }
-
- // ¹ÀËãÒôƵÁ÷´óС
- if (SUCCEEDED(hr))
- {
- PROPVARIANT prop;
- PropVariantInit(&prop);
-
- hr = reader->GetPresentationAttribute(
- (DWORD)MF_SOURCE_READER_MEDIASOURCE,
- MF_PD_DURATION,
- &prop
- );
-
- LONGLONG duration = prop.uhVal.QuadPart;
- max_stream_size = static_cast(
- (duration * wave_format_->nAvgBytesPerSec) / 10000000 + 1
- );
- PropVariantClear(&prop);
- }
-
- // ¶ÁÈ¡ÒôƵÊý¾Ý
- if (SUCCEEDED(hr))
- {
- DWORD flags = 0;
- DWORD position = 0;
- BYTE* data = new (std::nothrow) BYTE[max_stream_size];
-
- ComPtr sample;
- ComPtr buffer;
-
- if (data == nullptr)
- {
- E2D_ERROR_LOG(L"Low memory");
- hr = E_OUTOFMEMORY;
- }
- else
- {
- while (true)
- {
- hr = reader->ReadSample(
- (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM,
- 0,
- nullptr,
- &flags,
- nullptr,
- &sample
- );
-
- if (flags & MF_SOURCE_READERF_ENDOFSTREAM) { break; }
-
- if (sample == nullptr) { continue; }
-
- if (SUCCEEDED(hr))
- {
- hr = sample->ConvertToContiguousBuffer(&buffer);
-
- if (SUCCEEDED(hr))
- {
- BYTE *audio_data = nullptr;
- DWORD sample_buffer_length = 0;
-
- hr = buffer->Lock(
- &audio_data,
- nullptr,
- &sample_buffer_length
- );
-
- if (SUCCEEDED(hr))
- {
- for (DWORD i = 0; i < sample_buffer_length; i++)
- {
- data[position++] = audio_data[i];
- }
- hr = buffer->Unlock();
- }
- }
- buffer = nullptr;
- }
- sample = nullptr;
-
- if (FAILED(hr)) { break; }
- }
-
- if (SUCCEEDED(hr))
- {
- *wave_data = data;
- *wave_data_size = position;
- }
- }
- }
-
- return hr;
- }
-}
\ No newline at end of file
diff --git a/easy2d-audio/Transcoder.h b/easy2d-audio/Transcoder.h
deleted file mode 100644
index dcfa53af..00000000
--- a/easy2d-audio/Transcoder.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include
-#include
-#include
-
-namespace easy2d
-{
- class E2D_API Transcoder
- {
- WAVEFORMATEX* wave_format_;
-
- public:
- Transcoder();
-
- ~Transcoder();
-
- const WAVEFORMATEX* GetWaveFormatEx() const;
-
- HRESULT LoadMediaFile(
- String const& file_path,
- BYTE** wave_data,
- UINT32* wave_data_size
- );
-
- HRESULT LoadMediaResource(
- Resource const& res,
- BYTE** wave_data,
- UINT32* wave_data_size
- );
-
- HRESULT ReadSource(
- IMFSourceReader* reader,
- BYTE** wave_data,
- UINT32* wave_data_size
- );
- };
-}
diff --git a/easy2d-audio/Voice.cpp b/easy2d-audio/Voice.cpp
deleted file mode 100644
index 48dd3fe7..00000000
--- a/easy2d-audio/Voice.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include "easy2d-audio.h"
-#include "Voice.h"
-
-namespace easy2d
-{
- Voice::Voice()
- : source_voice_(nullptr)
- {
- }
-
- Voice::Voice(IXAudio2SourceVoice * source_voice)
- : source_voice_(source_voice)
- {
- }
-
- Voice::~Voice()
- {
- Destroy();
-
- Audio::Instance().DeleteVoice(this);
- }
-
- HRESULT Voice::Play(const BYTE * wave_data, UINT32 data_size, UINT32 loop_count)
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- XAUDIO2_BUFFER buffer = { 0 };
- buffer.pAudioData = wave_data;
- buffer.Flags = XAUDIO2_END_OF_STREAM;
- buffer.AudioBytes = data_size;
- buffer.LoopCount = loop_count;
-
- HRESULT hr = source_voice_->SubmitSourceBuffer(&buffer);
- if (SUCCEEDED(hr))
- {
- hr = source_voice_->Start();
- }
- return hr;
- }
-
- HRESULT Voice::Pause()
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- return source_voice_->Stop();
- }
-
- HRESULT Voice::Resume()
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- return source_voice_->Start();
- }
-
- HRESULT Voice::Stop()
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- HRESULT hr = source_voice_->Stop();
- if (SUCCEEDED(hr))
- {
- hr = source_voice_->ExitLoop();
- }
-
- if (SUCCEEDED(hr))
- {
- hr = source_voice_->FlushSourceBuffers();
- }
- return hr;
- }
-
- HRESULT Voice::GetVolume(float * volume) const
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- if (volume == nullptr)
- return E_POINTER;
-
- source_voice_->GetVolume(volume);
- return S_OK;
- }
-
- HRESULT Voice::SetVolume(float volume)
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- volume = std::min(std::max(volume, -224.f), 224.f);
- return source_voice_->SetVolume(volume);
- }
-
- HRESULT Voice::GetBuffersQueued(UINT32 * queued) const
- {
- if (!source_voice_)
- return E_UNEXPECTED;
-
- if (queued == nullptr)
- return E_POINTER;
-
- XAUDIO2_VOICE_STATE state;
- source_voice_->GetState(&state);
- *queued = state.BuffersQueued;
- return S_OK;
- }
-
- void Voice::Destroy()
- {
- if (source_voice_)
- {
- source_voice_->Stop();
- source_voice_->FlushSourceBuffers();
- source_voice_->DestroyVoice();
- source_voice_ = nullptr;
- }
- }
-
- void Voice::SetSourceVoice(IXAudio2SourceVoice * source_voice)
- {
- Destroy();
- source_voice_ = source_voice;
- }
-
-}
\ No newline at end of file
diff --git a/easy2d-audio/Voice.h b/easy2d-audio/Voice.h
deleted file mode 100644
index ce6cd830..00000000
--- a/easy2d-audio/Voice.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include
-
-namespace easy2d
-{
- class E2D_API Voice
- : protected Noncopyable
- {
- public:
- Voice();
-
- Voice(
- IXAudio2SourceVoice* source_voice
- );
-
- ~Voice();
-
- HRESULT Play(
- const BYTE* wave_data,
- UINT32 data_size,
- UINT32 loop_count
- );
-
- HRESULT Pause();
-
- HRESULT Resume();
-
- HRESULT Stop();
-
- HRESULT GetVolume(
- float* volume
- ) const;
-
- HRESULT SetVolume(
- float volume
- );
-
- HRESULT GetBuffersQueued(
- UINT32* queued
- ) const;
-
- void Destroy();
-
- void SetSourceVoice(
- IXAudio2SourceVoice* source_voice
- );
-
- protected:
- IXAudio2SourceVoice* source_voice_;
- };
-
-}
diff --git a/easy2d-audio/audio-modules.cpp b/easy2d-audio/audio-modules.cpp
deleted file mode 100644
index 983f9aa5..00000000
--- a/easy2d-audio/audio-modules.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include "easy2d-audio.h"
-#include "audio-modules.h"
-
-namespace easy2d
-{
- namespace modules
- {
- XAudio2::XAudio2()
- {
- const auto xaudio2_dll_names =
- {
- L"xaudio2_9.dll", // for Windows 10
- L"xaudio2_8.dll", // for Windows 8
- L"xaudio2_7.dll" // for DirectX SDK
- };
-
- for (const auto& name : xaudio2_dll_names)
- {
- xaudio2 = LoadLibraryW(name);
- if (xaudio2)
- {
- XAudio2Create = (PFN_XAudio2Create)
- GetProcAddress(xaudio2, "XAudio2Create");
- break;
- }
- }
-
- if (!xaudio2)
- {
- E2D_ERROR_LOG(L"Load xaudio2.dll failed");
- throw std::runtime_error("Load xaudio2.dll failed");
- }
- }
-
- MediaFoundation::MediaFoundation()
- {
- mfplat = LoadLibraryW(L"Mfplat.dll");
- if (mfplat)
- {
- MFStartup = (PFN_MFStartup)
- GetProcAddress(mfplat, "MFStartup");
-
- MFShutdown = (PFN_MFShutdown)
- GetProcAddress(mfplat, "MFShutdown");
-
- MFCreateMediaType = (PFN_MFCreateMediaType)
- GetProcAddress(mfplat, "MFCreateMediaType");
-
- MFCreateWaveFormatExFromMFMediaType = (PFN_MFCreateWaveFormatExFromMFMediaType)
- GetProcAddress(mfplat, "MFCreateWaveFormatExFromMFMediaType");
-
- MFCreateMFByteStreamOnStream = (PFN_MFCreateMFByteStreamOnStream)
- GetProcAddress(mfplat, "MFCreateMFByteStreamOnStream");
- }
- else
- {
- E2D_LOG(L"Load Mfplat.dll failed");
- throw std::runtime_error("Load Mfplat.dll failed");
- }
-
- mfreadwrite = LoadLibraryW(L"Mfreadwrite.dll");
- if (mfreadwrite)
- {
- MFCreateSourceReaderFromURL = (PFN_MFCreateSourceReaderFromURL)
- GetProcAddress(mfreadwrite, "MFCreateSourceReaderFromURL");
-
- MFCreateSourceReaderFromByteStream = (PFN_MFCreateSourceReaderFromByteStream)
- GetProcAddress(mfreadwrite, "MFCreateSourceReaderFromByteStream");
- }
- else
- {
- E2D_LOG(L"Load Mfreadwrite.dll failed");
- throw std::runtime_error("Load Mfreadwrite.dll failed");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/easy2d-audio/audio-modules.h b/easy2d-audio/audio-modules.h
deleted file mode 100644
index 059d1535..00000000
--- a/easy2d-audio/audio-modules.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include
-#include
-#include
-#include
-
-namespace easy2d
-{
- namespace modules
- {
- class E2D_API XAudio2
- {
- XAudio2();
-
- HMODULE xaudio2;
-
- // XAudio2 functions
- typedef HRESULT(WINAPI *PFN_XAudio2Create)(IXAudio2**, UINT32, XAUDIO2_PROCESSOR);
-
- public:
- static inline XAudio2& Get()
- {
- static XAudio2 instance;
- return instance;
- }
-
- PFN_XAudio2Create XAudio2Create;
- };
-
-
- class E2D_API MediaFoundation
- {
- MediaFoundation();
-
- HMODULE mfplat;
- HMODULE mfreadwrite;
-
- // MediaFoundation functions
- typedef HRESULT(WINAPI *PFN_MFStartup)(ULONG, DWORD);
- typedef HRESULT(WINAPI *PFN_MFShutdown)();
- typedef HRESULT(WINAPI *PFN_MFCreateMediaType)(IMFMediaType**);
- typedef HRESULT(WINAPI *PFN_MFCreateWaveFormatExFromMFMediaType)(IMFMediaType*, WAVEFORMATEX**, UINT32*, UINT32);
- typedef HRESULT(WINAPI *PFN_MFCreateSourceReaderFromURL)(LPCWSTR, IMFAttributes*, IMFSourceReader**);
- typedef HRESULT(WINAPI *PFN_MFCreateSourceReaderFromByteStream)(IMFByteStream*, IMFAttributes*, IMFSourceReader**);
- typedef HRESULT(WINAPI *PFN_MFCreateMFByteStreamOnStream)(IStream*, IMFByteStream**);
-
- public:
- static inline MediaFoundation& Get()
- {
- static MediaFoundation instance;
- return instance;
- }
-
- PFN_MFStartup MFStartup;
- PFN_MFShutdown MFShutdown;
- PFN_MFCreateMediaType MFCreateMediaType;
- PFN_MFCreateWaveFormatExFromMFMediaType MFCreateWaveFormatExFromMFMediaType;
- PFN_MFCreateSourceReaderFromURL MFCreateSourceReaderFromURL;
- PFN_MFCreateSourceReaderFromByteStream MFCreateSourceReaderFromByteStream;
- PFN_MFCreateMFByteStreamOnStream MFCreateMFByteStreamOnStream;
- };
- }
-}
diff --git a/easy2d-audio/audio.cpp b/easy2d-audio/audio.cpp
deleted file mode 100644
index 233b1bd9..00000000
--- a/easy2d-audio/audio.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#include "easy2d-audio.h"
-#include "audio.h"
-#include "audio-modules.h"
-
-namespace easy2d
-{
- Audio::Audio()
- : x_audio2_(nullptr)
- , mastering_voice_(nullptr)
- {
- }
-
- Audio::~Audio()
- {
- }
-
- void Audio::SetupComponent(Application*)
- {
- E2D_LOG(L"Creating audio resources");
-
- HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL);
-
- if (SUCCEEDED(hr))
- {
- hr = modules::XAudio2::Get().XAudio2Create(&x_audio2_, 0, XAUDIO2_DEFAULT_PROCESSOR);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = x_audio2_->CreateMasteringVoice(&mastering_voice_);
- }
-
- ThrowIfFailed(hr);
- }
-
- void Audio::DestroyComponent()
- {
- E2D_LOG(L"Destroying audio resources");
-
- ClearVoiceCache();
-
- if (mastering_voice_)
- {
- mastering_voice_->DestroyVoice();
- mastering_voice_ = nullptr;
- }
-
- if (x_audio2_)
- {
- x_audio2_->Release();
- x_audio2_ = nullptr;
- }
-
- modules::MediaFoundation::Get().MFShutdown();
- }
-
- HRESULT Audio::CreateVoice(Voice& voice, const WAVEFORMATEX* wfx)
- {
- HRESULT hr;
- IXAudio2SourceVoice* source_voice;
-
- hr = x_audio2_->CreateSourceVoice(&source_voice, wfx, 0, XAUDIO2_DEFAULT_FREQ_RATIO);
- if (SUCCEEDED(hr))
- {
- voice.SetSourceVoice(source_voice);
- voice_cache_.insert(&voice);
- }
- return hr;
- }
-
- void Audio::DeleteVoice(Voice* voice)
- {
- voice_cache_.erase(voice);
- }
-
- void Audio::ClearVoiceCache()
- {
- for (auto voice : voice_cache_)
- {
- voice->Destroy();
- }
- voice_cache_.clear();
- }
-
- void Audio::Open()
- {
- x_audio2_->StartEngine();
- }
-
- void Audio::Close()
- {
- x_audio2_->StopEngine();
- }
-
-}
\ No newline at end of file
diff --git a/easy2d-audio/audio.h b/easy2d-audio/audio.h
deleted file mode 100644
index 4058042f..00000000
--- a/easy2d-audio/audio.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2016-2018 Easy2D - Nomango
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#pragma once
-#include "Voice.h"
-
-namespace easy2d
-{
- class E2D_API Audio
- : public Singleton