--- a/src/cdrom/macosx/CDPlayer.c Wed Mar 08 18:30:12 2006 +0000
+++ b/src/cdrom/macosx/CDPlayer.c Thu Mar 09 06:33:21 2006 +0000
@@ -25,16 +25,16 @@
#include "AudioFilePlayer.h"
#include "SDLOSXCAGuard.h"
-// we're exporting these functions into C land for SDL_syscdrom.c
-//extern "C" {
+/* we're exporting these functions into C land for SDL_syscdrom.c */
+/*extern "C" {*/
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// Constants
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
+/*///////////////////////////////////////////////////////////////////////////
+ Constants
+ //////////////////////////////////////////////////////////////////////////*/
-#define kAudioCDFilesystemID (UInt16)(('J' << 8) | 'H') // 'JH'; this avoids compiler warning
+#define kAudioCDFilesystemID (UInt16)(('J' << 8) | 'H') /* 'JH'; this avoids compiler warning */
-// XML PList keys
+/* XML PList keys */
#define kRawTOCDataString "Format 0x02 TOC Data"
#define kSessionsString "Sessions"
#define kSessionTypeString "Session Type"
@@ -47,9 +47,9 @@
#define kSessionNumberKeyString "Session Number"
#define kStartBlockKeyString "Start Block"
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// Globals
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
+/*///////////////////////////////////////////////////////////////////////////
+ Globals
+ //////////////////////////////////////////////////////////////////////////*/
#pragma mark -- Globals --
@@ -61,9 +61,9 @@
static SDL_sem *callbackSem;
static SDL_CD* theCDROM;
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// Prototypes
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
+/*///////////////////////////////////////////////////////////////////////////
+ Prototypes
+ //////////////////////////////////////////////////////////////////////////*/
#pragma mark -- Prototypes --
@@ -89,10 +89,6 @@
SDL_mutexV(apiMutex);
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// DetectAudioCDVolumes
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int DetectAudioCDVolumes(FSVolumeRefNum *volumes, int numVolumes)
{
int volumeIndex;
@@ -116,7 +112,7 @@
if (result == noErr)
{
- if (volumeInfo.filesystemID == kAudioCDFilesystemID) // It's an audio CD
+ if (volumeInfo.filesystemID == kAudioCDFilesystemID) /* It's an audio CD */
{
if (volumes != NULL && cdVolumeCount < numVolumes)
volumes[cdVolumeCount] = actualVolume;
@@ -126,18 +122,14 @@
}
else
{
- // I'm commenting this out because it seems to be harmless
- //SDL_SetError ("DetectAudioCDVolumes: FSGetVolumeInfo returned %d", result);
+ /* I'm commenting this out because it seems to be harmless */
+ /*SDL_SetError ("DetectAudioCDVolumes: FSGetVolumeInfo returned %d", result);*/
}
}
return cdVolumeCount;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// ReadTOCData
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int ReadTOCData (FSVolumeRefNum theVolume, SDL_CD *theCD)
{
HFSUniStr255 dataForkName;
@@ -154,7 +146,7 @@
const char* error = "Unspecified Error";
- // get stuff from .TOC.plist
+ /* get stuff from .TOC.plist */
fsRefPB.ioCompletion = NULL;
fsRefPB.ioNamePtr = "\p.TOC.plist";
fsRefPB.ioVRefNum = theVolume;
@@ -167,7 +159,7 @@
goto bail;
}
- // Load and parse the TOC XML data
+ /* Load and parse the TOC XML data */
theErr = FSGetDataForkName (&dataForkName);
if (theErr != noErr) {
@@ -187,7 +179,7 @@
goto bail;
}
- // Allocate some memory for the XML data
+ /* Allocate some memory for the XML data */
forkData = NewPtr (forkSize);
if(forkData == NULL) {
error = "NewPtr";
@@ -215,9 +207,9 @@
goto bail;
}
- // Now we got the Property List in memory. Parse it.
+ /* Now we got the Property List in memory. Parse it. */
- // First, make sure the root item is a CFDictionary. If not, release and bail.
+ /* First, make sure the root item is a CFDictionary. If not, release and bail. */
if(CFGetTypeID(propertyListRef)== CFDictionaryGetTypeID())
{
CFDictionaryRef dictRef = (CFDictionaryRef)propertyListRef;
@@ -227,19 +219,19 @@
CFIndex numSessions;
CFIndex index;
- // This is how we get the Raw TOC Data
+ /* This is how we get the Raw TOC Data */
theRawTOCDataRef = (CFDataRef)CFDictionaryGetValue (dictRef, CFSTR(kRawTOCDataString));
- // Get the session array info.
+ /* Get the session array info. */
theSessionArrayRef = (CFArrayRef)CFDictionaryGetValue (dictRef, CFSTR(kSessionsString));
- // Find out how many sessions there are.
+ /* Find out how many sessions there are. */
numSessions = CFArrayGetCount (theSessionArrayRef);
- // Initialize the total number of tracks to 0
+ /* Initialize the total number of tracks to 0 */
theCD->numtracks = 0;
- // Iterate over all sessions, collecting the track data
+ /* Iterate over all sessions, collecting the track data */
for(index = 0; index < numSessions; index++)
{
CFDictionaryRef theSessionDict;
@@ -272,7 +264,7 @@
startBlock = (CFNumberRef) CFDictionaryGetValue (theTrackDict, CFSTR(kStartBlockKeyString));
isDataTrack = (CFBooleanRef) CFDictionaryGetValue (theTrackDict, CFSTR(kDataKeyString));
- // Fill in the SDL_CD struct
+ /* Fill in the SDL_CD struct */
int idx = theCD->numtracks++;
CFNumberGetValue (trackNumber, kCFNumberSInt32Type, &value);
@@ -283,19 +275,19 @@
theCD->track[idx].type = (isDataTrack == kCFBooleanTrue) ? SDL_DATA_TRACK : SDL_AUDIO_TRACK;
- // Since the track lengths are not stored in .TOC.plist we compute them.
+ /* Since the track lengths are not stored in .TOC.plist we compute them. */
if (trackIndex > 0) {
theCD->track[idx-1].length = theCD->track[idx].offset - theCD->track[idx-1].offset;
}
}
- // Compute the length of the last track
+ /* Compute the length of the last track */
CFNumberGetValue (leadoutBlock, kCFNumberSInt32Type, &value);
theCD->track[theCD->numtracks-1].length =
value - theCD->track[theCD->numtracks-1].offset;
- // Set offset to leadout track
+ /* Set offset to leadout track */
theCD->track[theCD->numtracks].offset = value;
}
@@ -320,10 +312,6 @@
return theErr;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// ListTrackFiles
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int ListTrackFiles (FSVolumeRefNum theVolume, FSRef *trackFiles, int numTracks)
{
OSStatus result = -1;
@@ -357,11 +345,11 @@
CFStringRef name;
name = CFStringCreateWithCharacters (NULL, nameStr.unicode, nameStr.length);
- // Look for .aiff extension
+ /* Look for .aiff extension */
if (CFStringHasSuffix (name, CFSTR(".aiff")) ||
CFStringHasSuffix (name, CFSTR(".cdda"))) {
- // Extract the track id from the filename
+ /* Extract the track id from the filename */
int trackID = 0, i = 0;
while (i < nameStr.length && !isdigit(nameStr.unicode[i])) {
++i;
@@ -376,7 +364,7 @@
CFStringGetCStringPtr (name, CFStringGetSystemEncoding()));
#endif
- // Track ID's start at 1, but we want to start at 0
+ /* Track ID's start at 1, but we want to start at 0 */
trackID--;
assert(0 <= trackID && trackID <= SDL_MAX_TRACKS);
@@ -393,10 +381,6 @@
return 0;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// LoadFile
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int LoadFile (const FSRef *ref, int startFrame, int stopFrame)
{
int error = -1;
@@ -404,7 +388,7 @@
if (CheckInit () < 0)
goto bail;
- // release any currently playing file
+ /* release any currently playing file */
if (ReleaseFile () < 0)
goto bail;
@@ -412,14 +396,14 @@
printf ("LoadFile: %d %d\n", startFrame, stopFrame);
#endif
- //try {
+ /*try {*/
- // create a new player, and attach to the audio unit
+ /* create a new player, and attach to the audio unit */
thePlayer = new_AudioFilePlayer(ref);
if (thePlayer == NULL) {
SDL_SetError ("LoadFile: Could not create player");
- return -3; //throw (-3);
+ return -3; /*throw (-3);*/
}
if (!thePlayer->SetDestination(thePlayer, &theUnit))
@@ -431,8 +415,8 @@
if (stopFrame >= 0 && stopFrame > startFrame)
thePlayer->SetStopFrame (thePlayer, stopFrame);
- // we set the notifier later
- //thePlayer->SetNotifier(thePlayer, FilePlayNotificationHandler, NULL);
+ /* we set the notifier later */
+ /*thePlayer->SetNotifier(thePlayer, FilePlayNotificationHandler, NULL);*/
if (!thePlayer->Connect(thePlayer))
goto bail;
@@ -441,11 +425,11 @@
thePlayer->Print(thePlayer);
fflush (stdout);
#endif
- //}
- //catch (...)
- //{
- // goto bail;
- //}
+ /*}
+ catch (...)
+ {
+ goto bail;
+ }*/
error = 0;
@@ -453,16 +437,12 @@
return error;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// ReleaseFile
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int ReleaseFile ()
{
int error = -1;
- // (Don't see any way that the original C++ code could throw here.) --ryan.
- //try {
+ /* (Don't see any way that the original C++ code could throw here.) --ryan. */
+ /*try {*/
if (thePlayer != NULL) {
thePlayer->Disconnect(thePlayer);
@@ -471,22 +451,18 @@
thePlayer = NULL;
}
- //}
- //catch (...)
- //{
- // goto bail;
- //}
+ /*}
+ catch (...)
+ {
+ goto bail;
+ }*/
error = 0;
-// bail:
+/* bail: */
return error;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// PlayFile
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int PlayFile ()
{
OSStatus result = -1;
@@ -494,17 +470,17 @@
if (CheckInit () < 0)
goto bail;
-// try {
+ /*try {*/
// start processing of the audio unit
result = AudioOutputUnitStart (theUnit);
if (result) goto bail; //THROW_RESULT("PlayFile: AudioOutputUnitStart")
-// }
-// catch (...)
-// {
-// goto bail;
-// }
+ /*}
+ catch (...)
+ {
+ goto bail;
+ }*/
result = 0;
@@ -512,10 +488,6 @@
return result;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// PauseFile
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int PauseFile ()
{
OSStatus result = -1;
@@ -523,26 +495,22 @@
if (CheckInit () < 0)
goto bail;
- //try {
+ /*try {*/
- // stop processing the audio unit
+ /* stop processing the audio unit */
result = AudioOutputUnitStop (theUnit);
- if (result) goto bail; //THROW_RESULT("PauseFile: AudioOutputUnitStop")
- //}
- //catch (...)
- //{
- // goto bail;
- //}
+ if (result) goto bail; /*THROW_RESULT("PauseFile: AudioOutputUnitStop")*/
+ /*}
+ catch (...)
+ {
+ goto bail;
+ }*/
result = 0;
bail:
return result;
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// SetCompletionProc
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
void SetCompletionProc (CDPlayerCompletionProc proc, SDL_CD *cdrom)
{
assert(thePlayer != NULL);
@@ -552,10 +520,6 @@
thePlayer->SetNotifier (thePlayer, FilePlayNotificationHandler, cdrom);
}
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-// GetCurrentFrame
-//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
-
int GetCurrentFrame ()
{
int frame;
@@ -578,13 +542,13 @@
OSStatus result = noErr;
- // Create the callback semaphore
+ /* Create the callback semaphore */
callbackSem = SDL_CreateSemaphore(0);
- // Start callback thread
+ /* Start callback thread */
SDL_CreateThread(RunCallBackThread, NULL);
- { //try {
+ { /*try {*/
ComponentDescription desc;
desc.componentType = kAudioUnitComponentType;
@@ -609,10 +573,10 @@
playBackWasInit = true;
}
- //catch (...)
- //{
- // return -1;
- //}
+ /*catch (...)
+ {
+ return -1;
+ }*/
return 0;
}
@@ -621,7 +585,7 @@
{
if (inStatus == kAudioFilePlay_FileIsFinished) {
- // notify non-CA thread to perform the callback
+ /* notify non-CA thread to perform the callback */
SDL_SemPost(callbackSem);
} else if (inStatus == kAudioFilePlayErr_FilePlayUnderrun) {
@@ -661,4 +625,4 @@
return 0;
}
-//}; // extern "C"
+/*}; // extern "C" */