diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-29 21:39:58 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-29 21:39:58 +0300 |
commit | 1982c1020a8b3535b019cb1199010ff696968f62 (patch) | |
tree | 09f7ef5f000efd287086b13d82f2bf92da6ea591 | |
parent | b6984855ca3a0bed2212bf974d4319e11d74b887 (diff) |
Added stub for audio player
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/audio/player.c | 38 | ||||
-rw-r--r-- | src/audio/player.h | 28 |
3 files changed, 69 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d9d69b3..0a54a9eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -103,6 +103,9 @@ set (SOURCES | |||
103 | src/stb_truetype.h | 103 | src/stb_truetype.h |
104 | src/visited.c | 104 | src/visited.c |
105 | src/visited.h | 105 | src/visited.h |
106 | # Audio playback: | ||
107 | src/audio/player.c | ||
108 | src/audio/player.h | ||
106 | # User interface: | 109 | # User interface: |
107 | src/ui/color.c | 110 | src/ui/color.c |
108 | src/ui/color.h | 111 | src/ui/color.h |
diff --git a/src/audio/player.c b/src/audio/player.c new file mode 100644 index 00000000..b68d5ba5 --- /dev/null +++ b/src/audio/player.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
23 | #include "player.h" | ||
24 | |||
25 | #include <the_Foundation/thread.h> | ||
26 | #include <SDL_audio.h> | ||
27 | |||
28 | struct Impl_Player { | ||
29 | SDL_AudioDeviceID device; | ||
30 | }; | ||
31 | |||
32 | void init_Player(iPlayer *d) { | ||
33 | d->device = 0; | ||
34 | } | ||
35 | |||
36 | void deinit_Player(iPlayer *d) { | ||
37 | SDL_CloseAudioDevice(d->device); | ||
38 | } | ||
diff --git a/src/audio/player.h b/src/audio/player.h new file mode 100644 index 00000000..2786f619 --- /dev/null +++ b/src/audio/player.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
23 | #pragma once | ||
24 | |||
25 | #include <the_Foundation/defs.h> | ||
26 | |||
27 | iDeclareType(Player) | ||
28 | iDeclareTypeConstruction(Player) | ||