193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)/*
293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Copyright (C) 2013 Google Inc. All rights reserved.
393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *
493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * modification, are permitted provided that the following conditions
693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * are met:
793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *  * Redistributions of source code must retain the above copyright
893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *    notice, this list of conditions and the following disclaimer.
993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *  * Redistributions in binary form must reproduce the above copyright
1093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *    notice, this list of conditions and the following disclaimer in the
1193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *    documentation and/or other materials provided with the distribution.
1293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) *
1393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
1493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) */
2593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
2693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#ifndef WebSpeechSynthesisUtterance_h
2793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#define WebSpeechSynthesisUtterance_h
2893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
2993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebCommon.h"
3093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebPrivatePtr.h"
3193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebString.h"
3293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
3351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
3493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
35e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class PlatformSpeechSynthesisUtterance;
36e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
3793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class WebSpeechSynthesisUtterance {
3893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)public:
3993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    WebSpeechSynthesisUtterance() { }
4093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    WebSpeechSynthesisUtterance(const WebSpeechSynthesisUtterance& other) { assign(other); }
4193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    ~WebSpeechSynthesisUtterance() { reset(); }
4293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
4393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    WebSpeechSynthesisUtterance& operator=(const WebSpeechSynthesisUtterance& other)
4493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    {
4593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        assign(other);
4693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        return *this;
4793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    }
4893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
49a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT void assign(const WebSpeechSynthesisUtterance&);
50a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT void reset();
5193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    bool isNull() const { return m_private.isNull(); }
5293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
53a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT WebString text() const;
54a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT WebString lang() const;
55a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT WebString voice() const;
5693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
5793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    // As defined in: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
58a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT float volume() const; // 0...1, 1 is default
59a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT float rate() const; // 0.1...10, 1 is default
60a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT float pitch() const; // 0...2, 1 is default
6193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
62a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    BLINK_PLATFORM_EXPORT double startTime() const; // In seconds.
6393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
64a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#if INSIDE_BLINK
65e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    BLINK_PLATFORM_EXPORT WebSpeechSynthesisUtterance(PlatformSpeechSynthesisUtterance*);
66e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    BLINK_PLATFORM_EXPORT WebSpeechSynthesisUtterance& operator=(PlatformSpeechSynthesisUtterance*);
67e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    BLINK_PLATFORM_EXPORT operator PlatformSpeechSynthesisUtterance*() const;
6893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif
6993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
7093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)private:
71e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    WebPrivatePtr<PlatformSpeechSynthesisUtterance> m_private;
7293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)};
7393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
7451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
7593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)
7693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif // WebSpeechSynthesisUtterance_h
77