//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	RadioEffectUnit::RadioEffectUnit
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RadioEffectUnit::RadioEffectUnit(AudioUnit Component)
	: AUEffectBase(Component)
{
	CreateElements();

	if (!bGLocalized) {		
		// Because we are in a component, we need to load our bundle by identifier so we can access our localized strings
		// It is important that the string passed here exactly matches that in the Info.plist Identifier string
		CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.epicgames.audiounit.radio") );
		
		if (bundle != NULL) {
			kChebyshevPowerMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevPowerMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));
			kChebyshevPowerName = CFCopyLocalizedStringFromTableInBundle(kChebyshevPowerName, CFSTR("Localizable"), bundle, CFSTR(""));
			kChebyshevMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));	
			kChebyshevCubedMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevCubedMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));	
		}
		bGLocalized = TRUE; //so never pass the test again...
	}

	GFinalBandPassFilter.Initialize( 2000.0f, 400.0f, GetSampleRate() );

	SetParameter(RadioParam_ChebyshevPowerMultiplier, 	kDefaultValue_ChebyshevPowerMultiplier );
	SetParameter(RadioParam_ChebyshevPower, 			kDefaultValue_ChebyshevPower );
	SetParameter(RadioParam_ChebyshevMultiplier, 		kDefaultValue_ChebyshevMultiplier );
	SetParameter(RadioParam_ChebyshevCubedMultiplier,	kDefaultValue_ChebyshevCubedMultiplier );
}
Example #2
0
	/**
	 * Constructor. 
	 *
	 * @param	InitialSampleRate	The sample rate to process the audio.
	 */
	FXAudio2RadioEffect( float InitialSampleRate )
		:	CXAPOParametersBase( &Registration, ( uint8* )Parameters, sizeof( FAudioRadioEffect ), false )
		,	SampleRate( InitialSampleRate )
	{
		// Initialize the global audio processing helper classes
		GFinalBandPassFilter.Initialize( 2000.0f, 400.0f, SampleRate );

		// Setup default values for the parameters to initialize the rest of the global 
		// audio processing helper classes. See FXAudio2RadioEffect::OnSetParameters().
		FAudioRadioEffect DefaultParameters;
		SetParameters( &DefaultParameters, sizeof( DefaultParameters ) );
	}