ou est passée l'interface /dev/dsp sous Linux

Hello,

Tout est dans le titre.

.... #define SOUND_DEV "/dev/dsp" ....

int main() { int sfd; char number[100];

sfd = open(SOUND_DEV,O_RDWR); if(sfd

Reply to
habib
Loading thread data ...

Hello tout le monde !

Je viens de passer un peu de temps sur interface alsa sous Linux et en

Si quelqu'un a le temps de compiler ce petit programme sous Linux juste pour savoir si c'est ok.

/* ===================================== DTMF Encoding In C HBV - 2021 Reviewed for alsa interface ===================================== Code based on multimon package

---------- Makefile to compile under GNU/Linux

CFLAGS= -Wall -DUNSIGNED -DDTMF_ALSA -lasound CC = gcc

default: detect gen

detect: detect.c $(CC) detect.c $(CFLAGS) -o detect

gen: gen.c $(CC) gen.c $(CFLAGS) -o gen

clean: rm -rf *.o core a.out detect gen

*/ #include #include #include #include #include #include #include

#ifdef DTMF_ALSA #define DTMF_FILE snd_pcm_t #include #else #define DTMF_FILE int #include #include #endif

#ifdef DTMF_ALSA #define SOUND_DEV "default" /* May be ?? */ #else #define SOUND_DEV "/dev/dsp" /* Legacy OSS Interface */ #endif

/* -------- local defines (if we had more.. seperate file) ----- */ #define FSAMPLE 8000 /* sampling rate, 8KHz */

/* * FLOAT_TO_SAMPLE converts a float in the range -1.0 to 1.0 * into a format valid to be written out in a sound file * or to a sound device */ #ifdef SIGNED # define FLOAT_TO_SAMPLE(x) ((char)((x) * 127.0)) #else # define FLOAT_TO_SAMPLE(x) ((char)((x + 1.0) * 127.0)) #endif

#define BLEN 2048

typedef char sample;

int err; snd_pcm_t *handle; snd_pcm_hw_params_t *params; snd_pcm_sframes_t frames;

unsigned char buffer[16*1024];

/* --------------------------------------------------------------- */

/* * take the sine of x, where x is 0 to 65535 (for 0 to 360 degrees) */ float mysine(short in) { static float coef[] = { 3.140625, 0.02026367, -5.325196, 0.5446778, 1.800293 }; float x,y,res; int sign,i;

if(in < 0) { /* force positive */ sign = -1; in = -in; } else sign = 1; if(in >= 0x4000) /* 90 degrees */ in = 0x8000 - in; /* 180 degrees - in */ x = in * (1/32768.0); y = x; /* y holds x^i) */ res = 0; for(i=0; i

Reply to
habib

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.