locked
Do I need to call flush or SpeechSynthesisStream? RRS feed

  • Question

  • I'm planning to use a static speech synthesis class with static fields for SpeechSynthesizer, SpeechSynthesizerStream, and Media Element. Should I call flush when the media element is finished playing the stream or, since it's a static field, will it be overwritten the next time that speech is called.

    Another matter of opinion is whether I should have the class as static at all, or make the stream a method variable and flush it.


    Michael DiLeo

    Sunday, February 2, 2014 10:45 PM

Answers

  • Hi Michael,

    Is it a long time speech? Take a look at: Optimize media resources, flush is necessary if your SpeechSynthesisStream is big enough.

    Media files are some of the most common and expensive resources apps typically use. Because media file resources can greatly increase the size of your app's memory footprint, you must remember to release the handle to media as soon as the app is finished using it. 

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by mcd023 Monday, February 3, 2014 3:26 PM
    Monday, February 3, 2014 3:25 AM
    Moderator

All replies

  • Hi Michael,

    Is it a long time speech? Take a look at: Optimize media resources, flush is necessary if your SpeechSynthesisStream is big enough.

    Media files are some of the most common and expensive resources apps typically use. Because media file resources can greatly increase the size of your app's memory footprint, you must remember to release the handle to media as soon as the app is finished using it. 

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by mcd023 Monday, February 3, 2014 3:26 PM
    Monday, February 3, 2014 3:25 AM
    Moderator
  • Thanks, the audio streams are only a few seconds long, so I guess I'll be fine since I plan to reuse the stream object.

    Michael DiLeo

    Monday, February 3, 2014 3:27 PM