text:
namespace {

// For testing the creation of multiple temp paths.
const int kNumMultiplePaths = 32;

// When testing non-empty directories, populate them with this many files.
const int kNumFilesPerNonEmptyDirectory = 10;

// The length of the path template suffix used internally by ScopedTempPath and
// derived classes.
const size_t kTemplateSuffixSize = strlen("XXXXXX");

// Temporary paths use this prefix by default. Copied from scoped_temp_path.cc.
const char kTempPathTemplatePrefix[] = "/tmp/quipper.";

// Tests if |path| exists on the file system.
bool PathExists(const string& path) {
  struct stat buf;
  // stat() returns 0 on success, i.e. if the path exists and is valid.
  return !stat(path.c_str(), &buf);
}

// Creates some files in a directory. Returns the number of files created.
int PopulateDirectoryWithFiles(const string& dir, int num_files) {
  // The last six characters of the file template must be "XXXXXX".
  const char kPathTemplateSuffix[] = "/testXXXXXX";

  // The string providing the path template for creating temp files must not be
  // constant, so allocate some space here.
  size_t buf_size = dir.size() + strlen(kPathTemplateSuffix) + 1;
  char* path_template = new char[buf_size];

  int num_files_created = 0;
  for (int i = 0; i < num_files; ++i) {
    // Construct the mutable path template.
    snprintf(path_template, buf_size, "%s%s", dir.c_str(), kPathTemplateSuffix);
    // Create the file and make sure it is valid.
    int fd = mkstemp(path_template);
    if (fd == -1) {
      LOG(ERROR) << "Could not create file, errno=" << errno;
      continue;
    }
    ++num_files_created;
    close(fd);
  }
  delete [] path_template;

  return num_files_created;
}

}  // namespace

namespace quipper {

// Create one file and make sure it is deleted when out of scope.
TEST(ScopedTempPathTest, OneFile) {
  string path;
  {
    ScopedTempFile temp_file;
    path = temp_file.path();
    EXPECT_TRUE(PathExists(path)) << path;
    EXPECT_EQ(strlen(kTempPathTemplatePrefix) + kTemplateSuffixSize,
              path.size());
    EXPECT_EQ(kTempPathTemplatePrefix,
              path.substr(0, strlen(kTempPathTemplatePrefix)));
  }
  EXPECT_FALSE(PathExists(path)) << path;
}

// Create a file with a custom template filename.
TEST(ScopedTempPathTest, CustomFileTemplate) {
  string path;
  {
    const string prefix = "/tmp/foobar.";
    ScopedTempFile temp_file(prefix);
    path = temp_file.path();
    EXPECT_TRUE(PathExists(path)) << path;
    EXPECT_EQ(prefix.size() + kTemplateSuffixSize, path.size());
    EXPECT_EQ(prefix, path.substr(0, prefix.size()));
  }
  EXPECT_FALSE(PathExists(path)) << path;
}

// Create many files and make sure they are deleted when out of scope.
TEST(ScopedTempPathTest, MultipleFiles) {
  std::vector<string> paths(kNumMultiplePaths);
  {
    std::vector<ScopedTempFile> temp_files(kNumMultiplePaths);
    for (size_t i = 0; i < kNumMultiplePaths; ++i) {
      paths[i] = temp_files[i].path();
      EXPECT_TRUE(PathExists(paths[i])) << paths[i];
    }
  }
  for (size_t i = 0; i < kNumMultiplePaths; ++i) {
    EXPECT_FALSE(PathExists(paths[i])) << paths[i];
  }
}

// Create one empty directory and make sure it is deleted when out of scope.
TEST(ScopedTempPathTest, OneEmptyDir) {
  string path;
  {
    ScopedTempDir temp_path;
    path = temp_path.path();
    EXPECT_TRUE(PathExists(path)) << path;
    EXPECT_EQ('/', path.back()) << "Should append a slash";
    EXPECT_EQ(strlen(kTempPathTemplatePrefix) + kTemplateSuffixSize + 1,
              path.size());
    EXPECT_EQ(kTempPathTemplatePrefix,
              path.substr(0, strlen(kTempPathTemplatePrefix)));
  }
  EXPECT_FALSE(PathExists(path)) << path;
}

// Create a file with a custom template dirname.
TEST(ScopedTempPathTest, CustomDirTemplate) {
  string path;
  {
    const string prefix = "/tmp/foobar.";
    ScopedTempDir temp_path(prefix);
    path = temp_path.path();
    EXPECT_TRUE(PathExists(path)) << path;
    EXPECT_EQ('/', path.back()) << "Should append a slash";
    // Check prefix matches:
    EXPECT_EQ(prefix.size()+kTemplateSuffixSize+1, path.size());
    EXPECT_EQ(prefix, path.substr(0, prefix.size()));
  }
  EXPECT_FALSE(PathExists(path)) << path;
}

// Create many empty directories and make sure they are deleted when out of
// scope.
TEST(ScopedTempPathTest, MultipleEmptyDirs) {
  std::vector<string> paths(kNumMultiplePaths);
  {
    std::vector<ScopedTempDir> temp_dirs(kNumMultiplePaths);
    for (size_t i = 0; i < kNumMultiplePaths; ++i) {
      paths[i] = temp_dirs[i].path();
      EXPECT_TRUE(PathExists(paths[i])) << paths[i];
    }
  }
  for (size_t i = 0; i < kNumMultiplePaths; ++i) {
    EXPECT_FALSE(PathExists(paths[i])) << paths[i];
  }
}

// Create a directory with some files in it, and make sure it is deleted when
// out of scope.
TEST(ScopedTempPathTest, OneNonEmptyDir) {
  string path;
  {
    ScopedTempDir temp_path;
    path = temp_path.path();
    EXPECT_TRUE(PathExists(path)) << path;
    // Populate the directory with files.
    EXPECT_EQ(kNumFilesPerNonEmptyDirectory,
              PopulateDirectoryWithFiles(path, kNumFilesPerNonEmptyDirectory));
  }
  EXPECT_FALSE(PathExists(path)) << path;
}

// Create many empty directories with files in them, and make sure they are
// deleted when out of scope.
TEST(ScopedTempPathTest, MultipleNonEmptyDirs) {
  std::vector<string> paths(kNumMultiplePaths);
  {
    std::vector<ScopedTempDir> temp_dirs(kNumMultiplePaths);
    for (size_t i = 0; i < kNumMultiplePaths; ++i) {
      paths[i] = temp_dirs[i].path();
      EXPECT_TRUE(PathExists(paths[i])) << paths[i];
      // Populate the directory with files.
      EXPECT_EQ(
          kNumFilesPerNonEmptyDirectory,
          PopulateDirectoryWithFiles(paths[i], kNumFilesPerNonEmptyDirectory));
    }
  }
  for (size_t i = 0; i < kNumMultiplePaths; ++i) {
    EXPECT_FALSE(PathExists(paths[i])) << paths[i];
  }
}

}  // namespace quipper


text:
package inspect

import (
	"fmt"
	"io"
	"net/http"
	"reflect"
)

// Prints field names and values to the given output.
func Response(resp *http.Response, out io.Writer) {
	val := reflect.ValueOf(*resp)
	typeOf := val.Type()
	for i := 0; i < val.NumField(); i++ {
		fieldVal := val.Field(i).Interface()
		if header, isHeader := fieldVal.(http.Header); isHeader {
			fmt.Fprintf(out, "%v:\n", typeOf.Field(i).Name)
			Header(header, out)
		} else {
			fmt.Fprintf(out, "%v: %v\n", typeOf.Field(i).Name, fieldVal)
		}
	}
}

// Prints http.Header key value pairs with indents for cookies.
func Header(header http.Header, out io.Writer) {
	for key := range header {
		isMultiVal := len(header[key]) > 1
		if isMultiVal {
			fmt.Fprintf(out, "  %v:\n", key)
		}
		for _, val := range header[key] {
			if isMultiVal {
				fmt.Fprintf(out, "    %v\n", val)
			} else {
				fmt.Fprintf(out, "  %v: %v\n", key, val)
			}
		}
	}
}

redpajama_set_name: RedPajamaGithub


text: Implement a queue using two stacks.


text:
@extends('shared/_adminlayout')

@section('title')
    Image
@endsection

@section('content')

Changing details for image {{ $image->name }}

    {!! Form::model($image, ['route' => ['admin.image.update', $image->id]]) !!}
    @include('shared/_errors')

    @include('admin/image/_form')

        {!! Form::submit('Change details', ['class' => 'btn btn-primary']) !!} cancel

    {!! Form::close() !!}
@endsection


text:
from rest_framework import serializers

from .models import BehindSubscription, Subscription, SubscriptionSendFailure

class CreateUserSerializer(serializers.Serializer):
    email = serializers.EmailField()

class SubscriptionSerializer(serializers.ModelSerializer):
    messageset_label = serializers.SlugRelatedField(
        source="messageset", slug_field="label", read_only=True
    )

    class Meta:
        model = Subscription
        read_only_fields = ("url", "id", "created_at", "updated_at")
        fields = (
            "url",
            "id",
            "version",
            "identity",
            "messageset",
            "next_sequence_number",
            "lang",
            "active",
            "completed",
            "schedule",
            "process_status",
            "metadata",
            "created_at",
            "updated_at",
            "initial_sequence_number",
            "messageset_label",
        )

class SubscriptionSendFailureSerializer(serializers.HyperlinkedModelSerializer):
    subscription_id = serializers.PrimaryKeyRelatedField(read_only=True)

    class Meta:
        model = SubscriptionSendFailure
        fields = (
            "url",
            "id",
            "subscription",
            "subscription_id",
            "task_id",
            "initiated_at",
            "reason",
        )

