Commit Graph

654 Commits

Author SHA1 Message Date
orbea
2bfbc4d79f cmake: Silence warnings. 2020-09-08 21:18:40 -07:00
LC
8e505ad8d5
Merge pull request #9055 from JosJuice/gc-sample-rate
AudioInterface: Use 32029/48043 Hz in more places
2020-09-07 22:35:00 -04:00
JosJuice
bd44106fec AudioCommon: Get initial sample rates from AudioInterface 2020-09-06 15:37:20 +02:00
Shawn Hoffman
2f47f486af msbuild: re-enable standalone vcxproj processing 2020-08-22 16:17:50 -07:00
Shawn Hoffman
94bf48b67c msbuild: refactor stuff out of project files (for dolphin) 2020-08-22 16:17:50 -07:00
Shawn Hoffman
36ace8eb52 prettify some constructs in vcxproj files 2020-08-22 16:17:50 -07:00
degasus
9fd1385733 Externals: Fix OpenAL include directory. 2020-04-29 13:07:51 +02:00
degasus
239cde8aea Externals: Alter the soundtouch include directory.
We must not provide the /Externals directory as global include directory.
Here, this yield a crash because of external minizip header and system library mismatch.

Soundtouch itself recormends to include it with <SoundTouch.h> and -I/usr/include/soundtouch, so this should fit better.
2020-04-29 11:30:26 +02:00
David Korth
c2dd2e8a2e Use std::istringstream or std::ostringstream instead of std::stringstream where possible.
This removes std::iostream from the inheritance chain, which reduces
overhead slightly.
2019-12-29 23:45:02 -05:00
Stenzek
6fcb1c6c46 Add an ARM64 target to Visual Studio projects 2019-12-28 19:20:41 +10:00
Stenzek
dd23a1ee79 Update VS projects/solutions to VS2019 2019-11-30 13:42:52 +10:00
Lioncash
c792961000 Common: Unify logging namespace with Common
Previously the logging was a in a little bit of a disarray. Some things
were in namespaces, and other things were not.

Given this code will feature a bit of restructuring during the
transition over to fmt, this is a good time to unify it under a single
namespace and also remove functions and types from the global namespace.

Now, all functions and types are under the Common::Log namespace. The
only outliers being, of course, the preprocessor macros.
2019-11-28 05:13:21 -05:00
JosJuice
cf8208ace9 Android: Add audio volume setting 2019-11-26 21:10:27 +01:00
LAGonauta
08787ebc4a Centralize logic to detect when the DPL2 decoder should be used. 2019-11-11 08:03:36 -03:00
LAGonauta
2ff646b796 DSP must be set to LLE to select the decoder 2019-10-22 22:55:59 -03:00
LAGonauta
3c9eb37381 Allow user to change DPLII decoding quality 2019-10-22 22:55:15 -03:00
Stenzek
7c286064b8 AudioCommon: Don't forget to call Init() on fallback 2019-10-10 00:09:16 +10:00
Stenzek
1c5441aa40 AlsaSoundStream: Don't call join() on invalid thread
This can happen if initialization failed.
2019-10-10 00:07:27 +10:00
Michael M
71c3c5626b AudioCommon: if backend is unknown, use default backend 2019-09-14 14:16:13 -07:00
Michael M
0f3695a14b Remove XAudio2
Audio on Windows is provided by the cubeb (shared mode) and WASAPI
(exclusive mode) backends, both of which exhibit lower latency.
2019-09-14 14:08:13 -07:00
QuellaZhang
e67eb4693e
Fix implicit false-to-nullptr conversions 2019-08-15 17:49:57 +02:00
JosJuice
a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
Léo Lam
eed4fcc218
Merge pull request #8135 from lioncash/cmake
CMakeLists: Specify header files in target sources
2019-05-31 14:03:12 +02:00
Lioncash
78e96230b2 AudioCommon: Move static locals into the AudioCommon namespace
Given these are locals, they can be moved out of the global namespace.
While we're at it, turn the constants below it into constexpr variables.
2019-05-31 07:07:16 -04:00
Lioncash
15397e2a89 AudioCommon: Use emplace_back instead of push_back in GetSoundBackends()
Constructs the strings directly within the container instead of
performing a construction, then a copy.

The reasoning is that the BACKEND_* strings are const char arrays, so
the push_back code is equivalent to:

