OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // AlsaWrapper is a simple stateless class that wraps the alsa library commands | 5 // AlsaWrapper is a simple stateless class that wraps the alsa library commands |
6 // we want to use. It's purpose is to allow injection of a mock so that the | 6 // we want to use. It's purpose is to allow injection of a mock so that the |
7 // higher level code is testable. | 7 // higher level code is testable. |
8 | 8 |
9 #include <alsa/asoundlib.h> | 9 #include <alsa/asoundlib.h> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 virtual int PcmOpen(snd_pcm_t** handle, const char* name, | 22 virtual int PcmOpen(snd_pcm_t** handle, const char* name, |
23 snd_pcm_stream_t stream, int mode); | 23 snd_pcm_stream_t stream, int mode); |
24 virtual int PcmClose(snd_pcm_t* handle); | 24 virtual int PcmClose(snd_pcm_t* handle); |
25 virtual int PcmPrepare(snd_pcm_t* handle); | 25 virtual int PcmPrepare(snd_pcm_t* handle); |
26 virtual int PcmDrop(snd_pcm_t* handle); | 26 virtual int PcmDrop(snd_pcm_t* handle); |
27 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay); | 27 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay); |
28 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle, | 28 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle, |
29 const void* buffer, | 29 const void* buffer, |
30 snd_pcm_uframes_t size); | 30 snd_pcm_uframes_t size); |
| 31 virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle, |
| 32 void* buffer, |
| 33 snd_pcm_uframes_t size); |
31 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent); | 34 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent); |
32 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format, | 35 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format, |
33 snd_pcm_access_t access, unsigned int channels, | 36 snd_pcm_access_t access, unsigned int channels, |
34 unsigned int rate, int soft_resample, | 37 unsigned int rate, int soft_resample, |
35 unsigned int latency); | 38 unsigned int latency); |
36 virtual int PcmGetParams(snd_pcm_t* handle, snd_pcm_uframes_t* buffer_size, | 39 virtual int PcmGetParams(snd_pcm_t* handle, snd_pcm_uframes_t* buffer_size, |
37 snd_pcm_uframes_t* period_size); | 40 snd_pcm_uframes_t* period_size); |
38 virtual const char* PcmName(snd_pcm_t* handle); | 41 virtual const char* PcmName(snd_pcm_t* handle); |
39 virtual snd_pcm_sframes_t PcmAvailUpdate(snd_pcm_t* handle); | 42 virtual snd_pcm_sframes_t PcmAvailUpdate(snd_pcm_t* handle); |
40 virtual snd_pcm_state_t PcmState(snd_pcm_t* handle); | 43 virtual snd_pcm_state_t PcmState(snd_pcm_t* handle); |
| 44 virtual int PcmStart(snd_pcm_t* handle); |
41 | 45 |
42 virtual const char* StrError(int errnum); | 46 virtual const char* StrError(int errnum); |
43 | 47 |
44 private: | 48 private: |
45 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper); | 49 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper); |
46 }; | 50 }; |
OLD | NEW |