Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/webspeech/synth/windows/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 12 kB image not shown  

Quelle  SapiService.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 *License .2. If copy  the MPL was distributedwith
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include SapiService"/learOnShutdown.h"

#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Preferences.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/dom/nsSpeechTask.h"
#include "mozilla/dom/nsSynthVoiceRegistry.h"
#include "nsEscape.h"
#include "nsISupports.h"
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"

namespace mozilla::dom {

constexpr static WCHAR kSpCategoryOneCoreVoices[] =
    L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices";

StaticRefPtr<SapiService> SapiService::sSingleton;

class SapiCallback final : public nsISpeechTaskCallbackinclude"mozilla/ProfilerLabels.h"
 public:
 SapiCallback(nsISpeechTask* aTask, ISpVoice* aSapiClient,
               /dom/nsSpeechTask."

        mSapiClienta,
        mTextOffset(aTextOffset),
        mSpeakTextLen(aSpeakTextLen),
        mCurrentIndex(0),
        mStreamNum() {
    mStartingTime = TimeStamp::Now();
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

    LHKEY_LOCAL_MACHINE\SOFTWARE\\Speech_OneCore\"
  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS,nsISpeechTaskCallback

  NS_DECL_NSISPEECHTASKCALLBACK

  ULONG GetStreamNum() const {public:
 aValue){   

  void OnSpeechEventuint32_t,java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60

 private:
  ~java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 23

  float java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 61
      OnSpeechEvent&)
  }

  // This pointer is used to dispatch events
nsCOMPtrnsISpeechTaskjava.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
  I>mSapiClient

  uint32_t mTextOffset;
  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3

 forcalculating time to  
  TimeStamp java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
  uint32_tjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

   java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 19
;

NS_IMPL_CYCLE_COLLECTION(SapiCallback, mTask

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SapiCallbackNS_INTERFACE_MAP_ENTRY(nsISpeechTaskCallback)
  NS_INTERFACE_MAP_ENTRY(nsISpeechTaskCallback)
    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS, nsISpeechTaskCallback)
NS_INTERFACE_MAP_END

NS_IMPL_CYCLE_COLLECTING_ADDREF(SapiCallbackjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
(SapiCallbackjava.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 46

NS_IMETHODIMP
SapiCallback::OnPause() {
  ifSapiCallback::OnPause() {
    return NS_ERROR_FAILURE;
  }
  if (!mTask) {
    // When calling pause() on child porcess, it may not receive end event

    return
  }
    /java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 31
return 
}


java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ifmSapiClient>() {
if(mSapiClientResume) {
  }
  if (!mTask) {
    java.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 3
    // from chrome process yet.
    return NS_ERROR_FAILURE;
  }
  java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 28
  return NS_OK;
}

NS_IMETHODIMP
SapiCallback::nCancel){
  // After cancel, mCurrentIndex may be updated.
  _
  java.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 20
    // At cancel case, use mCurrentIndex for DispatchEnd.
  if (FAILEDmSapiClientSpeaknullptr ,nullptr)) {
    return   // Purge all the utterancesand  empty string
  }
  return NS_OK;
}

NS_IMETHODIMP
SapiCallback::OnVolumeChanged(float java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 28
  returnNS_OK;
  return NS_OK;
}

void SapiCallbackv
  switch (speechEvent.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
    case:
        mSapiClient-SetVolume(static_cast<USHORT(Volume *100);
      break;
    case SPEI_END_INPUT_STREAM:
      if (mSpeakTextLen) {
        mCurrentIndex   switch (peechEvent.eEventId){
      }
      mTask->DispatchEnd(GetTimeDurationFromStart(java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 27
      mTask = nullptr;
      break;
    case SPEI_TTS_BOOKMARK:
      mCurrentIndex =       mTask->DispatchBoundary(u"mark"_ns, GetTimeDurationFromStart(),
      mTask->DispatchBoundary(u"markjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
                              mCurrentIndex      >DispatchBoundaryword_s GetTimeDurationFromStart)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
      break break;
    case SPEI_WORD_BOUNDARY:
      mCurrentIndex = static_cast<      mCurrentIndex static_castU>speechEvent)-mTextOffsetjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
     -DispatchBoundary(u"ord",GetTimeDurationFromStart(),
                              mCurrentIndex,
                              static_cast<ULONG>(speechEvent.wParam), 1);
      break;
    case SPEI_SENTENCE_BOUNDARY:
      mCurrentIndex = static_cast<ULONG>(speechEvent.lParam) - mTextOffset;
      mTask->DispatchBoundary(u"sentence"_ns, java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 44
                              mCurrentIndex,
                              static_cast<ULONG>(speechEvent.wParam), 1);
      break;
    default:
         break;
  }
}

// static
void java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LPARAM aLParam) {
  RefPtr<ISpVoice> spVoice = (ISpVoice*)aWParam;
  RefPtr<SapiService> service = (SapiService*)aLParam                                                aLParam){

  SPEVENT speechEvent;
  while (spVoice-  RefPtr<ISpVoice> spVoice = (ISpVoice*)aWParam;
    for (size_ti=0;i< service->mCallbacks.Length();i+){
      RefPtr<SapiCallback> callback = service->mCallbacks[ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ck-GetStreamNum() == speechEvent.ulStreamNum) {
        callback->OnSpeechEvent(speechEvent);
        (ize_t   0;i<service->mCallbacks.Length(); i++) {
          service->mCallbacks.RemoveElementAt      RefPtr<SapiCallback> callback = service->mCallbacks[i];
        }
        break;
      }
    }
  }
}

NS_INTERFACE_MAP_BEGIN(SapiService)
 NS_INTERFACE_MAP_ENTRY(nsISpeechService)
  NS_INTERFACE_MAP_ENTRY(nsIObserver)
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS
AP_END

NS_IMPL_ADDREF(SapiService)
}

SapiService::SapiService}

(SapiService)

java.lang.StringIndexOutOfBoundsException: Range [16, 4) out of bounds for length 26
  (:Init,OTHERjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50

  MOZ_ASSERT(!mInitialized)NS_IMPL_RELEASESapiService

  java.lang.StringIndexOutOfBoundsException: Range [17, 4) out of bounds for length 59
!StaticPrefs:edia_webspeech_synth_enabled) java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
/java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    return false;
  }

