OLD | NEW |
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 * 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // nodes reference all nodes they're connected to. All nodes are ultimately | 232 // nodes reference all nodes they're connected to. All nodes are ultimately |
233 // connected to the AudioDestinationNode. When the context release a source | 233 // connected to the AudioDestinationNode. When the context release a source |
234 // node, it will be deactivated from the rendering graph along with all | 234 // node, it will be deactivated from the rendering graph along with all |
235 // other nodes it is uniquely connected to. | 235 // other nodes it is uniquely connected to. |
236 void notifySourceNodeStartedProcessing(AudioNode*); | 236 void notifySourceNodeStartedProcessing(AudioNode*); |
237 // When a source node has no more processing to do (has finished playing), | 237 // When a source node has no more processing to do (has finished playing), |
238 // this method tells the context to release the corresponding node. | 238 // this method tells the context to release the corresponding node. |
239 void notifySourceNodeFinishedProcessing(AudioHandler*); | 239 void notifySourceNodeFinishedProcessing(AudioHandler*); |
240 | 240 |
241 // Called at the start of each render quantum. | 241 // Called at the start of each render quantum. |
242 void handlePreRenderTasks(); | 242 void handlePreRenderTasks(const AudioIOPosition& outputPosition); |
243 | 243 |
244 // Called at the end of each render quantum. | 244 // Called at the end of each render quantum. |
245 void handlePostRenderTasks(); | 245 void handlePostRenderTasks(); |
246 | 246 |
247 // Called periodically at the end of each render quantum to release finished | 247 // Called periodically at the end of each render quantum to release finished |
248 // source nodes. | 248 // source nodes. |
249 void releaseFinishedSourceNodes(); | 249 void releaseFinishedSourceNodes(); |
250 | 250 |
251 // Keeps track of the number of connections made. | 251 // Keeps track of the number of connections made. |
252 void incrementConnectionCount() { | 252 void incrementConnectionCount() { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 void rejectPendingDecodeAudioDataResolvers(); | 341 void rejectPendingDecodeAudioDataResolvers(); |
342 | 342 |
343 // If any, unlock user gesture requirements if a user gesture is being | 343 // If any, unlock user gesture requirements if a user gesture is being |
344 // processed. | 344 // processed. |
345 void maybeUnlockUserGesture(); | 345 void maybeUnlockUserGesture(); |
346 | 346 |
347 // Returns whether the AudioContext is allowed to start rendering. | 347 // Returns whether the AudioContext is allowed to start rendering. |
348 bool isAllowedToStart() const; | 348 bool isAllowedToStart() const; |
349 | 349 |
| 350 AudioIOPosition outputPosition(); |
| 351 |
350 private: | 352 private: |
351 friend class BaseAudioContextTest; | 353 friend class BaseAudioContextTest; |
352 | 354 |
353 // Do not change the order of this enum, it is used for metrics. | 355 // Do not change the order of this enum, it is used for metrics. |
354 enum AutoplayStatus { | 356 enum AutoplayStatus { |
355 // The AudioContext failed to activate because of user gesture requirements. | 357 // The AudioContext failed to activate because of user gesture requirements. |
356 AutoplayStatusFailed = 0, | 358 AutoplayStatusFailed = 0, |
357 // Same as AutoplayStatusFailed but start() on a node was called with a user | 359 // Same as AutoplayStatusFailed but start() on a node was called with a user |
358 // gesture. | 360 // gesture. |
359 AutoplayStatusFailedWithStart = 1, | 361 AutoplayStatusFailedWithStart = 1, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 Member<PeriodicWave> m_periodicWaveSine; | 445 Member<PeriodicWave> m_periodicWaveSine; |
444 Member<PeriodicWave> m_periodicWaveSquare; | 446 Member<PeriodicWave> m_periodicWaveSquare; |
445 Member<PeriodicWave> m_periodicWaveSawtooth; | 447 Member<PeriodicWave> m_periodicWaveSawtooth; |
446 Member<PeriodicWave> m_periodicWaveTriangle; | 448 Member<PeriodicWave> m_periodicWaveTriangle; |
447 | 449 |
448 // This is considering 32 is large enough for multiple channels audio. | 450 // This is considering 32 is large enough for multiple channels audio. |
449 // It is somewhat arbitrary and could be increased if necessary. | 451 // It is somewhat arbitrary and could be increased if necessary. |
450 enum { MaxNumberOfChannels = 32 }; | 452 enum { MaxNumberOfChannels = 32 }; |
451 | 453 |
452 Optional<AutoplayStatus> m_autoplayStatus; | 454 Optional<AutoplayStatus> m_autoplayStatus; |
| 455 AudioIOPosition m_outputPosition; |
453 }; | 456 }; |
454 | 457 |
455 } // namespace blink | 458 } // namespace blink |
456 | 459 |
457 #endif // BaseAudioContext_h | 460 #endif // BaseAudioContext_h |
OLD | NEW |