summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-02-23 08:14:46 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-03-03 07:23:38 +0100
commit286a4c5caa1945c8d1cb365a3d90fb09d5700cb2 (patch)
tree4835f46d16ec78d035ec9f49333079fe618384c1 /firmware/target/hosted/android
parent3f82f3aca14eb954e55f761721ffdd2684f0e812 (diff)
downloadrockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.gz
rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.zip
Revise the PCM callback system after adding multichannel audio.
Additional status callback is added to pcm_play/rec_data instead of using a special function to set it. Status includes DMA error reporting to the status callback. Playback and recording callback become more alike except playback uses "const void **addr" (because the data should not be altered) and recording uses "void **addr". "const" is put in place throughout where appropriate. Most changes are fairly trivial. One that should be checked in particular because it isn't so much is telechips, if anyone cares to bother. PP5002 is not so trivial either but that tested as working. Change-Id: I4928d69b3b3be7fb93e259f81635232df9bd1df2 Reviewed-on: http://gerrit.rockbox.org/166 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'firmware/target/hosted/android')
-rw-r--r--firmware/target/hosted/android/pcm-android.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c
index 4e58707d0a..7a0f28634e 100644
--- a/firmware/target/hosted/android/pcm-android.c
+++ b/firmware/target/hosted/android/pcm-android.c
@@ -80,8 +80,8 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this,
80 80
81 if (!pcm_data_size) /* get some initial data */ 81 if (!pcm_data_size) /* get some initial data */
82 { 82 {
83 new_buffer = true; 83 new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
84 pcm_play_get_more_callback((void**) &pcm_data_start, &pcm_data_size); 84 (const void**)&pcm_data_start, &pcm_data_size);
85 } 85 }
86 86
87 while(left > 0 && pcm_data_size) 87 while(left > 0 && pcm_data_size)
@@ -99,7 +99,7 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this,
99 if (new_buffer) 99 if (new_buffer)
100 { 100 {
101 new_buffer = false; 101 new_buffer = false;
102 pcm_play_dma_started_callback(); 102 pcm_play_dma_status_callback(PCM_DMAST_STARTED);
103 103
104 /* NOTE: might need to release the mutex and sleep here if the 104 /* NOTE: might need to release the mutex and sleep here if the
105 buffer is shorter than the required buffer (like pcm-sdl.c) to 105 buffer is shorter than the required buffer (like pcm-sdl.c) to
@@ -114,15 +114,15 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this,
114 114
115 if (pcm_data_size == 0) /* need new data */ 115 if (pcm_data_size == 0) /* need new data */
116 { 116 {
117 new_buffer = true; 117 new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
118 pcm_play_get_more_callback((void**)&pcm_data_start, &pcm_data_size); 118 (const void**)&pcm_data_start, &pcm_data_size);
119 } 119 }
120 else /* increment data pointer and feed more */ 120 else /* increment data pointer and feed more */
121 pcm_data_start += transfer_size; 121 pcm_data_start += transfer_size;
122 } 122 }
123 123
124 if (new_buffer && pcm_data_size) 124 if (new_buffer)
125 pcm_play_dma_started_callback(); 125 pcm_play_dma_status_callback(PCM_DMAST_STARTED);
126 126
127 unlock_audio(); 127 unlock_audio();
128 return max_size - left; 128 return max_size - left;
@@ -154,7 +154,7 @@ void pcm_play_dma_start(const void *addr, size_t size)
154 154
155void pcm_play_dma_stop(void) 155void pcm_play_dma_stop(void)
156{ 156{
157 /* NOTE: due to how pcm_play_get_more_callback() works, this is 157 /* NOTE: due to how pcm_play_dma_complete_callback() works, this is
158 * possibly called from nativeWrite(), i.e. another (host) thread 158 * possibly called from nativeWrite(), i.e. another (host) thread
159 * => need to discover the appropriate JNIEnv* */ 159 * => need to discover the appropriate JNIEnv* */
160 JNIEnv* env = getJavaEnvironment(); 160 JNIEnv* env = getJavaEnvironment();