Commit graph

566 commits

Author SHA1 Message Date
Bill Currie
a9c6974fc7 [audio] Quieten jack about xruns
They messages are annoying at the moment, but I will want them when I
get around to chasing down the root cause, so hidden behind a developer
mask.
2020-03-23 15:19:05 +09:00
Bill Currie
4e4d1b99b4 Clean up all the system shutdown calls
I added Sys_RegisterShutdown years ago and never really did anything
with it: now any system that needs to be shutdown can ensure it gets
shutdown on program exit, and in the correct order (ie, reverse to init
order).
2019-07-12 23:15:26 +09:00
Bill Currie
34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie
2329fb1885 Fix some warnings and bitrot. 2016-10-25 00:10:30 +09:00
Bill Currie
3efb0c538f Separate file search from loading.
QFS_LoadFile (and its wrappers) now  take a file handle rather than a
path. This will make vpath usage a little cleaner to implement.
2014-01-28 16:22:05 +09:00
Bill Currie
25a060f369 Remove the foundname param from _QFS_FOpenFile.
It's now obsolete with qfs_foundfile.
2014-01-28 16:22:05 +09:00
Bill Currie
f5501fbf24 Fix a pile of automake deprecation warnings.
s/INCLUDES/AM_CPPFLAGS/g

I <3 sed :)
2013-11-24 13:11:50 +09:00
Bill Currie
e27d7cbd2d Handle alloca "correctly".
Use AC_FUNC_ALLOCA and the #ifdef mess suggested by the autoconf docs
(hidden in qfalloca.h).
2013-01-22 21:02:50 +09:00
Bill Currie
f1aefc969d Fix some 64-bit mingw compile issues.
Just one more issue to fix (alloca), but with a hack, QF compiles (no clue
yet if it works: wine doesn't seem to be an option at this stage)
2013-01-22 21:02:49 +09:00
Bill Currie
f3682069e2 Ensure the float pointer to SND_Convert is aligned.
This should fix johnny's SIGBUS.
2013-01-19 16:09:32 +09:00
Bill Currie
6eb6b6c0ba Change pointer_t to unsigned and clean up the mess.
It doesn't make sense to have negative pointers. The size of the commit is
from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
2012-12-21 21:53:13 +09:00
Bill Currie
7b38b0b339 Make S_Init safe to use with a null viewentity.
Current work in qwaq doesn't need 3d spacialization, so it wants to pass
null for the viewentity pointer.
2012-12-17 15:07:49 +09:00
Bill Currie
ec42bde527 Make hash tables more const correct.
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
Bill Currie
0bd613b73d Disable vorbisfile's static callbacks.
Since we use callbacks anyway, they're not needed, and this fixes the
warnings/errors when using ps3toolchain.
2012-08-19 08:05:50 +09:00
Bill Currie
6200d35109 Don't include SDL_byteorder.h
We don't need it and it's not always available.
2012-08-18 21:35:24 +09:00
Bill Currie
7d84800250 Remove an unnecessary if.
It needed during initial development of the patch, but with the refactoring
of s_init, it became redundant.
2012-05-28 07:58:11 +09:00
Bill Currie
01fb4f265d Attempt to reconnect to jack on loss of connection. 2012-05-28 07:46:22 +09:00
Bill Currie
23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
ce6ab908a5 Don't include the specific plugin headers in plugin.h.
This lets files that use plugins not depend on plugins they don't use.
2012-02-13 22:02:07 +09:00
Bill Currie
699ab70482 Fix audio again.
Bah, even though audio no longer needs models, it was still linking with
it :P
2012-02-13 16:44:30 +09:00
Bill Currie
3cb4cb59b5 Link QFgamecode directly into QFruamoko.
First step in the library "merge down".

QFgamecode is now a convenience library. The only things that mention it
directly now are ruamoko and qfcc.
2012-02-13 15:05:31 +09:00
Bill Currie
9a91aff93c Move the ambient level check out of the sound renderer.
Instead, the client gets the current leaf and passes ambient_sound_level
from the leaf to S_Update.
2012-02-13 13:44:29 +09:00
Bill Currie
02d24189ef Use QF_NEED for plugins.
At the moment, the selection of the default sound driver etc is broken.
2012-02-12 11:37:25 +09:00
Bill Currie
0a277376ed Fix static builds. 2012-02-07 20:17:32 +09:00
Bill Currie
8ecf74753c Refer to local libs without a path.
I'm sure I've been here before... Anyway, using $(top_builddir)/... to
refer to a local lib confuses make and breaks parallel builds.
2012-02-07 18:45:55 +09:00
Bill Currie
9fbff2f4d5 Do an audit of the Makefile.am files.
o All instances of LIBADD/LDADD have a corresponding DEPENDENCIES
    specificatiion.
  o libraries now use a lib_ldflags macro to keep things consistent
  o duplication of source/lib names has been minimized (particularly in
    the libraries; more work needs to be done for the executables)
  o automake spec blocks have been organized (again, more work needs to be
    done for the executables)
2012-02-07 16:04:19 +09:00
Bill Currie
b5019c8e33 Nuke the engine dicrectory from gamecode.
Not the contents, of course :) Anyway, finally, that totally useless
directory is gone.
2012-02-06 23:44:52 +09:00
Bill Currie
201532ea7e Fix missing library references when linking. 2012-02-05 14:25:22 +09:00
Bill Currie
f8dfee6de7 Merge branch 'master' into glsl 2012-01-29 22:36:35 +09:00
Bill Currie
d18aa2fe3e Do not try to unregister ports with a lost jackd.
libjack seems to get stuck when unregistering ports with a broken
connection.
2012-01-27 19:58:03 +09:00
Sander van Dijk
25ffe6bc3e cd_sdl.c: fix typo. 2012-01-21 09:27:30 +09:00
Sander van Dijk
d8432e78bb Fix a wrongly negated condition in snd_win.c:SNDDMA_UnblockSound(). 2012-01-18 21:39:17 +09:00
Bill Currie
05bf637466 SDL sound patches from SVD.
Thanks to "Sander van Dijk" <a.h.vandijk@gmail.com>, we now have much
better SDL sound support.

