You can easily build the desktop image with your customizations with:
$ ./build.sh -b debian -n jessie
There is even a Dockerfile for your convenience which lists all the dependencies needed.
And finally, you can see the Developer Guide to understand how to build your own complete Maru OS image with your changes.
There are many repositories to touch and it can be a long process to set up your system for building Maru OS so I can add your changes for you once I've tested everything.
/*
* Copyright (C) 2010 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
*
* 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
* limitations under the License.
*/
/* interactive buffer queue test program */
#ifdef ANDROID
#define USE_ANDROID_SIMPLE_BUFFER_QUEUE // change to #undef for compatibility testing
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <poll.h>
#include <fcntl.h>
#include <SLES/OpenSLES.h>
#ifdef USE_ANDROID_SIMPLE_BUFFER_QUEUE
#include <SLES/OpenSLES_Android.h>
#endif
#ifdef USE_ANDROID_SIMPLE_BUFFER_QUEUE
#define DATALOCATOR_BUFFERQUEUE SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE
#define IID_BUFFERQUEUE SL_IID_ANDROIDSIMPLEBUFFERQUEUE
#define BufferQueueItf SLAndroidSimpleBufferQueueItf
#define BufferQueueState SLAndroidSimpleBufferQueueState
#define INDEX index
#else
#define DATALOCATOR_BUFFERQUEUE SL_DATALOCATOR_BUFFERQUEUE
#define IID_BUFFERQUEUE SL_IID_BUFFERQUEUE
#define BufferQueueItf SLBufferQueueItf
#define BufferQueueState SLBufferQueueState
#define INDEX playIndex
#endif
#define checkResult(r) do { if ((r) != SL_RESULT_SUCCESS) fprintf(stderr, "error %d at %s:%d\n", \
(int) r, __FILE__, __LINE__); } while (0)
typedef struct {
short left;
short right;
} frame_t;
#define SINE_FRAMES (44100*5)
frame_t sine[SINE_FRAMES];
BufferQueueItf expectedCaller = NULL;
void *expectedContext = NULL;
static void callback(BufferQueueItf caller, void *context)
{
putchar('.');
if (caller != expectedCaller)
printf("caller %p expected %p\r\n", caller, expectedCaller);
if (context != expectedContext)
printf("context %p expected %p\r\n", context, expectedContext);
fflush(stdout);
}
int sleepTimeFromRate(int sampleRate /* per microsecond */, int bitsPerSample, int channelCount, int samplesGot) {
return sampleRate / samplesGot * bitsPerSample * channelCount;
}
int main(int argc, char **argv)
{
if (argc != 2) {
printf("usage: %s <pulseaudio pipe>\n", argv[0]);
exit(1);
}
SLresult result;
// create engine
SLObjectItf engineObject;
result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); checkResult(result);
result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); checkResult(result);
SLEngineItf engineEngine;
result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); checkResult(result);
// create output mix
SLObjectItf outputmixObject;
result = (*engineEngine)->CreateOutputMix(engineEngine, &outputmixObject, 0, NULL, NULL); checkResult(result);
result = (*outputmixObject)->Realize(outputmixObject, SL_BOOLEAN_FALSE); checkResult(result);
// create audio player
SLDataSource audiosrc;
SLDataSink audiosnk;
SLDataFormat_PCM pcm;
SLDataLocator_OutputMix locator_outputmix;
SLDataLocator_BufferQueue locator_bufferqueue;
locator_bufferqueue.locatorType = DATALOCATOR_BUFFERQUEUE;
locator_bufferqueue.numBuffers = 255;
locator_outputmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
locator_outputmix.outputMix = outputmixObject;
pcm.formatType = SL_DATAFORMAT_PCM;
pcm.numChannels = 2;
pcm.samplesPerSec = SL_SAMPLINGRATE_44_1;
pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
pcm.containerSize = 16;
pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
audiosrc.pLocator = &locator_bufferqueue;
audiosrc.pFormat = &pcm;
audiosnk.pLocator = &locator_outputmix;
audiosnk.pFormat = NULL;
SLObjectItf playerObject;
SLInterfaceID ids[1] = {IID_BUFFERQUEUE};
SLboolean flags[1] = {SL_BOOLEAN_TRUE};
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &playerObject, &audiosrc, &audiosnk,
1, ids, flags); checkResult(result);
result = (*playerObject)->Realize(playerObject, SL_BOOLEAN_FALSE); checkResult(result);
SLPlayItf playerPlay;
result = (*playerObject)->GetInterface(playerObject, SL_IID_PLAY, &playerPlay); checkResult(result);
BufferQueueItf playerBufferqueue;
result = (*playerObject)->GetInterface(playerObject, IID_BUFFERQUEUE, &playerBufferqueue); checkResult(result);
SLuint32 state;
state = SL_PLAYSTATE_PLAYING;
result = (*playerPlay)->SetPlayState(playerPlay, state); checkResult(result);
/*unsigned i;
float pi2 = 3.14*2;
float hz = 441;
float sr = 44100;
for (i = 0; i < SINE_FRAMES; ++i) {
sine[i].left = sin((float) (i / (sr / hz)) * pi2 ) * 32000.0;
sine[i].right = sine[i].left;
}
for (i=0; i<500; i++) {
usleep(10000);
result = (*playerBufferqueue)->Enqueue(playerBufferqueue, sine, sizeof(sine));
}*/
#define MAX_BUFF_SIZE 4096
frame_t buff[MAX_BUFF_SIZE];
memset (buff, 0, sizeof(buff));
int fd,ret,len;
struct pollfd fdinfo[1];
if((fd = open(argv[1], O_RDONLY)) == -1) {
perror("Error opening pulseaudio pipe");
exit(1);
}
fdinfo[0].fd = fd;
fdinfo[0].events = POLLIN|POLLPRI ;
//printf("start reading...\n");
int playtime;
while(1){
ret = poll(fdinfo,1,-1);
if (ret < 0) printf("\n error \n");
if ( ((fdinfo[0].revents&POLLIN) == POLLIN) || ((fdinfo[0].revents&POLLPRI) == POLLPRI) ){
len = read(fdinfo[0].fd, buff, sizeof(buff));
//printf("read (%d)...\n", len);
if (len > 0){
result = (*playerBufferqueue)->Enqueue(playerBufferqueue, buff, len);
playtime = pcm.samplesPerSec/(len/sizeof(frame_t))*10;
//printf("play time is\t%d\n", playtime);
usleep(playtime*0.9);
}
}
}
}pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
load-module module-simple-protocol-tcp rate=44100 format=s16le channels=2 record=true port=12345" listen=127.0.0.1Sound works , In a way or another , using a named piper , or like your or others said a socket , and pulse audio .
What is not working for now is 3d acceleration
maru@jessie:~$ cat /etc/asound.conf
pcm.!default {
type asym
playback.pcm {
type plug
slave {
pcm {
type file
file "/mnt/maru/maudio"
slave.pcm null
format raw
}
rate 44100
format s16_le
channels 2
}
}
}#!/bin/sh
adb root
adb shell mount -o remount,rw /
adb push out-arm/usr /usr
adb push android-pulseaudio.conf /
adb shell HOME=/pulse TMPDIR=/pulse LD_LIBRARY_PATH=/usr/lib:/usr/lib/pulseaudio/:/usr/lib/pulse-11.1/modules/ /usr/bin/pulseaudio --disable-shm -n -F android-pulseaudio.conf --daemonize=false --use-pid-file=false --log-target=stderr --log-level=debug --system=false --dl-search-path=/usr/lib/pulse-11.1/modules/
# Default to PulseAudio
pcm.!default {
type pulse
hint {
show on
description "Default ALSA Output (currently PulseAudio Sound Server)"
}
} ctl.!default { type pulse }
pcm.pulse {
type pulse
hint {
show on
description "PulseAudio Sound Server"
}
}
ctl.pulse {
type pulse
}
--
You received this message because you are subscribed to a topic in the Google Groups "Maru OS dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/maru-os-dev/HzqAdt2bpNw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to maru-os-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/maru-os-dev/66574a4e-20ac-4cc7-80c0-f62966c35426%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to maru-os-dev...@googlegroups.com.
/usr/bin/pulseaudio --start --log-target=syslog -F daemon.confI added in .conf : load-module module-suspend-on-idle timeout=20
so here is the config file :
android_pulseaudio.conf
-------------------------------------------------------
#!/usr/bin/pulseaudio -nF
.nofail
.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 port=4712 auth-anonymous=true
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply
load-module module-switch-on-port-available
load-module module-sles-sink
load-module module-suspend-on-idle timeout=20
--------------------------------------------------------------------------------
But it just reveice a killed :
.......................
I: [pulseaudio_andr] module.c: Loaded "module-sles-sink" (index: #14; argument: "").
D: [pulseaudio_andr] module-suspend-on-idle.c: Sink auto_null becomes idle, timeout in 20 seconds.
D: [pulseaudio_andr] module-suspend-on-idle.c: Sink OpenSL_ES_sink becomes idle, timeout in 20 seconds.
I: [pulseaudio_andr] module.c: Loaded "module-suspend-on-idle" (index: #15; argument: "timeout=20").
I: [pulseaudio_andr] main.c: Daemon startup complete.
I: [pulseaudio_andr] module.c: Unloading "module-null-sink" (index: #7).
D: [pulseaudio_andr] module-rescue-streams.c: No sink inputs to move away.
I: [pulseaudio_andr] core.c: default_sink: auto_null -> OpenSL_ES_sink
I: [pulseaudio_andr] core.c: default_source: auto_null.monitor -> OpenSL_ES_sink.monitor
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio_andr] module-rescue-streams.c: No source outputs to move away.
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to remove event.
D: [null-sink] module-null-sink.c: Thread shutting down
I: [pulseaudio_andr] sink.c: Freeing sink 0 "auto_null"
I: [pulseaudio_andr] source.c: Freeing source 0 "auto_null.monitor"
I: [pulseaudio_andr] module.c: Unloaded "module-null-sink" (index: #7).
D: [pulseaudio_andr] core-subscribe.c: Dropped redundant event due to remove event.
Killed