| 2145 | } |
| 2146 | |
| 2147 | OSStatus ProxyAudioDevice::SetBoxPropertyData(AudioServerPlugInDriverRef inDriver, |
| 2148 | AudioObjectID inObjectID, |
| 2149 | pid_t inClientProcessID, |
| 2150 | const AudioObjectPropertyAddress *inAddress, |
| 2151 | UInt32 inQualifierDataSize, |
| 2152 | const void *inQualifierData, |
| 2153 | UInt32 inDataSize, |
| 2154 | const void *inData, |
| 2155 | UInt32 *outNumberPropertiesChanged, |
| 2156 | AudioObjectPropertyAddress outChangedAddresses[2]) { |
| 2157 | #pragma unused(inClientProcessID, inQualifierDataSize, inQualifierData, inDataSize, inData) |
| 2158 | |
| 2159 | // declare the local variables |
| 2160 | OSStatus theAnswer = 0; |
| 2161 | |
| 2162 | // check the arguments |
| 2163 | FailWithAction(inDriver != gAudioServerPlugInDriverRef, |
| 2164 | theAnswer = kAudioHardwareBadObjectError, |
| 2165 | Done, |
| 2166 | "SetBoxPropertyData: bad driver reference"); |
| 2167 | FailWithAction( |
| 2168 | inAddress == NULL, theAnswer = kAudioHardwareIllegalOperationError, Done, "SetBoxPropertyData: no address"); |
| 2169 | FailWithAction(outNumberPropertiesChanged == NULL, |
| 2170 | theAnswer = kAudioHardwareIllegalOperationError, |
| 2171 | Done, |
| 2172 | "SetBoxPropertyData: no place to return the number of properties that changed"); |
| 2173 | FailWithAction(outChangedAddresses == NULL, |
| 2174 | theAnswer = kAudioHardwareIllegalOperationError, |
| 2175 | Done, |
| 2176 | "SetBoxPropertyData: no place to return the properties that changed"); |
| 2177 | FailWithAction(inObjectID != kObjectID_Box, |
| 2178 | theAnswer = kAudioHardwareBadObjectError, |
| 2179 | Done, |
| 2180 | "SetBoxPropertyData: not the box object"); |
| 2181 | |
| 2182 | // initialize the returned number of changed properties |
| 2183 | *outNumberPropertiesChanged = 0; |
| 2184 | |
| 2185 | // Note that for each object, this driver implements all the required properties plus a few |
| 2186 | // extras that are useful but not required. There is more detailed commentary about each |
| 2187 | // property in the GetPlugInPropertyData() method. |
| 2188 | switch (inAddress->mSelector) { |
| 2189 | case kAudioObjectPropertyName: |
| 2190 | // Boxes should allow their name to be editable |
| 2191 | { |
| 2192 | FailWithAction(inDataSize != sizeof(CFStringRef), |
| 2193 | theAnswer = kAudioHardwareBadPropertySizeError, |
| 2194 | Done, |
| 2195 | "SetBoxPropertyData: wrong size for the data for kAudioObjectPropertyName"); |
| 2196 | CFStringRef *newValue = (CFStringRef *)inData; |
| 2197 | |
| 2198 | FailWithAction((newValue == NULL || *newValue == NULL || CFGetTypeID(*newValue) != CFStringGetTypeID()), |
| 2199 | theAnswer = kAudioHardwareIllegalOperationError, |
| 2200 | Done, |
| 2201 | "SetBoxPropertyData: bad value for kAudioObjectPropertyName"); |
| 2202 | |
| 2203 | // See the comment in the switch case for 'kAudioObjectPropertyIdentify' to get a description of the |
| 2204 | // crazy hackery that is going on here. |