push_back(std::string(BACKEND_WHATEVER)) instead of forwarding the
arguments to a constructed instance directly in the container.
2019-05-31 07:03:54 -04:00
Lioncash
1a56e9d9e0 AudioCommon: Use std::string_view with feature querying functions
Provides the same behavior, but allows passed in strings to be
non-allocating in calling code.
2019-05-31 07:01:47 -04:00
Lioncash
b6d9b85293 AudioCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:52:44 -04:00
spycrab
ec734065db
Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
2019-05-14 21:07:26 +02:00
spycrab
b5160ec685 Common/CMake: Fix Windows build 2019-05-12 00:05:08 +02:00
Miksel12
ee8226cc1b Set Cubeb as default on Windows
Cubeb and Xaudio2 are identical in features while Cubeb has lower
latency and is still actively being worked on.
2019-05-11 14:22:03 +02:00
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
Léo Lam
ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Léo Lam
99a4ca8de7
Merge pull request #7839 from ShFil119/impr/redundant
Remove redundant initialization
2019-05-04 22:50:51 +02:00
Filip Gawin
c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
Jordan Woyak
d34a9afe04 Minor changes to usages of std::condition_variable. 2019-04-06 17:39:25 -05:00
LAGonauta
99a35568ca Allow XAudio2 to be selected as a surround backend. 2019-03-18 09:21:40 -03:00
LAGonauta
f37ff190e4 Added DPL2 decoder to XAudio2 and XAudio2_7 backends. 2019-03-18 09:06:41 -03:00
LAGonauta
c209d07c96 Removed FFDShow DPL2 decoder 2019-02-13 22:52:41 -02:00
LAGonauta
f4cf1e4f49 Removed zeroing-out the LFE as it is not needed anymore.
Also removed minimum number of frames needed when decoding DPL2, and use
std::numeric_limits to clamp the samples when needed.

Clamping is still needed, but those samples are much rarer now and depend
on the game.
2019-02-13 22:52:40 -02:00
LAGonauta
fdfd9d6953 Cleaned up PulseAudio as we now use FreeSurround 2019-02-13 22:52:40 -02:00
LAGonauta
df631f0d75 Swapped FFDShow's DPL2 decoder by FreeSurround
Added class in AudioCommon for the surround decoder
2019-02-13 22:52:40 -02:00
Tillmann Karras
97cc9894e4 Update to Visual Studio's default Windows SDK 2018-10-20 00:53:08 +01:00
spycrab
a196dfe50d AudioCommon: Implement WASAPI 2018-05-26 13:08:10 +02:00
spycrab
40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Lioncash
b96bbc8f8d
AudioCommon/CMakelists: Migrate off add_dolphin_library
Continues the changes that were introduced in 3a4c3bbe01
2018-03-22 22:07:11 -04:00
Lioncash
50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
Ryan Meredith
b7276483da Change FATAL_ERROR to STATUS message for OpenAL not found in externals 2018-03-09 12:29:23 -05:00
Michael M
a988a8a458 AudioCommon: make SetSoundStreamRunning idempotent 2017-11-19 12:09:54 -08:00
Michael M
0baddbf9a8 SoundStream: change Start/Stop to Init/SetRunning/destruct 2017-11-19 12:09:54 -08:00
Michael M
ad4a89d64b CubebStream: implement SetRunning 2017-11-19 12:09:54 -08:00
JosJuice
b00ef39c1c Fix DTK audio not working after loading a savestate
The main problem was that the volume of the mixer wasn't savestated.
The volume is typically 0 at the beginning of a game, so loading a
savestate at the beginning of a game would lead to silent DTK audio.

I also added savestating to StreamADPCM.cpp.
2017-11-06 09:15:14 +01:00
Leo Lam
5393575c55 Merge pull request #6130 from ligfx/emptynullsoundstream
NullSoundStream: don't call Mixer->Mix
2017-10-24 11:44:22 +02:00
Leo Lam
b002d9d94f Merge pull request #6132 from ligfx/updatecubeb
Externals: update cubeb to kinetiknz/cubeb@c2bd582
2017-10-22 15:39:39 +02:00
Michael M
b031d3316c SoundStream: rename Clear(mute) to SetRunning(running) 2017-10-21 16:28:04 -07:00
Michael M
d6985fc3e8 AudioCommon: rename ClearAudioBuffer(mute) to SetSoundStreamRunning(running) 2017-10-21 16:28:04 -07:00
Michael M
7bcdd1a46a SoundStream: remove unused m_muted and IsMuted 2017-10-21 16:28:04 -07:00
Michael M
aa40c4a7ce Externals: update cubeb to kinetiknz/cubeb@c2bd582
A bunch of changes, looks mainly like bug fixes and code cleanup.

Notable changes:
- `cubeb_get_min_latency`'s signature was changed to take params via
  pointer, requiring Dolphin code to be tweaked in two places.
