TtsEngineSsml.GetOutputFormat(SpeakOutputFormat, IntPtr) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
特定の出力形式をサポートするために、シンセサイザー エンジンへの要求に対する特定の合成エンジンの応答でサポートされる最適な一致オーディオ出力を返します。
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
パラメーター
- speakOutputFormat
- SpeakOutputFormat
要求されたオーディオ出力形式の種類を示す SpeakOutputFormat 列挙体の有効なメンバー。
- targetWaveFormat
-
IntPtr
nativeint
struct引数によって要求されたオーディオ形式の種類の詳細設定を含むspeakOutputFormatへのポインター。
返品
nativeint
出力形式に関する詳細情報を含むIntPtrを参照する有効なstruct インスタンスを返します。
例
次のサンプル実装では、選択した入力が許容範囲内にある場合は使用され、それ以外の場合は既定値を使用して検証されます。
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;
}
注釈
targetWaveFormatとして使用され、メソッドによって返される構造体は、SAPI で使用可能なWAVEFORMATEXと互換性があり、戻り値はCoTaskMemAllocを使用して割り当てる必要があります。
structは、次に相当する機能を提供する必要があります。
internal struct WaveFormat
{
public Int16 FormatTag;
public Int16 Channels;
public int SamplesPerSec;
public int AvgBytesPerSec;
public Int16 BlockAlign;
public Int16 BitsPerSample;
public Int16 Size;
}
注意 (実装者)
TtsEngineSsmlから継承するオブジェクトは、targetWaveFormatで指定された要求された出力形式を調べて、サポートされている最も近い形式を返す必要があります。