Here's the promised cleaned up version of the "double buffer" approach
patch for "snd_sdl.c". I've taken some more time to re-read and test
it this time, and it seems to behave well. All memory that is used by
both the main thread and the SDL audio thread is prefixed with "shm_",
and locking is used to ensure that only one thread accesses it at the
same time.
2012-01-17 19:14:42 +09:00
Bill Currie
a988c192ab Fix OSS sound. YAY!!!
Much thanks to Spirit from quaddicted for his patient help in testing, and
Spike for his heckling ;)
2012-01-06 21:21:45 +09:00
Bill Currie
206199652a Fix a stray CFLAGS.
Should be AM_CFLAGS.
2011-12-10 20:45:33 +09:00
Bill Currie
d3cf5c4b75 Beg for mmap access.
If the default sound device does not support mmap access, retry with
plughw. However, assume the user knows best and do not retry if snd_device
has been set to anything, including "default".

QF alsa support now works out of the box with pulseaudio.
2011-12-08 11:32:33 +09:00
Bill Currie
45288a1a7f Fix the ghastly sound quality.
Due to quake's original sound engine using a push model, the actual place
to which the sound data should be written is not necessarily where the
"hardware" dma cursor is, but rather where the last write finished off.
Thus, the correct output location is indicated by snd_paintedtime rather
than snd_shm->framepos.
2011-12-08 11:02:19 +09:00
Bill Currie
d9ab3a1f54 Move the config file/command line parsing into qargs.c
I don't like the COM prefix, but it will do for now.
2011-09-11 14:57:05 +09:00
Bill Currie
a71acc9ae5 Move the essential init code into Sys_Init(). 2011-09-11 14:56:47 +09:00
Bill Currie
da7ddc35c0 Fix the segaults when trying to use snd_disk.
It's output is still bogus (and it writes to the current directory!), but
at least the plugin can be used without any nasty issues.
2011-09-10 12:07:18 +09:00
Bill Currie
a426dacc8a Add a missing \n 2011-09-09 17:43:48 +09:00
Bill Currie
881d4babce Fix some undefined symbols in snd_alsa.c.
Serves me right for testing with only my debug build :P
2011-09-08 18:10:09 +09:00
Bill Currie
2ae33a753a Support non-interleaved mmap sound.
Unfortuanately, I can't test this properly as I don't have any such
hardware, but as the code is mosly an edited copy of the interleaved code,
any errors should be easy to fix.
2011-09-07 17:00:57 +09:00
Bill Currie
a8ea3aaad9 Allow dma sound targets to specify an xfer function. 2011-09-07 17:00:18 +09:00
Bill Currie
9ffa1f410a Detect the silent death of the jack client thread.
When jackd gets an unhandled xrun, it stops all processing but neglects to
tell the client about it. Thus, add a bit of a watchdog function to
s_update() and assume the client thread is dead if there's no sign of life
after one second. No more hanging on exit.
2011-09-07 15:16:27 +09:00
Bill Currie
f75b0a611b Some compile fixes for OpenBSD 2011-08-25 22:35:20 +09:00
Bill Currie
c1a60551ae Clean up default rate setting and add explicit support for 48kHz. 2011-08-11 17:22:14 +09:00
Bill Currie
5feb0454ca Add and use SYS_SND for both sound and cd debug prints. 2011-08-11 17:20:33 +09:00
Bill Currie
28610c08e3 Do not try to build testsound when not building sound libs. 2011-07-30 15:03:19 +09:00
Bill Currie
9ccd570105 Fix a problem with linking FLAC libs. 2011-07-23 21:37:34 +09:00
Bill Currie
efa0105748 Rename some headers to fix doxygen warnings. 2011-07-23 15:58:45 +09:00
Antti Harri
358a844a42 Implement --version-info configure switch to override QuakeForge
library versioning. From Lasse Collin, thanks!
2011-07-09 01:23:36 +03:00
Bill Currie
47201137d5 Make the default cd plugin configurable.
The default default is file, but now distribution maintainers can change it
if necessary.
2011-06-04 17:19:18 +09:00
Antti Harri
8d1bd58ade snd_dma.c fixes for non-power-of-two values. From Jacob Meuser. 2011-06-04 09:47:15 +03:00
Antti Harri
67c7796c0b Change default music backend from OGG to CD. 2011-05-31 00:05:35 +03:00
Bill Currie
74a7e07dfc Use AM_CFLAGS instead of CFLAGS.
CFLAGS is meant to be reserved for the user.
2011-05-10 12:44:44 +09:00
Bill Currie
f17b1275ea Undo an accidental commit. 2011-05-10 11:48:38 +09:00
Bill Currie
77ccf8a824 Build the audio libs before the test dir. 2011-05-10 11:32:38 +09:00
Bill Currie
f7a95ec2f4 Move the test program into its own directory.
This is to avoid issues with -prefer-pic (really need to clean things up
properly).
2011-05-10 11:25:12 +09:00
Bill Currie
70783e4bd5 Disable all sound calls if jack could not be contacted.
This fixes the file handle leak when jack is unavailable.
2010-12-25 20:31:14 +09:00
Jeff Teunissen
9defba8d92 Get rid of plugin versioning (again).
automake needs -avoid-version to be in Makefile.am, otherwise it doesn't
make libtool do the right thing...or something. My head hurts. ;)
2010-12-25 04:45:39 -05:00
Bill Currie
ce64227a71 Fix for debian wildmidi.
This might break lenny :/
2010-12-24 17:33:09 +09:00
Bill Currie
de04e1b602 Lots of win32 (mingw cross) build fixes.
HTTP (curl) support is missing, but everything else builds.
2010-12-23 11:40:16 +09:00
Bill Currie
889bbd364e Explicitly link testsound against libQFutil. 2010-12-18 22:21:55 +09:00
Bill Currie
765807def0 Make sdl's sound parameters easy to tweak. 2010-12-15 18:48:25 +09:00
Bill Currie
d265bbf011 Support any sample rate. 2010-12-15 18:48:25 +09:00
Bill Currie
df65679028 Remove support for alsa 0.9.
It's way obsolete and I doubt we'll ever need it again. I do wonder what to
do abut sun, sgi etc.
2010-12-15 18:48:25 +09:00
Ragnvald Maartmann-Moe IV
843823de84 testsound depends on libQFutil 2010-12-10 17:07:06 +09:00
Bill Currie
185e21e4e4 Tweak some developer cvar usage. 2010-11-27 16:53:17 +09:00
Bill Currie
8c4fe2f844 Rename Sys_DPrintf to Sys_MaskPrintf.
We now have finer runtime control over what gets printed. Need to do a
SYS_DEV audit, creating new masks as apropriate.
2010-11-26 16:19:26 +09:00
Bill Currie
1dfb914c46 fix an oopsie (rebase!!) 2010-11-21 14:25:32 +09:00
Bill Currie
4cec187465 zixthree's wav file patch
Wav file were not read correctly when encoutering most chunk type beside the ones used by QuakeForge.

