// WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.0-beta.2

#include "py.Windows.Media.SpeechSynthesis.h"


namespace py::cpp::Windows::Media::SpeechSynthesis
{
    // ----- SpeechSynthesisStream class --------------------

    static PyObject* _new_SpeechSynthesisStream(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesisStream>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesisStream>::type_name);
        return nullptr;
    }

    static void _dealloc_SpeechSynthesisStream(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpeechSynthesisStream_CloneStream(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"CloneStream", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.CloneStream());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_Close(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Close", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                self->obj.Close();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_FlushAsync(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"FlushAsync", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.FlushAsync());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_GetInputStreamAt(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"GetInputStreamAt", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<uint64_t>(args, 0);

                return py::convert(self->obj.GetInputStreamAt(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_GetOutputStreamAt(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"GetOutputStreamAt", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<uint64_t>(args, 0);

                return py::convert(self->obj.GetOutputStreamAt(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_ReadAsync(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"ReadAsync", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 0);
                auto param1 = py::convert_to<uint32_t>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Storage::Streams::InputStreamOptions>(args, 2);

                return py::convert(self->obj.ReadAsync(param0, param1, param2));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_Seek(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Seek", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<uint64_t>(args, 0);

                self->obj.Seek(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_WriteAsync(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"WriteAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 0);

                return py::convert(self->obj.WriteAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_TimedMetadataTracks(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"TimedMetadataTracks"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TimedMetadataTracks());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_Markers(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Markers"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Markers());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_ContentType(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"ContentType"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.ContentType());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_Size(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Size"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Size());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesisStream_put_Size(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Size"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<uint64_t>(arg);

            self->obj.Size(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesisStream_get_CanRead(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"CanRead"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.CanRead());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_CanWrite(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"CanWrite"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.CanWrite());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesisStream_get_Position(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesisStream", L"Position"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Position());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_SpeechSynthesisStream(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesisStream>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_SpeechSynthesisStream(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesisStream>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_SpeechSynthesisStream(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_SpeechSynthesisStream(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpeechSynthesisStream[] = {
        { "clone_stream", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_CloneStream), METH_VARARGS, nullptr },
        { "close", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_Close), METH_VARARGS, nullptr },
        { "flush_async", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_FlushAsync), METH_VARARGS, nullptr },
        { "get_input_stream_at", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_GetInputStreamAt), METH_VARARGS, nullptr },
        { "get_output_stream_at", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_GetOutputStreamAt), METH_VARARGS, nullptr },
        { "read_async", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_ReadAsync), METH_VARARGS, nullptr },
        { "seek", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_Seek), METH_VARARGS, nullptr },
        { "write_async", reinterpret_cast<PyCFunction>(SpeechSynthesisStream_WriteAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_SpeechSynthesisStream, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpeechSynthesisStream), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_SpeechSynthesisStream), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_SpeechSynthesisStream), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpeechSynthesisStream[] = {
        { "timed_metadata_tracks", reinterpret_cast<getter>(SpeechSynthesisStream_get_TimedMetadataTracks), nullptr, nullptr, nullptr },
        { "markers", reinterpret_cast<getter>(SpeechSynthesisStream_get_Markers), nullptr, nullptr, nullptr },
        { "content_type", reinterpret_cast<getter>(SpeechSynthesisStream_get_ContentType), nullptr, nullptr, nullptr },
        { "size", reinterpret_cast<getter>(SpeechSynthesisStream_get_Size), reinterpret_cast<setter>(SpeechSynthesisStream_put_Size), nullptr, nullptr },
        { "can_read", reinterpret_cast<getter>(SpeechSynthesisStream_get_CanRead), nullptr, nullptr, nullptr },
        { "can_write", reinterpret_cast<getter>(SpeechSynthesisStream_get_CanWrite), nullptr, nullptr, nullptr },
        { "position", reinterpret_cast<getter>(SpeechSynthesisStream_get_Position), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpeechSynthesisStream[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpeechSynthesisStream) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpeechSynthesisStream) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpeechSynthesisStream) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpeechSynthesisStream) },
        { },
    };

    static PyType_Spec type_spec_SpeechSynthesisStream =
    {
        "winrt._winrt_windows_media_speechsynthesis.SpeechSynthesisStream",
        sizeof(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesisStream),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpeechSynthesisStream
    };

    // ----- SpeechSynthesizer class --------------------

    static PyObject* _new_SpeechSynthesizer(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer instance{  };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_SpeechSynthesizer(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpeechSynthesizer_Close(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"Close", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                self->obj.Close();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_SynthesizeSsmlToStreamAsync(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"SynthesizeSsmlToStreamAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(self->obj.SynthesizeSsmlToStreamAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_SynthesizeTextToStreamAsync(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"SynthesizeTextToStreamAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(self->obj.SynthesizeTextToStreamAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_TrySetDefaultVoiceAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"TrySetDefaultVoiceAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>(args, 0);

                return py::convert(winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer::TrySetDefaultVoiceAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_get_Voice(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"Voice"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Voice());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizer_put_Voice(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"Voice"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>(arg);

            self->obj.Voice(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizer_get_Options(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"Options"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Options());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_get_AllVoices(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"AllVoices"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer::AllVoices());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* SpeechSynthesizer_get_DefaultVoice(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizer", L"DefaultVoice"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer::DefaultVoice());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_SpeechSynthesizer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_SpeechSynthesizer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizer>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_SpeechSynthesizer(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_SpeechSynthesizer(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpeechSynthesizer[] = {
        { "close", reinterpret_cast<PyCFunction>(SpeechSynthesizer_Close), METH_VARARGS, nullptr },
        { "synthesize_ssml_to_stream_async", reinterpret_cast<PyCFunction>(SpeechSynthesizer_SynthesizeSsmlToStreamAsync), METH_VARARGS, nullptr },
        { "synthesize_text_to_stream_async", reinterpret_cast<PyCFunction>(SpeechSynthesizer_SynthesizeTextToStreamAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_SpeechSynthesizer, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpeechSynthesizer), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_SpeechSynthesizer), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_SpeechSynthesizer), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpeechSynthesizer[] = {
        { "voice", reinterpret_cast<getter>(SpeechSynthesizer_get_Voice), reinterpret_cast<setter>(SpeechSynthesizer_put_Voice), nullptr, nullptr },
        { "options", reinterpret_cast<getter>(SpeechSynthesizer_get_Options), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpeechSynthesizer[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpeechSynthesizer) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpeechSynthesizer) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpeechSynthesizer) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpeechSynthesizer) },
        { },
    };

    static PyType_Spec type_spec_SpeechSynthesizer =
    {
        "winrt._winrt_windows_media_speechsynthesis.SpeechSynthesizer",
        sizeof(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizer),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpeechSynthesizer
    };

    static PyGetSetDef getset_SpeechSynthesizer_Static[] = {
        { "all_voices", reinterpret_cast<getter>(SpeechSynthesizer_get_AllVoices), nullptr, nullptr, nullptr },
        { "default_voice", reinterpret_cast<getter>(SpeechSynthesizer_get_DefaultVoice), nullptr, nullptr, nullptr },
        { }
    };

    static PyMethodDef methods_SpeechSynthesizer_Static[] = {
        { "try_set_default_voice_async", reinterpret_cast<PyCFunction>(SpeechSynthesizer_TrySetDefaultVoiceAsync), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_SpeechSynthesizer_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_SpeechSynthesizer_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_SpeechSynthesizer_Static) },
        { }
    };

    static PyType_Spec type_spec_SpeechSynthesizer_Static =
    {
        "winrt._winrt_windows_media_speechsynthesis.SpeechSynthesizer_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_SpeechSynthesizer_Static
    };

    // ----- SpeechSynthesizerOptions class --------------------

    static PyObject* _new_SpeechSynthesizerOptions(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions>::type_name);
        return nullptr;
    }

    static void _dealloc_SpeechSynthesizerOptions(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpeechSynthesizerOptions_get_IncludeWordBoundaryMetadata(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"IncludeWordBoundaryMetadata"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeWordBoundaryMetadata());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_IncludeWordBoundaryMetadata(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"IncludeWordBoundaryMetadata"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            self->obj.IncludeWordBoundaryMetadata(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_IncludeSentenceBoundaryMetadata(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"IncludeSentenceBoundaryMetadata"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeSentenceBoundaryMetadata());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_IncludeSentenceBoundaryMetadata(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"IncludeSentenceBoundaryMetadata"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            self->obj.IncludeSentenceBoundaryMetadata(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_SpeakingRate(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"SpeakingRate"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.SpeakingRate());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_SpeakingRate(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"SpeakingRate"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.SpeakingRate(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_AudioVolume(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AudioVolume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AudioVolume());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_AudioVolume(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AudioVolume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.AudioVolume(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_AudioPitch(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AudioPitch"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AudioPitch());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_AudioPitch(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AudioPitch"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.AudioPitch(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_PunctuationSilence(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"PunctuationSilence"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.PunctuationSilence());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_PunctuationSilence(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"PunctuationSilence"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Media::SpeechSynthesis::SpeechPunctuationSilence>(arg);

            self->obj.PunctuationSilence(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpeechSynthesizerOptions_get_AppendedSilence(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AppendedSilence"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AppendedSilence());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SpeechSynthesizerOptions_put_AppendedSilence(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions", L"AppendedSilence"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Media::SpeechSynthesis::SpeechAppendedSilence>(arg);

            self->obj.AppendedSilence(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _assign_array_SpeechSynthesizerOptions(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_SpeechSynthesizerOptions(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpeechSynthesizerOptions[] = {
        { "_assign_array_", _assign_array_SpeechSynthesizerOptions, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpeechSynthesizerOptions), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpeechSynthesizerOptions[] = {
        { "include_word_boundary_metadata", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_IncludeWordBoundaryMetadata), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_IncludeWordBoundaryMetadata), nullptr, nullptr },
        { "include_sentence_boundary_metadata", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_IncludeSentenceBoundaryMetadata), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_IncludeSentenceBoundaryMetadata), nullptr, nullptr },
        { "speaking_rate", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_SpeakingRate), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_SpeakingRate), nullptr, nullptr },
        { "audio_volume", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_AudioVolume), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_AudioVolume), nullptr, nullptr },
        { "audio_pitch", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_AudioPitch), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_AudioPitch), nullptr, nullptr },
        { "punctuation_silence", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_PunctuationSilence), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_PunctuationSilence), nullptr, nullptr },
        { "appended_silence", reinterpret_cast<getter>(SpeechSynthesizerOptions_get_AppendedSilence), reinterpret_cast<setter>(SpeechSynthesizerOptions_put_AppendedSilence), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpeechSynthesizerOptions[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpeechSynthesizerOptions) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpeechSynthesizerOptions) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpeechSynthesizerOptions) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpeechSynthesizerOptions) },
        { },
    };

    static PyType_Spec type_spec_SpeechSynthesizerOptions =
    {
        "winrt._winrt_windows_media_speechsynthesis.SpeechSynthesizerOptions",
        sizeof(py::wrapper::Windows::Media::SpeechSynthesis::SpeechSynthesizerOptions),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpeechSynthesizerOptions
    };

    // ----- VoiceInformation class --------------------

    static PyObject* _new_VoiceInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>::type_name);
        return nullptr;
    }

    static void _dealloc_VoiceInformation(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* VoiceInformation_get_Description(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.VoiceInformation", L"Description"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Description());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* VoiceInformation_get_DisplayName(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.VoiceInformation", L"DisplayName"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.DisplayName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* VoiceInformation_get_Gender(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.VoiceInformation", L"Gender"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Gender());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* VoiceInformation_get_Id(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.VoiceInformation", L"Id"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Id());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* VoiceInformation_get_Language(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.SpeechSynthesis.VoiceInformation", L"Language"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Language());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_VoiceInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_VoiceInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::SpeechSynthesis::VoiceInformation>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_VoiceInformation[] = {
        { "_assign_array_", _assign_array_VoiceInformation, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_VoiceInformation), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_VoiceInformation[] = {
        { "description", reinterpret_cast<getter>(VoiceInformation_get_Description), nullptr, nullptr, nullptr },
        { "display_name", reinterpret_cast<getter>(VoiceInformation_get_DisplayName), nullptr, nullptr, nullptr },
        { "gender", reinterpret_cast<getter>(VoiceInformation_get_Gender), nullptr, nullptr, nullptr },
        { "id", reinterpret_cast<getter>(VoiceInformation_get_Id), nullptr, nullptr, nullptr },
        { "language", reinterpret_cast<getter>(VoiceInformation_get_Language), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_VoiceInformation[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_VoiceInformation) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_VoiceInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_VoiceInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_VoiceInformation) },
        { },
    };

    static PyType_Spec type_spec_VoiceInformation =
    {
        "winrt._winrt_windows_media_speechsynthesis.VoiceInformation",
        sizeof(py::wrapper::Windows::Media::SpeechSynthesis::VoiceInformation),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_VoiceInformation
    };

    // ----- Windows.Media.SpeechSynthesis Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Media::SpeechSynthesis");


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winrt_windows_media_speechsynthesis",
           module_doc,
           0,
           nullptr,
           nullptr,
           nullptr,
           nullptr,
           nullptr};

} // py::cpp::Windows::Media::SpeechSynthesis

PyMODINIT_FUNC PyInit__winrt_windows_media_speechsynthesis(void) noexcept
{
    using namespace py::cpp::Windows::Media::SpeechSynthesis;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle object_bases{PyTuple_Pack(1, object_type)};

    if (!object_bases)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_SpeechSynthesisStream, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    py::pyobj_handle type_SpeechSynthesizer_Static{PyType_FromSpec(&type_spec_SpeechSynthesizer_Static)};
    if (!type_SpeechSynthesizer_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_SpeechSynthesizer, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_SpeechSynthesizer_Static.get())) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_SpeechSynthesizerOptions, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_VoiceInformation, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }


    return module.detach();
}