class BehindSubscriptionSerializer(serializers.HyperlinkedModelSerializer):
    subscription_id = serializers.PrimaryKeyRelatedField(read_only=True)
    current_messageset_id = serializers.PrimaryKeyRelatedField(read_only=True)
    current_messageset_name = serializers.StringRelatedField(
        source="current_messageset"
    )
    expected_messageset_id = serializers.PrimaryKeyRelatedField(read_only=True)
    expected_messageset_name = serializers.StringRelatedField(
        source="expected_messageset"
    )

    class Meta:
        model = BehindSubscription
        fields = (
            "id",
            "subscription",
            "subscription_id",
            "messages_behind",
            "current_messageset",
            "current_messageset_id",
            "current_messageset_name",
            "current_sequence_number",
            "expected_messageset",
            "expected_messageset_id",
            "expected_messageset_name",
            "expected_sequence_number",
            "created_at",
        )


text:
using Soldier.Framework.Dao;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Soldier.Extension.Examination.Server.Enum
{
    public enum MessageCode
    {
        [DataDictionary("000", "成功")]
        Success,
        [DataDictionary("001", "无法获取超级管理员权限")]
        NotAdministrator,
        [DataDictionary("002", "无效的时间格式(格式:YYYY-MM-DD hh:mm:ss)")]
        InvalidTimeFormat,
        [DataDictionary("003", "时间同步失败")]
        SetLocalTimeError,
        [DataDictionary("004", "数据清除失败")]
        ClearDataError,
        [DataDictionary("005", "缓存清除失败")]
        ClearCacheError,
        [DataDictionary("006", "数据解密失败")]
        DataDecryptError,
        [DataDictionary("007", "请求参数为空")]
        ParamEmpty,
        [DataDictionary("008", "请求参数JSON格式错误")]
        ParamJsonError,
        [DataDictionary("009", "请求参数异常")]
        ParamError,
        [DataDictionary("010", "缺少访问权限")]
        AccessError,
        [DataDictionary("011", "数据获取失败")]
        DataQueryError,
        [DataDictionary("012", "数据获取结束")]
        DataQueryFinished,
        [DataDictionary("013", "握手失败")]
        ShakeError,
        [DataDictionary("014", "注册失败")]
        LoginError,
        [DataDictionary("015", "JavaScript执行失败")]
        JavaScriptExecuteError
    }
}


text:
MVVM extensions for .NET Core with support for async commands, MVVM-friendly Task and UI notification.

This library is a useful collection of API designed for *.NET Core* for an extended and easier implementation of the MVVM design pattern.
Essentially there are various implementations of the *ICommand* and INotifyPropertyChanged* interfaces, serving different purposes.

Here's a brief list of the API you can find:
- *ObservableObject*: Extend from this class to have an object that supports notifications without worrying to implement INotifyPropertyChanged.
- *ObservableTask*: A wrapper of Task that supports UI notifications.
- *RelayCommand* and *RelayCommand\<T\>*: Standard implementations (non-generic and generic) of the ICommand interface.
- *AsyncCommand*, *AsyncCommand\<TResult\>* and *AsyncCommand\<TParameter, TResult\>*: Commands that execute asynchronous operations or Tasks.

## License

MVVM Extensions is released under [MIT License](https://github.com/TommasoScalici/MVVMExtensions/blob/master/LICENSE.md).


text:
package org.wildfly.swarm.examples.netflix.ribbon.events;

import com.netflix.ribbon.Ribbon;
import com.netflix.ribbon.RibbonRequest;
import com.netflix.ribbon.proxy.annotation.Http;
import com.netflix.ribbon.proxy.annotation.Hystrix;
import com.netflix.ribbon.proxy.annotation.ResourceGroup;
import com.netflix.ribbon.proxy.annotation.TemplateName;
import io.netty.buffer.ByteBuf;

/**
 * @author Bob McWhirter
 */
@ResourceGroup( name="example-ribbon-consul-time" )
public interface TimeService {

    TimeService INSTANCE = Ribbon.from(TimeService.class);

    @TemplateName("currentTime")
    @Http(
            method = Http.HttpMethod.GET,
            uri = "/"
    )
    @Hystrix(
            fallbackHandler = TimeFallbackHandler.class
    )
    RibbonRequest<ByteBuf> currentTime();

}


text:
class FL_EXPORT Flcc_HueBox : public Fl_Widget {
  int px, py;
protected:
  void draw();
  int handle_key(int);
public:
  int handle(int);
  Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
  px = py = 0;}
};

class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
  int py;
protected:
  void draw();
  int handle_key(int);
public:
  int handle(int);
  Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
  py = 0;}
};

class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
public:
  int format(char*);
  Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
};

class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
  Flcc_HueBox huebox;
  Flcc_ValueBox valuebox;
  Fl_Choice choice;
  Flcc_Value_Input rvalue;
  Flcc_Value_Input gvalue;
  Flcc_Value_Input bvalue;
  Fl_Box resize_box;
  double hue_, saturation_, value_;
  double r_, g_, b_;
  void set_valuators();
  static void rgb_cb(Fl_Widget*, void*);
  static void mode_cb(Fl_Widget*, void*);
public:
  int mode() {return choice.value();}
  double hue() const {return hue_;}
  double saturation() const {return saturation_;}
  double value() const {return value_;}
  double r() const {return r_;}
  double g() const {return g_;}
  double b() const {return b_;}
  int hsv(double,double,double);
  int rgb(double,double,double);
  static void hsv2rgb(double, double, double,double&,double&,double&);
  static void rgb2hsv(double, double, double,double&,double&,double&);
  Fl_Color_Chooser(int,int,int,int,const char* = 0);
};

FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b);
FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);

#endif

//
// End of "$Id: Fl_Color_Chooser.H 4288 2005-04-16 00:13:17Z mike $".
//


text:
/*sculptGL gui*/
var gui;
var subGuiR;
var subGuiT;
var subGuiS;
var tool = {
    Tool:1
};
function initGui(cube, render) {
    gui = new dat.GUI({ autoPlace: false });
    document.getElementById('gui-container').appendChild(gui.domElement);
    subGuiR = gui.addFolder('RENDERING');
    subGuiT = gui.addFolder('TOPOLOGY');
    subGuiS = gui.addFolder('SCULPTING & PAINTING');
    subGuiS.add(tool, 'Tool', { Drag: 1, Brush: 2 }).onChange(function(){
        destroyTools();
        initTools(cube, render);
    });
}
function destroyTools() {
    var l = subGuiS.__controllers.length;
    for(var i = 1; i < l; i++) {
        subGuiS.__controllers[1].remove();
    }
}
function initTools(cube, render) {
    switch(tool.Tool) {
        case "1": // drag
            initDragToolsGui(cube, render);
            break;
        case "2": // brush
            initBrushToolsGui();
            break;
        default :
            break;
    }
}

/***** drag tools *****/
var dragTools = {
    Radius : 1,
    Symmetry : false
}
function initDragToolsGui(cube, render) {
    subGuiS.add(dragTools, 'Radius', 1, 25);
    subGuiS.add(dragTools, 'Symmetry');
    subGuiS.add(cube.scale, 'x', 0.1, 10, 0.1).onChange(function() { render(); });
    subGuiS.add(cube.scale, 'y', 0.1, 10, 0.1).onChange(function() { render(); });
    subGuiS.add(cube.scale, 'z', 0.1, 10, 0.1).onChange(function() { render(); });
}
/***** brush tools *****/
var brushTools = {
    Radius : 1,
    Intensity: 1,
    Negative: false,
    Symmetry: false
};
function initBrushToolsGui() {
    subGuiS.add(brushTools, 'Radius', 1, 25);
    subGuiS.add(brushTools, 'Intensity', 1, 100);
    subGuiS.add(brushTools, 'Negative');
    subGuiS.add(brushTools, 'Symmetry');
}


text:
PDRClient.directive('userLogin', ['SessionService',
    function(SessionService) {
      return {
        restrict: 'E',
        replace: true,
        templateUrl: 'client/views/directives/user_login.html',
        controller: ['$scope', '$rootScope', '$location',
          function($scope, $rootScope, $location) {
            $scope.email    = null;
            $scope.password = null;
            $scope.errors   = null;
            $scope.showalert = false;
            $scope.alerts = [];

            $scope.showError = function() {
              $scope.alerts.push({type: 'danger', msg: 'Invalid email or password!'});
            };

            $scope.closeAlert = function(index) {
              $scope.alerts.splice(index, 1);
            };

            $scope.authenticate = function(email, password) {
              SessionService.authenticate(email, password)
                .then(function(user) {
                  if($scope.redirect)
                    $location.url($scope.redirect);
                  else
                    $location.url('/home');

                  $rootScope.$broadcast('session_updated');
                }, function() {
                  $scope.showError();
                });
            };
          }],
      };
    }
]);


text:
class ScienceSeeker < Agent
  def request_options
    { content_type: 'xml' }
  end

  def get_query_string(options={})
    work = Work.where(id: options.fetch(:work_id, nil)).first
    return {} unless work.present? && work.doi.present?

    work.doi_escaped
  end

  def get_relations_with_related_works(result, work)
    related_works = result.fetch('feed', nil) && result.deep_fetch('feed', 'entry') { nil }
    related_works = [related_works] if related_works.is_a?(Hash)
    provenance_url = get_provenance_url(work_id: work.id)

    Array(related_works).map do |item|
      item.extend Hashie::Extensions::DeepFetch
      url = item.fetch("link", {}).fetch("href", nil)

      { prefix: work.prefix,
        relation: { "subj_id" => url,
                    "obj_id" => work.pid,
                    "relation_type_id" => "discusses",
                    "provenance_url" => provenance_url,
                    "source_id" => source_id },
        subj: { "pid" => url,
                "author" => get_authors([item.fetch('author', {}).fetch('name', "")]),
                "title" => item.fetch('title', nil),
                "container-title" => item.fetch('source', {}).fetch('title', ""),
                "issued" => get_iso8601_from_time(item.fetch("updated", nil)),
                "URL" => url,
                "type" => 'post',
                "tracked" => tracked }}
    end
  end

  def config_fields
    [:url, :provenance_url]
  end

  def url
    "http://scienceseeker.org/search/default/?type=post&filter0=citation&modifier0=doi&value0=%{query_string}"
  end

  def provenance_url
    "http://scienceseeker.org/posts/?filter0=citation&modifier0=doi&value0=%{query_string}"
  end

  def cron_line
    config.cron_line || "* 7 28 * *"
  end

  def rate_limiting
    config.rate_limiting || 1000
  end

  def tracked
    config.tracked || true
  end
