Skip to content

Commit

Permalink
formatter (#259)
Browse files Browse the repository at this point in the history
* eChannelGroupFormatter

* update version

* code rev

* fix  switch fallthrouh
  • Loading branch information
Raffaello authored Oct 19, 2023
1 parent 30a563b commit 4efc103
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()


project ("sdl2-hyper-sonic-drivers" VERSION 0.12.0 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards")
project ("sdl2-hyper-sonic-drivers" VERSION 0.12.1 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards")
include (TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(IS_BIG_ENDIAN)
Expand Down
41 changes: 41 additions & 0 deletions sdl2-hyper-sonic-drivers/src/std/eChannelGroupFormatter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma once

#include <string>
#include <format>
#include <HyperSonicDrivers/audio/mixer/ChannelGroup.hpp>

namespace std
{
template<>
struct formatter<HyperSonicDrivers::audio::mixer::eChannelGroup> : formatter<string_view>
{
template<typename FormatContext>
auto format(HyperSonicDrivers::audio::mixer::eChannelGroup ch_group, FormatContext& fc) const
{
string str;

switch (ch_group)
{
using enum HyperSonicDrivers::audio::mixers::eChannelGroup;

case Plain:
str = "Plain";
break;
case Music:
str = "Music";
break;
case Sfx:
str = "Sfx";
break;
case Speech:
str = "Speech";
break;
case Unknown:
str = "Unknown";
break;
}

return formatter<std::string_view>::format(str, fc);
}
};
}

0 comments on commit 4efc103

Please sign in to comment.