On Jun 11 2008, Alexander Leidinger wrote:
> Quoting Rogério Brito <
rbrito@...> (from Tue, 10 Jun 2008
> 15:53:34 -0300):
>
> [abx]
>> Alexander, could you test it under FreeBSD to see if it is too much
>> system dependent? I don't know how much the sound system of FreeBSD
>> differs from Linux, but I'm only using the basic Open Sound System at
>> this time (no ALSA etc---which is Linux only, I think).
>
> We also have an OSS compatible system. The important difference to linux
> is, that some IOCTLs are picky about te order in which they are issued. I
> try to get some time to test this. If you don't hear from me, nag me
> about it again.
Could you please test this code to see if the order of the ioctls is
right for FreeBSD? Just put a wav file (44.1kHz, stereo, little-endian)
named sai.wav on the same directory where you compile this and tell me
if it plays the file.
It was just a quick and dirty work, but I think that it would be a good
preliminary test.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h>
int main(void)
{
int fd, i;
int wav;
int buff[44100*2*2]; /* one sec */
fd = open("/dev/dsp", O_WRONLY);
if (fd == -1) {fprintf(stderr, "Fodeu abertura\n"); exit(1);}
ioctl(fd, SNDCTL_DSP_RESET, 0);
i = 1;
ioctl(fd, SNDCTL_DSP_STEREO, &i);
printf("%d\n", i);
i = 44100;
ioctl(fd, SNDCTL_DSP_SPEED, &i);
printf("%d\n", i);
i = AFMT_S16_LE;
printf("%x\n", i);
if (ioctl(fd, SNDCTL_DSP_SETFMT, &i) == -1) {fprintf(stdout, "prob\n");}
printf("%x\n", i);
wav = open("sai.wav", O_RDONLY);
if (wav == -1)
exit(1);
read(wav, buff, 44); /* discard wav header */
while (read(wav, buff, 44100*2*2)) {
write(fd, buff, 44100*2*2);
}
if (close(fd) == -1) {fprintf(stderr, "Fodeu fechamento\n"); exit(2);}
if (close(wav) == -1) {fprintf(stderr, "Fodeu fechamento wav\n"); exit(3);}
return 0;
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> P.S.: Can I add my name as one of the developers on the History marking
>> that I've done some janitorial work and debian packaging? I refrained
>> myself from doing this because I thought that my contributions to the
>> project weren't so much...
>
> You changed code, you have a commit bit, go ahead.
Nice. Thanks.
Regards, Rogério Brito.
--
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito :
http://meusite.mackenzie.com.br/rbritoProjects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
Lame-dev mailing list
Lame-dev@...
https://lists.sourceforge.net/lists/listinfo/lame-dev