Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added audio buffer #486

Merged
merged 21 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Install dependencies on MacOS
if: runner.os == 'macOS'
run: brew install cmake boost sdl2
run: brew install cmake boost openal-soft sdl2

- name: Set up Python ${{ matrix.python-version }} environment
uses: actions/setup-python@v1
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game
- Customizable resolution and rendering parameters,
- Access to the depth buffer (3D vision),
- Automatic labeling game objects visible in the frame,
- Access to the audio buffer (thanks to [Shashank Hegde](https://github.com/hegde95)),
- Off-screen rendering,
- Episodes recording,
- Time scaling in async mode.
Expand Down Expand Up @@ -66,7 +67,7 @@ pip install vizdoom

### macOS
```
brew install cmake boost sdl2
brew install cmake boost openal-soft sdl2
pip install vizdoom
```
(we recommend using at least macOS High Sierra 10.13+ with Python 3.7+)
Expand Down
97 changes: 97 additions & 0 deletions cmake_modules/FindOpenAL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindOpenAL
----------

Finds Open Audio Library (OpenAL).

Projects using this module should use ``#include "al.h"`` to include the OpenAL
header file, **not** ``#include <AL/al.h>``. The reason for this is that the
latter is not entirely portable. Windows/Creative Labs does not by default put
their headers in ``AL/`` and macOS uses the convention ``<OpenAL/al.h>``.

Hints
^^^^^

Environment variable ``$OPENALDIR`` can be used to set the prefix of OpenAL
installation to be found.

By default on macOS, system framework is search first. In other words,
OpenAL is searched in the following order:

1. System framework: ``/System/Library/Frameworks``, whose priority can be
changed via setting the :variable:`CMAKE_FIND_FRAMEWORK` variable.
2. Environment variable ``$OPENALDIR``.
3. System paths.
4. User-compiled framework: ``~/Library/Frameworks``.
5. Manually compiled framework: ``/Library/Frameworks``.
6. Add-on package: ``/opt``.

Result Variables
^^^^^^^^^^^^^^^^

This module defines the following variables:

``OPENAL_FOUND``
If false, do not try to link to OpenAL
``OPENAL_INCLUDE_DIR``
OpenAL include directory
``OPENAL_LIBRARY``
Path to the OpenAL library
``OPENAL_VERSION_STRING``
Human-readable string containing the version of OpenAL
#]=======================================================================]

# For Windows, Creative Labs seems to have added a registry key for their
# OpenAL 1.1 installer. I have added that key to the list of search paths,
# however, the key looks like it could be a little fragile depending on
# if they decide to change the 1.00.0000 nuctory. Currently there is only
# Win32 and I have hardcoded that here. This may need to be adjusted as
# platforms are introduced.
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
# I do not know if the Nvidia OpenAL SDK has a registry key.

SET(CMAKE_FIND_FRAMEWORK LAST)

find_path(OPENAL_INCLUDE_DIR al.h
HINTS
ENV OPENALDIR
PATHS
/opt
/usr/local/opt/openal-soft
~/Library/Frameworks
/Library/Frameworks
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
PATH_SUFFIXES include/AL include/OpenAL include AL OpenAL
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_OpenAL_ARCH_DIR libs/Win64)
else()
set(_OpenAL_ARCH_DIR libs/Win32)
endif()

find_library(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
HINTS
ENV OPENALDIR
PATHS
/opt
/usr/local/opt/openal-soft
~/Library/Frameworks
/Library/Frameworks
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
PATH_SUFFIXES libx32 lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
)

unset(_OpenAL_ARCH_DIR)

find_package_handle_standard_args(
OpenAL
REQUIRED_VARS OPENAL_LIBRARY OPENAL_INCLUDE_DIR
VERSION_VAR OPENAL_VERSION_STRING
)

mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
2 changes: 1 addition & 1 deletion doc/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To get dependencies install [homebrew](https://brew.sh/)

```sh
# ZDoom dependencies and Boost libraries
brew install cmake boost sdl2
brew install cmake boost openal-soft sdl2

# Python 3 dependencies
brew install python3
Expand Down
22 changes: 22 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog


## Changes in 1.1.9

#### Audio buffer
- Added `audio_buffer` to `State` and related methods `is/setAudioBufferEnabled`, `get/setAudioSamplingRate`, `get/setAudioBufferSize`.

#### Save/load methods
- Added `save` and `load` methods that allow to save/load game to/from a file.

#### Misc
- Added `viz_bots_path` CVAR that allows specifying path to custom bots configuration.

---

## Changes in 1.1.8

#### Objects and sectors
Expand All @@ -16,6 +30,7 @@
- Dropped support for Java bindings
- Dropped support for Lua/Torch bindings

---

## Changes in 1.1.7

Expand All @@ -25,6 +40,7 @@
#### CVARS
- Added `VIEW_HEIGHT`, `CAMERA_POSITION_X`/`Y`/`Z`, `CAMERA_ANGLE`, `CAMERA_PITCH`, `CAMERA_ROLL` and `CAMERA_FOV` GameVariables.

---

## Changes in 1.1.6

Expand All @@ -41,6 +57,7 @@
#### Python specific
- Added Python interpreter version check.

---

## Changes in 1.1.5

Expand Down Expand Up @@ -71,6 +88,7 @@
- Fixed minor rendering issue in depth and labels buffer.
- Fixed order of color values in `RGB/BGR` modes of `ScreenFormat`.

---

## Changes in 1.1.4

Expand All @@ -84,6 +102,7 @@
- **Ported Python binding to pybind11 as a replacement for Boost.Python.**
- Fixed problems with `pip install` detecting Python interpreter, includes and libraries from different Python versions.

---

## Changes in 1.1.3

Expand All @@ -108,6 +127,7 @@
#### Windows specific
- Fixed building for Windows 10.

---

## Changes in 1.1.2

Expand All @@ -120,6 +140,7 @@
#### Missing methods
- Added `isRunning`, `isDepthBufferEnabled`, `isLabelsBufferEnabled` and `isAutomapBufferEnabled` missing methods to Python and Lua bindings.

---

## Changes in 1.1.1

Expand All @@ -134,6 +155,7 @@
- Fixed minor memory leak
- Fixed crash when calling `getState` in a terminal state.

---

## Changes in 1.1.0

Expand Down
6 changes: 5 additions & 1 deletion doc/ConfigFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ A violation of any of these rules will result in ignoring **only** the line with
Each list assignment (**KEY = { VALUES }**)clears values specified for this key before (in other configuration files or in the code). That is why the **append operator(*KEY += { VALUES })** is available. This way you can more easily combine multiple configuration files and tinker in code.

### <a name="config_keys"></a> Supported configuration keys:
* `audioBufferEnabled/audio_buffer_enabled`
* `audioBufferSize/audio_buffer_size`
* `audioSamplingRate/audio_samping_rate`
* `automapBufferEnabled/automap_buffer_enabled`
* `automapMode/set_automap_mode`
* `automapMode/automap_mode`
* `automapRenderTextures/automap_render_textures`
* `automapRotate/automap_rotate`
* `availableButtons/available_buttons` (list)
Expand Down Expand Up @@ -60,6 +63,7 @@ Each list assignment (**KEY = { VALUES }**)clears values specified for this key
* `ViZDoomPath/vizdoom_path`
* `windowVisible/window_visible`


See also: [`DoomGame`](DoomGame.md) for config keys and functions related to them.


Expand Down
Loading