Modified by: bobcl...@real.com
Date: 1/5/09
Project: Mac RealPlayer

Overview:

Another installment in 64-bit cleanliness and general Mac cleanup on 150Cay branch. The background is at:

http://lists.helixcommunity.org/pipermail/client-dev/2008-December/004967.html

For a change, this diff is all Macintosh-specific; there are no 64-bit fixes in cross-platform code.

Files Modified:
 audio/device/hxaudev.cpp
 audio/device/platform/mac/macaudio.cp
 audio/device/platform/mac/usound.cp
 audio/device/pub/platform/mac/macaudio.h
 audio/device/pub/platform/mac/usound.h
 audio/fixptutil/pub/math64.h
 audio/resampler/allresamplers.h
 audio/resampler/hxrsmp2.cpp


Platforms and Profiles Affected: Mac OS X
Platforms and Profiles Build Verified: Mac OS X
Platforms and Profiles Functionality Verified: Mac OS X (with Leopard SDK)
Branch: 150Cay
Copyright assignment: I am a RealNetworks employee
Index: device/hxaudev.cpp
===================================================================
RCS file: /cvsroot/audio/device/hxaudev.cpp,v
retrieving revision 1.26.6.4
diff -u -w -r1.26.6.4 hxaudev.cpp
--- device/hxaudev.cpp  27 Sep 2006 18:56:00 -0000      1.26.6.4
+++ device/hxaudev.cpp  6 Jan 2009 02:24:52 -0000
@@ -120,7 +120,7 @@
 #if defined( _SOLARIS )
 #include "audSolaris.h"
 #endif
-#if defined( _MACINTOSH ) || defined( _MAC_UNIX )
+#if defined( _MAC_UNIX )
 #include "macaudio.h"
 #include "osxaudio.h"
 #endif
@@ -340,8 +340,6 @@
 
 #if defined( _MAC_UNIX )
     pAudioDevice = new CAudioOutOSX;
-#elif defined( _MACINTOSH )
-    pAudioDevice = new CAudioOutMac;
 #endif
 #if defined _HPUX
     pAudioDevice = new CAudioOutHPUX;
Index: device/platform/mac/macaudio.cp
===================================================================
RCS file: /cvsroot/audio/device/platform/mac/macaudio.cp,v
retrieving revision 1.7
diff -u -w -r1.7 macaudio.cp
--- device/platform/mac/macaudio.cp     9 Jul 2004 18:37:36 -0000       1.7
+++ device/platform/mac/macaudio.cp     6 Jan 2009 02:24:52 -0000
@@ -51,13 +51,11 @@
 //     macaudio.cp
 // 
 
+#if !defined(__LP64__)
+
 #include <stdio.h>
 #include "macaudio.h"
 #include "USound.h"            
-#ifndef _MAC_MACHO
-#include <AIFF.h>
-#include <fixmath.h>
-#endif
 
 #include "hxtypes.h"           
 #include "hxerrors.h"          
@@ -80,11 +78,7 @@
 
 BOOL                           gSoundCallbackTime = FALSE;
 
-#if defined( _CARBON ) || defined( _MAC_UNIX )
 DeferredTaskUPP                CAudioOutMac::gDeferredTask = 
NewDeferredTaskUPP(CAudioOutMac::DeferredTaskCallback);
-#else
-DeferredTaskUPP                CAudioOutMac::gDeferredTask = 
NewDeferredTaskProc(CAudioOutMac::DeferredTaskCallback);
-#endif
 
 #ifdef THREADS_SUPPORTED
 HXMutex*               CAudioOutMac::zm_pMutex = NULL;
@@ -93,8 +87,6 @@
 CAudioOutMac*       gActiveAudioDevice = NULL;                     
 
 
-#if defined( _CARBON ) || defined( _MAC_UNIX )
-
 typedef pascal Handle (*MacAudioNewHandleSysProcPtr)(Size);
 CFragConnectionID gAudioInterfaceLibConnID = kInvalidID;
 MacAudioNewHandleSysProcPtr gMacAudioNewHandleSysProc = nil;
@@ -119,8 +111,6 @@
        }
 }
 
-#endif
-
 /*--------------------------------------------------------------------------
 |      CMacWaveFormat
 |
@@ -461,11 +451,7 @@
        { /* begin NewChannel */
                
                SndChannelPtr           chan = nil;
-#if defined( _CARBON ) || defined( _MAC_UNIX )
                SndCallBackUPP          userProc = NewSndCallBackUPP (Callback);
-#else
-               SndCallBackUPP          userProc = NewSndCallBackProc 
(Callback);
-#endif
                
 //             if (noErr != ::SndNewChannel (&chan, sampledSynth, initStereo + 
