Commit graph

554 commits

Author SHA1 Message Date
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