-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathsound_android.h
36 lines (27 loc) · 1.01 KB
/
sound_android.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// +build android
#include <assert.h>
#include <jni.h>
#include <string.h>
// for __android_log_print(ANDROID_LOG_INFO, "YourApp", "formatted message");
// #include <android/log.h>
// for native audio
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
// for native asset manager
#include <sys/types.h>
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
typedef struct buffer_queue_ap
{
SLObjectItf bqPlayerObject;
SLPlayItf bqPlayerPlay;
SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
SLVolumeItf bqPlayerVolume;
} t_buffer_queue_ap;
extern SLresult initOpenSL();
extern void shutdownOpenSL();
extern SLresult createBufferQueueAudioPlayer(t_buffer_queue_ap *ap);
extern SLresult destroyBufferQueueAudioPlayer(t_buffer_queue_ap *ap);
extern SLresult enqueueBuffer(t_buffer_queue_ap *ap, const void *buffer, SLuint32 size);
extern SLresult getMaxVolumeLevel(t_buffer_queue_ap *ap, SLmillibel *maxLevel);
extern SLresult setVolumeLevel(t_buffer_queue_ap *ap, SLmillibel value);