initNoDrop + initNoInterp, userProc))
                if (noErr != ::SndNewChannel (&chan, sampledSynth, initStereo, 
userProc))
@@ -488,11 +474,7 @@
                if(chan)
                {
                        SndCallBackUPP          userProc = chan->callBack;
-#if defined( _CARBON ) || defined( _MAC_UNIX )
                        if (userProc) DisposeSndCallBackUPP (userProc);
-#else
-                       if (userProc) DisposeRoutineDescriptor (userProc);
-#endif
                
                        e = ::SndDisposeChannel (chan, TRUE);
                
@@ -512,10 +494,6 @@
        
        { /* begin Callback */
                
-#ifndef _MAC_UNIX
-               HXMM_INTERRUPTON();
-#endif
-       
 //    if (HXMM_RAHUL_CHECK())
 //    {
 //        DebugStr("\pCWaveHeader Deferred Task ENTER;g");
@@ -612,10 +590,6 @@
        
        CleanUp:
                
-#ifndef _MAC_UNIX
-               HXMM_INTERRUPTOFF();
-#endif
-               
 //    if (HXMM_RAHUL_CHECK())
 //    {
 //        DebugStr("\pCWaveHeader Deferred Task LEAVE;g");
@@ -632,10 +606,6 @@
         return;
     }
     
-#ifndef _MAC_UNIX
-       HXMM_INTERRUPTON();
-#endif
-       
        CAudioOutMac* pAudioOut = (CAudioOutMac*) param;
        
        pAudioOut->m_bAudioCallbacksAreAlive = FALSE;
@@ -702,9 +672,6 @@
        }
 #endif
 
-#ifndef _MAC_UNIX
-       HXMM_INTERRUPTOFF();
-#endif
 }
 
 void
@@ -745,43 +712,6 @@
        mDeferredTaskRec->dtAddr=CAudioOutMac::gDeferredTask;
     mDeferredTaskRec->dtParam= (long) this;
     
-       // Gestalt-based code that remembers potential deferred tasks for 
emergency removal
-       
-#ifndef _MAC_UNIX
-       Handle dtGestaltHandle = nil;
-       OSErr err = Gestalt( kLetInterruptsFinishBeforeQuittingGestalt, 
(long*)&dtGestaltHandle );
-       if ( err != noErr )
-       {
-#if defined( _CARBON )
-           MacAudioInitInterfaceLibProcPtrs();
-           if (gMacAudioNewHandleSysProc)
-           {
-               dtGestaltHandle = (*gMacAudioNewHandleSysProc)( 0 );
-           }
-           if (!dtGestaltHandle)
-           {
-               dtGestaltHandle = NewHandle( 0 );
-           }
-#else
-           dtGestaltHandle = NewHandleSys( 0 );
-#endif
-           if ( dtGestaltHandle )
-           {
-               NewGestaltValue( kLetInterruptsFinishBeforeQuittingGestalt, 
(long)dtGestaltHandle );
-           }
-       }
-
-       if ( dtGestaltHandle )
-       {
-           GestaltDeferredStruct gds;
-           gds.quitting = &m_bIsQuitting;
-           gds.pending = &m_bAudioCallbacksAreAlive;
-           GetCurrentProcess(&(gds.psn));
-           PtrAndHand( &gds, dtGestaltHandle, sizeof(gds) );
-       }
-#endif
-       
-
 #ifdef THREADS_SUPPORTED
        if (!zm_pMutex)
        {
@@ -843,38 +773,6 @@
        // first ensure that the Gestalt handle doesn't think it's
        // here any more.
        
-#ifndef _MAC_UNIX
-       Handle dtGestaltHandle = nil;
-       Gestalt( kLetInterruptsFinishBeforeQuittingGestalt, 
(long*)&dtGestaltHandle );
-       if ( dtGestaltHandle )
-       {
-           // XXXNH: only look at tasks for this process
-           ProcessSerialNumber psn;
-           GetCurrentProcess(&psn);
-       
-           // zip through and if an entry equals this deferred task,
-           // simply zero it out. We won't worry about shuffling
-           // the handle size at this juncture.
-           long hSize = GetHandleSize( dtGestaltHandle );
-           GestaltDeferredStruct* currentPtr = 
(GestaltDeferredStruct*)*dtGestaltHandle;
-           for ( int i = 0; i < hSize / sizeof(GestaltDeferredStruct); i++ )
-           {
-               unsigned char bSameProcess = FALSE;
-               SameProcess(&(currentPtr[i].psn), &psn, &bSameProcess);
-               
-               if (bSameProcess && 
-                   currentPtr[i].quitting == &m_bIsQuitting && 
-                   currentPtr[i].pending == &m_bAudioCallbacksAreAlive )
-               {
-                   currentPtr[i].quitting = NULL;
-                   currentPtr[i].pending = NULL;
-               }
-           }    
-       }
-#endif
-
-
-
                ::DisposePtr    ((Ptr)mDeferredTaskRec);
        }       
        
