Commit graph

2425 commits

Author SHA1 Message Date
Sam Lantinga
1cd8a4e6f2 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404118
2009-10-19 02:36:02 +00:00
Sam Lantinga
3070b39b91 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404117
2009-10-19 02:33:07 +00:00
Sam Lantinga
8ce0ea3899 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404116
2009-10-19 02:23:21 +00:00
Sam Lantinga
b0f60f0a44 There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct value after the first scanline. Ugh.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404114
2009-10-18 23:18:28 +00:00
Sam Lantinga
dc78cb75fd Fixed bug #855
Ludwig Nussel      2009-10-18 06:31:52 PDT

an mprotect call was added to fix bug 528. However that results in a buffer
that allows writing and code execution. Ie the no-execute security features of
modern operating systems are defeated this way. Two mprotect calls are needed.
One to make the buffer executable but not writeable when done and another one
to make the buffer writeable again if the content needs to be changed.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404112
2009-10-18 17:31:37 +00:00
Sam Lantinga
dd60160043 Use MacOS line endings for Mac resource files
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404111
2009-10-18 16:23:12 +00:00
Sam Lantinga
94eab0d7c7 Use MacOS line endings for SDL.x
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404110
2009-10-18 16:17:13 +00:00
Sam Lantinga
8a8f96df82 Fixed bug #853
Ludwig Nussel      2009-10-18 05:34:18 PDT

src/joystick/linux/SDL_sysjoystick.c has some problems:

- test_bit() might break with strict aliasing
- test_bit() assumes array is Uint32 but its actually "unsigned long"
  on 64bit systems sizeof(long) != sizeof(Uint32).
- the keybit array is too small
- the arrays are unitialized so the number of
  detected buttons is quite random

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404109
2009-10-18 16:14:57 +00:00
Sam Lantinga
ad3387731d We no longer have a DirectInput link requirement
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404105
2009-10-17 17:35:48 +00:00
Sam Lantinga
a336ec9d81 Fixed bug #849
This was a silly bug. :)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404104
2009-10-17 16:49:23 +00:00
Sam Lantinga
e9bac2e940 Don't need the define anymore...
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404101
2009-10-17 07:05:33 +00:00
Sam Lantinga
335f70faf3 Enable the ALSA debug code via environment variable
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404100
2009-10-17 07:04:58 +00:00
Sam Lantinga
86dfb8995b 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404099
2009-10-17 06:55:17 +00:00
Sam Lantinga
28207014ab matthew green
actually, please don't apply this upstream.  i need to think about
a better solution..

thanks.

.mrg.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404098
2009-10-17 05:05:29 +00:00
Sam Lantinga
0b57841390 Allow the application to resize the window without destroying the OpenGL context
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404097
2009-10-16 07:24:11 +00:00
Sam Lantinga
cb5e4ff83f 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404096
2009-10-16 05:12:20 +00:00
Sam Lantinga
242f11f73b patch-ac (from mrg@NetBSD.org):
Look for libGL.so, not any particular libGL.so.<X>, on NetBSD.
(the comment inline explains why)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404095
2009-10-16 05:06:17 +00:00
Sam Lantinga
dbe69ecf39 patch-ab (from reinoud@NetBSD.org):
Apply patch to first unlock the CD before trying to eject it. Since
SDL doesn't seem to have lock/unlock primitives, this looks like the
right thing to do.

Fixes audio/tcd's eject function too.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404094
2009-10-16 05:05:21 +00:00
Sam Lantinga
a084339a4f It helps to use the right constant. :)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404093
2009-10-16 04:29:27 +00:00
Sam Lantinga
f068193fd9 Use SDL's byte order check, just to be sure
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404092
2009-10-16 04:24:03 +00:00
Ryan C. Gordon
b627675ba0 Don't call it "ALSA 0.9 PCM audio" anymore, since we moved to the stable API.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404091
2009-10-15 05:29:49 +00:00
Sam Lantinga
aeea9fcac0 Fixed building on Mac OS X
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404090
2009-10-15 05:18:48 +00:00
Sam Lantinga
2b8a4a45ef 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404089
2009-10-15 02:52:11 +00:00
Sam Lantinga
4270bc2aa0 Thilo helped me track down the audio issue with 22050 hz stereo sound. Yay!
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404088
2009-10-14 07:34:35 +00:00
Patrice Mandin
a7c0a31643 Add a note for experimental Milan support.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404084
2009-10-13 18:14:13 +00:00
Sam Lantinga
4ae0e6460e 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404081
2009-10-13 09:59:20 +00:00
Sam Lantinga
ec6a0f32bb 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404080
2009-10-13 09:56:15 +00:00
Sam Lantinga
9786668dab 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404079
2009-10-13 09:35:37 +00:00
Sam Lantinga
ff4ec16bb6 Fixed debug code to print correct values
Passed a meaningful value to snd_pcm_sw_params_set_start_threshold()

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404078
2009-10-13 09:24:05 +00:00
Sam Lantinga
7de1a1a813 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404077
2009-10-13 08:42:40 +00:00
Ryan C. Gordon
8df8f52eb1 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
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404076
2009-10-13 08:27:28 +00:00
Sam Lantinga
41f37eccc5 Only show the dynamic audio libraries if we'll be dynamically loading them
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404072
2009-10-13 06:45:02 +00:00
Sam Lantinga
90ac468f99 Simplify and improve dynamic library detection, taken from SDL_image
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404067
2009-10-13 05:20:09 +00:00
Sam Lantinga
44980b540d We don't need dlvsym() for ALSA anymore, yay!
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404066
2009-10-13 04:23:34 +00:00
Sam Lantinga
9e00bd18a7 Merged fix from SDL 1.3
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404065
2009-10-12 23:21:19 +00:00
Sam Lantinga
deaf4b7e93 Steven Noonan to sdl
While trying to build the SDLMain.m included with SDL 1.2.14, with
#define SDL_USE_NIB_FILE 1:

/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:
In function '-[SDLMain fixMenu:withAppName:]':
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122:
warning: 'sizeToFit' is deprecated (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:
In function 'main':
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376:
warning: 'poseAsClass:' is deprecated (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376:
error: 'poseAsClass:' is unavailable (declared at
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127)
/Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377:
warning: passing argument 2 of 'NSApplicationMain' from incompatible
pointer type



Eric Wing to Sam

I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method.
This was deprecated in Obj-C 2.0 and not retained in 64-bit.

I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that.

Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason).

Three thoughts come to mind.
1) The Info.plist has properties to control things related to the startup class and nib.
NSPrincipalClass, NSMainNibFile

Maybe principle class needs to be SDLApplication and we can delete the poseAs

2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics.


3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance):

@interface SDLApplication : NSApplication
@end

@implementation SDLApplication
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
   /* Post a SDL_QUIT event */
   SDL_Event event;
   event.type = SDL_QUIT;
   SDL_PushEvent(&event);
}
@end


So instead, we change this to: (warning written in mail and untested)

@interface NSApplication (SDLApplication)
- (void) terminate:(id)sender;
@end

@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
   /* Post a SDL_QUIT event */
   SDL_Event event;
   event.type = SDL_QUIT;
   SDL_PushEvent(&event);
}
@end


Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line).

Perhaps you could ask the bug reporter to try this solution (#3).
And if that fails, maybe try #1.


-Eric


Steven Noonan to Sam

The suggested change (diff below) seems to work fine.

- Steven

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404064
2009-10-12 21:07:12 +00:00
Sam Lantinga
0e89501b8e Joystick patch from FreeBSD ports system
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404060
2009-10-12 09:32:55 +00:00
Ryan C. Gordon
d5b19efe79 Forcibly disabled MMX mixers.
Hopefully fixes Bugzilla #649.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404059
2009-10-12 08:58:12 +00:00
Ryan C. Gordon
5409db51f6 Whoops, need to convert from bits to bytes for frame size.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404057
2009-10-12 08:18:36 +00:00
Ryan C. Gordon
c865dbf891 Corrected misuse of snd_pcm_writei() in ALSA driver.
Hopefully fixes Bugzilla #650.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404056
2009-10-12 08:06:40 +00:00
Sam Lantinga
56967065f7 Added support for SDL_VIDEO_FULLSCREEN_DISPLAY, but mouse events need to be fixed up.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404043
2009-10-10 15:10:06 +00:00
Sam Lantinga
007680c438 Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for SDL_VIDEO_FULLSCREEN_HEAD on X11.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404042
2009-10-10 15:06:04 +00:00
Sam Lantinga
7d7dbf1910 Put the braces on the next line so vi can find the beginning of the function.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404041
2009-10-10 14:59:32 +00:00
Patrice Mandin
83b57facc5 Disable double buffer for Milan. Also set current width,height after we read it.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404038
2009-10-10 10:28:05 +00:00
Sam Lantinga
3b682483b5 Added missing caca files
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404037
2009-10-10 10:17:51 +00:00
Sam Lantinga
a1bececfc3 Fixed bug #838
Ozkan Sezer      2009-10-10 01:45:27 PDT

sdlenvvars.html doesn't list pulse among the supported values for
SDL_AUDIODRIVER var.  Attached a quick patch to remedy that, hopefully placing
the entry in the right order.  Regards.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404036
2009-10-10 10:15:35 +00:00
Sam Lantinga
dc6913d2e1 Adapted from Debian patch: 320_activate_xrandr_on_default.diff
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404035
2009-10-10 10:14:01 +00:00
Sam Lantinga
cb2bc4152c Debian patch: 310_segfault_noGLX.diff
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404034
2009-10-10 10:10:36 +00:00
Sam Lantinga
17a7853ac1 Debian patch: f230_manpages.diff
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404033
2009-10-10 10:09:01 +00:00
Sam Lantinga
826b5d2690 Debian patch: 218_joystick_memmove.diff
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404031
2009-10-10 10:01:38 +00:00