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 27 matching lines...) Expand all Loading... |
38 { | 38 { |
39 // FIXME: add support for workers. | 39 // FIXME: add support for workers. |
40 if (!context || !context->isDocument()) { | 40 if (!context || !context->isDocument()) { |
41 ec = NotSupportedError; | 41 ec = NotSupportedError; |
42 return 0; | 42 return 0; |
43 } | 43 } |
44 | 44 |
45 Document* document = toDocument(context); | 45 Document* document = toDocument(context); |
46 | 46 |
47 if (numberOfChannels > 10 || !isSampleRateRangeGood(sampleRate)) { | 47 if (numberOfChannels > 10 || !isSampleRateRangeGood(sampleRate)) { |
48 ec = SYNTAX_ERR; | 48 ec = SyntaxError; |
49 return 0; | 49 return 0; |
50 } | 50 } |
51 | 51 |
52 RefPtr<OfflineAudioContext> audioContext(adoptRef(new OfflineAudioContext(do
cument, numberOfChannels, numberOfFrames, sampleRate))); | 52 RefPtr<OfflineAudioContext> audioContext(adoptRef(new OfflineAudioContext(do
cument, numberOfChannels, numberOfFrames, sampleRate))); |
53 audioContext->suspendIfNeeded(); | 53 audioContext->suspendIfNeeded(); |
54 return audioContext.release(); | 54 return audioContext.release(); |
55 } | 55 } |
56 | 56 |
57 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh
annels, size_t numberOfFrames, float sampleRate) | 57 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh
annels, size_t numberOfFrames, float sampleRate) |
58 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) | 58 : AudioContext(document, numberOfChannels, numberOfFrames, sampleRate) |
59 { | 59 { |
60 ScriptWrappable::init(this); | 60 ScriptWrappable::init(this); |
61 } | 61 } |
62 | 62 |
63 OfflineAudioContext::~OfflineAudioContext() | 63 OfflineAudioContext::~OfflineAudioContext() |
64 { | 64 { |
65 } | 65 } |
66 | 66 |
67 } // namespace WebCore | 67 } // namespace WebCore |
68 | 68 |
69 #endif // ENABLE(WEB_AUDIO) | 69 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |