4 #if SILICONSTUDIO_PLATFORM_IOS
8 using SiliconStudio.Core;
9 using SiliconStudio.Core.Mathematics;
10 using SiliconStudio.Paradox.Audio.Wave;
12 namespace SiliconStudio.
Paradox.Audio
14 public partial class SoundEffect
17 private void AdaptAudioDataImpl()
19 if(UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
22 if(WaveFormat.SampleRate >= AudioVoice.AudioUnitOutputSampleRate)
26 var sampleRateRatio = WaveFormat.SampleRate / (float)AudioVoice.AudioUnitOutputSampleRate;
27 var newWaveDataSize = (
int)Math.Floor(WaveDataSize / sampleRateRatio);
28 var newWaveDataPtr = Utilities.AllocateMemory(newWaveDataSize);
31 if (Math.Abs(sampleRateRatio - 0.5f) < MathUtil.ZeroTolerance)
32 UpSampleByTwo(WaveDataPtr, newWaveDataPtr, newWaveDataSize, WaveFormat.Channels,
false);
34 UpSample(WaveDataPtr, newWaveDataPtr, newWaveDataSize, sampleRateRatio, WaveFormat.Channels,
false);
37 Utilities.FreeMemory(nativeDataBuffer);
38 nativeDataBuffer = newWaveDataPtr;
39 WaveDataPtr = newWaveDataPtr;
40 WaveDataSize = newWaveDataSize;
41 WaveFormat =
new WaveFormat(AudioVoice.AudioUnitOutputSampleRate, WaveFormat.Channels);
44 private void DestroyImpl()