annotate src/cdrom/macosx/AudioFileReaderThread.c @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents dc6b59e925a2
children 4da1ee79c9af
rev   line source
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 /*
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 Library General Public License for more details.
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 Sam Lantinga
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 slouken@libsdl.org
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22 This file based on Apple sample code. We haven't changed the file name,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 so if you want to see the original search for it on apple.com/developer
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
25 #include "SDL_config.h"
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
27 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
28 AudioFileManager.cpp
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
29 */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 #include "AudioFilePlayer.h"
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
31 #include <mach/mach.h> /* used for setting policy of thread */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 #include "SDLOSXCAGuard.h"
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 #include <pthread.h>
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
35 /*#include <list>*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
37 /*typedef void *FileData;*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38 typedef struct S_FileData
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 AudioFileManager *obj;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41 struct S_FileData *next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 } FileData;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
43
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
44
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
45 typedef struct S_FileReaderThread
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
46 {
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
47 /*public:*/
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
48 SDLOSXCAGuard *(*GetGuard) (struct S_FileReaderThread * frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
49 void (*AddReader) (struct S_FileReaderThread * frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
50 void (*RemoveReader) (struct S_FileReaderThread * frt,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
51 AudioFileManager * inItem);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
52 int (*TryNextRead) (struct S_FileReaderThread * frt,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
53 AudioFileManager * inItem);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
54
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
55 int mThreadShouldDie;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
56
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
57 /*private:*/
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
58 /*typedef std::list<AudioFileManager*> FileData; */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
59
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
60 SDLOSXCAGuard *mGuard;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
61 UInt32 mThreadPriority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
62
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
63 int mNumReaders;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
64 FileData *mFileData;
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
65
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
66
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
67 void (*ReadNextChunk) (struct S_FileReaderThread * frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
68 int (*StartFixedPriorityThread) (struct S_FileReaderThread * frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
69 /*static */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
70 UInt32 (*GetThreadBasePriority) (pthread_t inThread);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
71 /*static */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
72 void *(*DiskReaderEntry) (void *inRefCon);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73 } FileReaderThread;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
75
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
76 static SDLOSXCAGuard *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
77 FileReaderThread_GetGuard (FileReaderThread * frt)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
78 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
79 return frt->mGuard;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
80 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
81
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
82 /* returns 1 if succeeded */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
83 static int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
84 FileReaderThread_TryNextRead (FileReaderThread * frt,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
85 AudioFileManager * inItem)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
86 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
87 int didLock = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
88 int succeeded = 0;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
89 if (frt->mGuard->Try (frt->mGuard, &didLock)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
90 /*frt->mFileData.push_back (inItem); */
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
91 /* !!! FIXME: this could be faster with a "tail" member. --ryan. */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92 FileData *i = frt->mFileData;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
93 FileData *prev = NULL;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
94
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
95 FileData *newfd = (FileData *) SDL_malloc (sizeof (FileData));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
96 newfd->obj = inItem;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 newfd->next = NULL;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
99 while (i != NULL) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
100 prev = i;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
101 i = i->next;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
102 }
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103 if (prev == NULL)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 frt->mFileData = newfd;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105 else
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 prev->next = newfd;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
108 frt->mGuard->Notify (frt->mGuard);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109 succeeded = 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111 if (didLock)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
112 frt->mGuard->Unlock (frt->mGuard);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
114
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 return succeeded;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
118 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
119 FileReaderThread_AddReader (FileReaderThread * frt)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
121 if (frt->mNumReaders == 0) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 frt->mThreadShouldDie = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123 frt->StartFixedPriorityThread (frt);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
124 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125 frt->mNumReaders++;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
128 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
129 FileReaderThread_RemoveReader (FileReaderThread * frt,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
130 AudioFileManager * inItem)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
132 if (frt->mNumReaders > 0) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
133 int bNeedsRelease = frt->mGuard->Lock (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
134
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
135 /*frt->mFileData.remove (inItem); */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136 FileData *i = frt->mFileData;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137 FileData *prev = NULL;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
138 while (i != NULL) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 FileData *next = i->next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 if (i->obj != inItem)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 prev = i;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
142 else {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
143 if (prev == NULL)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144 frt->mFileData = next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145 else
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 prev->next = next;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
147 SDL_free (i);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
148 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
149 i = next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
150 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
151
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
152 if (--frt->mNumReaders == 0) {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
153 frt->mThreadShouldDie = 1;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
154 frt->mGuard->Notify (frt->mGuard); /* wake up thread so it will quit */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
155 frt->mGuard->Wait (frt->mGuard); /* wait for thread to die */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
156 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
157
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
158 if (bNeedsRelease)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
159 frt->mGuard->Unlock (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
160 }
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
161 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
162
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
163 static int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
164 FileReaderThread_StartFixedPriorityThread (FileReaderThread * frt)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
165 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
166 pthread_attr_t theThreadAttrs;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
167 pthread_t pThread;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
168
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
169 OSStatus result = pthread_attr_init (&theThreadAttrs);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
170 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
171 return 0; /*THROW_RESULT("pthread_attr_init - Thread attributes could not be created.") */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
172
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
173 result =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
174 pthread_attr_setdetachstate (&theThreadAttrs,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
175 PTHREAD_CREATE_DETACHED);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
176 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
177 return 0; /*THROW_RESULT("pthread_attr_setdetachstate - Thread attributes could not be detached.") */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
178
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
179 result =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
180 pthread_create (&pThread, &theThreadAttrs, frt->DiskReaderEntry, frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
181 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
182 return 0; /*THROW_RESULT("pthread_create - Create and start the thread.") */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
183
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
184 pthread_attr_destroy (&theThreadAttrs);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
185
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
186 /* we've now created the thread and started it
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
187 we'll now set the priority of the thread to the nominated priority
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
188 and we'll also make the thread fixed */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
189 thread_extended_policy_data_t theFixedPolicy;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
190 thread_precedence_policy_data_t thePrecedencePolicy;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
191 SInt32 relativePriority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
192
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
193 /* make thread fixed */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
194 theFixedPolicy.timeshare = 0; /* set to 1 for a non-fixed thread */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
195 result =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
196 thread_policy_set (pthread_mach_thread_np (pThread),
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
197 THREAD_EXTENDED_POLICY,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
198 (thread_policy_t) & theFixedPolicy,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
199 THREAD_EXTENDED_POLICY_COUNT);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
200 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
201 return 0; /*THROW_RESULT("thread_policy - Couldn't set thread as fixed priority.") */
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
202 /* set priority */
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
203 /* precedency policy's "importance" value is relative to spawning thread's priority */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
204 relativePriority =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
205 frt->mThreadPriority - frt->GetThreadBasePriority (pthread_self ());
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
206
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
207 thePrecedencePolicy.importance = relativePriority;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
208 result =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
209 thread_policy_set (pthread_mach_thread_np (pThread),
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
210 THREAD_PRECEDENCE_POLICY,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
211 (thread_policy_t) & thePrecedencePolicy,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
212 THREAD_PRECEDENCE_POLICY_COUNT);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
213 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
214 return 0; /*THROW_RESULT("thread_policy - Couldn't set thread priority.") */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
215
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
216 return 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
217 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
218
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
219 static UInt32
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
220 FileReaderThread_GetThreadBasePriority (pthread_t inThread)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
221 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
222 thread_basic_info_data_t threadInfo;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
223 policy_info_data_t thePolicyInfo;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
224 unsigned int count;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
225
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
226 /* get basic info */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
227 count = THREAD_BASIC_INFO_COUNT;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
228 thread_info (pthread_mach_thread_np (inThread), THREAD_BASIC_INFO,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
229 (integer_t *) & threadInfo, &count);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
230
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
231 switch (threadInfo.policy) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
232 case POLICY_TIMESHARE:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
233 count = POLICY_TIMESHARE_INFO_COUNT;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
234 thread_info (pthread_mach_thread_np (inThread),
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
235 THREAD_SCHED_TIMESHARE_INFO,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
236 (integer_t *) & (thePolicyInfo.ts), &count);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
237 return thePolicyInfo.ts.base_priority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
238 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
239
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
240 case POLICY_FIFO:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
241 count = POLICY_FIFO_INFO_COUNT;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
242 thread_info (pthread_mach_thread_np (inThread),
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
243 THREAD_SCHED_FIFO_INFO,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
244 (integer_t *) & (thePolicyInfo.fifo), &count);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
245 if (thePolicyInfo.fifo.depressed) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
246 return thePolicyInfo.fifo.depress_priority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
247 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
248 return thePolicyInfo.fifo.base_priority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
249 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
250 break;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
251
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
252 case POLICY_RR:
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
253 count = POLICY_RR_INFO_COUNT;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
254 thread_info (pthread_mach_thread_np (inThread),
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
255 THREAD_SCHED_RR_INFO,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
256 (integer_t *) & (thePolicyInfo.rr), &count);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
257 if (thePolicyInfo.rr.depressed) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
258 return thePolicyInfo.rr.depress_priority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
259 } else {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
260 return thePolicyInfo.rr.base_priority;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
261 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
262 break;
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
263 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
264
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
265 return 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
266 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
267
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
268 static void *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
269 FileReaderThread_DiskReaderEntry (void *inRefCon)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
270 {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
271 FileReaderThread *frt = (FileReaderThread *) inRefCon;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
272 frt->ReadNextChunk (frt);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
273 #if DEBUG
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
274 printf ("finished with reading file\n");
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
275 #endif
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
276
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
277 return 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
278 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
279
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
280 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
281 FileReaderThread_ReadNextChunk (FileReaderThread * frt)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
282 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
283 OSStatus result;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
284 UInt32 dataChunkSize;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
285 AudioFileManager *theItem = 0;
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
286
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
287 for (;;) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
288 { /* this is a scoped based lock */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
289 int bNeedsRelease = frt->mGuard->Lock (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
290
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
291 if (frt->mThreadShouldDie) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
292 frt->mGuard->Notify (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
293 if (bNeedsRelease)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
294 frt->mGuard->Unlock (frt->mGuard);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
295 return;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
296 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
297
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
298 /*if (frt->mFileData.empty()) */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
299 if (frt->mFileData == NULL) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
300 frt->mGuard->Wait (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
301 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
302
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
303 /* kill thread */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
304 if (frt->mThreadShouldDie) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
305
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
306 frt->mGuard->Notify (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
307 if (bNeedsRelease)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
308 frt->mGuard->Unlock (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
309 return;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
310 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
311
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
312 /*theItem = frt->mFileData.front(); */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
313 /*frt->mFileData.pop_front(); */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
314 theItem = NULL;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
315 if (frt->mFileData != NULL) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
316 FileData *next = frt->mFileData->next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
317 theItem = frt->mFileData->obj;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
318 SDL_free (frt->mFileData);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
319 frt->mFileData = next;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
320 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
321
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
322 if (bNeedsRelease)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
323 frt->mGuard->Unlock (frt->mGuard);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
324 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
325
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
326 if ((theItem->mFileLength - theItem->mReadFilePosition) <
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
327 theItem->mChunkSize)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
328 dataChunkSize = theItem->mFileLength - theItem->mReadFilePosition;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
329 else
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
330 dataChunkSize = theItem->mChunkSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
331
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
332 /* this is the exit condition for the thread */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
333 if (dataChunkSize <= 0) {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
334 theItem->mFinishedReadingData = 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
335 continue;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
336 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
337 /* construct pointer */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
338 char *writePtr = (char *) (theItem->GetFileBuffer (theItem) +
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
339 (theItem->
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
340 mWriteToFirstBuffer ? 0 : theItem->
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
341 mChunkSize));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
342
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
343 /* read data */
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
344 result = theItem->Read (theItem, writePtr, &dataChunkSize);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
345 if (result != noErr && result != eofErr) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
346 AudioFilePlayer *afp =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
347 (AudioFilePlayer *) theItem->GetParent (theItem);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
348 afp->DoNotification (afp, result);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
349 continue;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
350 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
351
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
352 if (dataChunkSize != theItem->mChunkSize) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
353 writePtr += dataChunkSize;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
354
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
355 /* can't exit yet.. we still have to pass the partial buffer back */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
356 SDL_memset (writePtr, 0, (theItem->mChunkSize - dataChunkSize));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
357 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
358
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
359 theItem->mWriteToFirstBuffer = !theItem->mWriteToFirstBuffer; /* switch buffers */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
360
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
361 if (result == eofErr)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
362 theItem->mReadFilePosition = theItem->mFileLength;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
363 else
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
364 theItem->mReadFilePosition += dataChunkSize; /* increment count */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
365 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
366 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
367
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
368 void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
369 delete_FileReaderThread (FileReaderThread * frt)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
370 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
371 if (frt != NULL) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
372 delete_SDLOSXCAGuard (frt->mGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
373 SDL_free (frt);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
374 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
375 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
376
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
377 FileReaderThread *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
378 new_FileReaderThread ()
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
379 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
380 FileReaderThread *frt =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
381 (FileReaderThread *) SDL_malloc (sizeof (FileReaderThread));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
382 if (frt == NULL)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
383 return NULL;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
384 SDL_memset (frt, '\0', sizeof (*frt));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
385
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
386 frt->mGuard = new_SDLOSXCAGuard ();
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
387 if (frt->mGuard == NULL) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
388 SDL_free (frt);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
389 return NULL;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
390 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
391 #define SET_FILEREADERTHREAD_METHOD(m) frt->m = FileReaderThread_##m
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
392 SET_FILEREADERTHREAD_METHOD (GetGuard);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
393 SET_FILEREADERTHREAD_METHOD (AddReader);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
394 SET_FILEREADERTHREAD_METHOD (RemoveReader);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
395 SET_FILEREADERTHREAD_METHOD (TryNextRead);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
396 SET_FILEREADERTHREAD_METHOD (ReadNextChunk);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
397 SET_FILEREADERTHREAD_METHOD (StartFixedPriorityThread);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
398 SET_FILEREADERTHREAD_METHOD (GetThreadBasePriority);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
399 SET_FILEREADERTHREAD_METHOD (DiskReaderEntry);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
400 #undef SET_FILEREADERTHREAD_METHOD
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
401
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
402 frt->mThreadPriority = 62;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
403 return frt;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
404 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
405
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
406
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
407 static FileReaderThread *sReaderThread;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
408
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
409
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
410 static int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
411 AudioFileManager_DoConnect (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
412 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
413 if (!afm->mIsEngaged) {
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
414 OSStatus result;
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
415
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
416 /*afm->mReadFilePosition = 0; */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
417 afm->mFinishedReadingData = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
418
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
419 afm->mNumTimesAskedSinceFinished = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
420 afm->mLockUnsuccessful = 0;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
421
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
422 UInt32 dataChunkSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
423
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
424 if ((afm->mFileLength - afm->mReadFilePosition) < afm->mChunkSize)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
425 dataChunkSize = afm->mFileLength - afm->mReadFilePosition;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
426 else
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
427 dataChunkSize = afm->mChunkSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
428
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
429 result = afm->Read (afm, afm->mFileBuffer, &dataChunkSize);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
430 if (result)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
431 return 0; /*THROW_RESULT("AudioFileManager::DoConnect(): Read") */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
432
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
433 afm->mReadFilePosition += dataChunkSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
434
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
435 afm->mWriteToFirstBuffer = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
436 afm->mReadFromFirstBuffer = 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
437
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
438 sReaderThread->AddReader (sReaderThread);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
439
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
440 afm->mIsEngaged = 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
441 }
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
442 /*
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
443 else
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
444 throw static_cast<OSStatus>(-1); *//* thread has already been started */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
445
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
446 return 1;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
447 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
448
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
449 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
450 AudioFileManager_Disconnect (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
451 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
452 if (afm->mIsEngaged) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
453 sReaderThread->RemoveReader (sReaderThread, afm);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
454 afm->mIsEngaged = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
455 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
456 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
457
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
458 static OSStatus
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
459 AudioFileManager_Read (AudioFileManager * afm, char *buffer, UInt32 * len)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
460 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
461 return FSReadFork (afm->mForkRefNum,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
462 fsFromStart,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
463 afm->mReadFilePosition + afm->mAudioDataOffset,
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
464 *len, buffer, len);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
465 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
466
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
467 static OSStatus
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
468 AudioFileManager_GetFileData (AudioFileManager * afm, void **inOutData,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
469 UInt32 * inOutDataSize)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
470 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
471 if (afm->mFinishedReadingData) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
472 ++afm->mNumTimesAskedSinceFinished;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
473 *inOutDataSize = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
474 *inOutData = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
475 return noErr;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
476 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
477
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
478 if (afm->mReadFromFirstBuffer == afm->mWriteToFirstBuffer) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
479 #if DEBUG
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
480 printf ("* * * * * * * Can't keep up with reading file\n");
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
481 #endif
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
482
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
483 afm->mParent->DoNotification (afm->mParent,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
484 kAudioFilePlayErr_FilePlayUnderrun);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
485 *inOutDataSize = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
486 *inOutData = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
487 } else {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
488 *inOutDataSize = afm->mChunkSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
489 *inOutData =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
490 afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm->
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
491 mFileBuffer +
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
492 afm->mChunkSize);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
493 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
494
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
495 afm->mLockUnsuccessful = !sReaderThread->TryNextRead (sReaderThread, afm);
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
496
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
497 afm->mReadFromFirstBuffer = !afm->mReadFromFirstBuffer;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
498
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
499 return noErr;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
500 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
501
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
502 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
503 AudioFileManager_AfterRender (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
504 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
505 if (afm->mNumTimesAskedSinceFinished > 0) {
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
506 int didLock = 0;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
507 SDLOSXCAGuard *guard = sReaderThread->GetGuard (sReaderThread);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
508 if (guard->Try (guard, &didLock)) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
509 afm->mParent->DoNotification (afm->mParent,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
510 kAudioFilePlay_FileIsFinished);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
511 if (didLock)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
512 guard->Unlock (guard);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
513 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
514 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
515
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
516 if (afm->mLockUnsuccessful)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
517 afm->mLockUnsuccessful =
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
518 !sReaderThread->TryNextRead (sReaderThread, afm);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
519 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
520
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
521 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
522 AudioFileManager_SetPosition (AudioFileManager * afm, SInt64 pos)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
523 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
524 if (pos < 0 || pos >= afm->mFileLength) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
525 SDL_SetError
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
526 ("AudioFileManager::SetPosition - position invalid: %d filelen=%d\n",
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
527 (unsigned int) pos, (unsigned int) afm->mFileLength);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
528 pos = 0;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
529 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
530
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
531 afm->mReadFilePosition = pos;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
532 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
533
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
534 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
535 AudioFileManager_SetEndOfFile (AudioFileManager * afm, SInt64 pos)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
536 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
537 if (pos <= 0 || pos > afm->mFileLength) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
538 SDL_SetError
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
539 ("AudioFileManager::SetEndOfFile - position beyond actual eof\n");
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
540 pos = afm->mFileLength;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
541 }
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
542
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
543 afm->mFileLength = pos;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
544 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
545
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
546 static const char *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
547 AudioFileManager_GetFileBuffer (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
548 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
549 return afm->mFileBuffer;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
550 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
551
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
552 const AudioFilePlayer *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
553 AudioFileManager_GetParent (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
554 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
555 return afm->mParent;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
556 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
557
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
558 static int
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
559 AudioFileManager_GetByteCounter (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
560 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
561 return afm->mByteCounter;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
562 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
563
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
564
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
565 static OSStatus
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
566 AudioFileManager_FileInputProc (void *inRefCon,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
567 AudioUnitRenderActionFlags inActionFlags,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
568 const AudioTimeStamp * inTimeStamp,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
569 UInt32 inBusNumber, AudioBuffer * ioData)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
570 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
571 AudioFileManager *afm = (AudioFileManager *) inRefCon;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
572 return afm->Render (afm, ioData);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
573 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
574
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
575 static OSStatus
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
576 AudioFileManager_Render (AudioFileManager * afm, AudioBuffer * ioData)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
577 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
578 OSStatus result = noErr;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
579
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
580 if (afm->mBufferOffset >= afm->mBufferSize) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
581 result = afm->GetFileData (afm, &afm->mTmpBuffer, &afm->mBufferSize);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
582 if (result) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
583 SDL_SetError ("AudioConverterFillBuffer:%ld\n", result);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
584 afm->mParent->DoNotification (afm->mParent, result);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
585 return result;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
586 }
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
587
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
588 afm->mBufferOffset = 0;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
589 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
590
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
591 if (ioData->mDataByteSize > afm->mBufferSize - afm->mBufferOffset)
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
592 ioData->mDataByteSize = afm->mBufferSize - afm->mBufferOffset;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
593 ioData->mData = (char *) afm->mTmpBuffer + afm->mBufferOffset;
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
594 afm->mBufferOffset += ioData->mDataByteSize;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
595
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
596 afm->mByteCounter += ioData->mDataByteSize;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
597 afm->AfterRender (afm);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
598 return result;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
599 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
600
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
601
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
602 void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
603 delete_AudioFileManager (AudioFileManager * afm)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
604 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
605 if (afm != NULL) {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
606 if (afm->mFileBuffer) {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
607 free (afm->mFileBuffer);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
608 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
609
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
610 SDL_free (afm);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
611 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
612 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
613
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
614
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
615 AudioFileManager *
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
616 new_AudioFileManager (AudioFilePlayer * inParent,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
617 SInt16 inForkRefNum,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
618 SInt64 inFileLength, UInt32 inChunkSize)
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
619 {
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
620 AudioFileManager *afm;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
621
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
622 if (sReaderThread == NULL) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
623 sReaderThread = new_FileReaderThread ();
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
624 if (sReaderThread == NULL)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
625 return NULL;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
626 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
627
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
628 afm = (AudioFileManager *) SDL_malloc (sizeof (AudioFileManager));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
629 if (afm == NULL)
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
630 return NULL;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
631 SDL_memset (afm, '\0', sizeof (*afm));
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
632
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
633 #define SET_AUDIOFILEMANAGER_METHOD(m) afm->m = AudioFileManager_##m
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
634 SET_AUDIOFILEMANAGER_METHOD (Disconnect);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
635 SET_AUDIOFILEMANAGER_METHOD (DoConnect);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
636 SET_AUDIOFILEMANAGER_METHOD (Read);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
637 SET_AUDIOFILEMANAGER_METHOD (GetFileBuffer);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
638 SET_AUDIOFILEMANAGER_METHOD (GetParent);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
639 SET_AUDIOFILEMANAGER_METHOD (SetPosition);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
640 SET_AUDIOFILEMANAGER_METHOD (GetByteCounter);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
641 SET_AUDIOFILEMANAGER_METHOD (SetEndOfFile);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
642 SET_AUDIOFILEMANAGER_METHOD (Render);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
643 SET_AUDIOFILEMANAGER_METHOD (GetFileData);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
644 SET_AUDIOFILEMANAGER_METHOD (AfterRender);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
645 SET_AUDIOFILEMANAGER_METHOD (FileInputProc);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
646 #undef SET_AUDIOFILEMANAGER_METHOD
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
647
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
648 afm->mParent = inParent;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
649 afm->mForkRefNum = inForkRefNum;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
650 afm->mBufferSize = inChunkSize;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
651 afm->mBufferOffset = inChunkSize;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
652 afm->mChunkSize = inChunkSize;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
653 afm->mFileLength = inFileLength;
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
654 afm->mFileBuffer = (char *) SDL_malloc (afm->mChunkSize * 2);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
655 FSGetForkPosition (afm->mForkRefNum, &afm->mAudioDataOffset);
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
656 assert (afm->mFileBuffer != NULL);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
657 return afm;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
658 }
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
659
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1487
diff changeset
660 /* vi: set ts=4 sw=4 expandtab: */