Commit Graph

254 Commits

Author SHA1 Message Date
Ryan C. Gordon
bd5b06d050 Cleaned up more compiler warnings in the 1.2 branch.
--HG--
branch : SDL-1.2
2011-10-13 12:29:03 -04:00
Patrice Mandin
4d790c6a1c Remove unused variables
--HG--
branch : SDL-1.2
2011-09-03 09:52:45 +02:00
Patrice Mandin
4c1bf583b9 audio/mint/dma8: Use XBIOS Supexec instead of GEMDOS Super
--HG--
branch : SDL-1.2
2011-09-01 23:52:09 +02:00
Patrice Mandin
daae314546 audio/mint: remove __attribute__((packed))
--HG--
branch : SDL-1.2
2011-08-30 23:53:53 +02:00
Patrice Mandin
7596089e6c Use proper m68k defines from gcc
--HG--
branch : SDL-1.2
2011-08-28 19:51:27 +02:00
Patrice Mandin
89a16918bb Remove more values now defined in mintlib
--HG--
branch : SDL-1.2
2011-08-28 19:19:03 +02:00
Patrice Mandin
505816c963 Fix more compilation warnings
--HG--
branch : SDL-1.2
2011-08-28 17:20:12 +02:00
Patrice Mandin
d11b29e176 Fix more compilation warnings
--HG--
branch : SDL-1.2
2011-08-28 17:19:32 +02:00
Patrice Mandin
036414b619 Update for latest mintlib, and remove duplicated defines
--HG--
branch : SDL-1.2
2011-08-26 19:56:08 +02:00
Patrice Mandin
a4c42a39b9 Fix various warnings for uninitialized or unused variables and functions
--HG--
branch : SDL-1.2
2011-08-26 14:37:39 +02:00
Ryan C. Gordon
804f8e784c Set a minimum sample count in ALSA target.
This should reduce unnecessary hardware interrupts. Apparently improves the
 ALSA target on some systems.

Fixes Bugzilla #1170.

Thanks to Paul Cercueil for the patch!

--HG--
branch : SDL-1.2
2011-08-21 11:42:47 -04:00
Sam Lantinga
7a99d1b90b RedHat patch: SDL-1.2.14-audiodriver.patch
--HG--
branch : SDL-1.2
2010-07-18 11:12:27 -07:00
Sam Lantinga
edd35e7af0 Fixed bug 993
GCC supports unnamed unions now. :)

--HG--
branch : SDL-1.2
2010-07-18 10:51:25 -07:00
Sam Lantinga
eae15b1ad8 Fixed bug #943
Ozkan Sezer      2010-02-06 12:31:06 PST

Hi:

Here are some small fixes for compiling SDL against mingw-w64.
(see http://mingw-w64.sourceforge.net/ .  Despite the name, it
supports both win32 and win64.)  Two patches, one for SDL-1.2
and one for SDL-1.3 attached.

src/audio/windx5/directx.h and src/video/windx5/directx.h (both
SDL-1.2 and SDL-1.3.)  I get compilation errors about some union
not having a member named u1 and alike, because of other system
headers being included before this one and them already defining
DUMMYUNIONNAME and stuff. This header probably assumes that those
stuff are defined in windef.h, but mingw-w64 headers define them
in _mingw.h. Easily fixed by moving NONAMELESSUNION definition to
the top of the file.  SDL_dx5yuv.c (SDL-1.2-only) also needs to
include the header before SDL_video.h to avoid the same problem.

src/thread/win32/SDL_systhread.c (both SDL-1.2 and SDL-1.3.) :
The __GNUC__ case for pfnSDL_CurrentBeginThread is 32-bit centric
because _beginthreadex returns uintptr_t, not unsigned long which
is 32 bits in win64. Changing the return type to uintptr_t fixes
it.

Hope these are useful. Thanks.

--HG--
branch : SDL-1.2
2010-03-10 15:04:13 +00:00
Ryan C. Gordon
22cd9e3e14 Fixed channel swizzling for ALSA target with 6-channel output.
Fixes Bugzilla #942.

--HG--
branch : SDL-1.2
2010-02-12 16:59:34 +00:00
Ryan C. Gordon
30d034e824 PulseAudio: get the window title for the context name if it wasn't set already.
Will still fall back to get_progname() if it can't figure out the title.

--HG--
branch : SDL-1.2
2010-01-24 20:08:14 +00:00
Ryan C. Gordon
2463df2be0 1.2: let PulseAudio hook into SDL_WM_SetCaption().
This lets Pulse's system-wide list of currently playing sources have accurate
names for SDL applications.

DO NOT MERGE WITH 1.3...we'll design a more formal API there.

