Commit Graph

388 Commits

Author SHA1 Message Date
Sam Lantinga
e1031e342b Fixed permissions for code generation scripts 2012-12-11 12:01:04 -08:00
Sam Lantinga
619c1d8cd0 Fixed bug 1632 - iOS CoreAudio doesn't close
C.W. Betts 2012-10-28 19:42:01 PDT

I noticed when looking through the CoreAudio code of SDL 2.0 that there was a
fix me wondering how iOS closed the audio system. While working on my own audio
code on PlayerPRO, I discovered that Carbon's component code was replaced in
the audio subsystem with Audio Component Services.
2012-11-02 09:28:40 -07:00
Sam Lantinga
1899a26c04 Allow playing iPod music in the background of SDL applications.
You can always change your audio session category afterwards if you want custom behavior.
2012-11-01 19:08:12 -07:00
Sam Lantinga
b3d60cfcbb Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
d79c21ea69 NetBSD patch to use AUDIO_GETBUFINFO when available (contributed by jmcneill) 2012-09-25 20:47:38 -07:00
Ryan C. Gordon
b3b40aac16 Removed Windows CE support from SDL 2.0.
It's a long-dead platform, and we don't have any way to build for, test, or
maintain it, so there's no sense in doing acrobatics to support it.

If you need Windows CE support, use SDL 1.2. If you need Windows Phone support,
send SDL 2.0 patches for the newer Windows Mobile platform.
2012-09-15 10:59:39 -04:00
Ryan C. Gordon
b735095b79 Removed a FIXME; RemoteIO is correct for iOS. 2012-09-02 19:37:36 -04:00
Ryan C. Gordon
801165cd3f Fixed compiler warning. 2012-08-30 12:58:58 -07:00
Ryan C. Gordon
c71bcb5678 Removed some unused variables that gcc 4.6.1 complains about. 2012-08-09 14:14:41 -04:00
Sam Lantinga
13ac487e86 Removed unneeded audio buffer memset() for consistent behavior on all platforms. 2012-07-05 12:16:44 -04:00
Ryan C. Gordon
d2093e13ed Replaced some assert macros with SDL_assert. 2012-02-07 02:11:15 -05:00
Sam Lantinga
1653c59262 Better interpolation for the x4 upsampling case 2012-01-12 22:54:09 -05:00
Sam Lantinga
e3d3970d6f Fixed issue where there was a garbage sample at the end of the buffer. 2012-01-12 21:42:35 -05:00
Sam Lantinga
0a04786fa5 Fixed memory corruption in the upsampling code, caught by valgrind 2012-01-08 17:31:11 -05:00
Sam Lantinga
e5c88e74f5 Fixed bug 1091 - Hardcoded size in SDL_audiocvt.c may lead to heap/stack corruption
Markovtsev Vadim 2011-01-18 22:00:16 PST

SDL_audiocvt.c:

static void SDLCALL
SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format):

#define dup_chans_1_to_2(type) \
    { \
        const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
        type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
        for (i = cvt->len_cvt / 2; i; --i, --src) { \
            const type val = *src; \
            dst -= 2; \
            dst[0] = dst[1] = val; \
        } \
    }

Pay attention to cvt->len_cvt / 2. 2 is the sizeof(Uint16), hovewer, below we
see that the conversion function supports Uint8 and Uint32:

switch (SDL_AUDIO_BITSIZE(format)) {
    case 8:
        dup_chans_1_to_2(Uint8);
        break;
    case 16:
        dup_chans_1_to_2(Uint16);
        break;
    case 32:
        dup_chans_1_to_2(Uint32);
        break;
    }

If type is Uint32, src will be decreased twice as it should be, memory being
written before the cvt->buf. If type is Uint8, the conversion will not be
complete. I suggest to change that define to

#define dup_chans_1_to_2(type) \
    { \
        const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
        type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
        for (i = cvt->len_cvt / sizeof(type); i; --i, --src) { \
            const type val = *src; \
            dst -= 2; \
            dst[0] = dst[1] = val; \
        } \
    }

I tested that and now it's working fine. I did not consider the similar defines
in functions nearby.
2012-01-08 17:20:33 -05:00
Sam Lantinga
efc62142fd Fixed bug 1014 - SDL_ConvertAudio crashes
The patch Mark attached looks good and valgrind gives it a clean bill of health:

Mark.Howson@ntu.ac.uk 2010-12-15 07:45:25 PST

Reproducible here under Windows and Linux. Looking at the code for
SDL_Upsample_S16LSB_2c:

