From 59b2541ea882e360b6ba9c724f238e545a9aa4fe Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 26 Sep 2024 16:16:31 +0200 Subject: add WIP audio facade --- design.tex | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 design.tex (limited to 'design.tex') diff --git a/design.tex b/design.tex new file mode 100644 index 0000000..bfc49ad --- /dev/null +++ b/design.tex @@ -0,0 +1,10 @@ +\documentclass{projdoc} + +\title{Software Design} + +\begin{document} + +\includepumldiag{img/facade-audio.puml} + +\end{document} + -- cgit v1.2.3 From 44da8d4f03be549ddb8b56941e6ab7c3eaca5eca Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 29 Sep 2024 17:21:36 +0200 Subject: more facade class diagram --- design.tex | 22 +++++++++++++++++++++- img/facade-audio.puml | 38 +++++++++++++++++++++++++++----------- img/theme.ipuml | 3 +++ 3 files changed, 51 insertions(+), 12 deletions(-) (limited to 'design.tex') diff --git a/design.tex b/design.tex index dcde483..9d5f999 100644 --- a/design.tex +++ b/design.tex @@ -38,9 +38,29 @@ workflows. \subsection{Audio} +\subsubsection{Library} + \subsubsection{Fa\c{c}ade} -\includepumldiag{img/facade-audio.puml} +\Cref{fig:class-audio-facade} shows a class diagram of the audio fa\c{c}ade. It +contains the following classes: +\begin{description} + \item[SoundSystem] This is a wrapper around the \codeinline{SoLoud::soloud} + `engine' class, and is therefore implemented as a singleton. This ensures the + audio engine is initialized before \codeinline{Sound} is able to use it. + + This class is friends with \codeinline{Sound}, so only \codeinline{Sound} is able + to get the \codeinline{SoundSystem} instance. + \item[Sound] This is a wrapper around the \codeinline{SoLoud::Wav} class, and uses + cr\^epe's \codeinline{api::Resource} class to load an audio sample instead. +\end{description} + +\begin{figure} + \centering + \includepumldiag{img/facade-audio.puml} + \caption{Audio fa\c{c}ade class diagram} + \label{fig:class-audio-facade} +\end{figure} \subsection{Input} diff --git a/img/facade-audio.puml b/img/facade-audio.puml index f760652..b256f47 100644 --- a/img/facade-audio.puml +++ b/img/facade-audio.puml @@ -4,33 +4,49 @@ skinparam Linetype ortho package crepe { - class Sound { - +Sound(crepe::api::Resource) + package api { + class Resource <> + } + class Sound { + +Sound(resource) + -- +pause() +play() +rewind() +set_volume(float) +set_looping(bool) - - -_handle : SoLoud::handle - -_paused : bool + -- + -sample : SoLoud::Wav + -handle : SoLoud::handle + -- + -load(resource) } - class SoundSystem { - + class SoundSystem <> { + -instance() : SoundSystem& <> + -- + -SoundSystem() + -~SoundSystem() + -- + -engine : SoLoud::Soloud } } package SoLoud { - class Soloud - class Wav + class Soloud <> + class Wav <> } ' layout crepe -[hidden]down- SoLoud -crepe.Sound ..> SoLoud.Wav -crepe.SoundSystem ..> SoLoud.Soloud +crepe.Sound --> SoLoud.Wav +crepe.SoundSystem --> SoLoud.Soloud + +crepe.Sound .> crepe.SoundSystem +crepe.SoundSystem .> crepe.Sound + +crepe.Sound .> crepe.api.Resource @enduml diff --git a/img/theme.ipuml b/img/theme.ipuml index 4e3613e..f716ddf 100644 --- a/img/theme.ipuml +++ b/img/theme.ipuml @@ -8,3 +8,6 @@ skinparam Nodesep 25 skinparam Padding 2 skinparam Ranksep 50 skinparam RoundCorner 0 + +hide <> stereotype +hide <> members -- cgit v1.2.3 From f91594111d9af7082444cbd434d2d52e6bd40700 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 1 Oct 2024 17:57:47 +0200 Subject: rename SoundSystem to SoundContext --- design.tex | 4 ++-- img/facade-audio.puml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'design.tex') diff --git a/design.tex b/design.tex index 9d5f999..1e42c03 100644 --- a/design.tex +++ b/design.tex @@ -45,12 +45,12 @@ workflows. \Cref{fig:class-audio-facade} shows a class diagram of the audio fa\c{c}ade. It contains the following classes: \begin{description} - \item[SoundSystem] This is a wrapper around the \codeinline{SoLoud::soloud} + \item[SoundContext] This is a wrapper around the \codeinline{SoLoud::soloud} `engine' class, and is therefore implemented as a singleton. This ensures the audio engine is initialized before \codeinline{Sound} is able to use it. This class is friends with \codeinline{Sound}, so only \codeinline{Sound} is able - to get the \codeinline{SoundSystem} instance. + to get the \codeinline{SoundContext} instance. \item[Sound] This is a wrapper around the \codeinline{SoLoud::Wav} class, and uses cr\^epe's \codeinline{api::Resource} class to load an audio sample instead. \end{description} diff --git a/img/facade-audio.puml b/img/facade-audio.puml index b256f47..6749915 100644 --- a/img/facade-audio.puml +++ b/img/facade-audio.puml @@ -14,8 +14,8 @@ package crepe { +pause() +play() +rewind() - +set_volume(float) - +set_looping(bool) + -volume : float <<+set>> <<+get>> + -looping : bool <<+set>> <<+get>> -- -sample : SoLoud::Wav -handle : SoLoud::handle @@ -23,11 +23,11 @@ package crepe { -load(resource) } - class SoundSystem <> { - -instance() : SoundSystem& <> + class SoundContext <> { + -instance() : SoundContext& <> -- - -SoundSystem() - -~SoundSystem() + -SoundContext() + -~SoundContext() -- -engine : SoLoud::Soloud } @@ -42,10 +42,10 @@ package SoLoud { crepe -[hidden]down- SoLoud crepe.Sound --> SoLoud.Wav -crepe.SoundSystem --> SoLoud.Soloud +crepe.SoundContext --> SoLoud.Soloud -crepe.Sound .> crepe.SoundSystem -crepe.SoundSystem .> crepe.Sound +crepe.Sound .> crepe.SoundContext +crepe.SoundContext .> crepe.Sound crepe.Sound .> crepe.api.Resource -- cgit v1.2.3 From 443b88053e580a790e2e5e5ecaaf506602bd2ae9 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 7 Oct 2024 13:44:30 +0200 Subject: update time.txt --- design.tex | 2 +- time.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'design.tex') diff --git a/design.tex b/design.tex index 1e42c03..7b232fe 100644 --- a/design.tex +++ b/design.tex @@ -52,7 +52,7 @@ contains the following classes: This class is friends with \codeinline{Sound}, so only \codeinline{Sound} is able to get the \codeinline{SoundContext} instance. \item[Sound] This is a wrapper around the \codeinline{SoLoud::Wav} class, and uses - cr\^epe's \codeinline{api::Resource} class to load an audio sample instead. + cr\^epe's \codeinline{Asset} class to load an audio sample instead. \end{description} \begin{figure} diff --git a/time.txt b/time.txt index 8d748b7..4aca083 100644 --- a/time.txt +++ b/time.txt @@ -59,6 +59,7 @@ loek: 2024-10-04 15m research :: read others' research loek: 2024-10-04 1h15m project meeting loek: 2024-10-05 1h10m refacting :: unify unit tests + update code style loek: 2024-10-06 3h40m implementation :: scripting interface +loek: 2024-10-07 2h45m project meeting max: 2024-09-02 1h project kickoff max: 2024-09-02 45m first project meeting -- cgit v1.2.3