end


text:
<?xml version="1.0" encoding="utf-8" ?>
<asn:Sequence
  xmlns:asn="http://schemas.dot.net/asnxml/201808/"
  name="EnvelopedDataAsn"
  namespace="System.Security.Cryptography.Pkcs.Asn1">

  <!--
    https://tools.ietf.org/html/rfc5652#section-6.1

    EnvelopedData ::= SEQUENCE {
        version CMSVersion,
        originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
        recipientInfos RecipientInfos,
        encryptedContentInfo EncryptedContentInfo,
        unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
    }

    RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo
  -->
  <asn:Integer name="Version" backingType="int" />
  <asn:AsnType name="OriginatorInfo" typeName="System.Security.Cryptography.Pkcs.Asn1.OriginatorInfoAsn" implicitTag="0" optional="true" />
  <asn:SetOf name="RecipientInfos">
    <asn:AsnType typeName="System.Security.Cryptography.Pkcs.Asn1.RecipientInfoAsn" />
  </asn:SetOf>
  <asn:AsnType name="EncryptedContentInfo" typeName="System.Security.Cryptography.Asn1.Pkcs7.EncryptedContentInfoAsn" />
  <asn:SetOf name="UnprotectedAttributes" implicitTag="1" optional="true">
    <asn:AsnType typeName="System.Security.Cryptography.Asn1.AttributeAsn" />
  </asn:SetOf>
</asn:Sequence>


text:
using System;
using System.Runtime.InteropServices;
using static Vanara.PInvoke.Ole32;
using static Vanara.PInvoke.Winmm;

