TtsEngineSsml.GetOutputFormat(SpeakOutputFormat, IntPtr) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Gibt die am besten übereinstimmende Audioausgabe zurück, die von einer bestimmten Synthesizermodulantwort auf eine Anforderung an das Synthesizermodul unterstützt wird, um ein bestimmtes Ausgabeformat zu unterstützen.
public:
abstract IntPtr GetOutputFormat(System::Speech::Synthesis::TtsEngine::SpeakOutputFormat speakOutputFormat, IntPtr targetWaveFormat);
public abstract IntPtr GetOutputFormat(System.Speech.Synthesis.TtsEngine.SpeakOutputFormat speakOutputFormat, IntPtr targetWaveFormat);
abstract member GetOutputFormat : System.Speech.Synthesis.TtsEngine.SpeakOutputFormat * nativeint -> nativeint
Public MustOverride Function GetOutputFormat (speakOutputFormat As SpeakOutputFormat, targetWaveFormat As IntPtr) As IntPtr
Parameter
- speakOutputFormat
- SpeakOutputFormat
Gültiges Element der SpeakOutputFormat Enumeration, das den Typ des angeforderten Audioausgabeformats angibt.
- targetWaveFormat
-
IntPtr
nativeint
Ein Zeiger auf eine struct enthaltende Detaileinstellung für den vom speakOutputFormat Argument angeforderten Audioformattyp.
Gibt zurück
nativeint
Gibt eine gültige IntPtr Instanz zurück, die auf eine struct ausführliche Informationen zum Ausgabeformat verweist.
Beispiele
Die nachstehende Beispielimplementierung überprüft ausgewählte Eingaben und verwendet diese, wenn sie sich innerhalb von Toleranzen befinden, andernfalls Standardwerte.
public IntPtr GetOutputFormat(SpeakOutputFormat format, IntPtr targetWaveFormat) {
WaveFormat waveFormat = new WaveFormat();
WaveFormat rq=new WaveFormat();
Marshal.PtrToStructure(targetWaveFormat,rq);
waveFormat.AvgBytesPerSec = AvgBytesPerSec Min < rq.AvgBytesPerSec && rq.AvgBytesPerSec < AvgBytesPerSecMax? rq.AvgBytesPerSec : 3200;
waveFormat.BitsPerSample = BitsPerSampleMin < rq.AvgBytesPerSec && rq.BitsPerSample < BitsPerSampleMax ? rq.AvgBytesPerSec : 3200; 16;
waveFormat.BlockAlign = 2;
waveFormat.Channels = 1;
waveFormat.FormatTag = 1;
waveFormat.SamplesPerSec = 16000;
waveFormat.Size = 0;
IntPtr wfx = Marshal.AllocCoTaskMem(Marshal.SizeOf(waveFormat));
Marshal.StructureToPtr(waveFormat, wfx, false);
//Console.WriteLine ("GetOutputFormat called");
return wfx;
}
internal struct WaveFormat {
public Int16 FormatTag;
public Int16 Channels;
public int SamplesPerSec;
public int AvgBytesPerSec;
public Int16 BlockAlign;
public Int16 BitsPerSample;
public Int16 Size;
}
Hinweise
Die von der Methode verwendete targetWaveFormat Und zurückgegebene Struktur sollte mit dem WAVEFORMATEX verfügbaren unter SAPI kompatibel sein, und der zurückgegebene Wert sollte mit CoTaskMemAlloczugewiesen werden.
Die struct Funktionalität muss für Folgendes bereitgestellt werden:
internal struct WaveFormat
{
public Int16 FormatTag;
public Int16 Channels;
public int SamplesPerSec;
public int AvgBytesPerSec;
public Int16 BlockAlign;
public Int16 BitsPerSample;
public Int16 Size;
}
Hinweise für Ausführende
Objekt, von TtsEngineSsml dem geerbt wird, sollte das angeforderte Ausgabeformat wie angegeben targetWaveFormat untersuchen und das nächstgelegene Format zurückgeben, das unterstützt wird.