@@ -1181,20 +1079,6 @@
     
     if(chan)
     {
-#if defined( _CARBON ) || defined( _MAC_UNIX )
-       leftVolume = rightVolume = (long) uVolume * 5; //uVolume is between 0 
and 100
-       volume = (rightVolume << 16) + leftVolume;
-       theCmd.cmd = volumeCmd;
-       theCmd.param1 = 0;
-       theCmd.param2 = volume;
-
-       // queue volume command in channel
-       ::SndDoImmediate(chan,&theCmd);
-#else
-#if OLDROUTINENAMES && !GENERATINGCFM
-       if (USound::CheckSMVersion () < 3)
-               ::SetSoundVol (uVolume);
-#else
        leftVolume = rightVolume = (long) uVolume * 5; //uVolume is between 0 
and 100
        volume = (rightVolume << 16) + leftVolume;
        theCmd.cmd = volumeCmd;
@@ -1203,8 +1087,6 @@
 
        // queue volume command in channel
        ::SndDoImmediate(chan,&theCmd);
-#endif
-#endif
     }
     
     m_uzVolume = uVolume;
@@ -1575,3 +1457,4 @@
 
 
 
+#endif
Index: device/platform/mac/usound.cp
===================================================================
RCS file: /cvsroot/audio/device/platform/mac/usound.cp,v
retrieving revision 1.4
diff -u -w -r1.4 usound.cp
--- device/platform/mac/usound.cp       9 Jul 2004 18:37:36 -0000       1.4
+++ device/platform/mac/usound.cp       6 Jan 2009 02:24:52 -0000
@@ -49,60 +49,11 @@
 
 //     Sound manager utilities
 
+#if !defined(__LP64__)
+
 #include <stdio.h>
-#ifndef _MAC_MACHO
-#include <Traps.h>
-#endif
 #include "USound.h"
 
-#if !defined( _CARBON ) && !defined( _MAC_UNIX )
-// ---------------------------------------------------------------------------
-//             ¥ GetTrapType [static]
-// ---------------------------------------------------------------------------
-//
-static TrapType GetTrapType(unsigned long theTrap)
-
-{
-    if (BitAnd(theTrap, 0x0800) > 0)
-        return(ToolTrap);
-    else
-        return(OSTrap);
-    }
-#endif
-
-// ---------------------------------------------------------------------------
-//             ¥ TrapAvailable [static]
-// ---------------------------------------------------------------------------
-//
-static Boolean TrapAvailable(unsigned long trap)
-
-{
-#if defined( _CARBON ) || defined( _MAC_UNIX )
-
-    return TRUE; // any trap we're likely to check for will exist in Carbon. 
xxxbobclark
-
-#else
-
-TrapType trapType = ToolTrap;
-unsigned long numToolBoxTraps;
-
-    if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E, 
ToolTrap))
-        numToolBoxTraps = 0x200;
-    else
-        numToolBoxTraps = 0x400;
-
-    trapType = GetTrapType(trap);
-    if (trapType == ToolTrap) {
-        trap = BitAnd(trap, 0x07FF);
-        if (trap >= numToolBoxTraps)
-            trap = _Unimplemented;
-        }
-    return(NGetTrapAddress(trap, trapType) != NGetTrapAddress(_Unimplemented, 
ToolTrap));
-
-#endif
-}
-
-
 short  USound::sSMVersion = -1;
 short  USound::sSMMinorVersion = -1;
 
@@ -116,18 +67,9 @@
        { /* begin CheckSMVersion */
                /* Check for SM 3.0 */
                if (sSMVersion < 0) {
-#ifdef _MAC_MACHO
                         NumVersion vers = SndSoundManagerVersion();
                         sSMVersion = vers.majorRev;
                         sSMMinorVersion = vers.minorAndBugRev >> 4;
-#else
-                       if (::TrapAvailable (_SoundDispatch)) {
-                               NumVersion      vers = SndSoundManagerVersion 
();
-                               sSMVersion = vers.majorRev;
-                               sSMMinorVersion = vers.minorAndBugRev >> 4;
-                               } /* if */
-                       else sSMVersion = 0;
-#endif
                        } /* if */
 
                return sSMVersion;
@@ -176,11 +118,6 @@
                
                long    value = level;
                
-#if 0 // OLDROUTINENAMES && !GENERATINGCFM
-               if (CheckSMVersion () < 3)
-                       ::SetSoundVol (level);
-               else 
-#endif
                        ::SetDefaultOutputVolume (value | value << 16); 
        
        } /* end SetVolume */