namespace Vanara.PInvoke
{
	/// Functions, structures and constants from Windows Core Audio Api.
	public static partial class CoreAudio
	{
		///
		/// Specifies the type of an ISpatialAudioObject. A spatial audio object can be dynamic, meaning that it's spatial properties can
		/// change over time, or static, which means that its spatial properties are fixed. There are 17 audio channels to which a static
		/// spatial audio object can be assigned, each representing a real or virtualized speaker. The static channel values of the
		/// enumeration can be combined as a mask to assign a spatial audio object to multiple channels. All of the enumeration values
		/// except for <c>AudioObjectType_None</c> and <c>AudioObjectType_Dynamic</c> represent static channels.
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/ne-spatialaudioclient-audioobjecttype typedef enum
		// AudioObjectType { AudioObjectType_None, AudioObjectType_Dynamic, AudioObjectType_FrontLeft, AudioObjectType_FrontRight,
		// AudioObjectType_FrontCenter, AudioObjectType_LowFrequency, AudioObjectType_SideLeft, AudioObjectType_SideRight,
		// AudioObjectType_BackLeft, AudioObjectType_BackRight, AudioObjectType_TopFrontLeft, AudioObjectType_TopFrontRight,
		// AudioObjectType_TopBackLeft, AudioObjectType_TopBackRight, AudioObjectType_BottomFrontLeft, AudioObjectType_BottomFrontRight,
		// AudioObjectType_BottomBackLeft, AudioObjectType_BottomBackRight, AudioObjectType_BackCenter } ;
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "DFFE770F-41C0-4048-A38F-FB96353E9216")]
		public enum AudioObjectType
		{
			/// The spatial audio object is not spatialized.
			AudioObjectType_None = 0,

			/// The spatial audio object is dynamic. It's spatial properties can be changed over time.
			AudioObjectType_Dynamic = (1 << 0),

			///
			/// The spatial audio object is assigned the front left channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_FRONT_LEFT.
			///
			AudioObjectType_FrontLeft = (1 << 1),

			///
			/// The spatial audio object is assigned the front right channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_FRONT_RIGHT.
			///
			AudioObjectType_FrontRight = (1 << 2),

			///
			/// The spatial audio object is assigned the front center channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_FRONT_CENTER.
			///
			AudioObjectType_FrontCenter = (1 << 3),

			///
			/// The spatial audio object is assigned the low frequency channel. Because this channel is not spatialized, it does not count
			/// toward the system resource limits for spatialized audio objects. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_LOW_FREQUENCY.
			///
			AudioObjectType_LowFrequency = (1 << 4),

			///
			/// The spatial audio object is assigned the side left channel. The equivalent channel mask of DirectShow's WAVEFORMATEXTENSIBLE
			/// enumeration is SPEAKER_SIDE_LEFT.
			///
			AudioObjectType_SideLeft = (1 << 5),

			///
			/// The spatial audio object is assigned the side right channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_SIDE_RIGHT.
			///
			AudioObjectType_SideRight = (1 << 6),

			///
			/// The spatial audio object is assigned the back left channel. The equivalent channel mask of DirectShow's WAVEFORMATEXTENSIBLE
			/// enumeration is SPEAKER_BACK_LEFT.
			///
			AudioObjectType_BackLeft = (1 << 7),

			///
			/// The spatial audio object is assigned the back right channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_BACK_RIGHT.
			///
			AudioObjectType_BackRight = (1 << 8),

			///
			/// The spatial audio object is assigned the top front left channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_TOP_FRONT_LEFT.
			///
			AudioObjectType_TopFrontLeft = (1 << 9),

			///
			/// The spatial audio object is assigned the top front right channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_TOP_FRONT_RIGHT.
			///
			AudioObjectType_TopFrontRight = (1 << 10),

			///
			/// The spatial audio object is assigned the top back left channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_TOP_BACK_LEFT.
			///
			AudioObjectType_TopBackLeft = (1 << 11),

			///
			/// The spatial audio object is assigned the top back right channel. The equivalent channel mask of DirectShow's
			/// WAVEFORMATEXTENSIBLE enumeration is SPEAKER_TOP_BACK_RIGHT.
			///
			AudioObjectType_TopBackRight = (1 << 12),

			/// The spatial audio object is assigned the bottom front left channel.
			AudioObjectType_BottomFrontLeft = (1 << 13),

			/// The spatial audio object is assigned the bottom front right channel.
			AudioObjectType_BottomFrontRight = (1 << 14),

			/// The spatial audio object is assigned the bottom back left channel.
			AudioObjectType_BottomBackLeft = (1 << 15),

			/// The spatial audio object is assigned the bottom back right channel.
			AudioObjectType_BottomBackRight = (1 << 16),

			/// The spatial audio object is assigned the back center channel.
			AudioObjectType_BackCenter = (1 << 17)
		}

		///
		/// Provides a list of supported audio formats. The most preferred format is first in the list. Get a reference to this interface by
		/// calling ISpatialAudioClient::GetSupportedAudioObjectFormatEnumerator.
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-iaudioformatenumerator
		[ComImport, Guid("DCDAA858-895A-4A22-A5EB-67BDA506096D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface IAudioFormatEnumerator
		{
			/// Gets the number of supported audio formats in the list
			/// <returns>The number of supported audio formats in the list.</returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-iaudioformatenumerator-getcount
			// HRESULT GetCount( UINT32 *count );
			uint GetCount();

			///
			/// Gets the format with the specified index in the list. The formats are listed in order of importance. The most preferable
			/// format is first in the list.
			///
			/// <param name="index">The index of the item in the list to retrieve.</param>
			/// <param name="format">Pointer to a pointer to a <c>WAVEFORMATEX</c> structure describing a supported audio format.</param>
			/// <returns>If the method succeeds, it returns S_OK.</returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-iaudioformatenumerator-getformat
			// HRESULT GetFormat( UINT32 index, WAVEFORMATEX **format );
			void GetFormat([In] uint index, out IntPtr format);
		}

		///
		/// The <c>ISpatialAudioClient</c> interface enables a client to create audio streams that emit audio from a position in 3D space.
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		///
		/// <remarks>
		/// <para>
		/// Get an instance of this interface by calling ActivateAudioInterfaceAsync, using the __uuidof operator to get the class ID of the
		/// <c>ISpatialAudioClient</c> interface. The following example code shows how to initialize this interface.
		/// </para>
		/// <para>
		/// <c>Note</c> When using the <c>ISpatialAudioClient</c> interfaces on an Xbox One Development Kit (XDK) title, you must first call
		/// <c>EnableSpatialAudio</c> before calling IMMDeviceEnumerator::EnumAudioEndpoints or
		/// IMMDeviceEnumerator::GetDefaultAudioEndpoint. Failure to do so will result in an E_NOINTERFACE error being returned from the
		/// call to Activate. <c>EnableSpatialAudio</c> is only available for XDK titles, and does not need to be called for Universal
		/// Windows Platform apps running on Xbox One, nor for any non-Xbox One devices.
		/// </para>
		/// <para>To access the <c>ActivateAudioIntefaceAsync</c>, you will need to link to mmdevapi.lib.</para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioclient
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "950778D4-79FE-4222-951F-5A456A633124")]
		[ComImport, Guid("BBF8E066-AAAA-49BE-9A4D-FD2A858EA27F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioClient
		{
			/// Gets the position in 3D space of the specified static spatial audio channel.
			/// <param name="type">
			/// A value indicating the static spatial audio channel for which the position is being queried. This method will return
			/// E_INVALIDARG if the value does not represent a static channel, including <c>AudioObjectType_Dynamic</c> and <c>AudioObjectType_None</c>.
			/// </param>
			/// <param name="x">
			/// The x coordinate of the static audio channel, in meters, relative to the listener. Positive values are to the right of the
			/// listener and negative values are to the left.
			/// </param>
			/// <param name="y">
			/// The y coordinate of the static audio channel, in meters, relative to the listener. Positive values are above the listener
			/// and negative values are below.
			/// </param>
			/// <param name="z">
			/// The z coordinate of the static audio channel, in meters, relative to the listener. Positive values are behind the listener
			/// and negative values are in front.
			/// </param>
			/// <remarks>
			/// Position values use a right-handed Cartesian coordinate system, where each unit represents 1 meter. The coordinate system is
			/// relative to the listener where the origin (x=0.0, y=0.0, z=0.0) represents the center point between the listener's ears.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-getstaticobjectposition
			// HRESULT GetStaticObjectPosition( AudioObjectType type, float *x, float *y, float *z );
			void GetStaticObjectPosition([In] AudioObjectType type, out float x, out float y, out float z);

			/// Gets a channel mask which represents the subset of static speaker bed channels native to current rendering engine.
			/// <returns>
			/// A bitwise combination of values from the AudioObjectType enumeration indicating a subset of static speaker channels. The
			/// values returned will only include the static channel values and will not include <c>AudioObjectType_Dynamic</c>.
			/// </returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-getnativestaticobjecttypemask
			// HRESULT GetNativeStaticObjectTypeMask( AudioObjectType *mask );
			AudioObjectType GetNativeStaticObjectTypeMask();

			/// Gets the maximum number of dynamic audio objects for the spatial audio client.
			/// <returns>Gets the maximum dynamic object count for this client.</returns>
			/// <remarks>
			/// <para>
			/// A dynamic ISpatialAudioObject is one that was activated by setting the type parameter to the
			/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method to <c>AudioObjectType_Dynamic</c>. The client has a limit
			/// of the maximum number of dynamic spatial audio objects that can be activated at one time. When the capacity of the audio
			/// rendering pipeline changes, the system will dynamically adjust the maximum number of concurrent dynamic spatial audio
			/// objects. Before doing so, the system will call OnAvailableDynamicObjectCountChange to notify clients of the resource limit change.
			/// </para>
			/// <para>
			/// Call Release on an <c>ISpatialAudioObject</c> when it is no longer being used to free up the resource to create new dynamic
			/// spatial audio objects.
			/// </para>
			/// <para>
			/// When Windows Sonic is not available (for instance, when playing to embedded laptop stereo speakers, or if the user has not
			/// explicitly enabled Windows Sonic on the device), the number of available dynamic objects returned by
			/// <c>GetMaxDynamicObjectCount</c> to an application will be 0.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-getmaxdynamicobjectcount
			// HRESULT GetMaxDynamicObjectCount( UINT32 *value );
			uint GetMaxDynamicObjectCount();

			///
			/// Gets an IAudioFormatEnumerator that contains all supported audio formats for spatial audio objects, the first item in the
			/// list represents the most preferable format.
			///
			/// <returns>Pointer to the pointer that receives the IAudioFormatEnumerator interface.</returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-getsupportedaudioobjectformatenumerator
			// HRESULT GetSupportedAudioObjectFormatEnumerator( IAudioFormatEnumerator **enumerator );
			IAudioFormatEnumerator GetSupportedAudioObjectFormatEnumerator();

			///
			/// Gets the maximum possible frame count per processing pass. This method can be used to determine the size of the source
			/// buffer that should be allocated to convey audio data for each processing pass.
			///
			/// <param name="objectFormat">
			/// The audio format used to calculate the maximum frame count. This should be the same format specified in the
			/// <c>ObjectFormat</c> field of the SpatialAudioObjectRenderStreamActivationParams passed to ActivateSpatialAudioStream.
			/// </param>
			/// <returns>The maximum number of audio frames that will be processed in one pass.</returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-getmaxframecount
			// HRESULT GetMaxFrameCount( const WAVEFORMATEX *objectFormat, UINT32 *frameCountPerBuffer );
			uint GetMaxFrameCount(in WAVEFORMATEX objectFormat);

			/// Gets a value indicating whether ISpatialAudioObjectRenderStream supports a the specified format.
			/// <param name="objectFormat">The format for which support is queried.</param>
			/// <returns>
			/// If the specified format is supported, it returns S_OK. If specified format is unsupported, this method returns AUDCLNT_E_UNSUPPORTED_FORMAT.
			/// </returns>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-isaudioobjectformatsupported
			// HRESULT IsAudioObjectFormatSupported( const WAVEFORMATEX *objectFormat );
			[PreserveSig]
			HRESULT IsAudioObjectFormatSupported(in WAVEFORMATEX objectFormat);

			///
			/// When successful, gets a value indicating whether the currently active spatial rendering engine supports the specified
			/// spatial audio render stream.
			///
			/// <param name="streamUuid">The interface ID of the interface for which availability is queried.</param>
			/// <param name="auxiliaryInfo">
			/// A structure containing additional information to be used when support is queried. For more information, see Remarks.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>SPTLAUDCLNT_E_STREAM_IS_NOT_AVAILABLE</term>
			/// <term>The specified stream interface can't be activated by the currently active rendering engine.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_METADATA_FORMAT_IS_NOT_SUPPORTED</term>
			/// <term>
			/// The metadata format supplied in the auxiliaryInfo parameter is not supported by the current rendering engine. For more
			/// information, see Remarks..
			/// </term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>
			/// <para>
			/// When querying to see if the ISpatialAudioObjectRenderStreamForMetadata you can use the auxilaryInfo parameter to query if a
			/// particular metadata format is supported. The following code example demonstrates how to initialize the PROPVARIANT structure
			/// to check for support for an example metadata format.
			/// </para>
			/// <para>If the specified metadata format is unsupported, <c>IsSpatialAudioStreamAvailable</c> returns SPTLAUDCLNT_E_METADATA_FORMAT_IS_NOT_SUPPORTED.</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-isspatialaudiostreamavailable
			// HRESULT IsSpatialAudioStreamAvailable( REFIID streamUuid, const PROPVARIANT *auxiliaryInfo );
			[PreserveSig]
			HRESULT IsSpatialAudioStreamAvailable(in Guid streamUuid, [In, Optional] PROPVARIANT auxiliaryInfo);

			/// Activates and initializes spatial audio stream using one of the spatial audio stream activation structures.
			/// <param name="activationParams">
			/// The structure defining the activation parameters for the spatial audio stream. The <c>vt</c> field should be set to VT_BLOB
			/// and the <c>blob</c> field should be populated with a SpatialAudioObjectRenderStreamActivationParams or a SpatialAudioObjectRenderStreamForMetadataActivationParams.
			/// </param>
			/// <param name="riid">The UUID of the spatial audio stream interface to activate.</param>
			/// <returns>A pointer which receives the activated spatial audio interface.</returns>
			/// <remarks>
			/// <para>This method supports activation of the following spatial audio stream interfaces:</para>
			/// <para>ISpatialAudioObjectRenderStream</para>
			/// <para>ISpatialAudioObjectRenderStreamForMetadata</para>
			/// <para>Examples</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioclient-activatespatialaudiostream
			// HRESULT ActivateSpatialAudioStream( const PROPVARIANT *activationParams, REFIID riid, void **stream );
			[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)]
			object ActivateSpatialAudioStream([In] PROPVARIANT activationParams, in Guid riid);
		}

		///
		/// <para>
		/// Represents an object that provides audio data to be rendered from a position in 3D space, relative to the user. Spatial audio
		/// objects can be static or dynamic, which you specify with the type parameter to the
		/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method. Dynamic audio objects can be placed in an arbitrary position
		/// in space and can be moved over time. Static audio objects are assigned to one or more channels, defined in the AudioObjectType
		/// enumeration, that each correlate to a fixed speaker location that may be a physical or a virtualized speaker.
		/// </para>
		/// <para>
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		/// </para>
		///
		/// <remarks>
		/// <c>Note</c> Many of the methods provided by this interface are implemented in the inherited ISpatialAudioObjectBase interface.
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioobject
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "EE83AF5F-4342-4CF2-81A7-1123F8DAFA6F")]
		[ComImport, Guid("DDE28967-521B-46E5-8F00-BD6F2BC8AB1D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioObject : ISpatialAudioObjectBase
		{
			/// Gets a buffer that is used to supply the audio data for the ISpatialAudioObject.
			/// <param name="buffer">The buffer into which audio data is written.</param>
			/// <param name="bufferLength">
			/// The length of the buffer in bytes. This length will be the value returned in the frameCountPerBuffer parameter to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects multiplied by the value of the <c>nBlockAlign</c> field of the
			/// WAVEFORMATEX structure passed in the SpatialAudioObjectRenderStreamActivationParams parameter to ISpatialAudioClient::ActivateSpatialAudioStream.
			/// </param>
			/// <remarks>
			/// <para>
			/// The first time <c>GetBuffer</c> is called after the ISpatialAudioObject is activated with a call
			/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject, lifetime of the spatial audio object starts. To keep the
			/// spatial audio object alive after that, this <c>GetBuffer</c> must be called on every processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects). If
			/// <c>GetBuffer</c> is not called within an audio processing pass, SetEndOfStream is called implicitly on the audio object to
			/// deactivate, and the audio object can only be reused after calling Release on the object and then reactivating the object by
			/// calling <c>ActivateSpatialAudioObject</c> again.
			/// </para>
			/// <para>
			/// The pointers retrieved by <c>GetBuffer</c> should not be used after ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects
			/// has been called.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-getbuffer
			// HRESULT GetBuffer( BYTE **buffer, UINT32 *bufferLength );
			new void GetBuffer(out IntPtr buffer, out uint bufferLength);

			///
			/// Instructs the system that the final block of audio data has been submitted for the ISpatialAudioObject so that the object
			/// can be deactivated and it's resources reused.
			///
			/// <param name="frameCount">
			/// The number of audio frames in the audio buffer that should be included in the final processing pass. This number may be
			/// smaller than or equal to the value returned in the frameCountPerBuffer parameter to ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>SPTLAUDCLNT_E_OUT_OF_ORDER</term>
			/// <term>ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects was not called before the call to SetEndOfStream.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_RESOURCES_INVALIDATED</term>
			/// <term>
			/// SetEndOfStream was called either explicitly or implicitly in a previous audio processing pass. SetEndOfStream is called
			/// implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects).
			/// </term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>Call Release after calling <c>SetEndOfStream</c> to make free the audio object resources for future use.</remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-setendofstream
			// HRESULT SetEndOfStream( UINT32 frameCount );
			new void SetEndOfStream([In] uint frameCount);

			/// Gets a boolean value indicating whether the ISpatialAudioObject is valid.
			/// <returns><c>TRUE</c> if the audio object is currently valid; otherwise, <c>FALSE</c>.</returns>
			/// <remarks>
			/// <para>If this value is false, you should call Release to make the audio object resource available in the future.</para>
			/// <para>
			/// <c>IsActive</c> will be set to false after SetEndOfStream is called implicitly or explicitly. <c>SetEndOfStream</c> is
			/// called implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects).
			/// </para>
			/// <para>
			/// The rendering engine will also deactivate the audio object, setting <c>IsActive</c> to false, when audio object resources
			/// become unavailable. In this case, a notification is sent via ISpatialAudioObjectRenderStreamNotify before the object is
			/// deactivated. The value returned in the availableDynamicObjectCount parameter to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects indicates how many objects will be processed for each pass.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-isactive
			// HRESULT IsActive( BOOL *isActive );
			[return: MarshalAs(UnmanagedType.Bool)]
			new bool IsActive();

			///
			/// Gets a value specifying the type of audio object that is represented by the ISpatialAudioObject. This value indicates if the
			/// object is dynamic or static. If the object is static, one and only one of the static audio channel values to which the
			/// object is assigned is returned.
			///
			/// <returns>A value specifying the type of audio object that is represented</returns>
			/// <remarks>
			/// Set the type of the audio object with the type parameter to the ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-getaudioobjecttype
			// HRESULT GetAudioObjectType( AudioObjectType *audioObjectType );
			new AudioObjectType GetAudioObjectType();

			///
			/// Sets the position in 3D space, relative to the listener, from which the ISpatialAudioObject audio data will be rendered.
			///
			/// <param name="x">
			/// The x position of the audio object, in meters, relative to the listener. Positive values are to the right of the listener
			/// and negative values are to the left.
			/// </param>
			/// <param name="y">
			/// The y position of the audio object, in meters, relative to the listener. Positive values are above the listener and negative
			/// values are below.
			/// </param>
			/// <param name="z">
			/// The z position of the audio object, in meters, relative to the listener. Positive values are behind the listener and
			/// negative values are in front.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>SPTLAUDCLNT_E_OUT_OF_ORDER</term>
			/// <term>ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects was not called before the call to SetPosition.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_RESOURCES_INVALIDATED</term>
			/// <term>
			/// SetEndOfStream was called either explicitly or implicitly in a previous audio processing pass. SetEndOfStream is called
			/// implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStreamBase::EndUpdatingAudioObjects).
			/// </term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_PROPERTY_NOT_SUPPORTED</term>
			/// <term>
			/// The ISpatialAudioObject is not of type AudioObjectType_Dynamic. Set the type of the audio object with the type parameter to
			/// the ISpatialAudioObjectRenderStreamBase::ActivateSpatialAudioObject method.
			/// </term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>
			/// <para>
			/// This method can only be called on a ISpatialAudioObject that is of type <c>AudioObjectType_Dynamic</c>. Set the type of the
			/// audio object with the type parameter to the ISpatialAudioObjectRenderStreamBase::ActivateSpatialAudioObject method.
			/// </para>
			/// <para>
			/// Position values use a right-handed Cartesian coordinate system, where each unit represents 1 meter. The coordinate system is
			/// relative to the listener where the origin (x=0.0, y=0.0, z=0.0) represents the center point between the listener's ears.
			/// </para>
			/// <para>
			/// If <c>SetPosition</c> is never called, the origin (x=0.0, y=0.0, z=0.0) is used as the default position. After
			/// <c>SetPosition</c> is called, the position that is set will be used for the audio object until the position is changed with
			/// another call to <c>SetPosition</c>.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobject-setposition
			// HRESULT SetPosition( float x, float y, float z );
			void SetPosition([In] float x, [In] float y, [In] float z);

			///
			/// Sets an audio amplitude multiplier that will be applied to the audio data provided by the ISpatialAudioObject before it is
			/// submitted to the audio rendering engine.
			///
			/// <param name="volume">The amplitude multiplier for audio data. This must be a value between 0.0 and 1.0.</param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>SPTLAUDCLNT_E_OUT_OF_ORDER</term>
			/// <term>ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects was not called before the call to SetVolume.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_RESOURCES_INVALIDATED</term>
			/// <term>
			/// SetEndOfStream was called either explicitly or implicitly in a previous audio processing pass. SetEndOfStream is called
			/// implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStreamBase::EndUpdatingAudioObjects).
			/// </term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>
			/// If <c>SetVolume</c> is never called, the default value of 1.0 is used. After <c>SetVolume</c> is called, the volume that is
			/// set will be used for the audio object until the volume is changed with another call to <c>SetVolume</c>.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobject-setvolume
			// HRESULT SetVolume( float volume );
			void SetVolume([In] float volume);
		}

		///
		/// <para>
		/// Base interface that represents an object that provides audio data to be rendered from a position in 3D space, relative to the
		/// user. Spatial audio objects can be static or dynamic, which you specify with the type parameter to the
		/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method. Dynamic audio objects can be placed in an arbitrary position
		/// in space and can be moved over time. Static audio objects are assigned to one or more channels, defined in the AudioObjectType
		/// enumeration, that each correlate to a fixed speaker location that may be a physical or a virtualized speaker.
		/// </para>
		/// <para>
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		/// </para>
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioobjectbase
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "54721875-D93A-4C7E-A07E-C286E1A409D3")]
		[ComImport, Guid("CCE0B8F2-8D4D-4EFB-A8CF-3D6ECF1C30E0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioObjectBase
		{
			/// Gets a buffer that is used to supply the audio data for the ISpatialAudioObject.
			/// <param name="buffer">The buffer into which audio data is written.</param>
			/// <param name="bufferLength">
			/// The length of the buffer in bytes. This length will be the value returned in the frameCountPerBuffer parameter to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects multiplied by the value of the <c>nBlockAlign</c> field of the
			/// WAVEFORMATEX structure passed in the SpatialAudioObjectRenderStreamActivationParams parameter to ISpatialAudioClient::ActivateSpatialAudioStream.
			/// </param>
			/// <remarks>
			/// <para>
			/// The first time <c>GetBuffer</c> is called after the ISpatialAudioObject is activated with a call
			/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject, lifetime of the spatial audio object starts. To keep the
			/// spatial audio object alive after that, this <c>GetBuffer</c> must be called on every processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects). If
			/// <c>GetBuffer</c> is not called within an audio processing pass, SetEndOfStream is called implicitly on the audio object to
			/// deactivate, and the audio object can only be reused after calling Release on the object and then reactivating the object by
			/// calling <c>ActivateSpatialAudioObject</c> again.
			/// </para>
			/// <para>
			/// The pointers retrieved by <c>GetBuffer</c> should not be used after ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects
			/// has been called.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-getbuffer
			// HRESULT GetBuffer( BYTE **buffer, UINT32 *bufferLength );
			void GetBuffer(out IntPtr buffer, out uint bufferLength);

			///
			/// Instructs the system that the final block of audio data has been submitted for the ISpatialAudioObject so that the object
			/// can be deactivated and it's resources reused.
			///
			/// <param name="frameCount">
			/// The number of audio frames in the audio buffer that should be included in the final processing pass. This number may be
			/// smaller than or equal to the value returned in the frameCountPerBuffer parameter to ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>SPTLAUDCLNT_E_OUT_OF_ORDER</term>
			/// <term>ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects was not called before the call to SetEndOfStream.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_RESOURCES_INVALIDATED</term>
			/// <term>
			/// SetEndOfStream was called either explicitly or implicitly in a previous audio processing pass. SetEndOfStream is called
			/// implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects).
			/// </term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>Call Release after calling <c>SetEndOfStream</c> to make free the audio object resources for future use.</remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-setendofstream
			// HRESULT SetEndOfStream( UINT32 frameCount );
			void SetEndOfStream([In] uint frameCount);

			/// Gets a boolean value indicating whether the ISpatialAudioObject is valid.
			/// <returns><c>TRUE</c> if the audio object is currently valid; otherwise, <c>FALSE</c>.</returns>
			/// <remarks>
			/// <para>If this value is false, you should call Release to make the audio object resource available in the future.</para>
			/// <para>
			/// <c>IsActive</c> will be set to false after SetEndOfStream is called implicitly or explicitly. <c>SetEndOfStream</c> is
			/// called implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects).
			/// </para>
			/// <para>
			/// The rendering engine will also deactivate the audio object, setting <c>IsActive</c> to false, when audio object resources
			/// become unavailable. In this case, a notification is sent via ISpatialAudioObjectRenderStreamNotify before the object is
			/// deactivated. The value returned in the availableDynamicObjectCount parameter to
			/// ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects indicates how many objects will be processed for each pass.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-isactive
			// HRESULT IsActive( BOOL *isActive );
			[return: MarshalAs(UnmanagedType.Bool)]
			bool IsActive();

			///
			/// Gets a value specifying the type of audio object that is represented by the ISpatialAudioObject. This value indicates if the
			/// object is dynamic or static. If the object is static, one and only one of the static audio channel values to which the
			/// object is assigned is returned.
			///
			/// <returns>A value specifying the type of audio object that is represented</returns>
			/// <remarks>
			/// Set the type of the audio object with the type parameter to the ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectbase-getaudioobjecttype
			// HRESULT GetAudioObjectType( AudioObjectType *audioObjectType );
			AudioObjectType GetAudioObjectType();
		}

		///
		/// <para>
		/// Provides methods for controlling a spatial audio object render stream, including starting, stopping, and resetting the stream.
		/// Also provides methods for activating new ISpatialAudioObject instances and notifying the system when you are beginning and
		/// ending the process of updating activated spatial audio objects and data.
		/// </para>
		/// <para>
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		/// </para>
		///
		/// <remarks>
		/// <c>Note</c> Many of the methods provided by this interface are implemented in the inherited ISpatialAudioObjectRenderStreamBase interface.
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioobjectrenderstream
		[ComImport, Guid("BAB5F473-B423-477B-85F5-B5A332A04153"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioObjectRenderStream : ISpatialAudioObjectRenderStreamBase
		{
			/// Gets the number of dynamic spatial audio objects that are currently available.
			/// <returns>The number of dynamic spatial audio objects that are currently available.</returns>
			/// <remarks>
			/// <para>
			/// A dynamic ISpatialAudioObject is one that was activated by setting the type parameter to the ActivateSpatialAudioObject
			/// method to <c>AudioObjectType_Dynamic</c>. The system has a limit of the maximum number of dynamic spatial audio objects that
			/// can be activated at one time. Call Release on an <c>ISpatialAudioObject</c> when it is no longer being used to free up the
			/// resource to create new dynamic spatial audio objects.
			/// </para>
			/// <para>
			/// You should not call this method after streaming has started, as the value is already provided by
			/// ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects. This method should only be called before streaming has
			/// started, which occurs after ISpatialAudioObjectRenderStreamBase::Start is called.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-getavailabledynamicobjectcount
			// HRESULT GetAvailableDynamicObjectCount( UINT32 *value );
			new uint GetAvailableDynamicObjectCount();

			/// Gets additional services from the <c>ISpatialAudioObjectRenderStream</c>.
			/// <param name="riid">
			/// <para>The interface ID for the requested service. The client should set this parameter to one of the following REFIID values:</para>
			/// <para>IID_IAudioClock</para>
			/// <para>IID_IAudioClock2</para>
			/// <para>IID_IAudioStreamVolume</para>
			/// </param>
			/// <param name="service">
			/// Pointer to a pointer variable into which the method writes the address of an instance of the requested interface. Through
			/// this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface,
			/// when it is no longer needed, by calling the interface's Release method. If the <c>GetService</c> call fails, *ppv is NULL.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>E_POINTER</term>
			/// <term>Parameter ppv is NULL.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_DESTROYED</term>
			/// <term>The ISpatialAudioClient associated with the spatial audio stream has been destroyed.</term>
			/// </item>
			/// <item>
			/// <term>AUDCLNT_E_DEVICE_INVALIDATED</term>
			/// <term>
			/// The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured,
			/// disabled, removed, or otherwise made unavailable for use.
			/// </term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_INTERNAL</term>
			/// <term>An internal error has occurred.</term>
			/// </item>
			/// <item>
			/// <term>AUDCLNT_E_UNSUPPORTED_FORMAT</term>
			/// <term>The media associated with the spatial audio stream uses an unsupported format.</term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>
			/// <para>The <c>GetService</c> method supports the following service interfaces:</para>
			/// <list type="bullet">
			/// <item>
			/// <term>IAudioClock</term>
			/// </item>
			/// <item>
			/// <term>IAudioClock2</term>
			/// </item>
			/// <item>
			/// <term>IAudioStreamVolume</term>
			/// </item>
			/// </list>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-getservice
			// HRESULT GetService( REFIID riid, void **service );
			[PreserveSig]
			new HRESULT GetService(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object service);

			/// Starts the spatial audio stream.
			/// <remarks>
			/// <para>
			/// Starting the stream causes data flow between the endpoint buffer and the audio engine. The first time this method is called,
			/// the stream's audio clock position will be at 0. Otherwise, the clock resumes from its position at the time that the stream
			/// was last paused with a call to Stop. Call Reset to reset the clock position to 0 and cause all active ISpatialAudioObject
			/// instances to be revoked.
			/// </para>
			/// <para>The stream must have been previously stopped with a call to Stop or the method will fail and return SPTLAUDCLNT_E_STREAM_NOT_STOPPED.</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-start
			// HRESULT Start();
			new void Start();

			/// Stops a running audio stream.
			/// <remarks>
			/// Stopping stream causes data to stop flowing between the endpoint buffer and the audio engine. You can consider this
			/// operation to pause the stream because it leaves the stream's audio clock at its current stream position and does not reset
			/// it to 0. A subsequent call to Start causes the stream to resume running from the current position. Call Reset to reset the
			/// clock position to 0 and cause all active ISpatialAudioObject instances to be revoked.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-stop
			// HRESULT Stop();
			new void Stop();

			/// Reset a stopped audio stream.
			/// <remarks>
			/// <para>
			/// Resetting the audio stream flushes all pending data and resets the audio clock stream position to 0. Resetting the stream
			/// also causes all active ISpatialAudioObject instances to be revoked. A subsequent call to Start causes the stream to start
			/// from 0 position.
			/// </para>
			/// <para>The stream must have been previously stopped with a call to Stop or the method will fail and return SPTLAUDCLNT_E_STREAM_NOT_STOPPED.</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-reset
			// HRESULT Reset();
			new void Reset();

			///
			/// Puts the system into the state where audio object data can be submitted for processing and the ISpatialAudioObject state can
			/// be modified.
			///
			/// <param name="availableDynamicObjectCount">
			/// The number of dynamic audio objects that are available to be rendered for the current processing pass. All allocated static
			/// audio objects can be rendered in every pass. For information on audio object types, see AudioObjectType.
			/// </param>
			/// <param name="frameCountPerBuffer">The size, in audio frames, of the buffer returned by GetBuffer.</param>
			/// <remarks>
			/// <para>
			/// This method must be called each time the event passed in the SpatialAudioObjectRenderStreamActivationParams to
			/// ISpatialAudioClient::ActivateSpatialAudioStream is signaled, even if there no audio object data to submit.
			/// </para>
			/// <para>
			/// For each <c>BeginUpdatingAudioObjects</c> call, there should be a corresponding call to EndUpdatingAudioObjects call. If
			/// <c>BeginUpdatingAudioObjects</c> is called twice without a call <c>EndUpdatingAudioObjects</c> between them, the second call
			/// to <c>BeginUpdatingAudioObjects</c> will return SPTLAUDCLNT_E_OUT_OF_ORDER.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-beginupdatingaudioobjects
			// HRESULT BeginUpdatingAudioObjects( UINT32 *availableDynamicObjectCount, UINT32 *frameCountPerBuffer );
			new void BeginUpdatingAudioObjects(out uint availableDynamicObjectCount, out uint frameCountPerBuffer);

			///
			/// Notifies the system that the app has finished supplying audio data for the spatial audio objects activated with ActivateSpatialAudioObject.
			///
			/// <remarks>The pointers retrieved with ISpatialAudioObjectBase::GetBuffer can no longer be used after this method is called.</remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-endupdatingaudioobjects
			// HRESULT EndUpdatingAudioObjects();
			new void EndUpdatingAudioObjects();

			/// Activates an ISpatialAudioObject for audio rendering.
			/// <param name="type">
			/// The type of audio object to activate. For dynamic audio objects, this value must be <c>AudioObjectType_Dynamic</c>. For
			/// static audio objects, specify one of the static audio channel values from the enumeration. Specifying
			/// <c>AudioObjectType_None</c> will produce an audio object that is not spatialized.
			/// </param>
			/// <returns>Receives a pointer to the activated interface.</returns>
			/// <remarks>
			/// A dynamic ISpatialAudioObject is one that was activated by setting the type parameter to the
			/// <c>ActivateSpatialAudioObject</c> method to <c>AudioObjectType_Dynamic</c>. The client has a limit of the maximum number of
			/// dynamic spatial audio objects that can be activated at one time. After the limit has been reached, attempting to activate
			/// additional audio objects will result in this method returning an SPTLAUDCLNT_E_NO_MORE_OBJECTS error. To avoid this, call
			/// Release on each dynamic <c>ISpatialAudioObject</c> after it is no longer being used to free up the resource so that it can
			/// be reallocated. See ISpatialAudioObject::IsActive and ISpatialAudioObject::SetEndOfStream for more information on the
			/// managing the lifetime of spatial audio objects.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstream-activatespatialaudioobject
			// HRESULT ActivateSpatialAudioObject( AudioObjectType type, ISpatialAudioObject **audioObject );
			ISpatialAudioObject ActivateSpatialAudioObject([In] AudioObjectType type);
		}

		///
		/// <para>
		/// Base interface that provides methods for controlling a spatial audio object render stream, including starting, stopping, and
		/// resetting the stream. Also provides methods for activating new ISpatialAudioObject instances and notifying the system when you
		/// are beginning and ending the process of updating activated spatial audio objects and data.
		/// </para>
		/// <para>
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		/// </para>
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioobjectrenderstreambase
		[ComImport, Guid("FEAAF403-C1D8-450D-AA05-E0CCEE7502A8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioObjectRenderStreamBase
		{
			/// Gets the number of dynamic spatial audio objects that are currently available.
			/// <returns>The number of dynamic spatial audio objects that are currently available.</returns>
			/// <remarks>
			/// <para>
			/// A dynamic ISpatialAudioObject is one that was activated by setting the type parameter to the ActivateSpatialAudioObject
			/// method to <c>AudioObjectType_Dynamic</c>. The system has a limit of the maximum number of dynamic spatial audio objects that
			/// can be activated at one time. Call Release on an <c>ISpatialAudioObject</c> when it is no longer being used to free up the
			/// resource to create new dynamic spatial audio objects.
			/// </para>
			/// <para>
			/// You should not call this method after streaming has started, as the value is already provided by
			/// ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects. This method should only be called before streaming has
			/// started, which occurs after ISpatialAudioObjectRenderStreamBase::Start is called.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-getavailabledynamicobjectcount
			// HRESULT GetAvailableDynamicObjectCount( UINT32 *value );
			uint GetAvailableDynamicObjectCount();

			/// Gets additional services from the <c>ISpatialAudioObjectRenderStream</c>.
			/// <param name="riid">
			/// <para>The interface ID for the requested service. The client should set this parameter to one of the following REFIID values:</para>
			/// <para>IID_IAudioClock</para>
			/// <para>IID_IAudioClock2</para>
			/// <para>IID_IAudioStreamVolume</para>
			/// </param>
			/// <param name="service">
			/// Pointer to a pointer variable into which the method writes the address of an instance of the requested interface. Through
			/// this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface,
			/// when it is no longer needed, by calling the interface's Release method. If the <c>GetService</c> call fails, *ppv is NULL.
			/// </param>
			/// <returns>
			/// <para>
			/// If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values
			/// shown in the following table.
			/// </para>
			/// <list type="table">
			/// <listheader>
			/// <term>Return code</term>
			/// <term>Description</term>
			/// </listheader>
			/// <item>
			/// <term>E_POINTER</term>
			/// <term>Parameter ppv is NULL.</term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_DESTROYED</term>
			/// <term>The ISpatialAudioClient associated with the spatial audio stream has been destroyed.</term>
			/// </item>
			/// <item>
			/// <term>AUDCLNT_E_DEVICE_INVALIDATED</term>
			/// <term>
			/// The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured,
			/// disabled, removed, or otherwise made unavailable for use.
			/// </term>
			/// </item>
			/// <item>
			/// <term>SPTLAUDCLNT_E_INTERNAL</term>
			/// <term>An internal error has occurred.</term>
			/// </item>
			/// <item>
			/// <term>AUDCLNT_E_UNSUPPORTED_FORMAT</term>
			/// <term>The media associated with the spatial audio stream uses an unsupported format.</term>
			/// </item>
			/// </list>
			/// </returns>
			/// <remarks>
			/// <para>The <c>GetService</c> method supports the following service interfaces:</para>
			/// <list type="bullet">
			/// <item>
			/// <term>IAudioClock</term>
			/// </item>
			/// <item>
			/// <term>IAudioClock2</term>
			/// </item>
			/// <item>
			/// <term>IAudioStreamVolume</term>
			/// </item>
			/// </list>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-getservice
			// HRESULT GetService( REFIID riid, void **service );
			[PreserveSig]
			HRESULT GetService(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object service);

			/// Starts the spatial audio stream.
			/// <remarks>
			/// <para>
			/// Starting the stream causes data flow between the endpoint buffer and the audio engine. The first time this method is called,
			/// the stream's audio clock position will be at 0. Otherwise, the clock resumes from its position at the time that the stream
			/// was last paused with a call to Stop. Call Reset to reset the clock position to 0 and cause all active ISpatialAudioObject
			/// instances to be revoked.
			/// </para>
			/// <para>The stream must have been previously stopped with a call to Stop or the method will fail and return SPTLAUDCLNT_E_STREAM_NOT_STOPPED.</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-start
			// HRESULT Start();
			void Start();

			/// Stops a running audio stream.
			/// <remarks>
			/// Stopping stream causes data to stop flowing between the endpoint buffer and the audio engine. You can consider this
			/// operation to pause the stream because it leaves the stream's audio clock at its current stream position and does not reset
			/// it to 0. A subsequent call to Start causes the stream to resume running from the current position. Call Reset to reset the
			/// clock position to 0 and cause all active ISpatialAudioObject instances to be revoked.
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-stop
			// HRESULT Stop();
			void Stop();

			/// Reset a stopped audio stream.
			/// <remarks>
			/// <para>
			/// Resetting the audio stream flushes all pending data and resets the audio clock stream position to 0. Resetting the stream
			/// also causes all active ISpatialAudioObject instances to be revoked. A subsequent call to Start causes the stream to start
			/// from 0 position.
			/// </para>
			/// <para>The stream must have been previously stopped with a call to Stop or the method will fail and return SPTLAUDCLNT_E_STREAM_NOT_STOPPED.</para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-reset
			// HRESULT Reset();
			void Reset();

			///
			/// Puts the system into the state where audio object data can be submitted for processing and the ISpatialAudioObject state can
			/// be modified.
			///
			/// <param name="availableDynamicObjectCount">
			/// The number of dynamic audio objects that are available to be rendered for the current processing pass. All allocated static
			/// audio objects can be rendered in every pass. For information on audio object types, see AudioObjectType.
			/// </param>
			/// <param name="frameCountPerBuffer">The size, in audio frames, of the buffer returned by GetBuffer.</param>
			/// <remarks>
			/// <para>
			/// This method must be called each time the event passed in the SpatialAudioObjectRenderStreamActivationParams to
			/// ISpatialAudioClient::ActivateSpatialAudioStream is signaled, even if there no audio object data to submit.
			/// </para>
			/// <para>
			/// For each <c>BeginUpdatingAudioObjects</c> call, there should be a corresponding call to EndUpdatingAudioObjects call. If
			/// <c>BeginUpdatingAudioObjects</c> is called twice without a call <c>EndUpdatingAudioObjects</c> between them, the second call
			/// to <c>BeginUpdatingAudioObjects</c> will return SPTLAUDCLNT_E_OUT_OF_ORDER.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-beginupdatingaudioobjects
			// HRESULT BeginUpdatingAudioObjects( UINT32 *availableDynamicObjectCount, UINT32 *frameCountPerBuffer );
			void BeginUpdatingAudioObjects(out uint availableDynamicObjectCount, out uint frameCountPerBuffer);

			///
			/// Notifies the system that the app has finished supplying audio data for the spatial audio objects activated with ActivateSpatialAudioObject.
			///
			/// <remarks>The pointers retrieved with ISpatialAudioObjectBase::GetBuffer can no longer be used after this method is called.</remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreambase-endupdatingaudioobjects
			// HRESULT EndUpdatingAudioObjects();
			void EndUpdatingAudioObjects();
		}

		///
		/// <para>Provides notifications for spatial audio clients to respond to changes in the state of an ISpatialAudioObjectRenderStream.</para>
		/// <para>
		/// You register the object that implements this interface by assigning it to the NotifyObject parameter of the
		/// SpatialAudioClientActivationParams structure passed into the ISpatialAudioClient::ActivateSpatialAudioStream method. After
		/// registering its <c>ISpatialAudioObjectRenderStreamNotify</c> interface, the client receives event notifications in the form of
		/// callbacks through the OnAvailableDynamicObjectCountChange method in the interface.
		/// </para>
		/// <para>
		/// This interface is a part of Windows Sonic, Microsoft's audio platform for more immersive audio which includes integrated spatial
		/// sound on Xbox and Windows.
		/// </para>
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nn-spatialaudioclient-ispatialaudioobjectrenderstreamnotify
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "3729D985-9040-43AD-A8B0-045509FE2F20")]
		[ComImport, Guid("DDDF83E6-68D7-4C70-883F-A1836AFB4A50"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
		public interface ISpatialAudioObjectRenderStreamNotify
		{
			///
			/// Notifies the spatial audio client when the rendering capacity for an ISpatialAudioObjectRenderStream is about to change,
			/// specifies the time after which the change will occur, and specifies the number of dynamic audio objects that will be
			/// available after the change.
			///
			/// <param name="sender">The spatial audio render stream for which the available dynamic object count is changing.</param>
			/// <param name="hnsComplianceDeadlineTime">
			/// The time after which the spatial resource limit will change, in 100-nanosecond units. A value of 0 means that the change
			/// will occur immediately.
			/// </param>
			/// <param name="availableDynamicObjectCountChange">
			/// The number of dynamic spatial audio objects that will be available to the stream after hnsComplianceDeadlineTime.
			/// </param>
			/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
			/// <remarks>
			/// <para>
			/// A dynamic ISpatialAudioObject is one that was activated by setting the type parameter to the
			/// ISpatialAudioObjectRenderStream::ActivateSpatialAudioObject method to <c>AudioObjectType_Dynamic</c>. The client has a limit
			/// of the maximum number of dynamic spatial audio objects that can be activated at one time. When the capacity of the audio
			/// rendering pipeline changes, the system will dynamically adjust the maximum number of concurrent dynamic spatial audio
			/// objects. Before doing so, the system will call <c>OnAvailableDynamicObjectCountChange</c> to notify clients of the resource
			/// limit change.
			/// </para>
			/// <para>
			/// Call Release on an <c>ISpatialAudioObject</c> when it is no longer being used to free up the resource to create new dynamic
			/// spatial audio objects.
			/// </para>
			/// </remarks>
			// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/nf-spatialaudioclient-ispatialaudioobjectrenderstreamnotify-onavailabledynamicobjectcountchange
			// HRESULT OnAvailableDynamicObjectCountChange( ISpatialAudioObjectRenderStreamBase *sender, LONGLONG hnsComplianceDeadlineTime,
			// UINT32 availableDynamicObjectCountChange );
			[PreserveSig]
			HRESULT OnAvailableDynamicObjectCountChange([In] ISpatialAudioObjectRenderStreamBase sender, int hnsComplianceDeadlineTime, [In] uint availableDynamicObjectCountChange);
		}

		///
		/// Represents optional activation parameters for a spatial audio render stream. Pass this structure to ActivateAudioInterfaceAsync
		/// when activating an ISpatialAudioClient interface.
		///
		/// <remarks>
		/// <para>The following example code shows how to initialize this structure.</para>
		/// <para>To access the <c>ActivateAudioIntefaceAsync</c>, you will need to link to mmdevapi.lib.</para>
		/// </remarks>
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/ns-spatialaudioclient-spatialaudioclientactivationparams
		// typedef struct SpatialAudioClientActivationParams { GUID tracingContextId; GUID appId; int majorVersion; int minorVersion1; int
		// minorVersion2; int minorVersion3; } SpatialAudioClientActivationParams;
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "6FEC7A70-D12E-4DB9-91DC-A54D5CCF8B57")]
		[StructLayout(LayoutKind.Sequential)]
		public struct SpatialAudioClientActivationParams
		{
			/// An app-defined context identifier, used for event logging.
			public Guid tracingContextId;

			///
			/// <para>An identifier for the client app, used for event logging.</para>
			/// <para>majorVersion</para>
			/// <para>The major version number of the client app, used for event logging.</para>
			/// <para>minorVersion1</para>
			/// <para>The first minor version number of the client app, used for event logging.</para>
			/// <para>minorVersion2</para>
			/// <para>The second minor version number of the client app, used for event logging.</para>
			/// <para>####### minorVersion3</para>
			/// <para>The third minor version number of the client app, used for event logging.</para>
			///
			public Guid appId;

			///
			public int majorVersion;

			///
			public int minorVersion1;

			///
			public int minorVersion2;

			///
			public int minorVersion3;
		}

		///
		/// Represents activation parameters for a spatial audio render stream. Pass this structure to
		/// ISpatialAudioClient::ActivateSpatialAudioStream when activating a stream.
		///
		// https://docs.microsoft.com/en-us/windows/win32/api/spatialaudioclient/ns-spatialaudioclient-spatialaudioobjectrenderstreamactivationparams
		// typedef struct SpatialAudioObjectRenderStreamActivationParams { const WAVEFORMATEX *ObjectFormat; AudioObjectType
		// StaticObjectTypeMask; UINT32 MinDynamicObjectCount; UINT32 MaxDynamicObjectCount; AUDIO_STREAM_CATEGORY Category; HANDLE
		// EventHandle; ISpatialAudioObjectRenderStreamNotify *NotifyObject; } SpatialAudioObjectRenderStreamActivationParams;
		[PInvokeData("spatialaudioclient.h", MSDNShortId = "DD27FDE1-3B4B-4C11-A980-15AF60A3A75B")]
		[StructLayout(LayoutKind.Sequential)]
		public struct SpatialAudioObjectRenderStreamActivationParams
		{
			///
			/// Format descriptor for a single spatial audio object. All objects used by the stream must have the same format and the format
			/// must be of type WAVEFORMATEX or WAVEFORMATEXTENSIBLE.
			///
			public IntPtr ObjectFormat;

			///
			/// A bitwise combination of <c>AudioObjectType</c> values indicating the set of static spatial audio channels that will be
			/// allowed by the activated stream.
			///
			public AudioObjectType StaticObjectTypeMask;

			///
			/// The minimum number of concurrent dynamic objects. If this number of dynamic audio objects can't be activated simultaneously,
			/// ISpatialAudioClient::ActivateSpatialAudioStream will fail with this error <c>SPTLAUDCLNT_E_NO_MORE_OBJECTS</c>.
			///
			public uint MinDynamicObjectCount;

			/// The maximum number of concurrent dynamic objects that can be activated with ISpatialAudioObjectRenderStream.
			public uint MaxDynamicObjectCount;

			/// The category of the audio stream and its spatial audio objects.
			public AUDIO_STREAM_CATEGORY Category;

			///
			/// The event that will signal the client to provide more audio data. This handle will be duplicated internally before it is used.
			///
			public HANDLE EventHandle;

			///
			/// The object that provides notifications for spatial audio clients to respond to changes in the state of an
			/// ISpatialAudioObjectRenderStream. This object is used to notify clients that the number of dynamic spatial audio objects that
			/// can be activated concurrently is about to change.
			///
			public ISpatialAudioObjectRenderStreamNotify NotifyObject;
		}
	}
}


text:
using UnityEngine;
using System.Collections;

namespace Lockstep
{
/// <summary>
/// Experimenting with dictionary. Not yet functional.
/// </summary>
	public class FastDictionary<TKey,TValue>
	{
		static int curDepth;
		static int bigIndex, smallIndex, normHash, leIndex;
		const int CollisionResolver = 1;
		const int CollisionDepth = 5;
		const int BucketCount = 64;
		const int BucketSize = 64;
		const int MaxItems = BucketCount * BucketSize;
		ulong[] bucketAllocation = new ulong[BucketCount];
		TValue[] bucketValues = new TValue[BucketCount * BucketSize];
		int[] bucketHashes = new int[BucketCount * BucketSize];
		//TKey[] bucketKeys = new TKey[BucketCount * BucketSize];

		public bool Add (TKey key, TValue value)
		{
			Prime ();
			return _Add (key.GetHashCode (), value);
		}

		private bool _Add (int hashCode, TValue item)
		{
			if (ForceStop)
				return false;
			GenerateIndexes (hashCode);
			if (bucketAllocation [bigIndex].GetBitTrue (smallIndex)) {
				if (bucketHashes [leIndex] == hashCode) {
					return false;
				}
				//Resolve collision
				return _Add (hashCode * CollisionResolver, item);
			}
			LSUtility.SetBitTrue (ref bucketAllocation [bigIndex], smallIndex);
			bucketValues [leIndex] = item;
			bucketHashes [leIndex] = hashCode;
			return true;
		}

		public bool Remove (TKey key)
		{
			Prime ();
			return _Remove (key.GetHashCode ());
		}

		private bool _Remove (int hashCode)
		{
			if (ForceStop)
				return false;
			if (ConfirmSlot (hashCode)) {
				LSUtility.SetBitFalse (ref bucketAllocation [bigIndex], smallIndex);
				return true;
			}
			return _Remove (hashCode * CollisionResolver);
		}

		public TValue this [TKey key] {
			get {
				Prime ();
				return _GetValue (key.GetHashCode ());
			}
		}

		private TValue _GetValue (int hashCode)
		{
			if (ForceStop)
				throw new System.IndexOutOfRangeException ();
			if (ConfirmSlot (hashCode))
			{
				return bucketValues[leIndex];
			}
			return _GetValue (hashCode * CollisionResolver);
		}

		public bool TryGetValue (TKey key, out TValue output)
		{
			Prime ();
			return _TryGetValue (key.GetHashCode (), out output);
		}

		private bool _TryGetValue (int hashCode, out TValue output)
		{
			if (ForceStop) {
				output = default(TValue);
				return false;
			}
			if (ConfirmSlot (hashCode)) {
				output = bucketValues [leIndex];
				return true;
			}
			return _TryGetValue (hashCode * CollisionResolver, out output);
		}

		public bool ContainsKey (TKey key)
		{
			Prime ();
			return _ContainsKey (key.GetHashCode ());
		}

		private bool _ContainsKey (int hashCode)
		{
			if (ForceStop)
				return false;
			GenerateIndexes (hashCode);
			if (ConfirmSlot (hashCode))
				return true;
			return _ContainsKey (hashCode * CollisionResolver);
		}

		private static void Prime ()
		{
			curDepth = 0;
		}

		private static bool ForceStop {
			get{ return (curDepth++ >= CollisionDepth);}
		}

		private static void GenerateIndexes (int hashCode)
		{
			normHash = hashCode % MaxItems;
			bigIndex = normHash / BucketCount;
			smallIndex = normHash % BucketSize;
			leIndex = smallIndex * BucketCount + bigIndex;
		}

		private bool ConfirmSlot (int hashCode)
		{
			GenerateIndexes (hashCode);
			if (bucketAllocation [bigIndex].GetBitTrue (smallIndex)) {
				if (bucketHashes [leIndex] == hashCode) {
					return true;
				}
			}
			return false;
		}
	}
}


text:
package org.bridje.el.impl;

import de.odysseus.el.misc.TypeConverter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.el.ELException;
import org.bridje.el.ElAdvanceConverter;
import org.bridje.el.ElSimpleConvertMap;
import org.bridje.el.ElSimpleConvertProvider;
import org.bridje.el.ElSimpleConverter;
import org.bridje.ioc.Component;
import org.bridje.ioc.Inject;
import org.bridje.ioc.PostConstruct;

@Component
class TypeConverterImpl implements TypeConverter
{
    @Inject
    private ElAdvanceConverter[] advanceConverters;

    @Inject
    private ElSimpleConvertProvider[] simpleConverters;

    private Map<Class<?>,Map<Class<?>,ElAdvanceConverter>> advanceConvertMap;

    private ElSimpleConvertMap simpleConverMap;

    @PostConstruct
    public void init()
    {
        advanceConvertMap = new ConcurrentHashMap<>();
        simpleConverMap = new ElSimpleConvertMap();
        for (ElSimpleConvertProvider providers : simpleConverters)
        {
            ElSimpleConvertMap convMap = providers.createConvertMap();
            simpleConverMap.addAll(convMap);
        }
    }

    @Override
    public <T> T convert(Object value, Class<T> type) throws ELException
    {
        if (value == null)
        {
            return null;
        }

        if (type == value.getClass() ||
            type.isAssignableFrom(value.getClass()))
        {
            return type.cast(value);
        }

        ElSimpleConverter<Object, T> simpleConv = simpleConverMap.get((Class<Object>)value.getClass(), type);
        if(simpleConv != null)
        {
            return simpleConv.convert(value);
        }

        Map<Class<?>, ElAdvanceConverter> map = advanceConvertMap.get(value.getClass());
        if (map != null)
        {
            ElAdvanceConverter converter = map.get(type);
            if(converter != null)
            {
                return converter.convert(value, type);
            }
        }

        for (ElAdvanceConverter typeConverter : advanceConverters)
        {
            if(typeConverter.canConvert(value.getClass(), type))
            {
                map = advanceConvertMap.get(value.getClass());
                if(map == null)
                {
                    map = new ConcurrentHashMap<>();
                    advanceConvertMap.put(value.getClass(), map);
                }
                map.put(type, typeConverter);
                return typeConverter.convert(value, type);
            }
        }

        return TypeConverter.DEFAULT.convert(value, type);
    }
}


text:
module.exports = {
  'small numbers  (plain Nightwatch test)': function (client) {
    client
      .init()
      .setValue('#a', 9)
      .setValue('#b', 3)
      .click('#subtract')
      .assert.containsText('#result', 6)
      .end()
  },
  'big numbers  (plain Nightwatch test)': function (client) {
    client
      .init()
      .setValue('#a', 9)
      .setValue('#b', 3)
      .click('#subtract')
      .assert.containsText('#result', 6)
      .end()
  }
}