[pulseaudio-discuss] Is this a pulseaudio bug or a vala bug?

Alexander Kurtz kurtz.alex at googlemail.com
Thu Mar 24 19:37:12 PDT 2011


Hi,

I have a problem with Pulseaudio (0.9.21) + Vala (0.10.4). I've written
this small demonstration program:

	$ cat test.vala 
	class MyClass : Object {
		static void main(){
			PulseAudio.SampleSpec spec = PulseAudio.SampleSpec() {
				format = PulseAudio.SampleFormat.S32NE,
				channels = 2,
				rate = 44100
			};
			PulseAudio.MainLoop loop =
				new PulseAudio.MainLoop();
			PulseAudio.Context context =
				new PulseAudio.Context(loop.get_api(), null);	
			PulseAudio.Stream stream =
				new PulseAudio.Stream(context, "", spec);
			int32[] data = new int32[10];
			stream.write(data, sizeof(int32) * data.length);
		}
	}
	$

I know that this program won't work (i.e. "run") but it should compile
just fine. However, I get this:

	$ valac --vapidir=. --pkg=libpulse --pkg=posix test.vala
	/home/alexander/test/test.vala.c: In function ‘myclass_main’:
	/home/alexander/test/test.vala.c:61: warning: passing argument 5 of ‘pa_stream_write’ makes integer from pointer without a cast
	/usr/include/pulse/stream.h:503: note: expected ‘int64_t’ but argument is of type ‘void *’
	/home/alexander/test/test.vala.c:61: error: too many arguments to function ‘pa_stream_write’
	error: cc exited with status 256
	Compilation failed: 1 error(s), 0 warning(s)
	$ 

Looking at the generated C-Code reveals this:

	$ valac --vapidir=. --pkg=libpulse --pkg=posix --ccode test.vala
	$ cat test.c
	[...]
		pa_stream_write (stream, data, (gsize) (sizeof (gint32) * data_length1), NULL, NULL, 0, PA_SEEK_RELATIVE);
	[...]
	$

This is obviously wrong, since pa_stream_write takes 6 arguments not 7, see[1].

Is this a bug in PA's Vala bindings or in Vala itself?

Best regards

Alexander Kurtz

[1] http://0pointer.de/lennart/projects/pulseaudio/doxygen/stream_8h.html#a4fc69dec0cc202fcc174125dc88dada7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110325/dab71ed4/attachment.pgp>


More information about the pulseaudio-discuss mailing list