I've managed to compile android from source and install on my phone. I should probably say from the outset I'm not a c++ developer but I had hoped I would be able to work out how to output the data held in a variable to a file.
After a bit of googling I came up with the following code:
#include <iostream>
#include <fstream>
using namespace std;
ofstream myfile;
myfile.open ("/data/wav.raw");
myfile < mMixBuffer;
myfile.close();
frameworks/base/services/audioflinger/AudioFlinger.cpp: In member function 'virtual bool android::AudioFlinger::MixerThread::threadLoop()':
frameworks/base/services/audioflinger/AudioFlinger.cpp:1769: error: 'ofstream' was not declared in this scope
frameworks/base/services/audioflinger/AudioFlinger.cpp:1769: error: expected ';' before 'myfile'
frameworks/base/services/audioflinger/AudioFlinger.cpp:1770: error: 'myfile' was not declared in this scope
after this didn't work I tried which again gave compilation errors:
int fd;
fd = ::open("/data/wav.raw",O_WRONLY | O_APPEND);
::write(fd,mMixBuffer,minBufferSize);
::close(fd);
frameworks/base/services/audioflinger/AudioFlinger.cpp: In member function 'virtual bool android::AudioFlinger::MixerThread::threadLoop()':
frameworks/base/services/audioflinger/AudioFlinger.cpp:1770: error: '::open' has not been declared
frameworks/base/services/audioflinger/AudioFlinger.cpp:1770: error: 'O_WRONLY' was not declared in this scope
frameworks/base/services/audioflinger/AudioFlinger.cpp:1770: error: 'O_APPEND' was not declared in this scope
If it's not clear from the above I'm trying to append the contents of variable mMixBuffer
with size minBufferSize
to a file /data/wav.raw
. Does anyone have any idea how I can achieve this?