TtsEngineSsml.GetOutputFormat(SpeakOutputFormat, IntPtr) 메서드

정의

신시사이저 엔진의 특정 출력 형식 지원 요청에 응답하는 지정된 synthesize 엔진에서 지원한 최적의 오디오 출력을 반환합니다.

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

speakOutputFormat 인수에서 표현하는 오디오 형식에 대한 자세한 설정을 포함하는 struct에 대한 포인터입니다.

반환

IntPtr

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 반환한 및 메서드에 호환 없어야 합니다 WAVEFORMATEX SAPI, 사용할 수 있습니다를 사용 하 여 반환 된 값을 할당 해야 하 고 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 및 지원 되는 가장 가까운 형식을 반환 합니다.

적용 대상