private static void ValidateSampleProviderForInsert(AudioKernelExtensions.DSPSampleProviderDescription provider) { // Can only insert into variable-size arrays. if (!provider.m_IsArray || provider.m_Size >= 0) { throw new ArgumentException("Can only insert into variable-size array."); } }
private static void ValidateSampleProviderForRemove(AudioKernelExtensions.DSPSampleProviderDescription provider) { // Can only remove from variable-size arrays. if (!provider.m_IsArray || provider.m_Size >= 0) { throw new ArgumentException("Can only remove sample providers from variable-size array"); } }
private static void ValidateSampleProviderForSetWithMeaningfulMessages(AudioKernelExtensions.DSPSampleProviderDescription provider, int index) { // Index validation for fixed-size array items can be performed here. For variable-array, // it can only be performed in the job threads, where the array size is known and stable. if (provider.m_IsArray && provider.m_Size >= 0 && (provider.m_Size < index || index < 0)) { throw new IndexOutOfRangeException($"Provider index {index} is out of range"); } }