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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 "number of channels", | 60 "number of channels", |
61 numberOfChannels, | 61 numberOfChannels, |
62 0, | 62 0, |
63 ExceptionMessages::InclusiveBound, | 63 ExceptionMessages::InclusiveBound, |
64 AudioContext::maxNumberOfChannels(), | 64 AudioContext::maxNumberOfChannels(), |
65 ExceptionMessages::InclusiveBound)); | 65 ExceptionMessages::InclusiveBound)); |
66 return 0; | 66 return 0; |
67 } | 67 } |
68 | 68 |
69 if (!isSampleRateRangeGood(sampleRate)) { | 69 if (!isSampleRateRangeGood(sampleRate)) { |
70 exceptionState.throwDOMException(SyntaxError, "sample rate (" + String::
number(sampleRate) + ") must be in the range 44100-96000 Hz."); | 70 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange( |
71 return 0; | 71 "sampleRate", sampleRate, 3000.f, ExceptionMessages::InclusiveBound,
192000.f, ExceptionMessages::InclusiveBound)); |
| 72 return nullptr; |
72 } | 73 } |
73 | 74 |
74 OfflineAudioContext* audioContext = adoptRefCountedGarbageCollectedWillBeNoo
p(new OfflineAudioContext(document, numberOfChannels, numberOfFrames, sampleRate
)); | 75 OfflineAudioContext* audioContext = adoptRefCountedGarbageCollectedWillBeNoo
p(new OfflineAudioContext(document, numberOfChannels, numberOfFrames, sampleRate
)); |
75 | 76 |
76 if (!audioContext->destination()) { | 77 if (!audioContext->destination()) { |
77 exceptionState.throwDOMException( | 78 exceptionState.throwDOMException( |
78 NotSupportedError, | 79 NotSupportedError, |
79 "OfflineAudioContext(" + String::number(numberOfChannels) | 80 "OfflineAudioContext(" + String::number(numberOfChannels) |
80 + ", " + String::number(numberOfFrames) | 81 + ", " + String::number(numberOfFrames) |
81 + ", " + String::number(sampleRate) | 82 + ", " + String::number(sampleRate) |
(...skipping 10 matching lines...) Expand all Loading... |
92 ScriptWrappable::init(this); | 93 ScriptWrappable::init(this); |
93 } | 94 } |
94 | 95 |
95 OfflineAudioContext::~OfflineAudioContext() | 96 OfflineAudioContext::~OfflineAudioContext() |
96 { | 97 { |
97 } | 98 } |
98 | 99 |
99 } // namespace blink | 100 } // namespace blink |
100 | 101 |
101 #endif // ENABLE(WEB_AUDIO) | 102 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |