Exemplo n.º 1
0
        public static PortAudioHostApi GetHostApi(PaHostApiIndex index)
        {
            if (index.TryGetErrorCode(out var err))
            {
                throw PortAudioException.GetException(err);
            }

            if (ApiCache.TryGetValue(index, out var reference) && reference.TryGetTarget(out var target))
            {
                return(target);
            }

            var api = new PortAudioHostApi(index);

            ApiCache[index] = new WeakReference <PortAudioHostApi>(api);
            return(api);
        }
Exemplo n.º 2
0
        internal PortAudioHostApi(PaHostApiIndex index)
        {
            PortAudioLifetimeRegistry.Register(this);

            _apiIndex = index;
        }