// Copyright (c) The NodeRT Contributors
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN  *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions
// and limitations under the License.

// TODO: Verify that this is is still needed..
#define NTDDI_VERSION 0x06010000

#include <v8.h>
#include "nan.h"
#include <string>
#include <ppltasks.h>
#include "CollectionsConverter.h"
#include "CollectionsWrap.h"
#include "node-async.h"
#include "NodeRtUtils.h"
#include "OpaqueWrapper.h"
#include "WrapperBase.h"

#using <Windows.WinMD>

// this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search
// Some of the node header files brings windows definitions with the same names as some of the WinRT methods
#undef DocumentProperties
#undef GetObject
#undef CreateEvent
#undef FindText
#undef SendMessage

const char* REGISTRATION_TOKEN_MAP_PROPERTY_NAME = "__registrationTokenMap__";

using v8::Array;
using v8::String;
using v8::Value;
using v8::Boolean;
using v8::Integer;
using v8::FunctionTemplate;
using v8::Object;
using v8::Local;
using v8::Function;
using v8::Date;
using v8::Number;
using v8::PropertyAttribute;
using v8::Primitive;
using Nan::HandleScope;
using Nan::Persistent;
using Nan::Undefined;
using Nan::True;
using Nan::False;
using Nan::Null;
using Nan::MaybeLocal;
using Nan::EscapableHandleScope;
using Nan::HandleScope;
using Nan::TryCatch;
using namespace concurrency;

namespace NodeRT { namespace Windows { namespace Media { namespace Effects { 
  v8::Local<v8::Value> WrapAudioCaptureEffectsManager(::Windows::Media::Effects::AudioCaptureEffectsManager^ wintRtInstance);
  ::Windows::Media::Effects::AudioCaptureEffectsManager^ UnwrapAudioCaptureEffectsManager(Local<Value> value);
  
  v8::Local<v8::Value> WrapAudioEffect(::Windows::Media::Effects::AudioEffect^ wintRtInstance);
  ::Windows::Media::Effects::AudioEffect^ UnwrapAudioEffect(Local<Value> value);
  
