Assets/Plugins/Unity.DSPGraph/Runtime/SampleProviderContainer.cs
/// <summary>
/// Gets the sample provider associated with a given index.
/// </summary>
/// <param name="itemIndex"></param>
/// <param name="arrayIndex"></param>
/// <returns></returns>
Gets the sample provider associated with a given index.
Gets the sample provider associated with a given index .
public SampleProvider GetSampleProvider(int itemIndex = 0, int arrayIndex = 0)
        {
            if (itemIndex < 0 || itemIndex >= Count)
                throw new ArgumentOutOfRangeException(nameof(itemIndex));
            int globalIndex = SampleProviderIndices[itemIndex];
            if (globalIndex < 0)
                throw new ArgumentOutOfRangeException(nameof(arrayIndex));
            globalIndex += arrayIndex;
            int nextItemIndex = itemIndex + 1;
            int nextGlobalIndex = -1;
            for (; nextItemIndex < Count; ++nextItemIndex)
            {
                nextGlobalIndex = SampleProviderIndices[nextItemIndex];
                if (nextGlobalIndex != -1)
                    break;
            }
            if (nextGlobalIndex == -1)
            {
                if (globalIndex >= SampleProvidersCount)
                    throw new ArgumentOutOfRangeException(nameof(arrayIndex));
            }
            else
            {
                if (globalIndex >= nextGlobalIndex)
                    throw new ArgumentOutOfRangeException(nameof(arrayIndex));
            }
            return new SampleProvider
            {
                ProviderHandle = SampleProviders[globalIndex],
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                Safety = Safety,
#endif
            };
        }
public SampleProvider GetSampleProvider ( int itemIndex = 0 , int arrayIndex = 0 ) { if ( itemIndex < 0 || itemIndex >= Count ) throw new ArgumentOutOfRangeException ( nameof ( itemIndex ) ) ; int globalIndex = SampleProviderIndices [ itemIndex ] ; if ( globalIndex < 0 ) throw new ArgumentOutOfRangeException ( nameof ( arrayIndex ) ) ; globalIndex += arrayIndex ; int nextItemIndex = itemIndex + 1 ; int nextGlobalIndex = - 1 ; for ( ; nextItemIndex < Count ; ++ nextItemIndex ) { nextGlobalIndex = SampleProviderIndices [ nextItemIndex ] ; if ( nextGlobalIndex != - 1 ) break ; } if ( nextGlobalIndex == - 1 ) { if ( globalIndex >= SampleProvidersCount ) throw new ArgumentOutOfRangeException ( nameof ( arrayIndex ) ) ; } else { if ( globalIndex >= nextGlobalIndex ) throw new ArgumentOutOfRangeException ( nameof ( arrayIndex ) ) ; } return new SampleProvider { ProviderHandle = SampleProviders [ globalIndex ] , if ENABLE_UNITY_COLLECTIONS_CHECKS Safety = Safety , endif } ; }
Gets the sample provider associated with a given index.
Gets the sample provider associated with a given index .
// Happens if the 'index'th item is an empty array. // Find the index of the next non-empty item. // Happens if indexing beyond the end of the last item. // Happens if indexing beyond the end of the current item.
None
itemIndex
int
None
arrayIndex
int
None