Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBuffer.h

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and prefix use counter names with WebAudio Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/DOMTypedArray.h" 33 #include "core/dom/DOMTypedArray.h"
34 #include "modules/ModulesExport.h" 34 #include "modules/ModulesExport.h"
35 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include "wtf/build_config.h" 38 #include "wtf/build_config.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class AudioBus; 42 class AudioBus;
43 class AudioBufferOptions;
44 class BaseAudioContext;
43 class ExceptionState; 45 class ExceptionState;
44 46
45 class MODULES_EXPORT AudioBuffer final : public GarbageCollected<AudioBuffer>, p ublic ScriptWrappable { 47 class MODULES_EXPORT AudioBuffer final : public GarbageCollected<AudioBuffer>, p ublic ScriptWrappable {
46 DEFINE_WRAPPERTYPEINFO(); 48 DEFINE_WRAPPERTYPEINFO();
47 public: 49 public:
48 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate); 50 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
49 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); 51 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&);
52 static AudioBuffer* create(BaseAudioContext*, const AudioBufferOptions&, Exc eptionState&);
50 53
51 // Returns 0 if data is not a valid audio file. 54 // Returns 0 if data is not a valid audio file.
52 static AudioBuffer* createFromAudioFileData(const void* data, size_t dataSiz e, bool mixToMono, float sampleRate); 55 static AudioBuffer* createFromAudioFileData(const void* data, size_t dataSiz e, bool mixToMono, float sampleRate);
53 56
54 static AudioBuffer* createFromAudioBus(AudioBus*); 57 static AudioBuffer* createFromAudioBus(AudioBus*);
55 58
56 // Format 59 // Format
57 size_t length() const { return m_length; } 60 size_t length() const { return m_length; }
58 double duration() const { return length() / static_cast<double>(sampleRate() ); } 61 double duration() const { return length() / static_cast<double>(sampleRate() ); }
59 float sampleRate() const { return m_sampleRate; } 62 float sampleRate() const { return m_sampleRate; }
(...skipping 24 matching lines...) Expand all
84 87
85 float m_sampleRate; 88 float m_sampleRate;
86 size_t m_length; 89 size_t m_length;
87 90
88 HeapVector<Member<DOMFloat32Array>> m_channels; 91 HeapVector<Member<DOMFloat32Array>> m_channels;
89 }; 92 };
90 93
91 } // namespace blink 94 } // namespace blink
92 95
93 #endif // AudioBuffer_h 96 #endif // AudioBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698