CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Object: SpAudioFormat
Type: Hidden

GetWaveFormatEx Method

The GetWaveFormatEx method gets the audio format as an SpWaveFormatEx object.

Non-standard formats using wav files should use GetWaveFormatEx to retrieve formats.


SpAudioFormat.GetWaveFormatEx() As SpWaveFormatEx

Parameters

None.

Return Value

The GetWaveFormatEx method returns an SpWaveFormatEx variable.


Example

The following Visual Basic form code demonstrates the use of the GetWaveFormatEx and SetWaveFormatEx properties. To run this code, create a form with the following controls:

  • Two command buttons called Command1 and Command2
  • Paste this code into the Declarations section of the form.

    The Command1 procedure creates an SpAudioFormat object and sets it to the audio format SAFT22kHz16BitStereo. It then gets the format object's SpWaveFormatEx object and displays the properties. The code then changes the format of the SpAudioFormat object to SAFT11kHz16BitMono, gets a new SpWaveFormatEx object and displays its properties again. Note that the SpWaveFormatEx properties have changed to reflect the new audio format.

    The Command2 procedure creates an SpAudioFormat object and sets it to the audio format SAFT22kHz16BitStereo. It then gets the format object's SpWaveFormatEx object and displays the properties. The code then changes the properties of the SpWaveFormatEx object to match the SAFT11kHz16BitMono format and sets the format of the SpAudioFormat object with the SetWaveFormatEx method. Note that the SpAudioFormat object's Type property has changed to SAFT11kHz16BitMono to reflect the new SpWaveFormatEx properties.


    Option Explicit
    
    Dim F As SpeechLib.SpAudioFormat
    Dim W As SpeechLib.SpWaveFormatEx
    
    Private Sub Command1_Click()
    
        'Create an empty SpAudioFormat object
        'Set it to the default format
        'Get its format in an SpWaveFormatEx object
        Set F = New SpAudioFormat
        F.Type = SAFT22kHz16BitStereo
        Set W = F.GetWaveFormatEx
        
        Debug.Print
        Debug.Print "Default SpAudioFormat and SpWaveFormatEx"
        Debug.Print "Format:        SAFT22kHz16BitStereo"
        Debug.Print "Format code:   " & F.Type
        Debug.Print "AvgBytesPerSec " & W.AvgBytesPerSec
        Debug.Print "BitsPerSample  " & W.BitsPerSample
        Debug.Print "BlockAlign     " & W.BlockAlign
        Debug.Print "Channels       " & W.Channels
        Debug.Print "ExtraData      " & W.ExtraData
        Debug.Print "FormatTag      " & W.FormatTag
        Debug.Print "SamplesPerSec  " & W.SamplesPerSec
        
        'Give the SpAudioFormat object an audio type
        'Get its format in an SpWaveFormatEx object
        F.Type = SAFT11kHz16BitMono
        Set W = F.GetWaveFormatEx
        
        Debug.Print
        Debug.Print "Changing SpAudioFormat changes SpWaveFormatEx"
        Debug.Print "Format:        SAFT11kHz16BitMono"
        Debug.Print "Format code:   " & F.Type
        Debug.Print "AvgBytesPerSec " & W.AvgBytesPerSec
        Debug.Print "BitsPerSample  " & W.BitsPerSample
        Debug.Print "BlockAlign     " & W.BlockAlign
        Debug.Print "Channels       " & W.Channels
        Debug.Print "ExtraData      " & W.ExtraData
        Debug.Print "FormatTag      " & W.FormatTag
        Debug.Print "SamplesPerSec  " & W.SamplesPerSec
    
    End Sub
    
    Private Sub Command2_Click()
    
        'Create an empty SpAudioFormat object
        'Set it to the default format
        'Get its format in an SpWaveFormatEx object
        
        Set F = New SpAudioFormat
        F.Type = SAFT22kHz16BitStereo
        Set W = F.GetWaveFormatEx
        
        Debug.Print
        Debug.Print "Default SpAudioFormat and SpWaveFormatEx:"
        Debug.Print "Format:        SAFT22kHz16BitStereo"
        Debug.Print "Format code:   " & F.Type
        Debug.Print "AvgBytesPerSec " & W.AvgBytesPerSec
        Debug.Print "BitsPerSample  " & W.BitsPerSample
        Debug.Print "BlockAlign     " & W.BlockAlign
        Debug.Print "Channels       " & W.Channels
        Debug.Print "ExtraData      " & W.ExtraData
        Debug.Print "FormatTag      " & W.FormatTag
        Debug.Print "SamplesPerSec  " & W.SamplesPerSec
        
        'Set SpWaveFormatEx properties as in SAFT11kHz16BitMono format;
        'this will reset the SpAudioFormat Type.
        
        Debug.Print
        Debug.Print "Changing SpWaveFormatEx properties changes SpAudioFormat:"
        W.AvgBytesPerSec = 22050
        W.BitsPerSample = 16
        W.BlockAlign = 2
        W.Channels = 1
        W.SamplesPerSec = 11025
        
        Call F.SetWaveFormatEx(W)
        Debug.Print "Format code:   " & F.Type
    
    End Sub


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web