| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return nullptr; | 46 return nullptr; |
| 47 } | 47 } |
| 48 | 48 |
| 49 Document* document = toDocument(context); | 49 Document* document = toDocument(context); |
| 50 | 50 |
| 51 if (!numberOfFrames) { | 51 if (!numberOfFrames) { |
| 52 exceptionState.throwDOMException(SyntaxError, "number of frames cannot b
e zero."); | 52 exceptionState.throwDOMException(SyntaxError, "number of frames cannot b
e zero."); |
| 53 return nullptr; | 53 return nullptr; |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (numberOfChannels > 10) { | 56 if (numberOfChannels > AudioContext::maxNumberOfChannels()) { |
| 57 exceptionState.throwDOMException(SyntaxError, "number of channels (" + S
tring::number(numberOfChannels) + ") exceeds maximum (10)."); | 57 exceptionState.throwDOMException( |
| 58 IndexSizeError, |
| 59 ExceptionMessages::indexOutsideRange<unsigned>( |
| 60 "number of channels", |
| 61 numberOfChannels, |
| 62 0, |
| 63 ExceptionMessages::InclusiveBound, |
| 64 AudioContext::maxNumberOfChannels(), |
| 65 ExceptionMessages::InclusiveBound)); |
| 58 return nullptr; | 66 return nullptr; |
| 59 } | 67 } |
| 60 | 68 |
| 61 if (!isSampleRateRangeGood(sampleRate)) { | 69 if (!isSampleRateRangeGood(sampleRate)) { |
| 62 exceptionState.throwDOMException(SyntaxError, "sample rate (" + String::
number(sampleRate) + ") must be in the range 44100-96000 Hz."); | 70 exceptionState.throwDOMException(SyntaxError, "sample rate (" + String::
number(sampleRate) + ") must be in the range 44100-96000 Hz."); |
| 63 return nullptr; | 71 return nullptr; |
| 64 } | 72 } |
| 65 | 73 |
| 66 RefPtr<OfflineAudioContext> audioContext(adoptRef(new OfflineAudioContext(do
cument, numberOfChannels, numberOfFrames, sampleRate))); | 74 RefPtr<OfflineAudioContext> audioContext(adoptRef(new OfflineAudioContext(do
cument, numberOfChannels, numberOfFrames, sampleRate))); |
| 67 | 75 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 84 ScriptWrappable::init(this); | 92 ScriptWrappable::init(this); |
| 85 } | 93 } |
| 86 | 94 |
| 87 OfflineAudioContext::~OfflineAudioContext() | 95 OfflineAudioContext::~OfflineAudioContext() |
| 88 { | 96 { |
| 89 } | 97 } |
| 90 | 98 |
| 91 } // namespace WebCore | 99 } // namespace WebCore |
| 92 | 100 |
| 93 #endif // ENABLE(WEB_AUDIO) | 101 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |