annotate src/cdrom/macosx/AudioFilePlayer.h @ 1555:780fd5b61df1

Fixed bug #89 Date: Sun, 23 Oct 2005 16:39:03 +0200 From: "A. Schmid" <sahib@phreaker.net> Subject: [SDL] no software surfaces with svgalib driver? Hi, I noticed that the SDL (1.2.9) svgalib driver only makes use of linear addressable (framebuffer) video modes. On older systems (like one of mine), linear addressable modes are often not available. Especially for cards with VESA VBE < 2.0 the svgalib vesa driver is unusable, since VESA only supports framebuffering for VBE 2.0 and later. The changes necessary to add support for software surfaces seem to be relatively small. I only had to hack src/video/svga/SDL_svgavideo.c (see attached patch). The code worked fine for me, but it is no more than a proof of concept and should be reviewed (probably has a memory leak when switching modes). It also uses the vgagl library (included in the svgalib package) and needs to be linked against it. -Alex
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 Mar 2006 12:05:16 +0000
parents dc6b59e925a2
children 782fd950bd46 c121d94672cb 9df8136abec0
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
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 768
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
613
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 This file based on Apple sample code. We haven't changed the file name,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 so if you want to see the original search for it on apple.com/developer
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1143
diff changeset
25 #include "SDL_config.h"
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.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 AudioFilePlayer.h
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
29 */
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #ifndef __AudioFilePlayer_H__
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #define __AudioFilePlayer_H__
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <CoreServices/CoreServices.h>
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <AudioUnit/AudioUnit.h>
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
653
1bd056de5d1b *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 613
diff changeset
37 #include "SDL_error.h"
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 const char* AudioFilePlayerErrorStr (OSStatus error);
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
41 /*
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 void ThrowResult (OSStatus result, const char *str);
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #define THROW_RESULT(str) \
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 if (result) { \
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 ThrowResult (result, str); \
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 }
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
48 */
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 typedef void (*AudioFilePlayNotifier)(void *inRefCon,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 OSStatus inStatus);
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 enum {
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 kAudioFilePlayErr_FilePlayUnderrun = -10000,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 kAudioFilePlay_FileIsFinished = -10001,
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 kAudioFilePlay_PlayerIsUninitialized = -10002
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 };
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
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
60 struct S_AudioFileManager;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 #pragma mark __________ AudioFilePlayer
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
63 typedef struct S_AudioFilePlayer
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 {
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
65 /*public:*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
66 int (*SetDestination)(struct S_AudioFilePlayer *afp, AudioUnit *inDestUnit);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
67 void (*SetNotifier)(struct S_AudioFilePlayer *afp, AudioFilePlayNotifier inNotifier, void *inRefCon);
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
68 void (*SetStartFrame)(struct S_AudioFilePlayer *afp, int frame); /* seek in the file */
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
69 int (*GetCurrentFrame)(struct S_AudioFilePlayer *afp); /* get the current frame position */
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
70 void (*SetStopFrame)(struct S_AudioFilePlayer *afp, int frame); /* set limit in the file */
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
71 int (*Connect)(struct S_AudioFilePlayer *afp);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
72 void (*Disconnect)(struct S_AudioFilePlayer *afp);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
73 void (*DoNotification)(struct S_AudioFilePlayer *afp, OSStatus inError);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
74 int (*IsConnected)(struct S_AudioFilePlayer *afp);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
75 AudioUnit (*GetDestUnit)(struct S_AudioFilePlayer *afp);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
76 void (*Print)(struct S_AudioFilePlayer *afp);
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
78 /*private:*/
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 AudioUnit mPlayUnit;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
80 SInt16 mForkRefNum;
613
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 AudioUnitInputCallback mInputCallback;
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 AudioStreamBasicDescription mFileDescription;
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
86 int mConnected;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
88 struct S_AudioFileManager* mAudioFileManager;
613
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 AudioFilePlayNotifier mNotifier;
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 void* mRefCon;
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 int mStartFrame;
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 #pragma mark __________ Private_Methods
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
97 int (*OpenFile)(struct S_AudioFilePlayer *afp, const FSRef *inRef, SInt64 *outFileSize);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
98 } AudioFilePlayer;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
99
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
100
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
101 AudioFilePlayer *new_AudioFilePlayer(const FSRef *inFileRef);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
102 void delete_AudioFilePlayer(AudioFilePlayer *afp);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
103
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
104
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 #pragma mark __________ 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: 935
diff changeset
107 typedef struct S_AudioFileManager
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 {
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
109 /*public:*/
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
110 /* this method should NOT be called by an object of this class
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
111 as it is called by the parent's Disconnect() 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: 935
diff changeset
112 void (*Disconnect)(struct S_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: 935
diff changeset
113 int (*DoConnect)(struct S_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: 935
diff changeset
114 OSStatus (*Read)(struct S_AudioFileManager *afm, char *buffer, UInt32 *len);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
115 const char* (*GetFileBuffer)(struct S_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: 935
diff changeset
116 const AudioFilePlayer *(*GetParent)(struct S_AudioFileManager *afm);
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
117 void (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos); /* seek/rewind in the file */
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
118 int (*GetByteCounter)(struct S_AudioFileManager *afm); /* return actual bytes streamed to audio hardware */
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
119 void (*SetEndOfFile)(struct S_AudioFileManager *afm, SInt64 pos); /* set the "EOF" (will behave just like it reached eof) */
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
121 /*protected:*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
122 AudioFilePlayer* mParent;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
123 SInt16 mForkRefNum;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
124 SInt64 mAudioDataOffset;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
126 char* mFileBuffer;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
127
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
128 int mByteCounter;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
130 int mReadFromFirstBuffer;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
131 int mLockUnsuccessful;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
132 int mIsEngaged;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
133
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
134 int mNumTimesAskedSinceFinished;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
935
f8d5ddc7aef1 Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
136
f8d5ddc7aef1 Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
137 void* mTmpBuffer;
f8d5ddc7aef1 Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
138 UInt32 mBufferSize;
f8d5ddc7aef1 Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
139 UInt32 mBufferOffset;
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
140 /*public:*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
141 UInt32 mChunkSize;
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
142 SInt64 mFileLength;
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
143 SInt64 mReadFilePosition;
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
144 int mWriteToFirstBuffer;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
145 int mFinishedReadingData;
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
146
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
147 /*protected:*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
148 OSStatus (*Render)(struct S_AudioFileManager *afm, AudioBuffer *ioData);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
149 OSStatus (*GetFileData)(struct S_AudioFileManager *afm, void** inOutData, UInt32 *inOutDataSize);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
150 void (*AfterRender)(struct S_AudioFileManager *afm);
768
de1b2c3063b9 Max has been reworking this code so it works on MacOS X 10.1
Sam Lantinga <slouken@libsdl.org>
parents: 653
diff changeset
151
1487
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
152 /*public:*/
dc6b59e925a2 Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
153 /*static*/
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
154 OSStatus (*FileInputProc)(void *inRefCon,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
155 AudioUnitRenderActionFlags inActionFlags,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
156 const AudioTimeStamp *inTimeStamp,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
157 UInt32 inBusNumber,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
158 AudioBuffer *ioData);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
159 } AudioFileManager;
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
162 AudioFileManager *new_AudioFileManager (AudioFilePlayer *inParent,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
163 SInt16 inForkRefNum,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
164 SInt64 inFileLength,
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
165 UInt32 inChunkSize);
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
166
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
167 void delete_AudioFileManager(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: 935
diff changeset
168
613
9c6717a1c66f Added MacOS X CD-ROM audio support (thanks Max and Darrell)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 #endif
1143
71a2648acc75 Replaced Mac OS X's C++ cdrom code with almost-direct translation to C. Sam
Ryan C. Gordon <icculus@icculus.org>
parents: 935
diff changeset
170