- A fix for kinetiknz/cubeb#320, as reported by @shuffle2
- Fixed build on FreeBSD (kinetiknz/cubeb#344), as contributed by @endrift
2017-10-21 14:28:39 -07:00
Michael M
6abd1c8c99 NullSoundStream: don't call Mixer->Mix 2017-10-21 13:32:33 -07:00
JosJuice
09f3f9b41a Remove NonCopyable
The class NonCopyable is, like the name says, supposed to disallow
copying. But should it allow moving?

For a long time, NonCopyable used to not allow moving. (It declared
a deleted copy constructor and assigment operator without declaring
a move constructor and assignment operator, making the compiler
implicitly delete the move constructor and assignment operator.)
That's fine if the classes that inherit from NonCopyable don't need
to be movable or if writing the move constructor and assignment
operator by hand is fine, but that's not the case for all classes,
as I discovered when I was working on the DirectoryBlob PR.

Because of that, I decided to make NonCopyable movable in c7602cc,
allowing me to use NonCopyable in DirectoryBlob.h. That was however
an unfortunate decision, because some of the classes that inherit
from NonCopyable have incorrect behavior when moved by default-
generated move constructors and assignment operators, and do not
explicitly delete the move constructors and assignment operators,
relying on NonCopyable being non-movable.

So what can we do about this? There are four solutions that I can
think of:

1. Make NonCopyable non-movable and tell DirectoryBlob to suck it.

2. Keep allowing moving NonCopyable, and expect that classes that
   don't support moving will delete the move constructor and
   assignment operator manually. Not only is this inconsistent
   (having classes disallow copying one way and disallow moving
   another way), but deleting the move constructor and assignment
   operator manually is too easy to forget compared to how tricky
   the resulting problems are.

3. Have one "MovableNonCopyable" and one "NonMovableNonCopyable".
   It works, but it feels rather silly...

4. Don't have a NonCopyable class at all. Considering that deleting
   the copy constructor and assignment operator only takes two lines
   of code, I don't see much of a reason to keep NonCopyable. I
   suppose that there was more of a point in having NonCopyable back
   in the pre-C++11 days, when it wasn't possible to use "= delete".

I decided to go with the fourth one (like the commit title says).
The implementation of the commit is fairly straight-forward, though
I would like to point out that I skipped adding "= delete" lines
for classes whose only reason for being uncopyable is that they
contain uncopyable classes like File::IOFile and std::unique_ptr,
because the compiler makes such classes uncopyable automatically.
2017-08-22 16:40:34 +02:00
Michael Maltese
21fa010bb6 Remove CoreAudio audio backend
Cubeb handles everything the CoreAudio backend can, plus supports DPL2.
2017-06-29 16:53:20 -07:00
LAGonauta
db7bb3bda8 Swapped C-style arrays to std::array
Also changed C-Style casts to static_cast
2017-06-27 07:12:15 -03:00
LAGonauta
9eb209c214 Removed redundant conversion to float when playing back stereo. 2017-06-27 07:10:32 -03:00
lfsafady
75af792070 Swapped out the sound_sync_event.Wait() call by a simple std::sleep_for.
It seems to make no difference besides allowing lower latencies and more
stability on hardware OpenAL cards. Maybe the Wait() call waits for too
long, causing buffers underruns.
2017-06-27 07:08:43 -03:00
lfsafady
d9d51fe0c4 Renamed some variables to the current coding standard and some to better
fit what they really are.
2017-06-27 07:08:43 -03:00
LAGonauta
8fd1af6783 Changed OpenAL latency setting to really reflect how much time it is.
Before these changes each value of latency were actually 5ms, with a
minimum latency of ~10 ms. If it was set to 4 ms on the UI, the actual
latency was 10 + 5 * 4 = 30 ms.
Now 30 ms on the UI means 30 ms on the backend.
2017-06-27 06:54:28 -03:00
Michael Maltese
749889236d OpenALStream: remove commented-out ALC_REFRESH code 2017-06-27 00:06:14 -07:00
Michael Maltese
c882d52f4a OpenAL: load DLL dynamically 2017-06-27 00:06:14 -07:00
Michael Maltese
18e70cdf91 Only build OpenAL on Windows 2017-06-27 00:06:14 -07:00
Michael Maltese
42ea1c8ecf OpenAL: remove aldlist.cpp 2017-06-27 00:06:13 -07:00
Michael Maltese
32470ef284 clean up OpenALStream::Start() 2017-06-27 00:06:13 -07:00
Michael Maltese
56961f5561 OpenALStream: don't include headers if not building 2017-06-27 00:06:13 -07:00
Michael Maltese
b2c9d6d217 Rename CMixer to Mixer 2017-06-26 15:01:07 -07:00
JosJuice
f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +02:00
Shawn Hoffman
fd166032ab msbuild: obey some warnings about missing virtual destructors 2017-06-07 20:20:25 -07:00
Michael Maltese
60f4f499e8 OpenAL: hardcode that X-Fi supports surround 2017-06-06 15:23:55 -07:00
Michael Maltese
3bfebf396a Fix OpenAL backend on macOS
OpenALStream was querying the backend for AL_EXT_float32 support (which
suceeds), but AL_FORMAT_STEREO_FLOAT32 was defined incorrectly.

Also changes OpenALStream to query for AL_EXT_MCFORMATS (multichannel
support) rather than hard-coding that it doesn't work on macOS.
2017-06-06 15:23:55 -07:00
shuffle2
0b00477c8a Merge pull request #5311 from ligfx/mixerdpl2
AudioCommon: Move DPL2 decoding into Mixer
2017-06-05 20:09:18 -07:00
Shawn Hoffman
397720a9fe might as well update yet some more pointless version numbers.. 2017-06-03 18:20:40 -07:00
Michael Maltese
14c3d4716f AudioStretcher: split StretchAudio into ProcessSamples / GetStretchedSamples 2017-06-03 16:54:00 -07:00
Michael Maltese
87a467fe42 AudioCommon: extract AudioStretcher class for time-stretching 2017-06-03 16:54:00 -07:00
Michael Maltese
a4508e85e8 AudioCommon: move DPL2 decoding into Mixer 2017-06-03 16:53:59 -07:00
BhaaL
072c161445 upgrade to Windows SDK 10.0.15063.0
this is required for /permissive- to work, because some headers in the
Windows SDK use Microsoft extensions that are not allowed in standards mode
2017-05-28 13:37:31 +02:00
Lioncash
3e7af2a2cd CubebStream: Add missing <vector> include 2017-05-27 23:50:39 -04:00
Michael Maltese
d416cbd9ed Add CubebUtils namespace and hook up cubeb logging 2017-05-27 18:28:57 -07:00
Michael Maltese
f6e1da0dc0 AudioCommon: add Cubeb backend 2017-05-27 18:28:56 -07:00
Pierre Bourdon
d592bdd4d4 Migrate to Visual Studio 2017.
Auto-generated by the IDE, I'll trust it knows what it's doing.
2017-05-25 15:58:59 -07:00
MerryMage
c9f50fd4ed DPL2Decoder: Prefer static_cast to C-style casts 2017-04-23 09:21:30 +01:00
MerryMage
4f884d0b2f DPL2Decoder: Simplify DotProduct 2017-04-23 09:21:30 +01:00
MerryMage
42a1f7939d DPL2Decoder: Prefer std::vector to calloc-ed array 2017-04-23 09:21:29 +01:00
MerryMage
71dc810418 DPL2Decoder: Make constant variables const in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage
751351fd20 DPL2Decoder: Simplify cut-off frequency logic in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage
24027c1d4a DPL2Decoder: Reduce scope of variable in DesignFIR 2017-04-23 09:18:29 +01:00
MerryMage
d0e75bb438 DPL2Decoder: Remove unnecessary pointer arguments of DesignFIR 2017-04-23 09:18:28 +01:00
Michael Maltese
c538cdcd47 AudioCommon: set volume _after_ starting stream
Fixes an error with the CoreAudio backend, which apparently doesn't
allow you to set the volume before starting the stream:

```
59:31:087 AudioCommon/CoreAudioSoundStream.cpp:97 E[Audio]: error setting volume
```

This shouldn't cause any problems with other backends, since the mixer
starts with silence anyways.
2017-04-20 02:06:42 -07:00
MerryMage
cbaa00457a Mixer: Tweak audio stretch parameters 2017-04-12 17:56:58 +01:00
MerryMage
9397fdfe95 Mixer: Use a temporary buffer when stretching audio 2017-04-12 14:58:20 +01:00
MerryMage
f5018010d3 Mixer: Calculate actual_samples based on availability in all FIFOs 2017-04-12 14:58:19 +01:00
MerryMage
ac0df5b2db Mixer: Disable frequency shifting when stretching is enabled 2017-04-12 13:56:29 +01:00
MerryMage
26514358f4 Add audio stretching as a configuration option 2017-04-12 13:56:29 +01:00
MerryMage
b8c867dd7a Mixer: Implement audio stretching 2017-04-12 13:56:28 +01:00