summaryrefslogtreecommitdiff
path: root/platform/android/.old/audio_driver_android.cpp
blob: 7e2d065d656ecb2ad018fe0b2ae56710fbe311ce (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "audio_driver_android.h"

AudioDriverAndroid* AudioDriverAndroid::s_ad=NULL;

const char* AudioDriverAndroid::get_name() const {

	return "Android";
}

#if 0
int AudioDriverAndroid::thread_func(SceSize args, void *argp) {

	AudioDriverAndroid* ad = s_ad;
	sceAudioOutput2Reserve(AUDIO_OUTPUT_SAMPLE);

	int half=0;
	while(!ad->exit_thread) {

		int16_t *ptr = &ad->outbuff[AUDIO_OUTPUT_SAMPLE*2*half];



		if (!ad->active) {

			for(int i=0;i<AUDIO_OUTPUT_SAMPLE*2;i++) {
				ptr[i]=0;
			}

		} else {

		//printf("samples: %i\n",AUDIO_OUTPUT_SAMPLE);
			ad->lock();

			ad->audio_server_process(AUDIO_OUTPUT_SAMPLE,ad->outbuff_32);

			ad->unlock();

			const int32_t* src_buff=ad->outbuff_32;

			for(int i=0;i<AUDIO_OUTPUT_SAMPLE*2;i++) {

				ptr[i]=src_buff[i]>>16;
			}
		}


		/* Output 16-bit PCM STEREO data that is in pcmBuf without changing the volume */
		sceAudioOutput2OutputBlocking(
			   SCE_AUDIO_VOLUME_0dB*3, //0db at 0x8000, that's obvious
			 ptr
		);

		if (half)
			half=0;
		else
			half=1;

	}

	sceAudioOutput2Release();

	sceKernelExitThread(SCE_KERNEL_EXIT_SUCCESS);
	ad->thread_exited=true;
	return SCE_KERNEL_EXIT_SUCCESS;

}

#endif
Error AudioDriverAndroid::init(){

	return OK;


}
void AudioDriverAndroid::start(){


}
int AudioDriverAndroid::get_mix_rate() const {

	return 44100;
}
AudioDriverSW::OutputFormat AudioDriverAndroid::get_output_format() const{

	return OUTPUT_STEREO;
}
void AudioDriverAndroid::lock(){


}
void AudioDriverAndroid::unlock() {


}
void AudioDriverAndroid::finish(){

	}


AudioDriverAndroid::AudioDriverAndroid()
{
	s_ad=this;
}