  v8::Local<v8::Value> WrapAudioEffectDefinition(::Windows::Media::Effects::AudioEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::AudioEffectDefinition^ UnwrapAudioEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapAudioEffectsManager(::Windows::Media::Effects::AudioEffectsManager^ wintRtInstance);
  ::Windows::Media::Effects::AudioEffectsManager^ UnwrapAudioEffectsManager(Local<Value> value);
  
  v8::Local<v8::Value> WrapAudioRenderEffectsManager(::Windows::Media::Effects::AudioRenderEffectsManager^ wintRtInstance);
  ::Windows::Media::Effects::AudioRenderEffectsManager^ UnwrapAudioRenderEffectsManager(Local<Value> value);
  
  v8::Local<v8::Value> WrapCompositeVideoFrameContext(::Windows::Media::Effects::CompositeVideoFrameContext^ wintRtInstance);
  ::Windows::Media::Effects::CompositeVideoFrameContext^ UnwrapCompositeVideoFrameContext(Local<Value> value);
  
  v8::Local<v8::Value> WrapIAudioEffectDefinition(::Windows::Media::Effects::IAudioEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::IAudioEffectDefinition^ UnwrapIAudioEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBasicAudioEffect(::Windows::Media::Effects::IBasicAudioEffect^ wintRtInstance);
  ::Windows::Media::Effects::IBasicAudioEffect^ UnwrapIBasicAudioEffect(Local<Value> value);
  
  v8::Local<v8::Value> WrapIBasicVideoEffect(::Windows::Media::Effects::IBasicVideoEffect^ wintRtInstance);
  ::Windows::Media::Effects::IBasicVideoEffect^ UnwrapIBasicVideoEffect(Local<Value> value);
  
  v8::Local<v8::Value> WrapIVideoCompositor(::Windows::Media::Effects::IVideoCompositor^ wintRtInstance);
  ::Windows::Media::Effects::IVideoCompositor^ UnwrapIVideoCompositor(Local<Value> value);
  
  v8::Local<v8::Value> WrapIVideoCompositorDefinition(::Windows::Media::Effects::IVideoCompositorDefinition^ wintRtInstance);
  ::Windows::Media::Effects::IVideoCompositorDefinition^ UnwrapIVideoCompositorDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapIVideoEffectDefinition(::Windows::Media::Effects::IVideoEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::IVideoEffectDefinition^ UnwrapIVideoEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapProcessAudioFrameContext(::Windows::Media::Effects::ProcessAudioFrameContext^ wintRtInstance);
  ::Windows::Media::Effects::ProcessAudioFrameContext^ UnwrapProcessAudioFrameContext(Local<Value> value);
  
  v8::Local<v8::Value> WrapProcessVideoFrameContext(::Windows::Media::Effects::ProcessVideoFrameContext^ wintRtInstance);
  ::Windows::Media::Effects::ProcessVideoFrameContext^ UnwrapProcessVideoFrameContext(Local<Value> value);
  
  v8::Local<v8::Value> WrapSlowMotionEffectDefinition(::Windows::Media::Effects::SlowMotionEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::SlowMotionEffectDefinition^ UnwrapSlowMotionEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapVideoCompositorDefinition(::Windows::Media::Effects::VideoCompositorDefinition^ wintRtInstance);
  ::Windows::Media::Effects::VideoCompositorDefinition^ UnwrapVideoCompositorDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapVideoEffectDefinition(::Windows::Media::Effects::VideoEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::VideoEffectDefinition^ UnwrapVideoEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapVideoTransformEffectDefinition(::Windows::Media::Effects::VideoTransformEffectDefinition^ wintRtInstance);
  ::Windows::Media::Effects::VideoTransformEffectDefinition^ UnwrapVideoTransformEffectDefinition(Local<Value> value);
  
  v8::Local<v8::Value> WrapVideoTransformSphericalProjection(::Windows::Media::Effects::VideoTransformSphericalProjection^ wintRtInstance);
  ::Windows::Media::Effects::VideoTransformSphericalProjection^ UnwrapVideoTransformSphericalProjection(Local<Value> value);
  



  static void InitAudioEffectTypeEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("AudioEffectType").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("other").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::Other)));
    Nan::Set(enumObject, Nan::New<String>("acousticEchoCancellation").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::AcousticEchoCancellation)));
    Nan::Set(enumObject, Nan::New<String>("noiseSuppression").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::NoiseSuppression)));
    Nan::Set(enumObject, Nan::New<String>("automaticGainControl").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::AutomaticGainControl)));
    Nan::Set(enumObject, Nan::New<String>("beamForming").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::BeamForming)));
    Nan::Set(enumObject, Nan::New<String>("constantToneRemoval").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::ConstantToneRemoval)));
    Nan::Set(enumObject, Nan::New<String>("equalizer").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::Equalizer)));
    Nan::Set(enumObject, Nan::New<String>("loudnessEqualizer").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::LoudnessEqualizer)));
    Nan::Set(enumObject, Nan::New<String>("bassBoost").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::BassBoost)));
    Nan::Set(enumObject, Nan::New<String>("virtualSurround").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::VirtualSurround)));
    Nan::Set(enumObject, Nan::New<String>("virtualHeadphones").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::VirtualHeadphones)));
    Nan::Set(enumObject, Nan::New<String>("speakerFill").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::SpeakerFill)));
    Nan::Set(enumObject, Nan::New<String>("roomCorrection").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::RoomCorrection)));
    Nan::Set(enumObject, Nan::New<String>("bassManagement").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::BassManagement)));
    Nan::Set(enumObject, Nan::New<String>("environmentalEffects").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::EnvironmentalEffects)));
    Nan::Set(enumObject, Nan::New<String>("speakerProtection").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::SpeakerProtection)));
    Nan::Set(enumObject, Nan::New<String>("speakerCompensation").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::SpeakerCompensation)));
    Nan::Set(enumObject, Nan::New<String>("dynamicRangeCompression").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::AudioEffectType::DynamicRangeCompression)));
  }

  static void InitMediaEffectClosedReasonEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("MediaEffectClosedReason").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("done").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaEffectClosedReason::Done)));
    Nan::Set(enumObject, Nan::New<String>("unknownError").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaEffectClosedReason::UnknownError)));
    Nan::Set(enumObject, Nan::New<String>("unsupportedEncodingFormat").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaEffectClosedReason::UnsupportedEncodingFormat)));
    Nan::Set(enumObject, Nan::New<String>("effectCurrentlyUnloaded").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaEffectClosedReason::EffectCurrentlyUnloaded)));
  }

  static void InitMediaMemoryTypesEnum(const Local<Object> exports) {
    HandleScope scope;

    Local<Object> enumObject = Nan::New<Object>();

    Nan::Set(exports, Nan::New<String>("MediaMemoryTypes").ToLocalChecked(), enumObject);
    Nan::Set(enumObject, Nan::New<String>("gpu").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaMemoryTypes::Gpu)));
    Nan::Set(enumObject, Nan::New<String>("cpu").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaMemoryTypes::Cpu)));
    Nan::Set(enumObject, Nan::New<String>("gpuAndCpu").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Media::Effects::MediaMemoryTypes::GpuAndCpu)));
  }


  static bool IsColorJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    return true;
  }

  ::Windows::UI::Color ColorFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::UI::Color returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    return returnValue;
  }

  Local<Value> ColorToJsObject(::Windows::UI::Color value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();


    return scope.Escape(obj);
  }
  static bool IsSizeJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    return true;
  }

  ::Windows::Foundation::Size SizeFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::Foundation::Size returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    return returnValue;
  }

  Local<Value> SizeToJsObject(::Windows::Foundation::Size value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();


    return scope.Escape(obj);
  }
  static bool IsRectJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    return true;
  }

  ::Windows::Foundation::Rect RectFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Windows::Foundation::Rect returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    return returnValue;
  }

  Local<Value> RectToJsObject(::Windows::Foundation::Rect value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();


    return scope.Escape(obj);
  }
  static bool IsQuaternionJsObject(Local<Value> value) {
    if (!value->IsObject()) {
      return false;
    }

    Local<String> symbol;
    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();

    symbol = Nan::New<String>("x").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsNumber()) {
        return false;
      }
    }
    
    symbol = Nan::New<String>("y").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsNumber()) {
        return false;
      }
    }
    
    symbol = Nan::New<String>("z").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsNumber()) {
        return false;
      }
    }
    
    symbol = Nan::New<String>("w").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      if (!Nan::Get(obj,symbol).ToLocalChecked()->IsNumber()) {
        return false;
      }
    }
    
    return true;
  }

  ::Platform::Numerics::Quaternion QuaternionFromJsObject(Local<Value> value) {
    HandleScope scope;
    ::Platform::Numerics::Quaternion returnValue;

    if (!value->IsObject()) {
      Nan::ThrowError(Nan::TypeError(NodeRT::Utils::NewString(L"Unexpected type, expected an object")));
      return returnValue;
    }

    Local<Object> obj = Nan::To<Object>(value).ToLocalChecked();
    Local<String> symbol;

    symbol = Nan::New<String>("x").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.X = static_cast<float>(Nan::To<double>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0.0));
    }
    
    symbol = Nan::New<String>("y").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.Y = static_cast<float>(Nan::To<double>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0.0));
    }
    
    symbol = Nan::New<String>("z").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.Z = static_cast<float>(Nan::To<double>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0.0));
    }
    
    symbol = Nan::New<String>("w").ToLocalChecked();
    if (Nan::Has(obj, symbol).FromMaybe(false)) {
      returnValue.W = static_cast<float>(Nan::To<double>(Nan::Get(obj,symbol).ToLocalChecked()).FromMaybe(0.0));
    }
    
    return returnValue;
  }

  Local<Value> QuaternionToJsObject(::Platform::Numerics::Quaternion value) {
    EscapableHandleScope scope;

    Local<Object> obj = Nan::New<Object>();

    Nan::Set(obj, Nan::New<String>("x").ToLocalChecked(), Nan::New<Number>(static_cast<double>(value.X)));
    Nan::Set(obj, Nan::New<String>("y").ToLocalChecked(), Nan::New<Number>(static_cast<double>(value.Y)));
    Nan::Set(obj, Nan::New<String>("z").ToLocalChecked(), Nan::New<Number>(static_cast<double>(value.Z)));
    Nan::Set(obj, Nan::New<String>("w").ToLocalChecked(), Nan::New<Number>(static_cast<double>(value.W)));

    return scope.Escape(obj);
  }

  class AudioCaptureEffectsManager : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AudioCaptureEffectsManager").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "getAudioCaptureEffects", GetAudioCaptureEffects);
          


          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);


        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AudioCaptureEffectsManager").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AudioCaptureEffectsManager(::Windows::Media::Effects::AudioCaptureEffectsManager^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::AudioCaptureEffectsManager^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioCaptureEffectsManager^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::AudioCaptureEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AudioCaptureEffectsManager *wrapperInstance = new AudioCaptureEffectsManager(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioCaptureEffectsManager^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::AudioCaptureEffectsManager^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::AudioCaptureEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAudioCaptureEffectsManager(winRtInstance));
    }


    static void GetAudioCaptureEffects(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioCaptureEffectsManager^>(info.This())) {
        return;
      }

      AudioCaptureEffectsManager *wrapper = AudioCaptureEffectsManager::Unwrap<AudioCaptureEffectsManager>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::Foundation::Collections::IVectorView<::Windows::Media::Effects::AudioEffect^>^ result;
          result = wrapper->_instance->GetAudioCaptureEffects();
          info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Media::Effects::AudioEffect^>::CreateVectorViewWrapper(result, 
            [](::Windows::Media::Effects::AudioEffect^ val) -> Local<Value> {
              return WrapAudioEffect(val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffect^>(value);
            },
            [](Local<Value> value) -> ::Windows::Media::Effects::AudioEffect^ {
              return UnwrapAudioEffect(value);
            }
          ));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }





    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"audioCaptureEffectsChanged", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioCaptureEffectsManager^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        AudioCaptureEffectsManager *wrapper = AudioCaptureEffectsManager::Unwrap<AudioCaptureEffectsManager>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->AudioCaptureEffectsChanged::add(
            ref new ::Windows::Foundation::TypedEventHandler<::Windows::Media::Effects::AudioCaptureEffectsManager^, ::Platform::Object^>(
            [callbackObjPtr](::Windows::Media::Effects::AudioCaptureEffectsManager^ arg0, ::Platform::Object^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapAudioCaptureEffectsManager(arg0);
                  wrappedArg1 = CreateOpaqueWrapper(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"audioCaptureEffectsChanged", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"audioCaptureEffectsChanged", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioCaptureEffectsManager^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          AudioCaptureEffectsManager *wrapper = AudioCaptureEffectsManager::Unwrap<AudioCaptureEffectsManager>(info.This());
          wrapper->_instance->AudioCaptureEffectsChanged::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::Media::Effects::AudioCaptureEffectsManager^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAudioCaptureEffectsManager(::Windows::Media::Effects::AudioCaptureEffectsManager^ wintRtInstance);
      friend ::Windows::Media::Effects::AudioCaptureEffectsManager^ UnwrapAudioCaptureEffectsManager(Local<Value> value);
  };

  Persistent<FunctionTemplate> AudioCaptureEffectsManager::s_constructorTemplate;

  v8::Local<v8::Value> WrapAudioCaptureEffectsManager(::Windows::Media::Effects::AudioCaptureEffectsManager^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AudioCaptureEffectsManager::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::AudioCaptureEffectsManager^ UnwrapAudioCaptureEffectsManager(Local<Value> value) {
     return AudioCaptureEffectsManager::Unwrap<AudioCaptureEffectsManager>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAudioCaptureEffectsManager(Local<Object> exports) {
    AudioCaptureEffectsManager::Init(exports);
  }

  class AudioEffect : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AudioEffect").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("audioEffectType").ToLocalChecked(), AudioEffectTypeGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AudioEffect").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AudioEffect(::Windows::Media::Effects::AudioEffect^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::AudioEffect^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffect^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::AudioEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AudioEffect *wrapperInstance = new AudioEffect(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffect^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::AudioEffect^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::AudioEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAudioEffect(winRtInstance));
    }





    static void AudioEffectTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffect^>(info.This())) {
        return;
      }

      AudioEffect *wrapper = AudioEffect::Unwrap<AudioEffect>(info.This());

      try  {
        ::Windows::Media::Effects::AudioEffectType result = wrapper->_instance->AudioEffectType;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::AudioEffect^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAudioEffect(::Windows::Media::Effects::AudioEffect^ wintRtInstance);
      friend ::Windows::Media::Effects::AudioEffect^ UnwrapAudioEffect(Local<Value> value);
  };

  Persistent<FunctionTemplate> AudioEffect::s_constructorTemplate;

  v8::Local<v8::Value> WrapAudioEffect(::Windows::Media::Effects::AudioEffect^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AudioEffect::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::AudioEffect^ UnwrapAudioEffect(Local<Value> value) {
     return AudioEffect::Unwrap<AudioEffect>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAudioEffect(Local<Object> exports) {
    AudioEffect::Init(exports);
  }

  class AudioEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AudioEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AudioEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AudioEffectDefinition(::Windows::Media::Effects::AudioEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::AudioEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::AudioEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::Media::Effects::AudioEffectDefinition(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IPropertySet^>(info[1]))
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Foundation::Collections::IPropertySet^ arg1 = dynamic_cast<::Windows::Foundation::Collections::IPropertySet^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          winRtInstance = ref new ::Windows::Media::Effects::AudioEffectDefinition(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AudioEffectDefinition *wrapperInstance = new AudioEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::AudioEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::AudioEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAudioEffectDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectDefinition^>(info.This())) {
        return;
      }

      AudioEffectDefinition *wrapper = AudioEffectDefinition::Unwrap<AudioEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectDefinition^>(info.This())) {
        return;
      }

      AudioEffectDefinition *wrapper = AudioEffectDefinition::Unwrap<AudioEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::AudioEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAudioEffectDefinition(::Windows::Media::Effects::AudioEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::AudioEffectDefinition^ UnwrapAudioEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> AudioEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapAudioEffectDefinition(::Windows::Media::Effects::AudioEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AudioEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::AudioEffectDefinition^ UnwrapAudioEffectDefinition(Local<Value> value) {
     return AudioEffectDefinition::Unwrap<AudioEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAudioEffectDefinition(Local<Object> exports) {
    AudioEffectDefinition::Init(exports);
  }

  class AudioEffectsManager : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AudioEffectsManager").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);






        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);

        Nan::SetMethod(constructor, "createAudioRenderEffectsManager", CreateAudioRenderEffectsManager);
        Nan::SetMethod(constructor, "createAudioCaptureEffectsManager", CreateAudioCaptureEffectsManager);


        Nan::Set(exports, Nan::New<String>("AudioEffectsManager").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AudioEffectsManager(::Windows::Media::Effects::AudioEffectsManager^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::AudioEffectsManager^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectsManager^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::AudioEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AudioEffectsManager *wrapperInstance = new AudioEffectsManager(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffectsManager^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::AudioEffectsManager^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::AudioEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAudioEffectsManager(winRtInstance));
    }





    static void CreateAudioRenderEffectsManager(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 2
        && info[0]->IsString()
        && info[1]->IsInt32())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Media::Render::AudioRenderCategory arg1 = static_cast<::Windows::Media::Render::AudioRenderCategory>(Nan::To<int32_t>(info[1]).FromMaybe(0));
          
          ::Windows::Media::Effects::AudioRenderEffectsManager^ result;
          result = ::Windows::Media::Effects::AudioEffectsManager::CreateAudioRenderEffectsManager(arg0, arg1);
          info.GetReturnValue().Set(WrapAudioRenderEffectsManager(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 3
        && info[0]->IsString()
        && info[1]->IsInt32()
        && info[2]->IsInt32())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Media::Render::AudioRenderCategory arg1 = static_cast<::Windows::Media::Render::AudioRenderCategory>(Nan::To<int32_t>(info[1]).FromMaybe(0));
          ::Windows::Media::AudioProcessing arg2 = static_cast<::Windows::Media::AudioProcessing>(Nan::To<int32_t>(info[2]).FromMaybe(0));
          
          ::Windows::Media::Effects::AudioRenderEffectsManager^ result;
          result = ::Windows::Media::Effects::AudioEffectsManager::CreateAudioRenderEffectsManager(arg0, arg1, arg2);
          info.GetReturnValue().Set(WrapAudioRenderEffectsManager(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }

    static void CreateAudioCaptureEffectsManager(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() == 2
        && info[0]->IsString()
        && info[1]->IsInt32())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Media::Capture::MediaCategory arg1 = static_cast<::Windows::Media::Capture::MediaCategory>(Nan::To<int32_t>(info[1]).FromMaybe(0));
          
          ::Windows::Media::Effects::AudioCaptureEffectsManager^ result;
          result = ::Windows::Media::Effects::AudioEffectsManager::CreateAudioCaptureEffectsManager(arg0, arg1);
          info.GetReturnValue().Set(WrapAudioCaptureEffectsManager(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 3
        && info[0]->IsString()
        && info[1]->IsInt32()
        && info[2]->IsInt32())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Media::Capture::MediaCategory arg1 = static_cast<::Windows::Media::Capture::MediaCategory>(Nan::To<int32_t>(info[1]).FromMaybe(0));
          ::Windows::Media::AudioProcessing arg2 = static_cast<::Windows::Media::AudioProcessing>(Nan::To<int32_t>(info[2]).FromMaybe(0));
          
          ::Windows::Media::Effects::AudioCaptureEffectsManager^ result;
          result = ::Windows::Media::Effects::AudioEffectsManager::CreateAudioCaptureEffectsManager(arg0, arg1, arg2);
          info.GetReturnValue().Set(WrapAudioCaptureEffectsManager(result));
          return;
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else  {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    private:
      ::Windows::Media::Effects::AudioEffectsManager^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAudioEffectsManager(::Windows::Media::Effects::AudioEffectsManager^ wintRtInstance);
      friend ::Windows::Media::Effects::AudioEffectsManager^ UnwrapAudioEffectsManager(Local<Value> value);
  };

  Persistent<FunctionTemplate> AudioEffectsManager::s_constructorTemplate;

  v8::Local<v8::Value> WrapAudioEffectsManager(::Windows::Media::Effects::AudioEffectsManager^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AudioEffectsManager::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::AudioEffectsManager^ UnwrapAudioEffectsManager(Local<Value> value) {
     return AudioEffectsManager::Unwrap<AudioEffectsManager>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAudioEffectsManager(Local<Object> exports) {
    AudioEffectsManager::Init(exports);
  }

  class AudioRenderEffectsManager : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("AudioRenderEffectsManager").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "getAudioRenderEffects", GetAudioRenderEffects);
            Nan::SetPrototypeMethod(localRef, "showSettingsUI", ShowSettingsUI);
          


          
          Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
          Nan::SetPrototypeMethod(localRef,"on", AddListener);
          Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
          Nan::SetPrototypeMethod(localRef, "off", RemoveListener);

          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("effectsProviderSettingsLabel").ToLocalChecked(), EffectsProviderSettingsLabelGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("effectsProviderThumbnail").ToLocalChecked(), EffectsProviderThumbnailGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("AudioRenderEffectsManager").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      AudioRenderEffectsManager(::Windows::Media::Effects::AudioRenderEffectsManager^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::AudioRenderEffectsManager^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::AudioRenderEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      AudioRenderEffectsManager *wrapperInstance = new AudioRenderEffectsManager(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::AudioRenderEffectsManager^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::AudioRenderEffectsManager^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapAudioRenderEffectsManager(winRtInstance));
    }


    static void GetAudioRenderEffects(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This())) {
        return;
      }

      AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          ::Windows::Foundation::Collections::IVectorView<::Windows::Media::Effects::AudioEffect^>^ result;
          result = wrapper->_instance->GetAudioRenderEffects();
          info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Media::Effects::AudioEffect^>::CreateVectorViewWrapper(result, 
            [](::Windows::Media::Effects::AudioEffect^ val) -> Local<Value> {
              return WrapAudioEffect(val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioEffect^>(value);
            },
            [](Local<Value> value) -> ::Windows::Media::Effects::AudioEffect^ {
              return UnwrapAudioEffect(value);
            }
          ));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void ShowSettingsUI(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This())) {
        return;
      }

      AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->ShowSettingsUI();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void EffectsProviderSettingsLabelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This())) {
        return;
      }

      AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->EffectsProviderSettingsLabel;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void EffectsProviderThumbnailGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This())) {
        return;
      }

      AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());

      try  {
        ::Windows::Storage::Streams::IRandomAccessStreamWithContentType^ result = wrapper->_instance->EffectsProviderThumbnail;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IRandomAccessStreamWithContentType", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      Local<Function> callback = info[1].As<Function>();

      ::Windows::Foundation::EventRegistrationToken registrationToken;
      if (NodeRT::Utils::CaseInsenstiveEquals(L"audioRenderEffectsChanged", str))
      {
        if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This()))
        {
          Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
      return;
        }
        AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());
      
        try {
          Persistent<Object>* perstPtr = new Persistent<Object>();
          perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
          std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
            [] (Persistent<Object> *ptr ) {
              NodeUtils::Async::RunOnMain([ptr]() {
                ptr->Reset();
                delete ptr;
            });
          });

          registrationToken = wrapper->_instance->AudioRenderEffectsChanged::add(
            ref new ::Windows::Foundation::TypedEventHandler<::Windows::Media::Effects::AudioRenderEffectsManager^, ::Platform::Object^>(
            [callbackObjPtr](::Windows::Media::Effects::AudioRenderEffectsManager^ arg0, ::Platform::Object^ arg1) {
              NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
                HandleScope scope;


                Local<Value> wrappedArg0;
                Local<Value> wrappedArg1;

                {
                  TryCatch tryCatch;


                  wrappedArg0 = WrapAudioRenderEffectsManager(arg0);
                  wrappedArg1 = CreateOpaqueWrapper(arg1);


                  if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
                  if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
                }

                Local<Value> args[] = { wrappedArg0, wrappedArg1 };
                Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
                NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
              });
            })
          );
        }
        catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }

      }
 else  {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
      Local<Object> tokenMap;

      if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false)) {
        tokenMap = Nan::New<Object>();
        NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
      } else {
        tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
      }

      Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
    }

    static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
        return;
      }

      String::Value eventName(v8::Isolate::GetCurrent(), info[0]);
      auto str = *eventName;

      if ((!NodeRT::Utils::CaseInsenstiveEquals(L"audioRenderEffectsChanged", str))) {
        Nan::ThrowError(Nan::Error(String::Concat(v8::Isolate::GetCurrent(), NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
        return;
      }

      Local<Function> callback = info[1].As<Function>();
      Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());

      if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false)) {
        return;
      }

      Local<Value> opaqueWrapperObj =  Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();

      if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false)) {
        return;
      }

      OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());

      long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
      ::Windows::Foundation::EventRegistrationToken registrationToken;
      registrationToken.Value = tokenValue;

      try  {
        if (NodeRT::Utils::CaseInsenstiveEquals(L"audioRenderEffectsChanged", str)) {
          if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::AudioRenderEffectsManager^>(info.This()))
          {
            Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
            return;
          }
          AudioRenderEffectsManager *wrapper = AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(info.This());
          wrapper->_instance->AudioRenderEffectsChanged::remove(registrationToken);
        }
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }

      Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
    }
    private:
      ::Windows::Media::Effects::AudioRenderEffectsManager^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapAudioRenderEffectsManager(::Windows::Media::Effects::AudioRenderEffectsManager^ wintRtInstance);
      friend ::Windows::Media::Effects::AudioRenderEffectsManager^ UnwrapAudioRenderEffectsManager(Local<Value> value);
  };

  Persistent<FunctionTemplate> AudioRenderEffectsManager::s_constructorTemplate;

  v8::Local<v8::Value> WrapAudioRenderEffectsManager(::Windows::Media::Effects::AudioRenderEffectsManager^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(AudioRenderEffectsManager::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::AudioRenderEffectsManager^ UnwrapAudioRenderEffectsManager(Local<Value> value) {
     return AudioRenderEffectsManager::Unwrap<AudioRenderEffectsManager>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitAudioRenderEffectsManager(Local<Object> exports) {
    AudioRenderEffectsManager::Init(exports);
  }

  class CompositeVideoFrameContext : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("CompositeVideoFrameContext").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "getOverlayForSurface", GetOverlayForSurface);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("backgroundFrame").ToLocalChecked(), BackgroundFrameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("outputFrame").ToLocalChecked(), OutputFrameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("surfacesToOverlay").ToLocalChecked(), SurfacesToOverlayGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("CompositeVideoFrameContext").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      CompositeVideoFrameContext(::Windows::Media::Effects::CompositeVideoFrameContext^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::CompositeVideoFrameContext^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::CompositeVideoFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      CompositeVideoFrameContext *wrapperInstance = new CompositeVideoFrameContext(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::CompositeVideoFrameContext^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::CompositeVideoFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapCompositeVideoFrameContext(winRtInstance));
    }


    static void GetOverlayForSurface(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info.This())) {
        return;
      }

      CompositeVideoFrameContext *wrapper = CompositeVideoFrameContext::Unwrap<CompositeVideoFrameContext>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>(info[0]))
      {
        try
        {
          ::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^ arg0 = dynamic_cast<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          ::Windows::Media::Editing::MediaOverlay^ result;
          result = wrapper->_instance->GetOverlayForSurface(arg0);
          info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media.Editing", "MediaOverlay", result));
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void BackgroundFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info.This())) {
        return;
      }

      CompositeVideoFrameContext *wrapper = CompositeVideoFrameContext::Unwrap<CompositeVideoFrameContext>(info.This());

      try  {
        ::Windows::Media::VideoFrame^ result = wrapper->_instance->BackgroundFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "VideoFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OutputFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info.This())) {
        return;
      }

      CompositeVideoFrameContext *wrapper = CompositeVideoFrameContext::Unwrap<CompositeVideoFrameContext>(info.This());

      try  {
        ::Windows::Media::VideoFrame^ result = wrapper->_instance->OutputFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "VideoFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SurfacesToOverlayGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info.This())) {
        return;
      }

      CompositeVideoFrameContext *wrapper = CompositeVideoFrameContext::Unwrap<CompositeVideoFrameContext>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVectorView<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>^ result = wrapper->_instance->SurfacesToOverlay;
        info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>::CreateVectorViewWrapper(result, 
            [](::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^ val) -> Local<Value> {
              return NodeRT::Utils::CreateExternalWinRTObject("Windows.Graphics.DirectX.Direct3D11", "IDirect3DSurface", val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>(value);
            },
            [](Local<Value> value) -> ::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^ {
              return dynamic_cast<::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface^>(NodeRT::Utils::GetObjectInstance(value));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::CompositeVideoFrameContext^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapCompositeVideoFrameContext(::Windows::Media::Effects::CompositeVideoFrameContext^ wintRtInstance);
      friend ::Windows::Media::Effects::CompositeVideoFrameContext^ UnwrapCompositeVideoFrameContext(Local<Value> value);
  };

  Persistent<FunctionTemplate> CompositeVideoFrameContext::s_constructorTemplate;

  v8::Local<v8::Value> WrapCompositeVideoFrameContext(::Windows::Media::Effects::CompositeVideoFrameContext^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(CompositeVideoFrameContext::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::CompositeVideoFrameContext^ UnwrapCompositeVideoFrameContext(Local<Value> value) {
     return CompositeVideoFrameContext::Unwrap<CompositeVideoFrameContext>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitCompositeVideoFrameContext(Local<Object> exports) {
    CompositeVideoFrameContext::Init(exports);
  }

  class IAudioEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IAudioEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IAudioEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IAudioEffectDefinition(::Windows::Media::Effects::IAudioEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IAudioEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IAudioEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IAudioEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IAudioEffectDefinition *wrapperInstance = new IAudioEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IAudioEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IAudioEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IAudioEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIAudioEffectDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IAudioEffectDefinition^>(info.This())) {
        return;
      }

      IAudioEffectDefinition *wrapper = IAudioEffectDefinition::Unwrap<IAudioEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IAudioEffectDefinition^>(info.This())) {
        return;
      }

      IAudioEffectDefinition *wrapper = IAudioEffectDefinition::Unwrap<IAudioEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IAudioEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIAudioEffectDefinition(::Windows::Media::Effects::IAudioEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::IAudioEffectDefinition^ UnwrapIAudioEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> IAudioEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapIAudioEffectDefinition(::Windows::Media::Effects::IAudioEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IAudioEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IAudioEffectDefinition^ UnwrapIAudioEffectDefinition(Local<Value> value) {
     return IAudioEffectDefinition::Unwrap<IAudioEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIAudioEffectDefinition(Local<Object> exports) {
    IAudioEffectDefinition::Init(exports);
  }

  class IBasicAudioEffect : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBasicAudioEffect").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "setEncodingProperties", SetEncodingProperties);
            Nan::SetPrototypeMethod(localRef, "processFrame", ProcessFrame);
            Nan::SetPrototypeMethod(localRef, "close", Close);
            Nan::SetPrototypeMethod(localRef, "discardQueuedFrames", DiscardQueuedFrames);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("supportedEncodingProperties").ToLocalChecked(), SupportedEncodingPropertiesGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("useInputFrameForOutput").ToLocalChecked(), UseInputFrameForOutputGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBasicAudioEffect").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBasicAudioEffect(::Windows::Media::Effects::IBasicAudioEffect^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IBasicAudioEffect^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IBasicAudioEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBasicAudioEffect *wrapperInstance = new IBasicAudioEffect(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IBasicAudioEffect^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IBasicAudioEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBasicAudioEffect(winRtInstance));
    }


    static void SetEncodingProperties(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::MediaProperties::AudioEncodingProperties^>(info[0]))
      {
        try
        {
          ::Windows::Media::MediaProperties::AudioEncodingProperties^ arg0 = dynamic_cast<::Windows::Media::MediaProperties::AudioEncodingProperties^>(NodeRT::Utils::GetObjectInstance(info[0]));
          
          wrapper->_instance->SetEncodingProperties(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void ProcessFrame(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessAudioFrameContext^>(info[0]))
      {
        try
        {
          ::Windows::Media::Effects::ProcessAudioFrameContext^ arg0 = UnwrapProcessAudioFrameContext(info[0]);
          
          wrapper->_instance->ProcessFrame(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void Close(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::Media::Effects::MediaEffectClosedReason arg0 = static_cast<::Windows::Media::Effects::MediaEffectClosedReason>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->Close(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void DiscardQueuedFrames(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->DiscardQueuedFrames();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void SupportedEncodingPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVectorView<::Windows::Media::MediaProperties::AudioEncodingProperties^>^ result = wrapper->_instance->SupportedEncodingProperties;
        info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Media::MediaProperties::AudioEncodingProperties^>::CreateVectorViewWrapper(result, 
            [](::Windows::Media::MediaProperties::AudioEncodingProperties^ val) -> Local<Value> {
              return NodeRT::Utils::CreateExternalWinRTObject("Windows.Media.MediaProperties", "AudioEncodingProperties", val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::MediaProperties::AudioEncodingProperties^>(value);
            },
            [](Local<Value> value) -> ::Windows::Media::MediaProperties::AudioEncodingProperties^ {
              return dynamic_cast<::Windows::Media::MediaProperties::AudioEncodingProperties^>(NodeRT::Utils::GetObjectInstance(value));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void UseInputFrameForOutputGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicAudioEffect^>(info.This())) {
        return;
      }

      IBasicAudioEffect *wrapper = IBasicAudioEffect::Unwrap<IBasicAudioEffect>(info.This());

      try  {
        bool result = wrapper->_instance->UseInputFrameForOutput;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IBasicAudioEffect^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBasicAudioEffect(::Windows::Media::Effects::IBasicAudioEffect^ wintRtInstance);
      friend ::Windows::Media::Effects::IBasicAudioEffect^ UnwrapIBasicAudioEffect(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBasicAudioEffect::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBasicAudioEffect(::Windows::Media::Effects::IBasicAudioEffect^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBasicAudioEffect::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IBasicAudioEffect^ UnwrapIBasicAudioEffect(Local<Value> value) {
     return IBasicAudioEffect::Unwrap<IBasicAudioEffect>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBasicAudioEffect(Local<Object> exports) {
    IBasicAudioEffect::Init(exports);
  }

  class IBasicVideoEffect : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IBasicVideoEffect").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "setEncodingProperties", SetEncodingProperties);
            Nan::SetPrototypeMethod(localRef, "processFrame", ProcessFrame);
            Nan::SetPrototypeMethod(localRef, "close", Close);
            Nan::SetPrototypeMethod(localRef, "discardQueuedFrames", DiscardQueuedFrames);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isReadOnly").ToLocalChecked(), IsReadOnlyGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("supportedEncodingProperties").ToLocalChecked(), SupportedEncodingPropertiesGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("supportedMemoryTypes").ToLocalChecked(), SupportedMemoryTypesGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("timeIndependent").ToLocalChecked(), TimeIndependentGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IBasicVideoEffect").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IBasicVideoEffect(::Windows::Media::Effects::IBasicVideoEffect^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IBasicVideoEffect^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IBasicVideoEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IBasicVideoEffect *wrapperInstance = new IBasicVideoEffect(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IBasicVideoEffect^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IBasicVideoEffect^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIBasicVideoEffect(winRtInstance));
    }


    static void SetEncodingProperties(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::MediaProperties::VideoEncodingProperties^>(info[0])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^>(info[1]))
      {
        try
        {
          ::Windows::Media::MediaProperties::VideoEncodingProperties^ arg0 = dynamic_cast<::Windows::Media::MediaProperties::VideoEncodingProperties^>(NodeRT::Utils::GetObjectInstance(info[0]));
          ::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^ arg1 = dynamic_cast<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          wrapper->_instance->SetEncodingProperties(arg0, arg1);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void ProcessFrame(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessVideoFrameContext^>(info[0]))
      {
        try
        {
          ::Windows::Media::Effects::ProcessVideoFrameContext^ arg0 = UnwrapProcessVideoFrameContext(info[0]);
          
          wrapper->_instance->ProcessFrame(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void Close(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::Media::Effects::MediaEffectClosedReason arg0 = static_cast<::Windows::Media::Effects::MediaEffectClosedReason>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->Close(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void DiscardQueuedFrames(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->DiscardQueuedFrames();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void IsReadOnlyGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      try  {
        bool result = wrapper->_instance->IsReadOnly;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SupportedEncodingPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      try  {
        ::Windows::Foundation::Collections::IVectorView<::Windows::Media::MediaProperties::VideoEncodingProperties^>^ result = wrapper->_instance->SupportedEncodingProperties;
        info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Media::MediaProperties::VideoEncodingProperties^>::CreateVectorViewWrapper(result, 
            [](::Windows::Media::MediaProperties::VideoEncodingProperties^ val) -> Local<Value> {
              return NodeRT::Utils::CreateExternalWinRTObject("Windows.Media.MediaProperties", "VideoEncodingProperties", val);
            },
            [](Local<Value> value) -> bool {
              return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::MediaProperties::VideoEncodingProperties^>(value);
            },
            [](Local<Value> value) -> ::Windows::Media::MediaProperties::VideoEncodingProperties^ {
              return dynamic_cast<::Windows::Media::MediaProperties::VideoEncodingProperties^>(NodeRT::Utils::GetObjectInstance(value));
            }
          ));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void SupportedMemoryTypesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      try  {
        ::Windows::Media::Effects::MediaMemoryTypes result = wrapper->_instance->SupportedMemoryTypes;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TimeIndependentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IBasicVideoEffect^>(info.This())) {
        return;
      }

      IBasicVideoEffect *wrapper = IBasicVideoEffect::Unwrap<IBasicVideoEffect>(info.This());

      try  {
        bool result = wrapper->_instance->TimeIndependent;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IBasicVideoEffect^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIBasicVideoEffect(::Windows::Media::Effects::IBasicVideoEffect^ wintRtInstance);
      friend ::Windows::Media::Effects::IBasicVideoEffect^ UnwrapIBasicVideoEffect(Local<Value> value);
  };

  Persistent<FunctionTemplate> IBasicVideoEffect::s_constructorTemplate;

  v8::Local<v8::Value> WrapIBasicVideoEffect(::Windows::Media::Effects::IBasicVideoEffect^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IBasicVideoEffect::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IBasicVideoEffect^ UnwrapIBasicVideoEffect(Local<Value> value) {
     return IBasicVideoEffect::Unwrap<IBasicVideoEffect>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIBasicVideoEffect(Local<Object> exports) {
    IBasicVideoEffect::Init(exports);
  }

  class IVideoCompositor : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IVideoCompositor").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);


          
            Nan::SetPrototypeMethod(localRef, "setEncodingProperties", SetEncodingProperties);
            Nan::SetPrototypeMethod(localRef, "compositeFrame", CompositeFrame);
            Nan::SetPrototypeMethod(localRef, "close", Close);
            Nan::SetPrototypeMethod(localRef, "discardQueuedFrames", DiscardQueuedFrames);
          



          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("timeIndependent").ToLocalChecked(), TimeIndependentGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IVideoCompositor").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IVideoCompositor(::Windows::Media::Effects::IVideoCompositor^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IVideoCompositor^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IVideoCompositor^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IVideoCompositor *wrapperInstance = new IVideoCompositor(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IVideoCompositor^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IVideoCompositor^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIVideoCompositor(winRtInstance));
    }


    static void SetEncodingProperties(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info.This())) {
        return;
      }

      IVideoCompositor *wrapper = IVideoCompositor::Unwrap<IVideoCompositor>(info.This());

      if (info.Length() == 2
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::MediaProperties::VideoEncodingProperties^>(info[0])
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^>(info[1]))
      {
        try
        {
          ::Windows::Media::MediaProperties::VideoEncodingProperties^ arg0 = dynamic_cast<::Windows::Media::MediaProperties::VideoEncodingProperties^>(NodeRT::Utils::GetObjectInstance(info[0]));
          ::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^ arg1 = dynamic_cast<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          wrapper->_instance->SetEncodingProperties(arg0, arg1);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void CompositeFrame(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info.This())) {
        return;
      }

      IVideoCompositor *wrapper = IVideoCompositor::Unwrap<IVideoCompositor>(info.This());

      if (info.Length() == 1
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::CompositeVideoFrameContext^>(info[0]))
      {
        try
        {
          ::Windows::Media::Effects::CompositeVideoFrameContext^ arg0 = UnwrapCompositeVideoFrameContext(info[0]);
          
          wrapper->_instance->CompositeFrame(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void Close(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info.This())) {
        return;
      }

      IVideoCompositor *wrapper = IVideoCompositor::Unwrap<IVideoCompositor>(info.This());

      if (info.Length() == 1
        && info[0]->IsInt32())
      {
        try
        {
          ::Windows::Media::Effects::MediaEffectClosedReason arg0 = static_cast<::Windows::Media::Effects::MediaEffectClosedReason>(Nan::To<int32_t>(info[0]).FromMaybe(0));
          
          wrapper->_instance->Close(arg0);
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }
    static void DiscardQueuedFrames(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info.This())) {
        return;
      }

      IVideoCompositor *wrapper = IVideoCompositor::Unwrap<IVideoCompositor>(info.This());

      if (info.Length() == 0)
      {
        try
        {
          wrapper->_instance->DiscardQueuedFrames();
          return;
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return;
      }
    }



    static void TimeIndependentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositor^>(info.This())) {
        return;
      }

      IVideoCompositor *wrapper = IVideoCompositor::Unwrap<IVideoCompositor>(info.This());

      try  {
        bool result = wrapper->_instance->TimeIndependent;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IVideoCompositor^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIVideoCompositor(::Windows::Media::Effects::IVideoCompositor^ wintRtInstance);
      friend ::Windows::Media::Effects::IVideoCompositor^ UnwrapIVideoCompositor(Local<Value> value);
  };

  Persistent<FunctionTemplate> IVideoCompositor::s_constructorTemplate;

  v8::Local<v8::Value> WrapIVideoCompositor(::Windows::Media::Effects::IVideoCompositor^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IVideoCompositor::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IVideoCompositor^ UnwrapIVideoCompositor(Local<Value> value) {
     return IVideoCompositor::Unwrap<IVideoCompositor>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIVideoCompositor(Local<Object> exports) {
    IVideoCompositor::Init(exports);
  }

  class IVideoCompositorDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IVideoCompositorDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IVideoCompositorDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IVideoCompositorDefinition(::Windows::Media::Effects::IVideoCompositorDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IVideoCompositorDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositorDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IVideoCompositorDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IVideoCompositorDefinition *wrapperInstance = new IVideoCompositorDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositorDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IVideoCompositorDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IVideoCompositorDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIVideoCompositorDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositorDefinition^>(info.This())) {
        return;
      }

      IVideoCompositorDefinition *wrapper = IVideoCompositorDefinition::Unwrap<IVideoCompositorDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoCompositorDefinition^>(info.This())) {
        return;
      }

      IVideoCompositorDefinition *wrapper = IVideoCompositorDefinition::Unwrap<IVideoCompositorDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IVideoCompositorDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIVideoCompositorDefinition(::Windows::Media::Effects::IVideoCompositorDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::IVideoCompositorDefinition^ UnwrapIVideoCompositorDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> IVideoCompositorDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapIVideoCompositorDefinition(::Windows::Media::Effects::IVideoCompositorDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IVideoCompositorDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IVideoCompositorDefinition^ UnwrapIVideoCompositorDefinition(Local<Value> value) {
     return IVideoCompositorDefinition::Unwrap<IVideoCompositorDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIVideoCompositorDefinition(Local<Object> exports) {
    IVideoCompositorDefinition::Init(exports);
  }

  class IVideoEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("IVideoEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("IVideoEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      IVideoEffectDefinition(::Windows::Media::Effects::IVideoEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::IVideoEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::IVideoEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      IVideoEffectDefinition *wrapperInstance = new IVideoEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::IVideoEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::IVideoEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapIVideoEffectDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoEffectDefinition^>(info.This())) {
        return;
      }

      IVideoEffectDefinition *wrapper = IVideoEffectDefinition::Unwrap<IVideoEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::IVideoEffectDefinition^>(info.This())) {
        return;
      }

      IVideoEffectDefinition *wrapper = IVideoEffectDefinition::Unwrap<IVideoEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::IVideoEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapIVideoEffectDefinition(::Windows::Media::Effects::IVideoEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::IVideoEffectDefinition^ UnwrapIVideoEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> IVideoEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapIVideoEffectDefinition(::Windows::Media::Effects::IVideoEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(IVideoEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::IVideoEffectDefinition^ UnwrapIVideoEffectDefinition(Local<Value> value) {
     return IVideoEffectDefinition::Unwrap<IVideoEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitIVideoEffectDefinition(Local<Object> exports) {
    IVideoEffectDefinition::Init(exports);
  }

  class ProcessAudioFrameContext : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ProcessAudioFrameContext").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("inputFrame").ToLocalChecked(), InputFrameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("outputFrame").ToLocalChecked(), OutputFrameGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ProcessAudioFrameContext").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ProcessAudioFrameContext(::Windows::Media::Effects::ProcessAudioFrameContext^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::ProcessAudioFrameContext^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessAudioFrameContext^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::ProcessAudioFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ProcessAudioFrameContext *wrapperInstance = new ProcessAudioFrameContext(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessAudioFrameContext^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::ProcessAudioFrameContext^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::ProcessAudioFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapProcessAudioFrameContext(winRtInstance));
    }





    static void InputFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessAudioFrameContext^>(info.This())) {
        return;
      }

      ProcessAudioFrameContext *wrapper = ProcessAudioFrameContext::Unwrap<ProcessAudioFrameContext>(info.This());

      try  {
        ::Windows::Media::AudioFrame^ result = wrapper->_instance->InputFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "AudioFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OutputFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessAudioFrameContext^>(info.This())) {
        return;
      }

      ProcessAudioFrameContext *wrapper = ProcessAudioFrameContext::Unwrap<ProcessAudioFrameContext>(info.This());

      try  {
        ::Windows::Media::AudioFrame^ result = wrapper->_instance->OutputFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "AudioFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::ProcessAudioFrameContext^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapProcessAudioFrameContext(::Windows::Media::Effects::ProcessAudioFrameContext^ wintRtInstance);
      friend ::Windows::Media::Effects::ProcessAudioFrameContext^ UnwrapProcessAudioFrameContext(Local<Value> value);
  };

  Persistent<FunctionTemplate> ProcessAudioFrameContext::s_constructorTemplate;

  v8::Local<v8::Value> WrapProcessAudioFrameContext(::Windows::Media::Effects::ProcessAudioFrameContext^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ProcessAudioFrameContext::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::ProcessAudioFrameContext^ UnwrapProcessAudioFrameContext(Local<Value> value) {
     return ProcessAudioFrameContext::Unwrap<ProcessAudioFrameContext>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitProcessAudioFrameContext(Local<Object> exports) {
    ProcessAudioFrameContext::Init(exports);
  }

  class ProcessVideoFrameContext : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("ProcessVideoFrameContext").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("inputFrame").ToLocalChecked(), InputFrameGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("outputFrame").ToLocalChecked(), OutputFrameGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("ProcessVideoFrameContext").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      ProcessVideoFrameContext(::Windows::Media::Effects::ProcessVideoFrameContext^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::ProcessVideoFrameContext^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessVideoFrameContext^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::ProcessVideoFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      ProcessVideoFrameContext *wrapperInstance = new ProcessVideoFrameContext(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessVideoFrameContext^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::ProcessVideoFrameContext^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::ProcessVideoFrameContext^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapProcessVideoFrameContext(winRtInstance));
    }





    static void InputFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessVideoFrameContext^>(info.This())) {
        return;
      }

      ProcessVideoFrameContext *wrapper = ProcessVideoFrameContext::Unwrap<ProcessVideoFrameContext>(info.This());

      try  {
        ::Windows::Media::VideoFrame^ result = wrapper->_instance->InputFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "VideoFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OutputFrameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::ProcessVideoFrameContext^>(info.This())) {
        return;
      }

      ProcessVideoFrameContext *wrapper = ProcessVideoFrameContext::Unwrap<ProcessVideoFrameContext>(info.This());

      try  {
        ::Windows::Media::VideoFrame^ result = wrapper->_instance->OutputFrame;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Media", "VideoFrame", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::ProcessVideoFrameContext^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapProcessVideoFrameContext(::Windows::Media::Effects::ProcessVideoFrameContext^ wintRtInstance);
      friend ::Windows::Media::Effects::ProcessVideoFrameContext^ UnwrapProcessVideoFrameContext(Local<Value> value);
  };

  Persistent<FunctionTemplate> ProcessVideoFrameContext::s_constructorTemplate;

  v8::Local<v8::Value> WrapProcessVideoFrameContext(::Windows::Media::Effects::ProcessVideoFrameContext^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(ProcessVideoFrameContext::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::ProcessVideoFrameContext^ UnwrapProcessVideoFrameContext(Local<Value> value) {
     return ProcessVideoFrameContext::Unwrap<ProcessVideoFrameContext>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitProcessVideoFrameContext(Local<Object> exports) {
    ProcessVideoFrameContext::Init(exports);
  }

  class SlowMotionEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("SlowMotionEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("timeStretchRate").ToLocalChecked(), TimeStretchRateGetter, TimeStretchRateSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("SlowMotionEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      SlowMotionEffectDefinition(::Windows::Media::Effects::SlowMotionEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::SlowMotionEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::SlowMotionEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Media::Effects::SlowMotionEffectDefinition();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      SlowMotionEffectDefinition *wrapperInstance = new SlowMotionEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::SlowMotionEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::SlowMotionEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapSlowMotionEffectDefinition(winRtInstance));
    }





    static void TimeStretchRateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info.This())) {
        return;
      }

      SlowMotionEffectDefinition *wrapper = SlowMotionEffectDefinition::Unwrap<SlowMotionEffectDefinition>(info.This());

      try  {
        double result = wrapper->_instance->TimeStretchRate;
        info.GetReturnValue().Set(Nan::New<Number>(static_cast<double>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void TimeStretchRateSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsNumber()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info.This())) {
        return;
      }

      SlowMotionEffectDefinition *wrapper = SlowMotionEffectDefinition::Unwrap<SlowMotionEffectDefinition>(info.This());

      try {

        double winRtValue = Nan::To<double>(value).FromMaybe(0.0);

        wrapper->_instance->TimeStretchRate = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info.This())) {
        return;
      }

      SlowMotionEffectDefinition *wrapper = SlowMotionEffectDefinition::Unwrap<SlowMotionEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::SlowMotionEffectDefinition^>(info.This())) {
        return;
      }

      SlowMotionEffectDefinition *wrapper = SlowMotionEffectDefinition::Unwrap<SlowMotionEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::SlowMotionEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapSlowMotionEffectDefinition(::Windows::Media::Effects::SlowMotionEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::SlowMotionEffectDefinition^ UnwrapSlowMotionEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> SlowMotionEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapSlowMotionEffectDefinition(::Windows::Media::Effects::SlowMotionEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(SlowMotionEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::SlowMotionEffectDefinition^ UnwrapSlowMotionEffectDefinition(Local<Value> value) {
     return SlowMotionEffectDefinition::Unwrap<SlowMotionEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitSlowMotionEffectDefinition(Local<Object> exports) {
    SlowMotionEffectDefinition::Init(exports);
  }

  class VideoCompositorDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("VideoCompositorDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("VideoCompositorDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      VideoCompositorDefinition(::Windows::Media::Effects::VideoCompositorDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::VideoCompositorDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoCompositorDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::VideoCompositorDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::Media::Effects::VideoCompositorDefinition(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IPropertySet^>(info[1]))
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Foundation::Collections::IPropertySet^ arg1 = dynamic_cast<::Windows::Foundation::Collections::IPropertySet^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          winRtInstance = ref new ::Windows::Media::Effects::VideoCompositorDefinition(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      VideoCompositorDefinition *wrapperInstance = new VideoCompositorDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoCompositorDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::VideoCompositorDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::VideoCompositorDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapVideoCompositorDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoCompositorDefinition^>(info.This())) {
        return;
      }

      VideoCompositorDefinition *wrapper = VideoCompositorDefinition::Unwrap<VideoCompositorDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoCompositorDefinition^>(info.This())) {
        return;
      }

      VideoCompositorDefinition *wrapper = VideoCompositorDefinition::Unwrap<VideoCompositorDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::VideoCompositorDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapVideoCompositorDefinition(::Windows::Media::Effects::VideoCompositorDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::VideoCompositorDefinition^ UnwrapVideoCompositorDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> VideoCompositorDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapVideoCompositorDefinition(::Windows::Media::Effects::VideoCompositorDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(VideoCompositorDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::VideoCompositorDefinition^ UnwrapVideoCompositorDefinition(Local<Value> value) {
     return VideoCompositorDefinition::Unwrap<VideoCompositorDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitVideoCompositorDefinition(Local<Object> exports) {
    VideoCompositorDefinition::Init(exports);
  }

  class VideoEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("VideoEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("VideoEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      VideoEffectDefinition(::Windows::Media::Effects::VideoEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::VideoEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::VideoEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 1
        && info[0]->IsString())
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          
          winRtInstance = ref new ::Windows::Media::Effects::VideoEffectDefinition(arg0);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 2
        && info[0]->IsString()
        && NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IPropertySet^>(info[1]))
      {
        try {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(v8::Isolate::GetCurrent(), info[0])));
          ::Windows::Foundation::Collections::IPropertySet^ arg1 = dynamic_cast<::Windows::Foundation::Collections::IPropertySet^>(NodeRT::Utils::GetObjectInstance(info[1]));
          
          winRtInstance = ref new ::Windows::Media::Effects::VideoEffectDefinition(arg0,arg1);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      VideoEffectDefinition *wrapperInstance = new VideoEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::VideoEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::VideoEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapVideoEffectDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoEffectDefinition^>(info.This())) {
        return;
      }

      VideoEffectDefinition *wrapper = VideoEffectDefinition::Unwrap<VideoEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoEffectDefinition^>(info.This())) {
        return;
      }

      VideoEffectDefinition *wrapper = VideoEffectDefinition::Unwrap<VideoEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::VideoEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapVideoEffectDefinition(::Windows::Media::Effects::VideoEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::VideoEffectDefinition^ UnwrapVideoEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> VideoEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapVideoEffectDefinition(::Windows::Media::Effects::VideoEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(VideoEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::VideoEffectDefinition^ UnwrapVideoEffectDefinition(Local<Value> value) {
     return VideoEffectDefinition::Unwrap<VideoEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitVideoEffectDefinition(Local<Object> exports) {
    VideoEffectDefinition::Init(exports);
  }

  class VideoTransformEffectDefinition : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("VideoTransformEffectDefinition").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("activatableClassId").ToLocalChecked(), ActivatableClassIdGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("properties").ToLocalChecked(), PropertiesGetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("rotation").ToLocalChecked(), RotationGetter, RotationSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("processingAlgorithm").ToLocalChecked(), ProcessingAlgorithmGetter, ProcessingAlgorithmSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("paddingColor").ToLocalChecked(), PaddingColorGetter, PaddingColorSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("outputSize").ToLocalChecked(), OutputSizeGetter, OutputSizeSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("mirror").ToLocalChecked(), MirrorGetter, MirrorSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("cropRectangle").ToLocalChecked(), CropRectangleGetter, CropRectangleSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("sphericalProjection").ToLocalChecked(), SphericalProjectionGetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("VideoTransformEffectDefinition").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      VideoTransformEffectDefinition(::Windows::Media::Effects::VideoTransformEffectDefinition^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::VideoTransformEffectDefinition^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::VideoTransformEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
      else if (info.Length() == 0)
      {
        try {
          winRtInstance = ref new ::Windows::Media::Effects::VideoTransformEffectDefinition();
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      VideoTransformEffectDefinition *wrapperInstance = new VideoTransformEffectDefinition(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::VideoTransformEffectDefinition^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::VideoTransformEffectDefinition^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapVideoTransformEffectDefinition(winRtInstance));
    }





    static void ActivatableClassIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        Platform::String^ result = wrapper->_instance->ActivatableClassId;
        info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Collections::IPropertySet^ result = wrapper->_instance->Properties;
        info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation.Collections", "IPropertySet", result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void RotationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Media::MediaProperties::MediaRotation result = wrapper->_instance->Rotation;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void RotationSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::Media::MediaProperties::MediaRotation winRtValue = static_cast<::Windows::Media::MediaProperties::MediaRotation>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->Rotation = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ProcessingAlgorithmGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Media::Transcoding::MediaVideoProcessingAlgorithm result = wrapper->_instance->ProcessingAlgorithm;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProcessingAlgorithmSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::Media::Transcoding::MediaVideoProcessingAlgorithm winRtValue = static_cast<::Windows::Media::Transcoding::MediaVideoProcessingAlgorithm>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->ProcessingAlgorithm = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void PaddingColorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::UI::Color result = wrapper->_instance->PaddingColor;
        info.GetReturnValue().Set(NodeRT::Utils::ColorToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void PaddingColorSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsColor(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::UI::Color winRtValue = NodeRT::Utils::ColorFromJs(value);

        wrapper->_instance->PaddingColor = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void OutputSizeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Size result = wrapper->_instance->OutputSize;
        info.GetReturnValue().Set(NodeRT::Utils::SizeToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void OutputSizeSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsSize(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::Foundation::Size winRtValue = NodeRT::Utils::SizeFromJs(value);

        wrapper->_instance->OutputSize = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void MirrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Media::MediaProperties::MediaMirroringOptions result = wrapper->_instance->Mirror;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void MirrorSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::Media::MediaProperties::MediaMirroringOptions winRtValue = static_cast<::Windows::Media::MediaProperties::MediaMirroringOptions>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->Mirror = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void CropRectangleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Foundation::Rect result = wrapper->_instance->CropRectangle;
        info.GetReturnValue().Set(NodeRT::Utils::RectToJs(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void CropRectangleSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsRect(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try {

        ::Windows::Foundation::Rect winRtValue = NodeRT::Utils::RectFromJs(value);

        wrapper->_instance->CropRectangle = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void SphericalProjectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformEffectDefinition^>(info.This())) {
        return;
      }

      VideoTransformEffectDefinition *wrapper = VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(info.This());

      try  {
        ::Windows::Media::Effects::VideoTransformSphericalProjection^ result = wrapper->_instance->SphericalProjection;
        info.GetReturnValue().Set(WrapVideoTransformSphericalProjection(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      


    private:
      ::Windows::Media::Effects::VideoTransformEffectDefinition^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapVideoTransformEffectDefinition(::Windows::Media::Effects::VideoTransformEffectDefinition^ wintRtInstance);
      friend ::Windows::Media::Effects::VideoTransformEffectDefinition^ UnwrapVideoTransformEffectDefinition(Local<Value> value);
  };

  Persistent<FunctionTemplate> VideoTransformEffectDefinition::s_constructorTemplate;

  v8::Local<v8::Value> WrapVideoTransformEffectDefinition(::Windows::Media::Effects::VideoTransformEffectDefinition^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(VideoTransformEffectDefinition::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::VideoTransformEffectDefinition^ UnwrapVideoTransformEffectDefinition(Local<Value> value) {
     return VideoTransformEffectDefinition::Unwrap<VideoTransformEffectDefinition>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitVideoTransformEffectDefinition(Local<Object> exports) {
    VideoTransformEffectDefinition::Init(exports);
  }

  class VideoTransformSphericalProjection : public WrapperBase {
    public:
      
      static void Init(const Local<Object> exports) {
        HandleScope scope;

        Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
        s_constructorTemplate.Reset(localRef);
        localRef->SetClassName(Nan::New<String>("VideoTransformSphericalProjection").ToLocalChecked());
        localRef->InstanceTemplate()->SetInternalFieldCount(1);





          
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("viewOrientation").ToLocalChecked(), ViewOrientationGetter, ViewOrientationSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("projectionMode").ToLocalChecked(), ProjectionModeGetter, ProjectionModeSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isEnabled").ToLocalChecked(), IsEnabledGetter, IsEnabledSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("horizontalFieldOfViewInDegrees").ToLocalChecked(), HorizontalFieldOfViewInDegreesGetter, HorizontalFieldOfViewInDegreesSetter);
            Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("frameFormat").ToLocalChecked(), FrameFormatGetter, FrameFormatSetter);

        Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
        Nan::SetMethod(constructor, "castFrom", CastFrom);



        Nan::Set(exports, Nan::New<String>("VideoTransformSphericalProjection").ToLocalChecked(), constructor);
      }

      virtual ::Platform::Object^ GetObjectInstance() const override {
        return _instance;
      }

    private:

      VideoTransformSphericalProjection(::Windows::Media::Effects::VideoTransformSphericalProjection^ instance) {
        _instance = instance;
      }

      
    static void New(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;

      Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);

      // in case the constructor was called without the new operator
      if (!localRef->HasInstance(info.This())) {
        if (info.Length() > 0) {
          std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);

          Local<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < info.Length(); i++) {
            argsPtr[i] = info[i];
          }

          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        } else {
          MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);

          if (res.IsEmpty()) {
            return;
          }

          info.GetReturnValue().Set(res.ToLocalChecked());
          return;
        }
      }

      ::Windows::Media::Effects::VideoTransformSphericalProjection^ winRtInstance;


      if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info[0])) {
        try {
          winRtInstance = (::Windows::Media::Effects::VideoTransformSphericalProjection^) NodeRT::Utils::GetObjectInstance(info[0]);
        } catch (Platform::Exception ^exception) {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return;
        }
      }
 else {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return;
      }

      NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());

      VideoTransformSphericalProjection *wrapperInstance = new VideoTransformSphericalProjection(winRtInstance);
      wrapperInstance->Wrap(info.This());

      info.GetReturnValue().Set(info.This());
    }


      
    static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info) {
      HandleScope scope;
      if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info[0])) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
        return;
      }

      ::Windows::Media::Effects::VideoTransformSphericalProjection^ winRtInstance;
      try {
        winRtInstance = (::Windows::Media::Effects::VideoTransformSphericalProjection^) NodeRT::Utils::GetObjectInstance(info[0]);
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }

      info.GetReturnValue().Set(WrapVideoTransformSphericalProjection(winRtInstance));
    }





    static void ViewOrientationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try  {
        ::Platform::Numerics::Quaternion result = wrapper->_instance->ViewOrientation;
        info.GetReturnValue().Set(QuaternionToJsObject(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ViewOrientationSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!IsQuaternionJsObject(value)) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try {

        ::Platform::Numerics::Quaternion winRtValue = QuaternionFromJsObject(value);

        wrapper->_instance->ViewOrientation = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void ProjectionModeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try  {
        ::Windows::Media::Playback::SphericalVideoProjectionMode result = wrapper->_instance->ProjectionMode;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void ProjectionModeSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try {

        ::Windows::Media::Playback::SphericalVideoProjectionMode winRtValue = static_cast<::Windows::Media::Playback::SphericalVideoProjectionMode>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->ProjectionMode = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void IsEnabledGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try  {
        bool result = wrapper->_instance->IsEnabled;
        info.GetReturnValue().Set(Nan::New<Boolean>(result));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void IsEnabledSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsBoolean()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try {

        bool winRtValue = Nan::To<bool>(value).FromMaybe(false);

        wrapper->_instance->IsEnabled = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void HorizontalFieldOfViewInDegreesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try  {
        double result = wrapper->_instance->HorizontalFieldOfViewInDegrees;
        info.GetReturnValue().Set(Nan::New<Number>(static_cast<double>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void HorizontalFieldOfViewInDegreesSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsNumber()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try {

        double winRtValue = Nan::To<double>(value).FromMaybe(0.0);

        wrapper->_instance->HorizontalFieldOfViewInDegrees = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      
    static void FrameFormatGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info) {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try  {
        ::Windows::Media::MediaProperties::SphericalVideoFrameFormat result = wrapper->_instance->FrameFormat;
        info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
        return;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return;
      }
    }
      
    static void FrameFormatSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) {
      HandleScope scope;

      if (!value->IsInt32()) {
        Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Media::Effects::VideoTransformSphericalProjection^>(info.This())) {
        return;
      }

      VideoTransformSphericalProjection *wrapper = VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(info.This());

      try {

        ::Windows::Media::MediaProperties::SphericalVideoFrameFormat winRtValue = static_cast<::Windows::Media::MediaProperties::SphericalVideoFrameFormat>(Nan::To<int32_t>(value).FromMaybe(0));

        wrapper->_instance->FrameFormat = winRtValue;
      } catch (Platform::Exception ^exception) {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
      


    private:
      ::Windows::Media::Effects::VideoTransformSphericalProjection^ _instance;
      static Persistent<FunctionTemplate> s_constructorTemplate;

      friend v8::Local<v8::Value> WrapVideoTransformSphericalProjection(::Windows::Media::Effects::VideoTransformSphericalProjection^ wintRtInstance);
      friend ::Windows::Media::Effects::VideoTransformSphericalProjection^ UnwrapVideoTransformSphericalProjection(Local<Value> value);
  };

  Persistent<FunctionTemplate> VideoTransformSphericalProjection::s_constructorTemplate;

  v8::Local<v8::Value> WrapVideoTransformSphericalProjection(::Windows::Media::Effects::VideoTransformSphericalProjection^ winRtInstance) {
    EscapableHandleScope scope;

    if (winRtInstance == nullptr) {
      return scope.Escape(Undefined());
    }

    Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Local<Value> args[] = {opaqueWrapper};
    Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(VideoTransformSphericalProjection::s_constructorTemplate);
    return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
  }

  ::Windows::Media::Effects::VideoTransformSphericalProjection^ UnwrapVideoTransformSphericalProjection(Local<Value> value) {
     return VideoTransformSphericalProjection::Unwrap<VideoTransformSphericalProjection>(Nan::To<Object>(value).ToLocalChecked())->_instance;
  }

  void InitVideoTransformSphericalProjection(Local<Object> exports) {
    VideoTransformSphericalProjection::Init(exports);
  }


} } } } 

NAN_MODULE_INIT(init) {
  // We ignore failures for now since it probably means that
  // the initialization already happened for STA, and that's cool

  CoInitializeEx(nullptr, COINIT_MULTITHREADED);

  /*
  if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) {
    Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"error in CoInitializeEx()")));
    return;
  }
  */

      NodeRT::Windows::Media::Effects::InitAudioEffectTypeEnum(target);
      NodeRT::Windows::Media::Effects::InitMediaEffectClosedReasonEnum(target);
      NodeRT::Windows::Media::Effects::InitMediaMemoryTypesEnum(target);
      NodeRT::Windows::Media::Effects::InitAudioCaptureEffectsManager(target);
      NodeRT::Windows::Media::Effects::InitAudioEffect(target);
      NodeRT::Windows::Media::Effects::InitAudioEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitAudioEffectsManager(target);
      NodeRT::Windows::Media::Effects::InitAudioRenderEffectsManager(target);
      NodeRT::Windows::Media::Effects::InitCompositeVideoFrameContext(target);
      NodeRT::Windows::Media::Effects::InitIAudioEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitIBasicAudioEffect(target);
      NodeRT::Windows::Media::Effects::InitIBasicVideoEffect(target);
      NodeRT::Windows::Media::Effects::InitIVideoCompositor(target);
      NodeRT::Windows::Media::Effects::InitIVideoCompositorDefinition(target);
      NodeRT::Windows::Media::Effects::InitIVideoEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitProcessAudioFrameContext(target);
      NodeRT::Windows::Media::Effects::InitProcessVideoFrameContext(target);
      NodeRT::Windows::Media::Effects::InitSlowMotionEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitVideoCompositorDefinition(target);
      NodeRT::Windows::Media::Effects::InitVideoEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitVideoTransformEffectDefinition(target);
      NodeRT::Windows::Media::Effects::InitVideoTransformSphericalProjection(target);


  NodeRT::Utils::RegisterNameSpace("Windows.Media.Effects", target);
}



NODE_MODULE(binding, init)
