Beispiel #1
0
// ----------------------------------------------------------------------------
void AudioCoreDriver::deinitialize()
// ----------------------------------------------------------------------------
{
	if (!mIsInitialized)
		return;
	
	stopPlayback();
	
	AudioDeviceDestroyIOProcID(mDeviceID, mEmulationPlaybackProcID);
	AudioDeviceDestroyIOProcID(mDeviceID, mPreRenderedBufferPlaybackProcID);
#if USE_NEW_API
    OSStatus err;
    AudioObjectPropertyAddress prop5 = {
        kAudioDevicePropertyStreamFormat,
        kAudioDevicePropertyScopeOutput,
        kAudioObjectPropertyElementMaster
    };
    err = AudioObjectRemovePropertyListener(mDeviceID, &prop5, streamFormatChanged, (void*)this);
    if (err != kAudioHardwareNoError)
            printf("AudioObjectRemovePropertyListener(streamFormatChanged) failed\n");

    AudioObjectPropertyAddress prop6 = {
        kAudioDeviceProcessorOverload,
        kAudioDevicePropertyScopeOutput,
        kAudioObjectPropertyElementMaster
    };
    err = AudioObjectRemovePropertyListener(mDeviceID, &prop6, overloadDetected, (void*)this);
    if (err != kAudioHardwareNoError)
            printf("AudioObjectRemovePropertyListener(overloadDetected) failed\n");

    AudioObjectPropertyAddress prop7 = {
        kAudioHardwarePropertyDefaultOutputDevice,
        kAudioDevicePropertyScopeOutput,
        kAudioObjectPropertyElementMaster
    };
    err = AudioObjectRemovePropertyListener(mDeviceID, &prop7, deviceChanged, (void*)this);
    if (err != kAudioHardwareNoError)
            printf("AudioObjectRemovePropertyListener(deviceChanged) failed\n");
#else
	AudioDeviceRemovePropertyListener(mDeviceID, 0, false, kAudioDevicePropertyStreamFormat, streamFormatChanged);
	AudioDeviceRemovePropertyListener(mDeviceID, 0, false, kAudioDeviceProcessorOverload, overloadDetected);
	AudioHardwareRemovePropertyListener(kAudioHardwarePropertyDefaultOutputDevice, deviceChanged);
#endif

	delete[] mSampleBuffer1;
	mSampleBuffer1 = NULL;
	delete[] mSampleBuffer2;
	mSampleBuffer2 = NULL;
    mSampleBuffer = NULL;
    mRetSampleBuffer = NULL;
    delete[] mSpectrumBuffer;
	mSpectrumBuffer = NULL;
	mIsInitialized = false;
}
JNIEXPORT jint JNICALL Java_com_apple_audio_hardware_AudioHardware_AudioHardwareRemovePropertyListener
  (JNIEnv *, jclass, jint inPropertyID, jint inProc)
{
	return (jint)AudioHardwareRemovePropertyListener((AudioHardwarePropertyID)inPropertyID, (AudioHardwarePropertyListenerProc)inProc);
}
void	CAAudioHardwareSystem::RemovePropertyListener(AudioHardwarePropertyID inPropertyID, AudioHardwarePropertyListenerProc inListenerProc)
{
	OSStatus theError = AudioHardwareRemovePropertyListener(inPropertyID, inListenerProc);
	ThrowIfError(theError, CAException(theError), "CAAudioHardwareSystem::RemovePropertyListener: got an error removing a property listener");
}