Skip to content

Commit

Permalink
Merge pull request #589 from novelrt/feature/audio-rework-v2.1
Browse files Browse the repository at this point in the history
Move Audio to new header format
  • Loading branch information
RubyNova authored Jul 2, 2023
2 parents b78f194 + cb9c362 commit 8cf5352
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 18 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ endif()
add_subdirectory(thirdparty)
add_subdirectory(resources)
add_subdirectory(graphics)
add_subdirectory(audio)
add_subdirectory(src)

if(NOVELRT_BUILD_SAMPLES)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root
// for more information.

#include <NovelRT/Audio/Audio.h>
#include <sndfile.h>
#include <NovelRT/Audio/Audio.hpp>

namespace NovelRT::Audio
{
Expand Down
58 changes: 58 additions & 0 deletions audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
add_library(NovelRT-Audio STATIC
AudioService.cpp
)

target_sources(NovelRT-Audio
PUBLIC
FILE_SET public_headers
TYPE HEADERS
BASE_DIRS include
FILES
include/NovelRT/Audio/Audio.hpp
include/NovelRT/Audio/AudioService.hpp
)

set_target_properties(NovelRT-Audio
PROPERTIES
EXPORT_NAME Audio
POSITION_INDEPENDENT_CODE ON
)

target_compile_features(NovelRT-Audio
PUBLIC
cxx_std_17
)

target_compile_options(NovelRT-Audio
PRIVATE
$<$<CXX_COMPILER_ID:GNU>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wabi>
$<$<CXX_COMPILER_ID:GNU>:-Werror>
$<$<CXX_COMPILER_ID:GNU>:-Wextra>
$<$<CXX_COMPILER_ID:GNU>:-Wpedantic>
$<$<CXX_COMPILER_ID:GNU>:-pedantic-errors>

$<$<CXX_COMPILER_ID:Clang>:-Wall>
$<$<CXX_COMPILER_ID:Clang>:-Werror>
$<$<CXX_COMPILER_ID:Clang>:-Wextra>
$<$<CXX_COMPILER_ID:Clang>:-Wpedantic>
$<$<CXX_COMPILER_ID:Clang>:-pedantic-errors>

$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<CXX_COMPILER_ID:MSVC>:/WX>
$<$<CXX_COMPILER_ID:MSVC>:/permissive->
)

target_include_directories(NovelRT-Audio PRIVATE "$<TARGET_PROPERTY:Engine,INCLUDE_DIRECTORIES>")
target_link_libraries(NovelRT-Audio
PUBLIC
spdlog
OpenAL
)

install(
TARGETS NovelRT-Audio
EXPORT NovelRTConfig
LIBRARY DESTINATION lib
FILE_SET public_headers DESTINATION include
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#define NOVELRT_AUDIO_H

// Dependencies for Audio
#include "../Exceptions/Exceptions.h"
#include "../LoggingService.h"
#include "../Utilities/Lazy.h"
#include "../Utilities/Misc.h"
#include <NovelRT/Exceptions/Exceptions.h>
#include <NovelRT/LoggingService.h>
#include <NovelRT/Utilities/Lazy.h>
#include <NovelRT/Utilities/Misc.h>
#include <AL/al.h>
#include <AL/alc.h>
#include <cstdint>
Expand All @@ -26,6 +26,6 @@ namespace NovelRT::Audio
}

// Audio Types
#include "AudioService.h"
#include <NovelRT/Audio/AudioService.hpp>

#endif // NOVELRT_AUDIO_H
File renamed without changes.
2 changes: 1 addition & 1 deletion include/NovelRT/Ecs/Audio/Ecs.Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#error NovelRT does not support including types explicitly by default. Please include Ecs.h instead for the Ecs namespace subset.
#endif

#include "../../Audio/Audio.h"
#include "../../Timing/StepTimer.h"
#include "../../Timing/Timestamp.h"
#include <NovelRT/Audio/Audio.hpp>
#include <chrono>
#include <map>

Expand Down
2 changes: 1 addition & 1 deletion include/NovelRT/Ecs/Ecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ namespace NovelRT::Ecs
#include "Catalogue.h"
#include "SystemScheduler.h"
#include "UnsafeComponentView.h"
#include "Graphics/Ecs.Graphics.h"
#include "Audio/Ecs.Audio.h"
#include "Graphics/Ecs.Graphics.h"
#include "Input/Ecs.Input.h"
#include "Narrative/Ecs.Narrative.h"
#include "Configurator.h"
Expand Down
2 changes: 2 additions & 0 deletions include/NovelRT/LoggingService.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#pragma warning(disable : 4275)
#endif

#include "Exceptions/Exceptions.h"
#include "Utilities/Misc.h"
#include <spdlog/async.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
Expand Down
6 changes: 0 additions & 6 deletions include/NovelRT/NovelRT.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
#include <NovelRT/LoggingService.h>
#include <NovelRT/Timing/StepTimer.h>

// Audio types
#include <NovelRT/Audio/Audio.h>

// ECS types
#include <NovelRT/Ecs/Ecs.h>

Expand Down Expand Up @@ -127,9 +124,6 @@
#include <NovelRT/ResourceManagement/ResourceManagement.h>
#include <NovelRT/ResourceManagement/Desktop/ResourceManagement.Desktop.h>

// Engine service types
#include <NovelRT/Audio/AudioService.h>

// Scene Graph types
#include <NovelRT/SceneGraph/SceneGraph.h>
#endif // __cplusplus
Expand Down
3 changes: 1 addition & 2 deletions src/NovelRT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ set(CORE_SOURCES
LoggingService.cpp
EngineConfig.cpp

Audio/AudioService.cpp

Ecs/Catalogue.cpp
Ecs/ComponentBufferMemoryContainer.cpp
Ecs/ComponentCache.cpp
Expand Down Expand Up @@ -86,6 +84,7 @@ target_link_libraries(Engine
opus
ogg
NovelRT-Graphics
NovelRT-Audio
)

if(NOVELRT_INSTALL)
Expand Down
2 changes: 1 addition & 1 deletion src/NovelRT/LoggingService.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © Matt Jones and Contributors. Licensed under the MIT License (MIT). See LICENCE.md in the repository root
// for more information.

#include <NovelRT/NovelRT.h>
#include <NovelRT/LoggingService.h>
#include <iostream>

namespace NovelRT
Expand Down

0 comments on commit 8cf5352

Please sign in to comment.