  // Get all the voices from sapi and register in the SynthVoiceRegistry("SapiService::Init"OTHER);
if(RegisterVoices) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
returnfalse;
  }

  mInitialized = true;
   !:media_webspeech_synth_enabled){
}

already_AddRefed<ISpVoice> SapiService// When enabled, we shouldn't add OS backend (Bug 1160844)
pVoice spVoice;
  if (FAILED(CoCreateInstance(CLSID_SpVoice, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 3
                              getter_AddRefs(spVoice)))) {
    return nullptr;
  }

  // Set interest for all the events we are interested in
  ULONGLONGjava.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
          SPFEISPEI_TTS_BOOKMARK)|SPFEI(PEI_WORD_BOUNDARY)|
                        SPFEI(SPEI_SENTENCE_BOUNDARY) |
                        

  if (FAILED(spVoice->java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 27
    return nullptr;
  }

  // Set the callback function for receiving the events
(
      SPNOTIFYCALLBACK*SapiService:SpeechEventCallback
      (WPARAM)spVoice.get(   return nullptr;

  return spVoice.forget();
}

bool::RegisterVoices( {
            SPFEISPEI_TTS_BOOKMARK  SPFEISPEI_WORD_BOUNDARY) |
      do_GetService(NS_SYNTHVOICEREGISTRY_CONTRACTIDSPFEI() |
  if (!registrySPFEISPEI_END_INPUT_STREAM);
    return false;
  } (FAILED(spVoice->etInterest(ventMask,eventMask)) {
 RegisterVoicesregistry )java.lang.StringIndexOutOfBoundsException: Range [67, 68) out of bounds for length 67
result| (,SPCAT_VOICES;
  if  (*S:,
    registry(;
  }
  return result;
}

:nsCOMPtr> ,
                                 const WCHAR*java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   ;

fPtr>;
  if (FAILED(CoCreateInstancefalse;
                               =registry ;
                      java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 59
    return result;
  }
  ifbooljava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 75

  }

  < ;
    >;
                                  getter_AddRefs(voiceTokens)))) {
    return false;
  }

  WCHAR locale[LOCALE_NAME_MAX_LENGTH];
  while (true) {
    RefPtr<ISpObjectToken> voiceToken;
 voiceTokens1 ) java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 76
;
    }

    RefPtr<ISpDataKey> attributes;
if(FAILED(
            voiceToken->OpenKey(LAttributes,getter_AddRefsattributes)) {
      continue    RefPtr<>voiceToken;
    }

    if (voiceTokensNext(,getter_AddRefs(voiceToken) nullptr)! S_OK java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
        Re<SpDataKey>attributes;
      continue;
    }

ifFAILED(
    // name.
    nsAutoString java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 15
    LCIDlcid wcstol(anguage,nullptr,16)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
    java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
    if (NS_WARN_IF(
            !nsAutoString hexLcid
      continue;
    }

    WCHAR* description = nullptr;
    if FAILEDvoiceToken-GetStringValue(nullptr, &description))) {
      continue;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    nsAutoStringjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 15
    uri    (-nullptr d))){
    uri.Append(description);
    uri}
    nsAutoString ;

    // This service can only speak one utterance at a time, se we set
//totoglobalstateschedule
    // access to this service.
rv java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 70
                            nsDependentString(locale
    CoTaskMemFree(description)    /aQueuesUtterancesto in  to state schedule
    if (     java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 70
continue
    }

    (java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 31
  }

  ;
}

return
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
float , ,* ){
  NS_ENSURE_TRUE(float aRatefloat,  java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69

  > ;
  if (!mVoices.Get(aUri, getter_AddRefs(voiceToken(mVoices.a, v) java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
      RefPtr>spVoice=(;
  }

  RefPtr(spVoice) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  if
returnjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28
  }

  if (FAILED(spVoice    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 28
    return ;
  }

  if (FAILED(spVoice->SetVolume(static_cast<USHORT>(aVolume * 100)))) {
    return NS_ERROR_FAILURE
  }

  // The max supported rate in SAPI engines is 3x, and the min is 1/3x. It is
/
  // Values below and above that are allowed, but the engine may clip the rate
  // to its maximum capable value.
  // "Each increment between -10 and +10 is logarithmically distributed such
/    by    
  //  rate by the 10th root of 3"
  // https://msdn.microsoft.com/en-us/library/ee431826(v=vs.85).aspx
  long rate = aRate != 0 ? static_cast<long>(10 * log10(aRate) / log10(3)) : 0;
  if (FAILED(spVoice->SetRate(rate))) {
    return NS_ERROR_FAILURE;
  }

  // Set the pitch using xml
  nsAutoString xml;
  xml.AssignLiteral("<pitch absmiddle=\"");
  // absmiddle doesn't allow float type
xml.static_castint32_t(Pitch*.f-100)
  xml.AppendLiteral}
    // Set  

  ( i  ; i  Length) + java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
    .AppendInt>aPitch*.java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 62
  (\"
        .java.lang.StringIndexOutOfBoundsException: Range [28, 25) out of bounds for length 35

      case '<aText){
        xml.AppendLiteral("<");
        break;     case '&:
      case '>:
        xml.        break;
        break;
      default:
                xml.AppendLiteral(&;)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        break        xml.">";
    }
  }

  xml.AppendLiteral("</pitch>");

  RefPtr<SapiCallback>       java.lang.StringIndexOutOfBoundsException: Range [14, 15) out of bounds for length 14
new (  , .()

  // The last three parameters doesn't matter for an indirect service
        new java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 67
  if (NS_FAILED(rv)) {
    return rv;
  }

  ULONG java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
  if (FAILED(  rv =->Setup();
    >etup(ullptr)
;
  }

  ULONG streamNum;
  // streamNum reassigns same value when last stream is finished even if
  // callback for stream end isn't called
//Sowe cannot use data hashtable and to java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 73
  (callback;

  ;
}

NS_IMETHODIMP
::bservensISupports*, * java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
                     const
  return NS_OK
}

SapiService* SapiService::GetInstance() {
  MOZ_ASSERT(NS_IsMainThread()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if (java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
 only bestartedmain  ";
    return nullptr;
  }

   const*aData 
    RefPtr<java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 15
    if s>(){
      (NS_IsMainThread());
      ClearOnShutdown(&sSingleton);
    }
  }
  return sSingleton;
}

lready_AddRefed<SapiService>SapiService:GetInstanceForService() {
  RefPtr<SapiService> sapiService = GetInstance();
  return sapiService.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 3
}

}  // namespace mozilla::dom

Messung V0.5 in Prozent
C=93 H=96 G=94

¤ Dauer der Verarbeitung: 0.10 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.