--HG--
branch : SDL-1.2
2010-01-24 08:35:09 +00:00
Ryan C. Gordon
8bac2a4e77 1.2 pulseaudio: make some function pointers static.
--HG--
branch : SDL-1.2
2010-01-17 05:17:59 +00:00
Patrice Mandin
c1aa984d3b Forgot a check for Coldfire CPU
--HG--
branch : SDL-1.2
2009-11-09 18:02:32 +00:00
Patrice Mandin
d2a96d82ef Adapt audio interrupts for Coldfire
--HG--
branch : SDL-1.2
2009-11-07 20:45:45 +00:00
Patrice Mandin
62830367f0 Disable m68k assembly for Coldfire CPUs
--HG--
branch : SDL-1.2
2009-11-06 18:06:01 +00:00
Sam Lantinga
d460dd9cfc Fixed bug #857
Fixed compiler warnings

--HG--
branch : SDL-1.2
2009-10-19 10:02:00 +00:00
Sam Lantinga
b8ce312c2d Whoops, missing newline!
--HG--
branch : SDL-1.2
2009-10-19 06:01:58 +00:00
Sam Lantinga
f005939def Added an untested code path for snd_pcm_wait()
--HG--
branch : SDL-1.2
2009-10-19 05:59:07 +00:00
Sam Lantinga
f91f685e87 ALSA write failed (unrecoverable): Resource temporarily unavailable
--HG--
branch : SDL-1.2
2009-10-19 05:24:48 +00:00
Sam Lantinga
1b26102024 Added an error message for when ALSA audio fails
--HG--
branch : SDL-1.2
2009-10-19 05:15:21 +00:00
Sam Lantinga
bb0c0285eb Getting as close as you can with periods is better than the default parameters.
--HG--
branch : SDL-1.2
2009-10-19 03:18:15 +00:00
Sam Lantinga
9d6d374b2e Recoomendation from Lennart Poettering:
I guess I don't have to mention that, but ALSA_WaitAudio() is
pure evil, and just broken. getpid() returns pids, not tids. You get
those via gettid(). But I'd recommend dropping that entirely. It's
just broken.

--HG--
branch : SDL-1.2
2009-10-19 02:36:02 +00:00
Sam Lantinga
9ae92e66fe Recommendation from Lennart Poettering:
In ALSA_PlayAudio() it is a good idea to use snd_pcm_recover() instead
of checking for the error codes yourself.

--HG--
branch : SDL-1.2
2009-10-19 02:33:07 +00:00
Sam Lantinga
1c6619a32c Recommendation from Lennart Poettering:
In ALSA_OpenAudio(): instead of setting period_size+n_periods OR
buffer_size I'd recommend copying the hwparams stuff before you do
this, then first try period_size+n_periods, and then apply it with
snd_pcm_hw_params() and check if that works. If it didn't you should
take the copy of hwparams and try setting buffer_size and apply that
via snd_pcm_hw_params() and check if that worked. And if that failed
too, then take the copy and don't apply neither period nor buffer
settings and see if that works.

--HG--
branch : SDL-1.2
2009-10-19 02:23:21 +00:00
Sam Lantinga
eea9c5c809 Don't need the define anymore...
--HG--
branch : SDL-1.2
2009-10-17 07:05:33 +00:00
Sam Lantinga
e79fc21546 Enable the ALSA debug code via environment variable
--HG--
branch : SDL-1.2
2009-10-17 07:04:58 +00:00
Sam Lantinga
b634b7d198 Option to fix bug #851
For some people setting the period size works better (and is what SDL 1.2.13 did), but for most people it's the same or worse.  You can use an environment variable to pick which one you want.

--HG--
branch : SDL-1.2
2009-10-17 06:55:17 +00:00
Sam Lantinga
8f203969cf patch-pulse (from ahoka@NetBSD.org):
Fix assertion triggered in pulsaudio by returning "unknown" instead
of NULL pointer when guessing application name.

- Use getprogname on NetBSD as it wont return NULL

--HG--
branch : SDL-1.2
2009-10-16 05:12:20 +00:00
Ryan C. Gordon
5ef00a7131 Don't call it "ALSA 0.9 PCM audio" anymore, since we moved to the stable API.
--HG--
branch : SDL-1.2
2009-10-15 05:29:49 +00:00
Sam Lantinga
20aa1c739b Fixed bug #728
I am using a headset on my monitor as primary sound output device. From time to
time it happens that I switch off my monitor when I leave my computer and
switch it on when I come back.
When doing so while wesnoth is running I get no sound back when I switch on my
monitor. There is probably good reason for that. Therefore I wanted to exit and
restart wesnoth. Unfortunately, wesnoth always hangs in this situation. It
looks like wesnoth can not be exited when the primary sound device vanished.
I created a backtrace of this situation (please see attachment).

--HG--
branch : SDL-1.2
2009-10-15 02:52:11 +00:00
Sam Lantinga
3507bd99c3 Thilo helped me track down the audio issue with 22050 hz stereo sound. Yay!
--HG--
branch : SDL-1.2
2009-10-14 07:34:35 +00:00
Sam Lantinga
7d2e20993f Use the plug: ALSA devices for surround sound formats, which have automatic sample format/rate conversion.
Based on feedback from the ALSA development mailing list:
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-October/022267.html

--HG--
branch : SDL-1.2
2009-10-13 09:59:20 +00:00
Sam Lantinga
ffd9005e0f Switched from setting the period size and count to setting the buffer size directly, based on feedback from the ALSA development list:
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-October/022267.html

This has the nice side effect of reducing latency on my SBLive! card.

--HG--
branch : SDL-1.2
2009-10-13 09:56:15 +00:00
Sam Lantinga
d61038dbd8 ALSA's idea of a "frame" is the same as SDL's idea of a "sample". The frame is a single sample on a single channel, and we've defined the frames for each channel as being interleaved.
--HG--
branch : SDL-1.2
2009-10-13 09:35:37 +00:00
Sam Lantinga
53ac1950cc Fixed debug code to print correct values
Passed a meaningful value to snd_pcm_sw_params_set_start_threshold()

--HG--
branch : SDL-1.2
2009-10-13 09:24:05 +00:00
Sam Lantinga
46ea188de1 On recent distributions ALSA pipes streams through PulseAudio anyway, so using PulseAudio first when it's available will improve latency and reduce ALSA configuration quirks.
--HG--
branch : SDL-1.2
2009-10-13 08:42:40 +00:00
Ryan C. Gordon
0689c21666 Corrected my snd_pcm_writei fix.
Apparently ALSA says "frames" but it means samples...you don't split this into
 groups by number of channels.

The adventure continues.

--HG--
branch : SDL-1.2
2009-10-13 08:27:28 +00:00
Ryan C. Gordon
502b4667e6 Forcibly disabled MMX mixers.
Hopefully fixes Bugzilla #649.

--HG--
branch : SDL-1.2
2009-10-12 08:58:12 +00:00
Ryan C. Gordon
fdf24e0516 Whoops, need to convert from bits to bytes for frame size.
--HG--
branch : SDL-1.2
2009-10-12 08:18:36 +00:00
Ryan C. Gordon
c14c3e1851 Corrected misuse of snd_pcm_writei() in ALSA driver.
Hopefully fixes Bugzilla #650.

--HG--
branch : SDL-1.2
2009-10-12 08:06:40 +00:00
Sam Lantinga
b11d094c13 Debian patch: 209_alsa_priority.diff
--HG--
branch : SDL-1.2
2009-10-10 09:07:51 +00:00
Ryan C. Gordon
d32ba2f65c Moved to stable ALSA API.
This cleans up a few problems with our use of the ancient ALSA 0.9 API.

This means we can ditch the dlvsym() nonsense and use SDL_LoadFunction(), too.

 Fixes Bugzilla #745.

--HG--
branch : SDL-1.2
2009-10-10 07:33:18 +00:00
Sam Lantinga
e2c3a0fd12 Fixed bug #698
Hans de Goede      2009-02-13 01:10:52 PST

Since the new "glitch free" version of pulseaudio (used in Fedora 10 amongst
others), the sound of SDL using apps (like a simple playmus call) has been
crackling.

While looking in to fixing this I noticed that the current pulseaudio code in
SDL uses pa_simple. However pa_simple uses a thread to pump pulseaudio events
and ipc, given that SDL already has its own thread for audio handling this is
clearly suboptimal, leading to unnecessary context switching IPC, etc. Also
pa_simple does not allow one to implement the WaitAudio() callback for SDL
audiodrivers properly.

Given that my work is mostly a rewrite (although some original pieces remain)
I'm attaching the new .c and .h file, as that is easier to review then the huge
diff.

Let me know if you also want the diff.

This new version has the following features:
-no longer use an additional thread next to the SDL sound thread
-do not crackle with glitch free audio
-when used with a newer pulse, which does glitch free audio, the total latency
is
 the same as with the alsa driver
-proper WaitAudio() implementation, saving another mixlen worth of latency
-adds a WaitDone() implementation

This patch has been written in consultancy with Lennart Poetering (the
pulseaudio author) and has been reviewed by him for correct use of the pa API.

--HG--
branch : SDL-1.2
2009-09-21 09:27:08 +00:00
Sam Lantinga
e5b30c87c1 Fixed bug #572
Please merge this patch for the PA driver in SDL.

http://0pointer.de/public/sdl-pulse-rework.patch

This patch:
- fixes buffering (i.e. reduces number of "fragments" to 2, doesn't defer
filling up of the buffer until the entire buffer ran completely empty.)
- drops $PASERVER and $PADEVICE env var support, since this is a duplication of
$PULSE_SERVER and $PULSE_SINK which the PA libs honor anyway.

This fixes the sound issues in all games I tested.

--HG--
branch : SDL-1.2
2009-09-21 08:03:00 +00:00