Attached is an unofficial patch that should help. We still need to go
through our review process, so things will take time.
Vandana Vuthoo wrote:
> Hi Sean,
>
> When will the patch be available ? I am in a total fix,please help,Can
> I get some workaround it for it?
>
> Rgds,
> Vandana
>
> On Thu, Jan 8, 2009 at 10:48 AM, Sean McNeil <[email protected]
> <mailto:[email protected]>> wrote:
>
>
> Google has made some minor changes to the audio interface and Wind
> River
> is aware of them. There is a patch pending and it will hopefully be
> committed soon.
>
> Sorry for the inconvenience,
> Sean
>
> Praveen wrote:
> > Hi Vandy,
> >
> > I am also getting the same error while compiling. Were you able to
> > make any progress on this?
> >
> > If so please feel free to share the solution
> >
> > On Jan 8, 9:42 am, Vandy <[email protected]
> <mailto:[email protected]>> wrote:
> >
> >> Hi All,
> >> I am getting the following errors when compiling alsa for the
> latest
> >> repository. Please help.
> >>
>
> ----------------------------------------------------------------------------------------------------------
> >> I am compiling android code for arm, when compiling in sound I am
> >> getting the following errors.
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In static member
> >> function 'static android::AudioHardwareInterface*
> >> android::AudioHardwareInterface::create()':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:96: error: cannot
> >> allocate an object of abstract type 'android::AudioHardwareALSA'
> >> hardware/alsa_sound/AudioHardwareALSA.h:224: note: because the
> >> following virtual functions are pure within
> >> 'android::AudioHardwareALSA':
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:178:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::setRouting(int, uint32_t)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:180:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::getRouting(int, uint32_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:187:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::setMode(int)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:188:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::getMode(int*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:196:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::setParameter(const char*, const
> >> char*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:200:
> >> note: virtual size_t
> >> android::AudioHardwareInterface::getInputBufferSize(uint32_t, int,
> >> int)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:207:
> >> note: virtual android::AudioStreamOut*
> >> android::AudioHardwareInterface::openOutputStream(int, int,
> uint32_t,
> >> android::status_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:214:
> >> note: virtual android::AudioStreamIn*
> >> android::AudioHardwareInterface::openInputStream(int, int,
> uint32_t,
> >> android::status_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:217:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::dumpState(int, const
> >> android::Vector<android::String16>&)
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:101: error: cannot
> >> allocate an object of abstract type 'android::AudioHardwareStub'
> >> hardware/alsa_sound/AudioHardwareStub.h:55: note: because the
> >> following virtual functions are pure within
> >> 'android::AudioHardwareStub':
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:178:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::setRouting(int, uint32_t)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:180:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::getRouting(int, uint32_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:187:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::setMode(int)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:188:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::getMode(int*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:200:
> >> note: virtual size_t
> >> android::AudioHardwareInterface::getInputBufferSize(uint32_t, int,
> >> int)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:207:
> >> note: virtual android::AudioStreamOut*
> >> android::AudioHardwareInterface::openOutputStream(int, int,
> uint32_t,
> >> android::status_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:214:
> >> note: virtual android::AudioStreamIn*
> >> android::AudioHardwareInterface::openInputStream(int, int,
> uint32_t,
> >> android::status_t*)
> >> hardware/libhardware/include/hardware/AudioHardwareInterface.h:217:
> >> note: virtual android::status_t
> >> android::AudioHardwareInterface::dumpState(int, const
> >> android::Vector<android::String16>&)
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: At global scope:
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:136: error:
> definition
> >> of implicitly-declared
> >> 'android::AudioHardwareInterface::AudioHardwareInterface()'
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In constructor
> >> 'android::AudioHardwareInterface::AudioHardwareInterface()':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:139: error:
> 'mRoutes'
> >> was not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:140: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In member function
> >> 'virtual android::status_t
> android::AudioHardwareInterface::setRouting
> >> (int, uint32_t)':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:150: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:153: error:
> 'mRoutes'
> >> was not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:155: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In member function
> >> 'virtual android::status_t
> android::AudioHardwareInterface::getRouting
> >> (int, uint32_t*)':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:169: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:172: error:
> 'mRoutes'
> >> was not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In member function
> >> 'virtual android::status_t android::AudioHardwareInterface::setMode
> >> (int)':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:187: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:193: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In member function
> >> 'virtual android::status_t android::AudioHardwareInterface::getMode
> >> (int*)':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:200: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp: In member function
> >> 'virtual android::status_t
> android::AudioHardwareInterface::dumpState
> >> (int, const android::Vector<android::String16>&)':
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:217: error:
> 'mMode' was
> >> not declared in this scope
> >> hardware/alsa_sound/AudioHardwareInterface.cpp:220: error:
> 'mRoutes'
> >> was not declared in this scope
> >>
> >> Rgds,
> >> Vandy
> >>
> > >
> >
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---
diff --git a/AudioHardwareALSA.cpp b/AudioHardwareALSA.cpp
index 5fe7fd1..872c824 100644
--- a/AudioHardwareALSA.cpp
+++ b/AudioHardwareALSA.cpp
@@ -106,9 +106,9 @@ static const alsa_properties_t masterCaptureProp = {
*/
static const char *deviceSuffix[] = {
/* ROUTE_EARPIECE */ "_Earpiece",
- /* ROUTE_SPEAKER */ "_Speaker",
- /* ROUTE_BLUETOOTH */ "_Bluetooth",
- /* ROUTE_HEADSET */ "_Headset",
+ /* ROUTE_SPEAKER */ "_Speaker",
+ /* ROUTE_BLUETOOTH */ "_Bluetooth",
+ /* ROUTE_HEADSET */ "_Headset",
};
static const int deviceSuffixLen = (sizeof(deviceSuffix) / sizeof(char *));
@@ -187,23 +187,29 @@ status_t AudioHardwareALSA::setMasterVolume(float volume)
return INVALID_OPERATION;
}
-AudioStreamOut *AudioHardwareALSA::openOutputStream(int format,
- int channelCount,
- uint32_t sampleRate)
+AudioStreamOut *
+AudioHardwareALSA::openOutputStream(int format,
+ int channelCount,
+ uint32_t sampleRate,
+ status_t *status)
{
AutoMutex lock(mLock);
// only one output stream allowed
- if (mOutput)
+ if (mOutput) {
+ *status = ALREADY_EXISTS;
return 0;
+ }
AudioStreamOutALSA *out = new AudioStreamOutALSA(this);
- if (out->set(format, channelCount, sampleRate) == NO_ERROR) {
+ *status = out->set(format, channelCount, sampleRate);
+
+ if (*status == NO_ERROR) {
mOutput = out;
// Some information is expected to be available immediately after
// the device is open.
- uint32_t routes = mRoutes[mMode];
+ uint32_t routes = mRoutes[mMode];
mOutput->setDevice(mMode, routes);
} else {
delete out;
@@ -212,19 +218,24 @@ AudioStreamOut *AudioHardwareALSA::openOutputStream(int format,
return mOutput;
}
-AudioStreamIn *AudioHardwareALSA::openInputStream(int format,
- int channelCount,
- uint32_t sampleRate)
+AudioStreamIn *
+AudioHardwareALSA::openInputStream(int format,
+ int channelCount,
+ uint32_t sampleRate,
+ status_t *status)
{
AutoMutex lock(mLock);
// only one input stream allowed
- if (mInput)
+ if (mInput) {
+ *status = ALREADY_EXISTS;
return 0;
+ }
AudioStreamInALSA *in = new AudioStreamInALSA(this);
- if (in->set(format, channelCount, sampleRate) == NO_ERROR) {
+ *status = in->set(format, channelCount, sampleRate);
+ if (*status == NO_ERROR) {
mInput = in;
// Now, actually open the device. Only 1 route used
mInput->setDevice(0, 0);
@@ -904,6 +915,11 @@ bool AudioStreamOutALSA::isStandby()
return (!mHandle);
}
+uint32_t AudioStreamOutALSA::latency() const
+{
+ return 0;
+}
+
// ----------------------------------------------------------------------------
AudioStreamInALSA::AudioStreamInALSA(AudioHardwareALSA *parent) :
@@ -978,6 +994,13 @@ const char *AudioStreamInALSA::deviceName(int mode, int device)
return devString;
}
+status_t AudioStreamInALSA::standby()
+{
+ AutoMutex lock(mLock);
+
+ return NO_ERROR;
+}
+
// ----------------------------------------------------------------------------
struct ALSAMixer::mixer_info_t {
diff --git a/AudioHardwareALSA.h b/AudioHardwareALSA.h
index 12d875c..3827270 100644
--- a/AudioHardwareALSA.h
+++ b/AudioHardwareALSA.h
@@ -22,7 +22,7 @@
#include <sys/types.h>
#include <alsa/asoundlib.h>
-#include <hardware/AudioHardwareInterface.h>
+#include <hardware/AudioHardwareBase.h>
namespace android {
@@ -157,6 +157,8 @@ public:
return ALSAStreamOps::format();
}
+ virtual uint32_t latency() const;
+
virtual ssize_t write(const void *buffer, size_t bytes);
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t setDevice(int mode, uint32_t newDevice);
@@ -211,42 +213,73 @@ public:
virtual status_t dump(int fd, const Vector<String16>& args);
virtual status_t setDevice(int mode, uint32_t newDevice);
- virtual status_t setGain(float gain);
+ virtual status_t setGain(float gain);
virtual const char *deviceName(int mode, int device);
+ virtual status_t standby();
+
private:
AudioHardwareALSA *mParent;
};
-class AudioHardwareALSA : public AudioHardwareInterface
+class AudioHardwareALSA : public AudioHardwareBase
{
public:
AudioHardwareALSA();
virtual ~AudioHardwareALSA();
- virtual status_t initCheck();
- virtual status_t standby();
- virtual status_t setVoiceVolume(float volume);
- virtual status_t setMasterVolume(float volume);
-
- virtual AudioStreamOut *openOutputStream(int format = 0,
- int channelCount = 0,
- uint32_t sampleRate = 0);
-
- virtual AudioStreamIn *openInputStream (int format = 0,
- int channelCount = 0,
- uint32_t sampleRate = 0);
-
- // Microphone mute
- virtual status_t setMicMute(bool state);
- virtual status_t getMicMute(bool *state);
+ /**
+ * check to see if the audio hardware interface has been initialized.
+ * return status based on values defined in include/utils/Errors.h
+ */
+ virtual status_t initCheck();
+
+ /**
+ * put the audio hardware into standby mode to conserve power. Returns
+ * status based on include/utils/Errors.h
+ */
+ virtual status_t standby();
+
+ /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
+ virtual status_t setVoiceVolume(float volume);
+
+ /**
+ * set the audio volume for all audio activities other than voice call.
+ * Range between 0.0 and 1.0. If any value other than NO_ERROR is returned,
+ * the software mixer will emulate this capability.
+ */
+ virtual status_t setMasterVolume(float volume);
+
+ // mic mute
+ virtual status_t setMicMute(bool state);
+ virtual status_t getMicMute(bool* state);
+
+ /** This method creates and opens the audio hardware output stream */
+ virtual AudioStreamOut* openOutputStream(
+ int format=0,
+ int channelCount=0,
+ uint32_t sampleRate=0,
+ status_t *status=0);
+
+ /** This method creates and opens the audio hardware input stream */
+ virtual AudioStreamIn* openInputStream(
+ int format,
+ int channelCount,
+ uint32_t sampleRate,
+ status_t *status);
protected:
- // audio routing
- virtual status_t doRouting();
- virtual status_t dump(int fd, const Vector<String16>& args);
+ /**
+ * doRouting actually initiates the routing. A call to setRouting
+ * or setMode may result in a routing change. The generic logic calls
+ * doRouting when required. If the device has any special requirements these
+ * methods can be overriden.
+ */
+ virtual status_t doRouting();
+
+ virtual status_t dump(int fd, const Vector<String16>& args);
friend class AudioStreamOutALSA;
friend class AudioStreamInALSA;
diff --git a/AudioHardwareInterface.cpp b/AudioHardwareInterface.cpp
index 68fa70e..8946bde 100644
--- a/AudioHardwareInterface.cpp
+++ b/AudioHardwareInterface.cpp
@@ -55,6 +55,7 @@ static const char* routeStrings[] =
"SPEAKER ",
"BLUETOOTH ",
"HEADSET "
+ "BLUETOOTH_A2DP "
};
static const char* routeNone = "NONE";
@@ -105,24 +106,10 @@ AudioHardwareInterface* AudioHardwareInterface::create()
// This code adds a record of buffers in a file to write calls made by AudioFlinger.
// It replaces the current AudioHardwareInterface object by an intermediate one which
// will record buffers in a file (after sending them to hardware) for testing purpose.
- // This feature is enabled by defining symbol DUMP_FLINGER_OUT and setting environement
- // "audioflinger.dump = 1". The output file is "tmp/FlingerOut.pcm". Pause are not recorded
- // in the file.
+ // This feature is enabled by defining symbol DUMP_FLINGER_OUT.
+ // The output file is FLINGER_DUMP_NAME. Pause are not recorded in the file.
- // read dump mode
- property_get("audioflinger.dump", value, "0");
- switch(value[0]) {
- case '1':
- LOGV("Dump mode");
- hw = new AudioDumpInterface(hw); // replace interface
- return hw;
- break;
- case '0':
- default:
- LOGV("No Dump mode");
- return hw;
- break;
- }
+ hw = new AudioDumpInterface(hw); // replace interface
#endif
return hw;
}
@@ -133,7 +120,7 @@ AudioStreamOut::~AudioStreamOut()
AudioStreamIn::~AudioStreamIn() {}
-AudioHardwareInterface::AudioHardwareInterface()
+AudioHardwareBase::AudioHardwareBase()
{
// force a routing update on initialization
memset(&mRoutes, 0, sizeof(mRoutes));
@@ -141,7 +128,7 @@ AudioHardwareInterface::AudioHardwareInterface()
}
// generics for audio routing - the real work is done in doRouting
-status_t AudioHardwareInterface::setRouting(int mode, uint32_t routes)
+status_t AudioHardwareBase::setRouting(int mode, uint32_t routes)
{
#if LOG_ROUTING_CALLS
LOGD("setRouting: mode=%s, routes=[%s]", displayMode(mode), displayRoutes(routes));
@@ -163,7 +150,7 @@ status_t AudioHardwareInterface::setRouting(int mode, uint32_t routes)
return doRouting();
}
-status_t AudioHardwareInterface::getRouting(int mode, uint32_t* routes)
+status_t AudioHardwareBase::getRouting(int mode, uint32_t* routes)
{
if (mode == AudioSystem::MODE_CURRENT)
mode = mMode;
@@ -177,7 +164,7 @@ status_t AudioHardwareInterface::getRouting(int mode, uint32_t* routes)
return NO_ERROR;
}
-status_t AudioHardwareInterface::setMode(int mode)
+status_t AudioHardwareBase::setMode(int mode)
{
#if LOG_ROUTING_CALLS
LOGD("setMode(%s)", displayMode(mode));
@@ -194,25 +181,44 @@ status_t AudioHardwareInterface::setMode(int mode)
return doRouting();
}
-status_t AudioHardwareInterface::getMode(int* mode)
+status_t AudioHardwareBase::getMode(int* mode)
{
// Implement: set audio routing
*mode = mMode;
return NO_ERROR;
}
-status_t AudioHardwareInterface::setParameter(const char* key, const char* value)
+status_t AudioHardwareBase::setParameter(const char* key, const char* value)
{
// default implementation is to ignore
return NO_ERROR;
}
-status_t AudioHardwareInterface::dumpState(int fd, const Vector<String16>& args)
+// default implementation
+size_t AudioHardwareBase::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
+{
+ if (sampleRate != 8000) {
+ LOGW("getInputBufferSize bad sampling rate: %d", sampleRate);
+ return 0;
+ }
+ if (format != AudioSystem::PCM_16_BIT) {
+ LOGW("getInputBufferSize bad format: %d", format);
+ return 0;
+ }
+ if (channelCount != 1) {
+ LOGW("getInputBufferSize bad channel count: %d", channelCount);
+ return 0;
+ }
+
+ return 320;
+}
+
+status_t AudioHardwareBase::dumpState(int fd, const Vector<String16>& args)
{
const size_t SIZE = 256;
char buffer[SIZE];
String8 result;
- snprintf(buffer, SIZE, "AudioHardwareInterface::dumpState\n");
+ snprintf(buffer, SIZE, "AudioHardwareBase::dumpState\n");
result.append(buffer);
snprintf(buffer, SIZE, "\tmMode: %d\n", mMode);
result.append(buffer);
diff --git a/AudioHardwareStub.cpp b/AudioHardwareStub.cpp
index 0046db8..d309902 100644
--- a/AudioHardwareStub.cpp
+++ b/AudioHardwareStub.cpp
@@ -2,16 +2,16 @@
**
** Copyright 2007, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -47,20 +47,28 @@ status_t AudioHardwareStub::standby()
}
AudioStreamOut* AudioHardwareStub::openOutputStream(
- int format, int channelCount, uint32_t sampleRate)
+ int format, int channelCount, uint32_t sampleRate, status_t *status)
{
AudioStreamOutStub* out = new AudioStreamOutStub();
- if (out->set(format, channelCount, sampleRate) == NO_ERROR)
+ status_t lStatus = out->set(format, channelCount, sampleRate);
+ if (status) {
+ *status = lStatus;
+ }
+ if (lStatus == NO_ERROR)
return out;
delete out;
return 0;
}
AudioStreamIn* AudioHardwareStub::openInputStream(
- int format, int channelCount, uint32_t sampleRate)
+ int format, int channelCount, uint32_t sampleRate, status_t *status)
{
AudioStreamInStub* in = new AudioStreamInStub();
- if (in->set(format, channelCount, sampleRate) == NO_ERROR)
+ status_t lStatus = in->set(format, channelCount, sampleRate);
+ if (status) {
+ *status = lStatus;
+ }
+ if (lStatus == NO_ERROR)
return in;
delete in;
return 0;
@@ -102,7 +110,7 @@ status_t AudioStreamOutStub::set(int format, int channels, uint32_t rate)
if (format == 0) format = AudioSystem::PCM_16_BIT;
if (channels == 0) channels = channelCount();
if (rate == 0) rate = sampleRate();
-
+
if ((format == AudioSystem::PCM_16_BIT) &&
(channels == channelCount()) &&
(rate == sampleRate()))
@@ -129,7 +137,7 @@ status_t AudioStreamOutStub::dump(int fd, const Vector<String16>& args)
snprintf(buffer, SIZE, "\tformat: %d\n", format());
result.append(buffer);
::write(fd, result.string(), result.size());
- return NO_ERROR;
+ return NO_ERROR;
}
// ----------------------------------------------------------------------------
diff --git a/AudioHardwareStub.h b/AudioHardwareStub.h
index 1a61552..5316d60 100644
--- a/AudioHardwareStub.h
+++ b/AudioHardwareStub.h
@@ -2,16 +2,16 @@
**
** Copyright 2007, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -21,7 +21,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <hardware/AudioHardwareInterface.h>
+#include <hardware/AudioHardwareBase.h>
namespace android {
@@ -34,6 +34,7 @@ public:
virtual size_t bufferSize() const { return 4096; }
virtual int channelCount() const { return 2; }
virtual int format() const { return AudioSystem::PCM_16_BIT; }
+ virtual uint32_t latency() const { return 0; }
virtual status_t setVolume(float volume) { return NO_ERROR; }
virtual ssize_t write(const void* buffer, size_t bytes);
virtual status_t dump(int fd, const Vector<String16>& args);
@@ -49,9 +50,10 @@ public:
virtual status_t setGain(float gain) { return NO_ERROR; }
virtual ssize_t read(void* buffer, ssize_t bytes);
virtual status_t dump(int fd, const Vector<String16>& args);
+ virtual status_t standby() { return NO_ERROR; }
};
-class AudioHardwareStub : public AudioHardwareInterface
+class AudioHardwareStub : public AudioHardwareBase
{
public:
AudioHardwareStub();
@@ -72,12 +74,14 @@ public:
virtual AudioStreamOut* openOutputStream(
int format=0,
int channelCount=0,
- uint32_t sampleRate=0);
+ uint32_t sampleRate=0,
+ status_t *status=0);
virtual AudioStreamIn* openInputStream(
int format,
int channelCount,
- uint32_t sampleRate);
+ uint32_t sampleRate,
+ status_t *status);
protected:
virtual status_t doRouting() { return NO_ERROR; }