~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/src/audio/opensl/opensllayer.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
#include "audio/audiolayer.h"
39
39
 
40
 
 
41
 
 
42
 
enum PCMType {
43
 
    SFL_PCM_BOTH = 0x0021,          /** To open both playback and capture devices */
44
 
    SFL_PCM_PLAYBACK = 0x0022,      /** To open playback device only */
45
 
    SFL_PCM_CAPTURE = 0x0023,       /** To open capture device only */
46
 
    SFL_PCM_RINGTONE = 0x0024       /** To open the ringtone device only */
47
 
};
48
 
 
49
40
class AudioPreference;
50
41
 
51
42
#include "noncopyable.h"
53
44
class OpenSLThread;
54
45
 
55
46
#define ANDROID_BUFFER_QUEUE_LENGTH 2U
56
 
#define BUFFER_SIZE 80U
 
47
#define BUFFER_SIZE 512U
57
48
 
58
49
#define MAX_NUMBER_INTERFACES 5
59
50
#define MAX_NUMBER_INPUT_DEVICES 3
60
51
 
61
 
 
62
52
/**
63
53
 * @file  OpenSLLayer.h
64
54
 * @brief Main sound class for android. Manages the data transfers between the application and the hardware.
100
90
         */
101
91
        virtual std::vector<std::string> getPlaybackDeviceList() const;
102
92
 
 
93
        void init();
 
94
 
103
95
        void initAudioEngine();
104
96
 
105
97
        void shutdownAudioEngine();
116
108
 
117
109
        void stopAudioCapture();
118
110
 
119
 
        virtual int getAudioDeviceIndex(const std::string&) const {
 
111
        virtual int getAudioDeviceIndex(const std::string&, DeviceType) const {
120
112
            return 0;
121
113
        }
122
114
 
123
 
        virtual std::string getAudioDeviceName(int, AudioLayer::PCMType) const {
 
115
        virtual std::string getAudioDeviceName(int, DeviceType) const {
124
116
            return "";
125
117
        }
126
118
 
137
129
 
138
130
        bool audioPlaybackFillWithUrgent(AudioBuffer &buffer, size_t bytesAvail);
139
131
 
140
 
        bool audioPlaybackFillWithVoice(AudioBuffer &buffer, size_t bytesAvail);
 
132
        size_t audioPlaybackFillWithVoice(AudioBuffer &buffer);
141
133
 
142
134
        void audioCaptureFillBuffer(AudioBuffer &buffer);
143
135
 
195
187
            recordBufferIndex_ = (recordBufferIndex_ + 1) % NB_BUFFER_CAPTURE_QUEUE;
196
188
        }
197
189
 
198
 
                void CheckErr( SLresult res );
 
190
        void CheckErr( SLresult res );
199
191
 
200
192
        void playback(SLAndroidSimpleBufferQueueItf queue);
201
193
        void capture(SLAndroidSimpleBufferQueueItf queue);
224
216
 
225
217
        NON_COPYABLE(OpenSLLayer);
226
218
 
227
 
        virtual void updatePreference(AudioPreference &pref, int index, PCMType type);
 
219
        virtual void updatePreference(AudioPreference &pref, int index, DeviceType type);
228
220
 
229
221
        OpenSLThread *audioThread_;
230
222
 
251
243
 
252
244
        SLRecordItf recorderInterface_;
253
245
 
254
 
                SLAudioIODeviceCapabilitiesItf AudioIODeviceCapabilitiesItf;
255
 
                SLAudioInputDescriptor AudioInputDescriptor;
 
246
        SLAudioIODeviceCapabilitiesItf AudioIODeviceCapabilitiesItf;
 
247
        SLAudioInputDescriptor AudioInputDescriptor;
256
248
 
257
249
        /**
258
250
         * OpenSL playback buffer
263
255
        int playbackBufferIndex_;
264
256
        int recordBufferIndex_;
265
257
 
266
 
                bool bufferIsFilled_;
 
258
        bool bufferIsFilled_;
 
259
        AudioFormat hardwareFormat_;
 
260
        size_t hardwareBuffSize_;
267
261
 
268
262
        AudioBufferStack playbackBufferStack_;
269
263
        AudioBufferStack recordBufferStack_;
 
264
 
270
265
};
271
266
 
272
267
#endif // _OPENSL_LAYER_H_