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

Side by Side Diff: chromeos/dbus/cras_audio_client_stub_impl.cc

Issue 478493002: Add ability to active multiple devices via the audio API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « chromeos/dbus/cras_audio_client_stub_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/cras_audio_client_stub_impl.h" 5 #include "chromeos/dbus/cras_audio_client_stub_impl.h"
6 6
7 namespace chromeos { 7 namespace chromeos {
8 8
9 CrasAudioClientStubImpl::CrasAudioClientStubImpl() 9 CrasAudioClientStubImpl::CrasAudioClientStubImpl()
10 : active_input_node_id_(0), 10 : active_input_node_id_(0),
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 else if (node_list_[i].id == node_id) 130 else if (node_list_[i].id == node_id)
131 node_list_[i].active = true; 131 node_list_[i].active = true;
132 } 132 }
133 active_input_node_id_ = node_id; 133 active_input_node_id_ = node_id;
134 FOR_EACH_OBSERVER(Observer, 134 FOR_EACH_OBSERVER(Observer,
135 observers_, 135 observers_,
136 ActiveInputNodeChanged(node_id)); 136 ActiveInputNodeChanged(node_id));
137 } 137 }
138 138
139 void CrasAudioClientStubImpl::AddActiveInputNode(uint64 node_id) { 139 void CrasAudioClientStubImpl::AddActiveInputNode(uint64 node_id) {
140 for (size_t i = 0; i < node_list_.size(); ++i) {
141 if (node_list_[i].id == node_id)
142 node_list_[i].active = true;
143 }
140 } 144 }
141 145
142 void CrasAudioClientStubImpl::RemoveActiveInputNode(uint64 node_id) { 146 void CrasAudioClientStubImpl::RemoveActiveInputNode(uint64 node_id) {
147 for (size_t i = 0; i < node_list_.size(); ++i) {
148 if (node_list_[i].id == node_id)
149 node_list_[i].active = false;
150 }
151 }
152
153 void CrasAudioClientStubImpl::AddActiveOutputNode(uint64 node_id) {
154 for (size_t i = 0; i < node_list_.size(); ++i) {
155 if (node_list_[i].id == node_id)
156 node_list_[i].active = true;
157 }
158 }
159
160 void CrasAudioClientStubImpl::RemoveActiveOutputNode(uint64 node_id) {
161 for (size_t i = 0; i < node_list_.size(); ++i) {
162 if (node_list_[i].id == node_id)
163 node_list_[i].active = false;
164 }
143 } 165 }
144 166
145 void CrasAudioClientStubImpl::SetAudioDevices( 167 void CrasAudioClientStubImpl::SetAudioDevices(
146 const AudioNodeList& audio_nodes) { 168 const AudioNodeList& audio_nodes) {
147 node_list_.clear(); 169 node_list_.clear();
148 for (size_t i = 0; i < audio_nodes.size(); ++i) 170 for (size_t i = 0; i < audio_nodes.size(); ++i)
149 node_list_.push_back(audio_nodes[i]); 171 node_list_.push_back(audio_nodes[i]);
150 } 172 }
151 173
152 void CrasAudioClientStubImpl::ChangeAudioNodes(const AudioNodeList& new_nodes) { 174 void CrasAudioClientStubImpl::ChangeAudioNodes(const AudioNodeList& new_nodes) {
153 SetAudioDevices(new_nodes); 175 SetAudioDevices(new_nodes);
154 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); 176 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
155 } 177 }
156 178
157 } // namespace chromeos 179 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/cras_audio_client_stub_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698