@@ -68,14 +68,14 @@ void EQM_Device::StaticInitializer()
6868 kObjectID_Mute_Output_Master );
6969 sInstance ->Activate ();
7070
71- if (
72- !EQM_Utils::process_at_path_running (" /Applications/eqMac.app/Contents/MacOS/eqMac" )
73- && !EQM_Utils::process_at_path_running (" /Applications/Xcode.app/Contents/MacOS/Xcode" )
74- ) {
75- // Activate the Driver only if eqMac or Xcode are running from /Application folder
76- sInstance ->Deactivate ();
77- } else {
78- }
71+ // if (
72+ // !EQM_Utils::process_at_path_running("/Applications/eqMac.app/Contents/MacOS/eqMac")
73+ // && !EQM_Utils::process_at_path_running("/Applications/Xcode.app/Contents/MacOS/Xcode")
74+ // ) {
75+ // // Activate the Driver only if eqMac or Xcode are running from /Application folder
76+ // sInstance->Deactivate();
77+ // } else {
78+ // }
7979
8080 // The instance for system (UI) sounds.
8181 sUISoundsInstance = new EQM_Device (kObjectID_Device_UI_Sounds ,
@@ -139,6 +139,7 @@ mMuteControl(inOutputMuteControlID, GetObjectID(), kAudioObjectPropertyScopeOutp
139139 SetSampleRate (kSampleRateDefault );
140140 SetSafetyOffset (kSafetyOffsetDefault );
141141 SetLatency (kLatencyDefault );
142+ SetShown (kShownDefault );
142143}
143144
144145EQM_Device::~EQM_Device ()
@@ -323,6 +324,7 @@ bool EQM_Device::Device_HasProperty(AudioObjectID inObjectID, pid_t inClientPID,
323324 case kAudioDevicePropertySafetyOffset :
324325 case kAudioDeviceCustomPropertyLatency :
325326 case kAudioDeviceCustomPropertySafetyOffset :
327+ case kAudioDeviceCustomPropertyShown :
326328 theAnswer = true ;
327329 break ;
328330
@@ -368,6 +370,7 @@ bool EQM_Device::Device_IsPropertySettable(AudioObjectID inObjectID, pid_t inCli
368370 case kAudioDeviceCustomPropertyEnabledOutputControls :
369371 case kAudioDeviceCustomPropertyLatency :
370372 case kAudioDeviceCustomPropertySafetyOffset :
373+ case kAudioDeviceCustomPropertyShown :
371374 theAnswer = true ;
372375 break ;
373376
@@ -454,7 +457,7 @@ UInt32 EQM_Device::Device_GetPropertyDataSize(AudioObjectID inObjectID, pid_t in
454457 break ;
455458
456459 case kAudioObjectPropertyCustomPropertyInfoList :
457- theAnswer = sizeof (AudioServerPlugInCustomPropertyInfo) * 8 ;
460+ theAnswer = sizeof (AudioServerPlugInCustomPropertyInfo) * 9 ;
458461 break ;
459462
460463 case kAudioDeviceCustomPropertyDeviceAudibleState :
@@ -488,6 +491,10 @@ UInt32 EQM_Device::Device_GetPropertyDataSize(AudioObjectID inObjectID, pid_t in
488491 theAnswer = sizeof (CFNumberRef);
489492 break ;
490493
494+ case kAudioDeviceCustomPropertyShown :
495+ theAnswer = sizeof (CFBooleanRef);
496+ break ;
497+
491498 default :
492499 theAnswer = EQM_AbstractDevice::GetPropertyDataSize (inObjectID, inClientPID, inAddress, inQualifierDataSize, inQualifierData);
493500 break ;
@@ -675,7 +682,7 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
675682 " kAudioDevicePropertyDeviceCanBeDefaultDevice for the device" );
676683 // TODO: Add a field for this and set it in EQM_Device::StaticInitializer so we don't
677684 // have to handle a specific instance differently here.
678- *reinterpret_cast <UInt32*>(outData) = ( GetObjectID () == kObjectID_Device_UI_Sounds ? 0 : 1 ) ;
685+ *reinterpret_cast <UInt32*>(outData) = mShown ? 1 : 0 ;
679686 outDataSize = sizeof (UInt32);
680687 break ;
681688
@@ -903,9 +910,9 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
903910 theNumberItemsToFetch = inDataSize / sizeof (AudioServerPlugInCustomPropertyInfo);
904911
905912 // clamp it to the number of items we have
906- if (theNumberItemsToFetch > 8 )
913+ if (theNumberItemsToFetch > 9 )
907914 {
908- theNumberItemsToFetch = 8 ;
915+ theNumberItemsToFetch = 9 ;
909916 }
910917
911918 if (theNumberItemsToFetch > 0 )
@@ -958,6 +965,13 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
958965 ((AudioServerPlugInCustomPropertyInfo*)outData)[6 ].mQualifierDataType = kAudioServerPlugInCustomPropertyDataTypeNone ;
959966 }
960967
968+ if (theNumberItemsToFetch > 8 )
969+ {
970+ ((AudioServerPlugInCustomPropertyInfo*)outData)[6 ].mSelector = kAudioDeviceCustomPropertyShown ;
971+ ((AudioServerPlugInCustomPropertyInfo*)outData)[6 ].mPropertyDataType = kAudioServerPlugInCustomPropertyDataTypeCFPropertyList ;
972+ ((AudioServerPlugInCustomPropertyInfo*)outData)[6 ].mQualifierDataType = kAudioServerPlugInCustomPropertyDataTypeNone ;
973+ }
974+
961975 outDataSize = theNumberItemsToFetch * sizeof (AudioServerPlugInCustomPropertyInfo);
962976 break ;
963977
@@ -1064,6 +1078,17 @@ void EQM_Device::Device_SetPropertyData(AudioObjectID inObjectID, pid_t inClient
10641078 break ;
10651079 }
10661080
1081+ case kAudioDeviceCustomPropertyShown :
1082+ {
1083+ ThrowIf (inDataSize < sizeof (CFBooleanRef),
1084+ CAException (kAudioHardwareBadPropertySizeError ),
1085+ " EQM_Device::Device_SetPropertyData: wrong size for the data for kAudioDeviceCustomPropertyShown" );
1086+ CFBooleanRef shownRef = *reinterpret_cast <const CFBooleanRef*>(inData);
1087+ bool shown = CFBooleanGetValue (shownRef);
1088+ SetShown (shown);
1089+ break ;
1090+ }
1091+
10671092 case kAudioDevicePropertyNominalSampleRate : {
10681093 ThrowIf (inDataSize < sizeof (Float64),
10691094 CAException (kAudioHardwareBadPropertySizeError ),
@@ -1846,6 +1871,12 @@ void EQM_Device::SetLatency(UInt32 inLatency)
18461871 mLatency = inLatency;
18471872}
18481873
1874+ void EQM_Device::SetShown (bool shown)
1875+ {
1876+ CAMutex::Locker theStateLocker (mStateMutex );
1877+ mShown = shown;
1878+ }
1879+
18491880bool EQM_Device::IsStreamID (AudioObjectID inObjectID) const noexcept
18501881{
18511882 return (inObjectID == mInputStream .GetObjectID ()) || (inObjectID == mOutputStream .GetObjectID ());
0 commit comments