OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "earcon_manager.h" | 9 #include "earcon_manager.h" |
10 #include "log.h" | 10 #include "log.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 delete[] old_audio_data; | 200 delete[] old_audio_data; |
201 frames += new_frames; | 201 frames += new_frames; |
202 } | 202 } |
203 | 203 |
204 pos += chunk_bytes + 8; | 204 pos += chunk_bytes + 8; |
205 } | 205 } |
206 | 206 |
207 if (frames && channels && rate) { | 207 if (frames && channels && rate) { |
208 return LoadEarcon(frames, audio_data.get(), channels, rate, loop); | 208 return LoadEarcon(frames, audio_data.get(), channels, rate, loop); |
209 } | 209 } |
| 210 return -1; |
210 } | 211 } |
211 | 212 |
212 void EarconManager::Play(int earcon_id) { | 213 void EarconManager::Play(int earcon_id) { |
213 earcons_[earcon_id].is_playing = true; | 214 earcons_[earcon_id].is_playing = true; |
214 earcons_[earcon_id].position = 0; | 215 earcons_[earcon_id].position = 0; |
215 } | 216 } |
216 | 217 |
217 void EarconManager::Stop(int earcon_id) { | 218 void EarconManager::Stop(int earcon_id) { |
218 earcons_[earcon_id].is_playing = false; | 219 earcons_[earcon_id].is_playing = false; |
219 } | 220 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 data[j] = value; | 257 data[j] = value; |
257 } | 258 } |
258 | 259 |
259 earcons_[i].position += count; | 260 earcons_[i].position += count; |
260 if (earcons_[i].position == earcons_[i].frame_count) | 261 if (earcons_[i].position == earcons_[i].frame_count) |
261 earcons_[i].is_playing = false; | 262 earcons_[i].is_playing = false; |
262 } | 263 } |
263 } | 264 } |
264 | 265 |
265 } // namespace speech_synthesis | 266 } // namespace speech_synthesis |
OLD | NEW |