🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #9225

Re: altavoz interno

#9225
From: Reinoso G.
Date: Tue, 27 Aug 2002 12:59
57 lines
2565 bytes
 El otro d�a, quantium nos estuvo contando:
> Buenas.
> �sabeis de alguna funcion para poder reproducir sonidos con el altavoz 
> interno del ordenador ? se que \a reproduce un peque�o pitido, pero me 
> gustaria personalizar los mios propios.
> 
> Un saludo a todos y a cuidarse.
> 

#include <sys/ioctl.h>
#include <sys/kd.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

[...]

void
sound (int frec, int dur)
// La llamo sound porque tienes la misma sintaxis que el sound de QBASIC
// pero aqu� la duraci�n se especifica en 1/20 de segundo.
{
  if (frec == 0)
    {
      ioctl (fd, KIOCSOUND, 0);
      usleep (dur * 50000);
    }
  else
    {
      ioctl (fd, KIOCSOUND, (int) 1190000 / frec);
      usleep (dur * 50000);
    }
}
 


void
silencio (int senal)
{
  ioctl (fd, KIOCSOUND, 0);
  if (fd != 1)
    close (fd);
  exit (0);
}

 


M�s info en los ejemplos que acompa�an la LPG y en google.

Saludos.

-- 
�������������������������������������������������������������������������
��  Reinoso G.  EA4BAO / MiKatp             r einoso.bao@wanadoo.e s   ��
��  http://perso.wanadoo.es/reinoso.bao                                ��
������������������������������������������������������������������������� 
Technical Details
Message-ID: <slrnammttg.hn.reinoso@EA4BAO.PLLANO.ESP.EU>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!62-36-136-160.dialup.uni2.ES!not-for-mail
References: <3D565CB5.9020204@lycos.es>

Show Full Headers
Complete Article Headers
X-Google-Language: PORTUGUESE,ASCII
X-Google-Thread: f86c8,854eb7207d569809
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-08-27 15:12:23 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!62-36-136-160.dialup.uni2.ES!not-for-mail
From: "Reinoso G." <reinoso@probando.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: altavoz interno
Date: Tue, 27 Aug 2002 14:59:28 +0200
Lines: 57
Message-ID: <slrnammttg.hn.reinoso@EA4BAO.PLLANO.ESP.EU>
References: <3D565CB5.9020204@lycos.es>
Reply-To: rei noso.bao@wanadoo.e s
NNTP-Posting-Host: 62-36-136-160.dialup.uni2.es (62.36.136.160)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1030486341 53270526 62.36.136.160 (16 [106654])
X-Orig-Path: news.cis.dfn.es!nobody
User-Agent: slrn/0.9.7.4 (Linux)