Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: Source/modules/webaudio/DefaultAudioDestinationNode.cpp

Issue 625363004: Implement suspend/resume for AudioContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update according to new webaudio spec Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 { 83 {
84 float hardwareSampleRate = AudioDestination::hardwareSampleRate(); 84 float hardwareSampleRate = AudioDestination::hardwareSampleRate();
85 WTF_LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate); 85 WTF_LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
86 86
87 m_destination = AudioDestination::create(*this, m_inputDeviceId, m_numberOfI nputChannels, channelCount(), hardwareSampleRate); 87 m_destination = AudioDestination::create(*this, m_inputDeviceId, m_numberOfI nputChannels, channelCount(), hardwareSampleRate);
88 } 88 }
89 89
90 void DefaultAudioDestinationNode::startRendering() 90 void DefaultAudioDestinationNode::startRendering()
91 { 91 {
92 ASSERT(isInitialized()); 92 ASSERT(isInitialized());
93 if (isInitialized()) 93 if (isInitialized()) {
94 ASSERT(!m_destination->isPlaying());
94 m_destination->start(); 95 m_destination->start();
96 }
97 }
98
99 void DefaultAudioDestinationNode::stopRendering()
100 {
101 ASSERT(isInitialized());
102 if (isInitialized()) {
103 ASSERT(m_destination->isPlaying());
104 m_destination->stop();
105 }
95 } 106 }
96 107
97 unsigned long DefaultAudioDestinationNode::maxChannelCount() const 108 unsigned long DefaultAudioDestinationNode::maxChannelCount() const
98 { 109 {
99 return AudioDestination::maxChannelCount(); 110 return AudioDestination::maxChannelCount();
100 } 111 }
101 112
102 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex ceptionState& exceptionState) 113 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex ceptionState& exceptionState)
103 { 114 {
104 // The channelCount for the input to this node controls the actual number of channels we 115 // The channelCount for the input to this node controls the actual number of channels we
(...skipping 16 matching lines...) Expand all
121 // Re-create destination. 132 // Re-create destination.
122 m_destination->stop(); 133 m_destination->stop();
123 createDestination(); 134 createDestination();
124 m_destination->start(); 135 m_destination->start();
125 } 136 }
126 } 137 }
127 138
128 } // namespace blink 139 } // namespace blink
129 140
130 #endif // ENABLE(WEB_AUDIO) 141 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/DefaultAudioDestinationNode.h ('k') | Source/modules/webaudio/OfflineAudioDestinationNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698