annotate src/cdrom/macosx/SDL_syscdrom_c.h @ 613:9c6717a1c66f

Added MacOS X CD-ROM audio support (thanks Max and Darrell)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 15 Apr 2003 16:33:56 +0000
parents
children de1b2c3063b9
rev   line source
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 /***********************************************************************************
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 Implementation Notes
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 *********************
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 This code has several limitations currently (all of which are proabaly fixable):
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 1. A CD-ROM device is inferred from a mounted cdfs volume, so device 0 is
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 not necessarily the first CD-ROM device on the system. (Somewhat easy to fix
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 by useing the device name from the volume id's to reorder the volumes)
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 2. You can only open and control 1 CD-ROM device at a time. (Challenging to fix,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 due to extensive code restructuring)
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 3. The status reported by SDL_CDStatus only changes to from CD_PLAYING to CD_STOPPED in
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 1-second intervals (because the audio is buffered in 1-second chunks) If
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 the audio data is less than 1 second, the remainder is filled with silence.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 If you need to play sequences back-to-back that are less that 1 second long,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 use the frame position to determine when to play the next sequence, instead
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 of SDL_CDStatus.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 This may be possible to fix with a clever usage of the AudioUnit API.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 4. When new volumes are inserted, our volume information is not updated. The only way
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 to refresh this information is to reinit the CD-ROM subsystem of SDL. To fix this,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 one would probably have to fix point 1 above first, then figure out how to register
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 for a notification when new media is mounted in order to perform an automatic
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 rescan for cdfs volumes.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 So, here comes a description of how this all works.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 < Initializing >
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 To get things rolling, we have to locate mounted volumes that contain
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 audio (since nearly all Macs don't have analog audio-in on the sound card).
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 That's easy, since these volumes have a flag that indicates this special
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 filesystem. See DetectAudioCDVolumes() in CDPlayer.cpp for this code.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 Next, we parse the invisible .TOC.plist in the root of the volume, which gets us
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 the track information (number, offset, length, leadout, etc). See ReadTOCData() in
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 CDPlayer.cpp for the skinny on this.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 < The Playback Loop >
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 Now come the tricky parts. Let's start with basic audio playback. When a frame
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 range to play is requested, we must first find the .aiff files on the volume,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 hopefully in the right order. Since these files all begin with a number "1 Audio Track",
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 etc, this is used to determine the correct track order.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 Once all files are determined, we have to find what file corresponds to the start
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 and length parameter to SDL_SYS_CDPlay(). Again, this is quite simple by walking the
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 cdrom's track list. At this point, we also save the offset to the next track and frames
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 remaining, if we're going to have to play another file after the first one. See
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 GetFileForOffset() for this code.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 At this point we have all info needed to start playback, so we hand off to the LoadFile()
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 function, which proceeds to do its magic and plays back the file.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 When the file is finished playing, CompletionProc() is invoked, at which time we can
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 play the next file if the previously saved next track and frames remaining
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 indicates that we should.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 < Magic >
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 OK, so it's not really magic, but since I don't fully understand all the hidden details it
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 seems like it to me ;-) The API's involved are the AudioUnit and AudioFile API's. These
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 appear to be an extension of CoreAudio for creating modular playback and f/x entities.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 The important thing is that CPU usage is very low and reliability is very high. You'd
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 be hard-pressed to find a way to stutter the playback with other CPU-intensive tasks.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 One part of this magic is that it uses multiple threads, which carries the usual potential
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 for disaster if not handled carefully. Playback currently requires 4 additional threads:
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 1. The coreaudio runloop thread
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 2. The coreaudio device i/o thread
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 3. The file streaming thread
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 4. The notification/callback thread
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 The first 2 threads are necessary evil - CoreAudio creates this no matter what the situation
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 is (even the SDL sound implementation creates theses suckers). The last two are are created
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 by us.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 The file is streamed from disk using a threaded double-buffer approach.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 This way, the high latency operation of reading from disk can be performed without interrupting
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 the real-time device thread (which amounts to avoiding dropouts). The device thread grabs the
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 buffer that isn't being read and sends it to the CoreAudio mixer where it eventually gets
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 to the sound card.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 The device thread posts a notification when the file streaming thread is out of data. This
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 notification must be handled in a separate thread to avoid potential deadlock in the
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 device thread. That's where the notification thread comes in. This thread is signaled
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 whenever a notification needs to be processed, so another file can be played back if need be.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 The API in CDPlayer.cpp contains synchronization because otherwise both the notification thread
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 and main thread (or another other thread using the SDL CD api) can potentially call it at the same time.
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 ************************************************************************************/
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 #include "SDL_cdrom.h"
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 #include "SDL_syscdrom.h"
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 #include "CDPlayer.h"
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 #define kErrorFakeDevice "Error: Cannot proceed since we're faking a CD-ROM device. Reinit the CD-ROM subsystem to scan for new volumes."
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132