> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XSpeechSynthesizerSetCustomVoice

> XSpeechSynthesizerSetCustomVoice

# XSpeechSynthesizerSetCustomVoice

音声合成器が指定されたカスタム音声を使用するように指定します。

## Syntax

```cpp theme={null}
HRESULT XSpeechSynthesizerSetCustomVoice(  
         XSpeechSynthesizerHandle speechSynthesizer,  
         const char* voiceId  
)  
```

### Parameters

*speechSynthesizer*   \_In\_\
型: XSpeechSynthesizerHandle

カスタム音声を使用する音声合成器を指定します。

*voiceId*   \_In\_z\_\
型: char\*

[XSpeechSynthesizerInstalledVoicesCallback](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback.md) 関数で返される [XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md) 構造体内の音声 ID。

### Return value

型: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

成功した場合は **S\_OK** を返します。そうでない場合はエラー コードを返します。エラー コードの一覧については、[エラー コード](https://docs.xbox.com/ja-jp/reference/errorcodes.md) を参照してください。

## Remarks

> [!NOTE]
>
> この関数はタイム センシティブなスレッドで呼び出すのは安全ではありません。詳細については、[タイム センシティブなスレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。

* インストールされている各音声について、[XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md) 構造体は音声 ID、説明、表示テキスト、性別、言語、その他の情報を提供します。

* 現在のデバイスにインストールされている音声を列挙し情報を取得するには、[XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md) 関数を [XSpeechSynthesizerInstalledVoicesCallback](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback.md) コールバック関数と共に使用します。

* 指定した音声合成器に現在のシステム音声を使用するには、[XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md) を呼び出します。

* **XSpeechSynthesizerSetCustomVoice** 関数の使用方法を示す例については、[XSpeechSynthesizerCreate](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md) を参照してください。

## Requirements

**ヘッダー:** XSpeechSynthesizer.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [テキスト読み上げ](https://docs.xbox.com/ja-jp/build/console-features/text-to-speech/text-to-speech.md)
* [タイム センシティブなスレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XAccessibility](https://docs.xbox.com/ja-jp/reference/system/xaccessibility/xaccessibility_members.md)\
[XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md)\
[XSpeechSynthesizer](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)


## Related topics

- [XSpeechSynthesizerInstalledVoicesCallback](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback.md)
- [XSpeechSynthesizerEnumerateInstalledVoices](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md)
- [XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md)
- [XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md)
- [テキスト読み上げ](https://docs.xbox.com/ja-jp/build/console-features/text-to-speech/text-to-speech.md)
