1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /* \file CAudioRecorder.c AudioRecorder class */
18 
19 #include "sles_allinclusive.h"
20 
21 
22 /** \brief Hook called by Object::Realize when an audio recorder is realized */
23 
CAudioRecorder_Realize(void * self,SLboolean async)24 SLresult CAudioRecorder_Realize(void *self, SLboolean async)
25 {
26     SLresult result = SL_RESULT_SUCCESS;
27 
28 #ifdef ANDROID
29     CAudioRecorder *thiz = (CAudioRecorder *) self;
30     result = android_audioRecorder_realize(thiz, async);
31 #endif
32 
33     return result;
34 }
35 
36 
37 /** \brief Hook called by Object::Resume when an audio recorder is resumed */
38 
CAudioRecorder_Resume(void * self,SLboolean async)39 SLresult CAudioRecorder_Resume(void *self, SLboolean async)
40 {
41     return SL_RESULT_SUCCESS;
42 }
43 
44 
45 /** \brief Hook called by Object::Destroy when an audio recorder is destroyed */
46 
CAudioRecorder_Destroy(void * self)47 void CAudioRecorder_Destroy(void *self)
48 {
49     CAudioRecorder *thiz = (CAudioRecorder *) self;
50     freeDataLocatorFormat(&thiz->mDataSource);
51     freeDataLocatorFormat(&thiz->mDataSink);
52 #ifdef ANDROID
53     android_audioRecorder_destroy(thiz);
54 #endif
55 }
56 
57 
58 /** \brief Hook called by Object::Destroy before an audio recorder is about to be destroyed */
59 
CAudioRecorder_PreDestroy(void * self)60 predestroy_t CAudioRecorder_PreDestroy(void *self)
61 {
62     CAudioRecorder *thiz = (CAudioRecorder *) self;
63 #ifdef ANDROID
64     android_audioRecorder_preDestroy(thiz);
65 #endif
66     return predestroy_ok;
67 }
68