OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate)) { | 70 if (!AudioUtilities::isValidAudioBufferSampleRate(sampleRate)) { |
71 exceptionState.throwDOMException( | 71 exceptionState.throwDOMException( |
72 IndexSizeError, | 72 IndexSizeError, |
73 ExceptionMessages::indexOutsideRange( | 73 ExceptionMessages::indexOutsideRange( |
74 "sampleRate", sampleRate, | 74 "sampleRate", sampleRate, |
75 AudioUtilities::minAudioBufferSampleRate(), ExceptionMessages::I
nclusiveBound, | 75 AudioUtilities::minAudioBufferSampleRate(), ExceptionMessages::I
nclusiveBound, |
76 AudioUtilities::maxAudioBufferSampleRate(), ExceptionMessages::I
nclusiveBound)); | 76 AudioUtilities::maxAudioBufferSampleRate(), ExceptionMessages::I
nclusiveBound)); |
77 return nullptr; | 77 return nullptr; |
78 } | 78 } |
79 | 79 |
80 OfflineAudioContext* audioContext = adoptRefCountedGarbageCollectedWillBeNoo
p(new OfflineAudioContext(document, numberOfChannels, numberOfFrames, sampleRate
)); | 80 OfflineAudioContext* audioContext = new OfflineAudioContext(document, number
OfChannels, numberOfFrames, sampleRate); |
81 | 81 |
82 if (!audioContext->destination()) { | 82 if (!audioContext->destination()) { |
83 exceptionState.throwDOMException( | 83 exceptionState.throwDOMException( |
84 NotSupportedError, | 84 NotSupportedError, |
85 "OfflineAudioContext(" + String::number(numberOfChannels) | 85 "OfflineAudioContext(" + String::number(numberOfChannels) |
86 + ", " + String::number(numberOfFrames) | 86 + ", " + String::number(numberOfFrames) |
87 + ", " + String::number(sampleRate) | 87 + ", " + String::number(sampleRate) |
88 + ")"); | 88 + ")"); |
89 } | 89 } |
90 | 90 |
91 audioContext->suspendIfNeeded(); | 91 audioContext->suspendIfNeeded(); |
92 return audioContext; | 92 return audioContext; |
93 } | 93 } |
94 | 94 |
95 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh
annels, size_t numberOfFrames, float sampleRate) | 95 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh
annels, size_t numberOfFrames, float sampleRate) |
96 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) | 96 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) |
97 { | 97 { |
98 } | 98 } |
99 | 99 |
100 OfflineAudioContext::~OfflineAudioContext() | 100 OfflineAudioContext::~OfflineAudioContext() |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 } // namespace blink | 104 } // namespace blink |
105 | 105 |
106 #endif // ENABLE(WEB_AUDIO) | 106 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |