Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  WebAudioUtils.cpp

  Sprache: C
 

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


#include "WebAudioUtils.h"

#include "blink/HRTFDatabaseLoader.h"
#include "mozilla/SchedulerGroup.h"
#include "nsComponentManagerUtils.h"
#include "nsContentUtils.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsJSUtils.h"
#include "nsServiceManagerUtils.h"

namespace mozilla {

LazyLogModule gWebAudioAPILog("WebAudioAPI");

namespace dom {

void WebAudioUtils::Shutdown() { WebCore::HRTFDatabaseLoader::shutdown(); }

int WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler,
                                         uint32_t aChannel, const float* aIn,
                                         uint32_t* aInLen, float* aOut,
                                         uint32_t* aOutLen) {
  return speex_resampler_process_float(aResampler, aChannel, aIn, aInLen, aOut,
                                       aOutLen);
}

int WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler,
                                         uint32_t aChannel, const int16_t* aIn,
                                         uint32_t* aInLen, float* aOut,
                                         uint32_t* aOutLen) {
  AutoTArray<AudioDataValue, WEBAUDIO_BLOCK_SIZE * 4> tmp;
  tmp.SetLength(*aInLen);
  ConvertAudioSamples(aIn, tmp.Elements(), *aInLen);
  int result = speex_resampler_process_float(
      aResampler, aChannel, tmp.Elements(), aInLen, aOut, aOutLen);
  return result;
}

int WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler,
                                         uint32_t aChannel, const int16_t* aIn,
                                         uint32_t* aInLen, int16_t* aOut,
                                         uint32_t* aOutLen) {
  AutoTArray<AudioDataValue, WEBAUDIO_BLOCK_SIZE * 4> tmp1;
  AutoTArray<AudioDataValue, WEBAUDIO_BLOCK_SIZE * 4> tmp2;
  tmp1.SetLength(*aInLen);
  tmp2.SetLength(*aOutLen);
  ConvertAudioSamples(aIn, tmp1.Elements(), *aInLen);
  int result = speex_resampler_process_float(
      aResampler, aChannel, tmp1.Elements(), aInLen, tmp2.Elements(), aOutLen);
  ConvertAudioSamples(tmp2.Elements(), aOut, *aOutLen);
  return result;
}

void WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID,
                                          const char* aKey) {
  // This implementation is derived from dom/media/VideoUtils.cpp, but we
  // use a windowID so that the message is delivered to the developer console.
  // It is similar to ContentUtils::ReportToConsole, but also works off main
  // thread.
  if (!NS_IsMainThread()) {
    nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction(
        "dom::WebAudioUtils::LogToDeveloperConsole",
        [aWindowID, aKey] { LogToDeveloperConsole(aWindowID, aKey); });
    SchedulerGroup::Dispatch(task.forget());
    return;
  }

  nsAutoString result;
  nsresult rv = nsContentUtils::GetLocalizedString(
      PropertiesFile::DOM_PROPERTIES, aKey, result);

  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to log message to console.");
    return;
  }

  nsContentUtils::ReportToConsoleByWindowID(result, nsIScriptError::warningFlag,
                                            "Web Audio"_ns, aWindowID);
}

}  // namespace dom
}  // namespace mozilla

Messung V0.5 in Prozent
C=95 H=84 G=89

¤ Dauer der Verarbeitung: 0.3 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002