This patch will fix the riff loader code so that unused but defined chunk are skipped. Most wav files should now be loaded correctly fixing some silent sound effect.

Also fixed a typo in wav loader and reordered wav validity check so that format is checked first. The data chunk could be inexistant on some weird format and so an invalid format is a more helpful error text.

! Fix: Skip unsupported chunk in riff loader instead of rejecting riff file.
! Fix: typo in Microsoft name.
! Fix: ordering of wav validity to enable more helpful error text.
2010-11-21 14:18:15 +09:00
Bill Currie
99e87b092b zixthree's stereo swap patch.
Modified slightly for formatting and cleaner swapping.
2010-11-21 14:09:23 +09:00
Bill Currie
15b423cbe7 Track 0 is used to stop the BGM 2010-11-20 14:32:27 +09:00
Bill Currie
37fb8d22da Don't open a streamed sfx when there's no sound driver.
This happens when qf fails to connect to jackd (possibly other times).
There is probably a better solution to the problem, but not opening a
stream when the sample rate is reported as 0 definitely fixes the inifinite
recursion in read_samples().
2010-11-14 20:46:29 +09:00
Bill Currie
f666f8d27a Get the lib dependency for testsound right.
No need for $(top_builddir) when the lib is in the same directory. Fixes
parallel builds.
2010-09-25 23:07:06 +09:00
Bill Currie
5a6e66b23e hopefully, correct plugin linking options
how we got away with this for so long is beyond me, but it seems libtool
really wants -rpath even for plugins (otherwise it refuses to install them)
2010-08-21 13:01:35 +09:00
Bill Currie
1442273a8f more opaque correctness 2010-08-20 12:58:37 +09:00
Bill Currie
4449f10c0a get alsa and sdl working, though sdl seems to be mono only 2010-08-15 05:15:47 +00:00
Bill Currie
bc4a3e79dc d'oh, bogus $ 2010-08-14 02:48:53 +00:00
Bill Currie
81ac779b7f forgot to add libsamplerate to the default renderer 2010-08-14 02:38:19 +00:00
Bill Currie
cc697236e5 bah, forgot that libsamplerate doesn't check for errors 2010-08-13 01:48:48 +00:00
Bill Currie
54fc922f6c better error checking while reading streamed data 2010-08-13 01:48:20 +00:00
Bill Currie
ce5658416d add support for up to 8 channels in sound effect files
The sounds are down-mixed to 2 channels (qf does not (yet) support more than
2 channel output), but this allows pretty much anything to be used for a
source of music. Only 5.1 (6 channel), stereo and mono have been tested, but
the others should work (any issues would be mis-interpretation/implementation
of the channel layout).
2010-08-12 02:28:27 +00:00
Bill Currie
b1620616b9 reset the "resampler" when seeking 2010-08-11 23:47:31 +00:00
Bill Currie
22e8698827 resampling now works
However, no fallback for when libsamplerate is missing.
2010-08-11 23:47:03 +00:00
Bill Currie
1c985bc925 bah, forgot these 2010-08-11 23:46:28 +00:00
Bill Currie
3499f5257f add a test app and a workaround for the clicking in the resamled stream
the proper fix for the clicking is to either use SRC's callback resampler or
fix snd_mem.c to handle not getting the samples it expects, but I think the
callback will be better in the long run.
2010-08-11 23:45:56 +00:00
Bill Currie
0e3b395943 ok, non-resampled flacs now work beautifully 2010-08-11 23:45:32 +00:00
Bill Currie
7502cd9ec5 making slow progress on sound quality
streamed oggs playback cleaning when not resampling, but flacs are still crap
2010-08-11 23:45:09 +00:00
Bill Currie
65a748fc3c floating point mixer now working
the resampler is being badly abused for streams, and it's not yet properly
autoconfiscated, but things are working. Better yet, at the correct pitch and
speed.
2010-08-11 23:44:34 +00:00
Bill Currie
2bb2d14b89 make "sample counts" frame based rather than mono sample based
that was always horribly confusing
2010-08-11 23:43:35 +00:00
Bill Currie
d0906f1453 conditionally build the sound format support files
Rather than using an ifdef around the entire code, get autoconf to do the work
for us. For one thing, this allows doxygen to produce decent docs. It also
makes for less compalation when building without support for various formats.
2010-08-11 23:42:42 +00:00
Bill Currie
c0a8c6c695 properly prefix all functions, static or not
makes doxygen produce better docs
2010-08-11 23:41:04 +00:00
Bill Currie
ac44950a69 sanitize the code by using defines for old flac libs 2010-08-11 23:40:35 +00:00
Bill Currie
46a067b2f6 Do proper error handling when loading sound files.
This fixes the segfault grg got when trying to play a 5.1 channel file.
2010-08-08 03:02:55 +00:00
Bill Currie
0dfff8fd58 ignore stuff 2010-08-07 10:42:09 +00:00
Bill Currie
adee45d22b add a comment about the valid range of samples 2010-08-06 01:58:12 +00:00
Bill Currie
98a0da742a Prefill the sfx stream buffer to ensure the decoders have allocated any memory they might need. Problem found using jack_interposer (http://repo.or.cz/w/jack_interposer.git). 2010-08-06 00:41:42 +00:00