Commit fcba9a96 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Feature/android aaudio sound card

parent 74919def
......@@ -271,6 +271,15 @@ MS2_PUBLIC const MSList * ms_snd_card_manager_get_list(MSSndCardManager *m);
*/
MS2_PUBLIC void ms_snd_card_manager_add_card(MSSndCardManager *m, MSSndCard *c);
/**
* Prepend a sound card object in a sound card manager's list.
*
* @param m A sound card manager containing sound cards.
* @param c A sound card object.
*
*/
MS2_PUBLIC void ms_snd_card_manager_prepend_card(MSSndCardManager *m, MSSndCard *c);
/**
* Set the sound card manager of a sound card.
*
......
......@@ -32,10 +32,9 @@ public class MediastreamerAndroidContext {
public static final int DEVICE_HAS_BUILTIN_OPENSLES_AEC = 8; // The device has a builtin AEC and it is working with OpenSLES (which is uncommon)
public static final int DEVICE_USE_ANDROID_CAMCORDER = 512;
private native void setDeviceFavoriteSampleRate(int samplerate);
private native void setDeviceFavoriteBufferSize(int bufferSize);
private static Context mContext;
private static int mDeviceFavoriteSampleRate = 44100;
private static int mDeviceFavoriteBufferSize = 256;
private MediastreamerAndroidContext() {
}
......@@ -52,6 +51,14 @@ public class MediastreamerAndroidContext {
return mContext;
}
public static int getDeviceFavoriteSampleRate() {
return mDeviceFavoriteSampleRate;
}
public static int getDeviceFavoriteBufferSize() {
return mDeviceFavoriteBufferSize;
}
@TargetApi(Build.VERSION_CODES.KITKAT)
public static void setContext(Object c) {
if (c == null)
......@@ -75,9 +82,9 @@ public class MediastreamerAndroidContext {
bufferSize = parseInt(bufferProperty, bufferSize);
String sampleRateProperty = audiomanager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
sampleRate = parseInt(sampleRateProperty, sampleRate);
Log.i("[Device] Output frames per buffer: " + bufferSize + ", output sample rates: " + sampleRate + " for OpenSLES MS sound card.");
mac.setDeviceFavoriteSampleRate(sampleRate);
mac.setDeviceFavoriteBufferSize(bufferSize);
Log.i("[Device] Output frames per buffer: " + bufferSize + ", output sample rate: " + sampleRate + ".");
mDeviceFavoriteSampleRate = sampleRate;
mDeviceFavoriteBufferSize = bufferSize;
} else {
Log.i("Android < 4.4 detected, android context not used.");
}
......
This diff is collapsed.
......@@ -122,6 +122,12 @@ void ms_snd_card_manager_add_card(MSSndCardManager *m, MSSndCard *c){
m->cards=bctbx_list_append(m->cards,c);
}
void ms_snd_card_manager_prepend_card(MSSndCardManager *m, MSSndCard *c){
ms_snd_card_set_manager(m,c);
ms_message("Card '%s' prepended with capabilities [%s]",ms_snd_card_get_string_id(c), cap_to_string(c->capabilities));
m->cards=bctbx_list_prepend(m->cards,c);
}
void ms_snd_card_manager_prepend_cards(MSSndCardManager *m, bctbx_list_t *l) {
bctbx_list_t *elem;
bctbx_list_t *lcopy = bctbx_list_copy(l);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment