Re: Linux Sound ioctls? 1.3.8x

Wingerde van GR (gertjan@cs.vu.nl)
Sat, 13 Apr 1996 12:13:46 +0200 (MET DST)


Scott Street writes:
>
>
> Kernel Sound hackers,
>
> I have been trying to get the a simple WAV file player working, I
> downloaded a package from sunsite, but never could get it to work either.
> I'm not sure if it kernel related or sound driver related.
>
> The problem is, anytime I call an ioctl with SNDCTL_* requests, I only
> get a Segfault and no real reason why is appearent.
>
> Is case it matters,gcc 2.7.0 on a pentium 90.
>

Change your program to the following:

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h>

int main()
{

int speed, ret;
int audiodev;

audiodev= open("/dev/dsp", O_RDWR);

speed = 11500;
ret = ioctl( audiodev, SNDCTL_DSP_SPEED, &speed);

printf("Audio Playback speed set to %d\n", speed);

return 0;
}

The 3rd parameter of the ioctl call in inout so it has to be a pointer.

Gertjan

-- 

Gertjan van Wingerde home address: Student Computer Science Vrije Universiteit J.H. Dunantstraat 44 Amsterdam 1561 BD Krommenie The Netherlands

e-mail: gertjan@cs.vu.nl URL: http://www.cs.vu.nl/~gertjan/