You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl-jni/audio/android_media_AudioTrack.c: 'default' as a PCM device seems to work nicely
also get rid of broken case for !PCM_DEVICE
This commit is contained in:
@@ -9,8 +9,7 @@
|
||||
|
||||
#include "../generated_headers/android_media_AudioTrack.h"
|
||||
|
||||
//#define PCM_DEVICE "sysdefault:CARD=Generic_1"
|
||||
#define PCM_DEVICE getenv("HAX_AUDIOTRACK_PCM_DEVICE")
|
||||
#define PCM_DEVICE "default"
|
||||
|
||||
void helper_hw_params_init(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *params, unsigned int rate, unsigned int channels, snd_pcm_format_t format)
|
||||
{
|
||||
@@ -47,9 +46,6 @@ JNIEXPORT void JNICALL Java_android_media_AudioTrack_native_1constructor(JNIEnv
|
||||
|
||||
int ret;
|
||||
|
||||
if(!PCM_DEVICE)
|
||||
return; // STUB
|
||||
|
||||
/* Open the PCM device in playback mode */
|
||||
ret = snd_pcm_open(&pcm_handle, PCM_DEVICE, SND_PCM_STREAM_PLAYBACK, 0);
|
||||
if (ret < 0)
|
||||
@@ -133,9 +129,6 @@ JNIEXPORT jint JNICALL Java_android_media_AudioTrack_getMinBufferSize(JNIEnv *en
|
||||
}
|
||||
// ---
|
||||
|
||||
if(!PCM_DEVICE)
|
||||
return 256; // STUB
|
||||
|
||||
ret = snd_pcm_open(&pcm_handle, PCM_DEVICE, SND_PCM_STREAM_PLAYBACK, 0);
|
||||
if (ret < 0)
|
||||
printf("Error calling snd_pcm_open: %s\n", snd_strerror(ret));
|
||||
@@ -169,9 +162,6 @@ void periodic_update_callback(snd_async_handler_t *pcm_callback)
|
||||
int getenv_ret;
|
||||
int attach_ret = -1;
|
||||
|
||||
if(!PCM_DEVICE)
|
||||
return; // STUB
|
||||
|
||||
// printf("periodic_update_callback called!\n");
|
||||
|
||||
JNIEnv *env;
|
||||
@@ -230,9 +220,6 @@ JNIEXPORT jint JNICALL Java_android_media_AudioTrack_native_1write(JNIEnv *env,
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(!PCM_DEVICE)
|
||||
return 0; // STUB
|
||||
|
||||
snd_pcm_t *pcm_handle = _PTR(_GET_LONG_FIELD(this, "pcm_handle"));
|
||||
|
||||
snd_pcm_sframes_t frames_written;
|
||||
|
||||
Reference in New Issue
Block a user