const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
while (dst > target) {
   dst[1] = ((Sint16) SDL_SwapLE16(sample1));
   dst[0] = ((Sint16) SDL_SwapLE16(sample0));
   dst -= 2;
...

if dstsize is odd (and therefore dst), it'll write to target[1] which is one
byte before the allocated buf.

The attached patch to sdlgenaudiocvt.pl changes dst > target to dst >= target,
and removes the - $channels for the upsample case. The patch is not fully
tested, but seems to work here.
2012-01-08 17:10:57 -05:00
Sam Lantinga
a13eb5857b Fixed bug 1362 - SDL Fails to compile with Visual C++ Express 2008 with Feb 2007 DirectX SDK
Pallav Nawani 2012-01-04 00:48:29 PST
Issue:
Attempted to compile SDL as a static library.

DirectX SDK: Feb 2007
OS: Win 7
Visual C++ Express 2008
Compliation Mode: Static (Changed project settings from dll to lib)

Error:
C1021: invalid preprocessor command 'warning'

It seems that the #warning directive does not exist in Vc++ Express 2008.
2012-01-07 00:57:24 -05:00
Ryan C. Gordon
db8ac79a37 Use arts_suspend() in a loop to wait for arts to become ready.
(Transplanted from hg changeset 331f27f01cdb to the 1.3 branch.)
2012-01-02 15:16:45 -05:00
Sam Lantinga
e256711bb9 Happy New Year! 2011-12-31 09:28:07 -05:00
Ryan C. Gordon
c33e36f58b Fixed some preprocessor mistakes introduced in iOS project cleanup. 2011-11-03 11:51:47 -04:00
Sam Lantinga
6371c44a9e Lots of fixes importing SDL source wholesale into a new iOS project 2011-10-31 05:56:58 -04:00
Ryan C. Gordon
73fbe0cd92 Commit updated generated C code. 2011-10-11 22:42:54 -04:00
Ryan C. Gordon
bd5cf5489e Fixed compiler warning for unused variable in generated C code. 2011-10-11 22:35:19 -04:00
Ryan C. Gordon
0a99c98e86 Fixed perl string escaping thing. 2011-10-11 22:34:52 -04:00
Ryan C. Gordon
2ef51927fe 1.3 API CHANGE: Add support for naming threads. 2011-10-02 00:29:16 -04:00
Ryan C. Gordon
4e42ccb0ae Replaced a sanity check with an SDL_assert(). 2011-09-21 02:42:25 -04:00
Ryan C. Gordon
7adf4f848a Fixed a compiler warning. 2011-09-09 04:48:45 -04:00
Ryan C. Gordon
1248146aa2 Removed the MAC_OS_X_VERSION_10_x macros from the 1.3 branch. 2011-08-25 03:11:28 -04:00
Ryan C. Gordon
a52dac6020 Cleaned out functions deprecated in Mac OS X 10.6 SDK. 2011-08-23 15:17:44 -04:00
Ryan C. Gordon
27c0f06736 Further XAudio2 build test cleanups. 2011-08-22 14:56:46 -04:00
Ryan C. Gordon
3bd23ad70f Removed SDL_xaudio2.h ... no real need for this to be separate. 2011-08-22 14:37:45 -04:00
Ryan C. Gordon
8dddad9b87 Let XAudio2 target be removed from the build by removing it from SDL_config.h 2011-08-22 14:30:49 -04:00
Ryan C. Gordon
979f801b08 Ported ALSA minimum-sample-count fix from 1.2 branch to 1.3. 2011-08-21 11:52:21 -04:00
Ryan C. Gordon
da15752375 Make sure XAudio2 is supported by the DirectX headers at compile time. 2011-08-21 02:35:13 -04:00
Ryan C. Gordon
de42332c37 Patched to compile on Mac OS X. 2011-08-06 02:15:23 -04:00
Ryan C. Gordon
b5dce54a48 Patched to compile on Linux.
(Grumble grumble, should have tested better after all the history editing...)
2011-08-05 00:48:56 -04:00
Ryan C. Gordon
968b82c8b8 Patched to compile. 2011-08-04 19:33:45 -04:00
Ryan C. Gordon
e57312411f Removed some Windows endlines. 2011-08-04 01:36:23 -04:00
Ryan C. Gordon
6634d3d1fe Merged Mac OS X and iOS audio targets. 2011-08-04 00:45:09 -04:00
Ryan C. Gordon
142fdca2c2 Removed no-op Deinitialize methods in audio drivers. 2011-07-26 14:20:22 -07:00
Ryan C. Gordon
9bcc29c934 Removed needless macros in various audio targets. 2011-07-26 14:18:00 -07:00
Ryan C. Gordon
78bf250a21 Cleaned up audio device detection. Cleared out a lot of cut-and-paste. 2011-08-04 00:31:11 -04:00
Ryan C. Gordon
854a2e9098 Implemented XAudio2 target for Windows (and Xbox360, theoretically!). 2011-08-04 01:07:09 -04:00
Ryan C. Gordon
94fa3d973d Added some FIXMEs. 2011-08-04 01:07:13 -04:00
Ryan C. Gordon
9391731cf9 Took out some more bitfields in the audio subsystem. 2011-07-22 16:09:13 -07:00
Ryan C. Gordon
7de8cc401e Reworked Windows waveOut code.
Implemented multi-device support, changed name to "winmm".
2011-08-04 01:24:22 -04:00
Ryan C. Gordon
26705b7afc Reworked Windows DirectSound code.
Now supports multiple devices, and uses DirectSound 8 instead of 5. Changed
name to "directsound" and renamed source directory.
2011-08-04 01:26:12 -04:00
Ryan C. Gordon
8b3e5696da Removed /dev/dsp DMA audio target. 2011-07-24 03:37:13 -07:00
Ryan C. Gordon
b967eec1ab Mark some QSA audio driver functions as static. 2011-07-26 13:42:34 -07:00
Ryan C. Gordon
632f5e5860 Removed comment questioning the code's correctness (the answer: it's correct). 2011-07-22 00:12:03 -07:00