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

# XSpeechSynthesizerSetCustomVoice

> XSpeechSynthesizerSetCustomVoice

# XSpeechSynthesizerSetCustomVoice

Indique que le synthétiseur vocal doit utiliser la voix personnalisée spécifiée.

## Syntaxe

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

### Paramètres

*speechSynthesizer*   \_In\_\
Type : XSpeechSynthesizerHandle

Spécifie le synthétiseur vocal qui utilisera la voix personnalisée.

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

ID de voix figurant dans une structure [XSpeechSynthesizerVoiceInformation](/fr/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation), retournée dans la fonction [XSpeechSynthesizerInstalledVoicesCallback](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback).

### Valeur de retour

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

Retourne **S\_OK** en cas de réussite ; sinon, retourne un code d'erreur. Pour obtenir la liste des codes d'erreur, consultez [Codes d'erreur](/fr/reference/errorcodes).

## Remarques

<Note>Cette fonction ne peut pas être appelée sans risque sur un thread à durée critique. Pour plus d'informations, consultez [Threads à durée critique](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

* Pour chaque voix installée, la structure [XSpeechSynthesizerVoiceInformation](/fr/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation) fournit l'ID de la voix, sa description, son texte d'affichage, son genre, sa langue et d'autres informations.

* Pour énumérer les voix installées sur l'appareil actuel et obtenir des informations à leur sujet, utilisez la fonction [XSpeechSynthesizerEnumerateInstalledVoices](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices) avec la fonction de rappel [XSpeechSynthesizerInstalledVoicesCallback](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback).

* Pour utiliser la voix système actuelle pour le synthétiseur vocal spécifié, appelez [XSpeechSynthesizerSetDefaultVoice](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice).

* Pour obtenir un exemple illustrant l'utilisation de la fonction **XSpeechSynthesizerSetCustomVoice**, consultez [XSpeechSynthesizerCreate](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate).

## Configuration requise

**En-tête :** XSpeechSynthesizer.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Documentation conceptuelle

* [Synthèse vocale](/fr/build/console-features/text-to-speech/text-to-speech)
* [Threads à durée critique](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Voir aussi

[XAccessibility](/fr/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCreateStreamFromText](/fr/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext)\
[XSpeechSynthesizer](/fr/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)


## Related topics

- [XSpeechSynthesizerSetCustomVoice](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md)
- [XSpeechSynthesizerEnumerateInstalledVoices](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices.md)
- [XSpeechSynthesizerInstalledVoicesCallback](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback.md)
