Is even Phonon really used for snappy/lightweight audio playback?<br><br>It *appears* that PulseAudio is usable according to here: <a href="http://maemo.org/development/sdks/maemo_5_api_documentation/">http://maemo.org/development/sdks/maemo_5_api_documentation/</a><br>
<br>With the code below on host, I can get a wav file to play. That same wav file won't play when I move everything to scratchbox... I get the following...<br><br>[sbox-FREMANTLE_X86: ~/test2] > fakeroot run-standalone.sh ./test2 cat1.wav<br>
main.cpp: pa_simple_new() failed: Connection refused<br><br>Does anyone know what could be wrong?<br><br>I compiled with qmake -project and added the pulseaudio-simple library with LIBS+=<br><br>--------------------CODE START------------------<br>
<br>/***<br> This file is part of PulseAudio.<br><br> PulseAudio is free software; you can redistribute it and/or modify<br> it under the terms of the GNU Lesser General Public License as published<br> by the Free Software Foundation; either version 2.1 of the License,<br>
or (at your option) any later version.<br><br> PulseAudio is distributed in the hope that it will be useful, but<br> WITHOUT ANY WARRANTY; without even the implied warranty of<br> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
General Public License for more details.<br><br> You should have received a copy of the GNU Lesser General Public License<br> along with PulseAudio; if not, write to the Free Software<br> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307<br>
USA.<br>***/<br><br>#ifdef HAVE_CONFIG_H<br>#include <config.h><br>#endif<br><br>#include <stdio.h><br>#include <unistd.h><br>#include <string.h><br>#include <errno.h><br>#include <fcntl.h><br>
<br>#include <pulse/simple.h><br>#include <pulse/error.h><br>#include <pulse/gccmacro.h><br><br>#define BUFSIZE 1024<br><br>int main(int argc, char*argv[]) {<br><br> /* The Sample format to use */<br>
/*static const pa_sample_spec ss = {<br> .format = PA_SAMPLE_S16LE,<br> .rate = 44100,<br> .channels = 2<br> };*/<br> <br> static const pa_sample_spec ss = {PA_SAMPLE_U8, 22050, 1};<br><br>
pa_simple *s = NULL;<br> int ret = 1;<br> int error;<br><br> /* replace STDIN with the specified file if needed */<br> if (argc > 1) {<br> int fd;<br><br> if ((fd = open(argv[1], O_RDONLY)) < 0) {<br>
fprintf(stderr, __FILE__": open() failed: %s\n", strerror(errno));<br> goto finish;<br> }<br><br> if (dup2(fd, STDIN_FILENO) < 0) {<br> fprintf(stderr, __FILE__": dup2() failed: %s\n", strerror(errno));<br>
goto finish;<br> }<br><br> close(fd);<br> }<br><br> /* Create a new playback stream */<br> if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &error))) {<br>
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));<br> goto finish;<br> }<br><br> for (;;) {<br> uint8_t buf[BUFSIZE];<br> ssize_t r;<br><br>#if 0<br>
pa_usec_t latency;<br><br> if ((latency = pa_simple_get_latency(s, &error)) == (pa_usec_t) -1) {<br> fprintf(stderr, __FILE__": pa_simple_get_latency() failed: %s\n", pa_strerror(error));<br>
goto finish;<br> }<br><br> fprintf(stderr, "%0.0f usec \r", (float)latency);<br>#endif<br><br> /* Read some data ... */<br> if ((r = read(STDIN_FILENO, buf, sizeof(buf))) <= 0) {<br>
if (r == 0) /* EOF */<br> break;<br><br> fprintf(stderr, __FILE__": read() failed: %s\n", strerror(errno));<br> goto finish;<br> }<br><br> /* ... and play it */<br>
if (pa_simple_write(s, buf, (size_t) r, &error) < 0) {<br> fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error));<br> goto finish;<br> }<br> }<br>
<br> /* Make sure that every single sample was played */<br> if (pa_simple_drain(s, &error) < 0) {<br> fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error));<br> goto finish;<br>
}<br><br> ret = 0;<br><br>finish:<br><br> if (s)<br> pa_simple_free(s);<br><br> return ret;<br>}<br><br><br>------------------CODE END-------------------<br><br><div class="gmail_quote">On Wed, Oct 28, 2009 at 5:31 PM, Antonio Aloisio <span dir="ltr"><<a href="mailto:antonio.aloisio@gmail.com">antonio.aloisio@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>You can use phonon to play video and sound with Qt for fremantle.<br>It's available in current 4.5 community port as well as in the official 4.6 port.<br>
It's cross-platform, anyhow you can read more about that at:<br>
<a href="http://doc.trolltech.com/4.5/phonon-overview.html" target="_blank">http://doc.trolltech.com/4.5/phonon-overview.html</a><br><br>Br,<br>Antonio<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Oct 28, 2009 at 5:12 PM, Tim Teulings <span dir="ltr"><<a href="mailto:rael@edge.ping.de" target="_blank">rael@edge.ping.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello!<br>
<div><br>
> Isn't it a bit of an overkill to set up an entire GST pipeline just to<br>
> play<br>
> a blip sound?<br>
<br>
</div>Yes, but if you want to play your own sound or any sound on the filesystem<br>
this seems the<br>
way to go (libcanberra is for predefined sounds for predefined events).<br>
Lower level ways are likely forbitten, higher level ways likely require<br>
more code.<br>
<div><br>
> Is there something more lightweight?<br>
<br>
</div>You can use "playbin" (or playbin2?) for simplifing the pipeline building<br>
process. That still<br>
makes it a number of lines of code (but of course you will wrap that into a<br>
helper method :-)).<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div>Gruß...<br>
Tim<br>
_______________________________________________<br>
maemo-developers mailing list<br>
<a href="mailto:maemo-developers@maemo.org" target="_blank">maemo-developers@maemo.org</a><br>
<a href="https://lists.maemo.org/mailman/listinfo/maemo-developers" target="_blank">https://lists.maemo.org/mailman/listinfo/maemo-developers</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br><br><a href="http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html" target="_blank">Pablo Picasso</a> - "Computers are useless. They can only give you answers."
</font><br>_______________________________________________<br>
maemo-developers mailing list<br>
<a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br>
<a href="https://lists.maemo.org/mailman/listinfo/maemo-developers" target="_blank">https://lists.maemo.org/mailman/listinfo/maemo-developers</a><br>
<br></blockquote></div><br>