[pulseaudio-tickets] [PulseAudio] #343: bsnes does not play well with pulseaudio
PulseAudio
trac-noreply at tango.0pointer.de
Wed Dec 17 09:23:12 PST 2008
#343: bsnes does not play well with pulseaudio
-----------------------+----------------------------------------------------
Reporter: belegdol | Owner: lennart
Type: defect | Status: new
Priority: normal | Milestone:
Component: daemon | Severity: normal
Resolution: | Keywords:
-----------------------+----------------------------------------------------
Comment (by belegdol):
byuu (the bsnes author) was kind enough to provide a simple test case. It
needs some love before it compiles, though.
{{{
#include <stdint.h>
#include <pulse/simple.h>
#include <pulse/error.h>
//PulseAudio simple test -- no error handling
int main() {
pa_simple *handle;
pa_sample_spec spec;
uint32_t buffer[64];
spec.format = PA_SAMPLE_S16LE;
spec.channels = 2;
spec.rate = 32000;
int error = 0;
handle = pa_simple_new(
0, //default server
"ruby::pulseaudio", //application name
PA_STREAM_PLAYBACK, //direction
0, //default device
"audio", //stream description
&spec, //sample format
0, //default channel map
0, //default buffering attributes
&error //error code
);
while(true) {
for(unsigned i = 0; i < 64; i++) {
int16_t sample = sin(i * 2 * M_PI / 64) * 0x2000; //may need
tweaking
buffer[buffer.offset++] = (sample << 16) | sample; //left and right
}
int error = 0;
pa_simple_write(handle, (const void*)buffer, 64 * sizeof(uint32_t),
&error);
}
pa_simple_flush(handle, &error);
pa_simple_free(handle);
return 0;
}
}}}
--
Ticket URL: <http://pulseaudio.org/ticket/343#comment:2>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
More information about the pulseaudio-bugs
mailing list