@@ -197,12 +134,6 @@
        
                short   level;
                
-#if 0 // OLDROUTINENAMES && !GENERATINGCFM
-               if (CheckSMVersion () < 3)
-                       ::GetSoundVol (&level);
-                       
-               else 
-#endif
                        {
                        long    value;
                        ::GetDefaultOutputVolume (&value);
@@ -309,3 +240,4 @@
        
        } /* end GetSoundHeaderOffset */
        
+#endif
Index: device/pub/platform/mac/macaudio.h
===================================================================
RCS file: /cvsroot/audio/device/pub/platform/mac/macaudio.h,v
retrieving revision 1.5
diff -u -w -r1.5 macaudio.h
--- device/pub/platform/mac/macaudio.h  9 Jul 2004 18:38:10 -0000       1.5
+++ device/pub/platform/mac/macaudio.h  6 Jan 2009 02:24:52 -0000
@@ -49,11 +49,9 @@
 
 #pragma once
 
+#if !defined(__LP64__)
+
 #include "hxtypes.h"
-//#include "callback.h"
-#ifndef _MAC_MACHO
-#include <SoundInput.h>
-#endif
 
 #include "hxcom.h"
 #include "hxausvc.h"
@@ -367,3 +365,4 @@
 
 };
        
+#endif
Index: device/pub/platform/mac/usound.h
===================================================================
RCS file: /cvsroot/audio/device/pub/platform/mac/usound.h,v
retrieving revision 1.3
diff -u -w -r1.3 usound.h
--- device/pub/platform/mac/usound.h    9 Jul 2004 18:38:10 -0000       1.3
+++ device/pub/platform/mac/usound.h    6 Jan 2009 02:24:52 -0000
@@ -49,10 +49,8 @@
 
 #pragma once
 
-#ifndef _MAC_MACHO
-#include <Sound.h>
-#include <SoundInput.h>
-#endif
+#if !defined(__LP64__)
+
 #include "hxtypes.h"
 
 class  USound {
@@ -74,3 +72,5 @@
                static  short   sSMVersion;
                static  short   sSMMinorVersion;
        };
+
+#endif
Index: fixptutil/pub/math64.h
===================================================================
RCS file: /cvsroot/audio/fixptutil/pub/math64.h,v
retrieving revision 1.26.2.7
diff -u -w -r1.26.2.7 math64.h
--- fixptutil/pub/math64.h      27 Jul 2006 22:55:06 -0000      1.26.2.7
+++ fixptutil/pub/math64.h      6 Jan 2009 02:24:52 -0000
@@ -657,7 +657,7 @@
 // platform independent implementations
 
///////////////////////////////////////////////////////////////////////////////////////
 
-#elif (defined(_MAC_UNIX) && defined(__i386__)) || (defined(_HPUX) || 
(defined(_SOLARIS) && !defined(__GNUC__)))
+#elif defined(_MAC_UNIX) || (defined(_HPUX) || (defined(_SOLARIS) && 
!defined(__GNUC__)))
 
 #ifndef ASSERT
 #define ASSERT(x)
Index: resampler/allresamplers.h
===================================================================
RCS file: /cvsroot/audio/resampler/allresamplers.h,v
retrieving revision 1.9.6.1
diff -u -w -r1.9.6.1 allresamplers.h
--- resampler/allresamplers.h   5 May 2005 17:55:31 -0000       1.9.6.1
+++ resampler/allresamplers.h   6 Jan 2009 02:24:52 -0000
@@ -125,7 +125,7 @@
 
 #ifndef _AIX
 typedef unsigned char uchar;
-#if !defined(_HPUX) && !defined(_LINUX) && !defined(_MAC_MACHO) && 
!defined(_FREEBSD4)
+#if !defined(_HPUX) && !defined(_LINUX) && !defined(_MAC_UNIX) && 
!defined(_FREEBSD4)
 typedef unsigned int uint;
 #endif
 #endif
Index: resampler/hxrsmp2.cpp
===================================================================
RCS file: /cvsroot/audio/resampler/hxrsmp2.cpp,v
retrieving revision 1.10
diff -u -w -r1.10 hxrsmp2.cpp
--- resampler/hxrsmp2.cpp       9 Jul 2004 18:37:30 -0000       1.10
+++ resampler/hxrsmp2.cpp       6 Jan 2009 02:24:52 -0000
@@ -63,9 +63,6 @@
 #include "hxcore.h"
 #include "hxprefs.h"
 #include "hxtick.h"
-#ifdef _MACINTOSH
-#include "hxmm.h"
-#endif
 
 #include "hxthread.h"
 


--
Bob Clark
Lead Software Development Engineer
RealPlayer Mac/Unix
RealNetworks, Inc.


_______________________________________________
Audio-dev mailing list
Audio-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to