aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-01 17:58:12 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-01 17:58:12 +0200
commitd61bce260a641de59daedf130768338fb5354ef8 (patch)
treeb86eb1c3d606ff6d67106709e436b96a655d99e4
parent1c6ce7dc4c624b5956a87814d5a7eb37e68d323b (diff)
parentf91594111d9af7082444cbd434d2d52e6bd40700 (diff)
Merge branch 'loek/design'
-rw-r--r--design.tex24
-rw-r--r--img/facade-audio.puml52
-rw-r--r--img/theme.ipuml3
3 files changed, 79 insertions, 0 deletions
diff --git a/design.tex b/design.tex
index c5bd017..1e42c03 100644
--- a/design.tex
+++ b/design.tex
@@ -38,6 +38,30 @@ workflows.
\subsection{Audio}
+\subsubsection{Library}
+
+\subsubsection{Fa\c{c}ade}
+
+\Cref{fig:class-audio-facade} shows a class diagram of the audio fa\c{c}ade. It
+contains the following classes:
+\begin{description}
+ \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{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}
+
+\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}
\subsection{Physics}
diff --git a/img/facade-audio.puml b/img/facade-audio.puml
new file mode 100644
index 0000000..6749915
--- /dev/null
+++ b/img/facade-audio.puml
@@ -0,0 +1,52 @@
+@startuml
+!include theme.ipuml
+skinparam Linetype ortho
+
+
+package crepe {
+ package api {
+ class Resource <<irrelevant>>
+ }
+
+ class Sound {
+ +Sound(resource)
+ --
+ +pause()
+ +play()
+ +rewind()
+ -volume : float <<+set>> <<+get>>
+ -looping : bool <<+set>> <<+get>>
+ --
+ -sample : SoLoud::Wav
+ -handle : SoLoud::handle
+ --
+ -load(resource)
+ }
+
+ class SoundContext <<Singleton>> {
+ -instance() : SoundContext& <<static>>
+ --
+ -SoundContext()
+ -~SoundContext()
+ --
+ -engine : SoLoud::Soloud
+ }
+}
+
+package SoLoud {
+ class Soloud <<irrelevant>>
+ class Wav <<irrelevant>>
+}
+
+' layout
+crepe -[hidden]down- SoLoud
+
+crepe.Sound --> SoLoud.Wav
+crepe.SoundContext --> SoLoud.Soloud
+
+crepe.Sound .> crepe.SoundContext
+crepe.SoundContext .> 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 <<irrelevant>> stereotype
+hide <<irrelevant>> members