Commit Graph

29 Commits

Author SHA1 Message Date
Mickaël Thomas 84daa28267 Fix memory corruption in S_TransferPaintBuffer
When using a non-default sound configuration (such as 6 channels), after
a long time (about 4.5hours for 6 channels at 22050 Hz) an overflow will
occur in `S_TransferPaintBuffer`, causing an out of bounds write into
the dma buffer.

The problematic line is:
```
out_idx = (s_paintedtime * dma.channels) % dma.samples;
```

With `s_paintedtime` large enough, the result of the multiplication will
overflow to a negative number (since `s_paintedtime` is signed), and the
index into the output buffer will be negative.
2021-12-08 18:46:58 +00:00
Zack Middleton 58b0fb07cd Fix SDL audio playback with 16-bit stereo sound
My commit last month "Fix SDL audio playback with surround sound" broke
16-bit stereo sound. S_TransferStereo16() still assumed that dma.samples
was a power of two. I also cleaned up code related to the previously
mentioned commit.
2018-10-01 22:28:51 -05:00
Zack Middleton 812a3dbfa5 Fix SDL audio playback with surround sound
If user has surround sound enabled, ioq3 would not play any sound.
Fix painting sound buffer for 4/5.1 audio channels. Extra channels
currently play no audio.
2018-09-13 12:58:23 -05:00
Simon McVittie 5909b9a1cf Isolate the Altivec code so non-Altivec PPC targets can use the same binary.
Moved all the code using Altivec intrinsics to separate files. This 
means we can optionally use GCC's -maltivec on just these files, which
are chosen at runtime if the CPU supports Altivec, and compile the rest
without it, making a single binary that has Altivec optimizations but
can still work on G3.

Unlike SSE and similar extensions on x86, there does not seem to be
a way to enable conditional, targeted use of Altivec based on runtime
detection (which is what ioquake3 wants to do) without also giving the
compiler permission to use Altivec in code generation; so to not crash
on CPUs that do not implement Altivec, we'll have to turn it off
altogether, except in translation units that are only entered when
runtime Altivec detection is successful.

This has been tested on Linux PPC (on an Altivec-enabled CPU),
but we may need further work after testing trickles out to other
PowerPC devices and ancient Mac OS X builds.

I did a little work on this patch, but the majority of the effort belongs 
to Simon McVittie (thanks!).
2018-05-12 14:14:47 -04:00
Ryan C. Gordon 4f8c7c2f2f Support SDL audio devices that require float32 samples.
Fixes missing audio when playing on Windows with SDL 2.0.7, which started
using WASAPI, which demands floating point audio.
2018-04-13 14:05:12 -04:00
Edward Betts fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Victor Roemer 398dea397c Fix Makefile for OSX
Bump base SDK from 10.5 -> 10.7
Just use the builtin __APPLE__
2016-06-12 17:17:33 -04:00
MAN-AT-ARMS dd83cbdc25 Fix possible division by zero in S_PaintChannelFrom16_altivec 2014-09-09 11:30:23 -04:00
Tim Angus 4f3c95c589 Fix client warnings 2014-09-01 11:13:47 +01:00
Zack Middleton a167110f43 Don't mix sfx with NULL soundData
Caused a crash. Already done for looping sounds.
2014-03-11 16:44:50 -05:00
Zack Middleton 1a86229538 Fix playback of stereo sounds in Base sound system
Already works correctly in OpenAL.
2013-12-15 00:23:10 -06:00
/dev/humancontroller bbd17d75ce reduce the amount of compiler warnings for variable shadowing 2013-05-30 15:43:20 -05:00
Tim Angus 98360bcd57 Fix some of the things clang --analyze flagged 2013-03-26 16:50:03 +00:00
Thilo Schulz 2a0812bc06 Mute sounds with 0 volume when game is minimized/unfocused instead of Stopping all sounds. Fixes (#4336) 2009-11-10 01:08:15 +00:00
Ryan C. Gordon 12326a9eac Initial patch for in-game VoIP support! 2008-06-01 07:51:23 +00:00
Tim Angus 672cfbf16f * Merge unified-sdl to trunk
* Bump Q3_VERSION to 1.35
2007-09-05 18:17:46 +00:00
Tim Angus a21eb2bbcb * AVI video output
- Uses motion jpeg codec by default
  - Use cl_avidemo to set a framerate
  - \video [filename] to start capture
  - \stopvideo to stop capture
  - Audio capture is a bit ropey
2006-01-04 03:12:12 +00:00
Tim Angus 382c6adb54 * Disable ccache by default. If you want it, add USE_CCACHE=1 to Makefile.local
* Remove -gfull from linux section in Makefile -- it's darwin only
* Cast away some warnings that surfaced from using "new" AL headers
* Various whitespace and consistency fixes
2005-11-26 15:01:28 +00:00
Ryan C. Gordon 721b9a7d01 Mac OS X work...lots of little changes that touch a lot of random places.
Still work to be done, but this at least matches the PowerPC Linux status
 now.

MacOS-specific directory (and XCode project) is gone...this now uses SDL,
 OpenAL, and the Unix Makefiles.

--ryan.
2005-11-26 07:46:21 +00:00
Tim Angus e4b7a04d5c * Replaced a bunch of inline and __inline with ID_INLINE
* Replaced a bunch of __i386__ with id386
* General tidy up of asm preprocessor decisions
* Removed C_ONLY from the dedicated server build
2005-11-04 22:32:00 +00:00
Tim Angus 05e8ab9538 * Added STATUS
* Updated TODO
* Moved ChangeLog to root
* Updated ChangeLog
* s/Foobar/Quake III Arena Source Code/
* Biggest patch EVAR. I wonder how many mail boxes this will fill...
2005-10-29 01:53:09 +00:00
Six ecd73786d5 Fix build problems under OS X 2005-10-11 01:52:29 +00:00
Tim Angus 2b8395a4d0 * Replaced lots of __linux__ || __FreeBSD__ with __GNUC__
* MinGW port now uses asm versions of SnapVector and ftol
* Improved the handling of mangled symbols in vm_x86.c
2005-09-23 02:59:15 +00:00
Tim Angus fcaf343d7f * Port to MinGW 2005-09-22 03:21:33 +00:00
Ludwig Nussel aa942839ce apply altivec fixes from Emanuel Steen (#2383) 2005-09-17 14:59:28 +00:00
Ludwig Nussel 5ae70d54b0 remove svn:executable property 2005-08-28 17:54:51 +00:00
Zachary Slater 59cce31e75 newlines fixed 2005-08-26 17:39:27 +00:00
Zachary Slater 5b755058f5 Itsa me, quake3io! 2005-08-26 04:48:05 +00:00
Travis Bradshaw dbe4ddb103 The Quake III Arena sources as originally released under the GPL license on August 20, 2005. 2012-01-31 13:41:34 -06:00