TMSOUND


TMSOUND ( 5.2) .

5.2. tmsound\tmsound.

// =====================================================

//

//

// (C) ., 1997

//

// E-mail: frolov@glas.apc.org

// WWW: http://www.glasnet.ru/~frolov

//

// http://www.dials.ccas.ru/frolov

// =====================================================

#include <stdio.h>

#include <conio.h>

#include <dos.h>

void sound(int, int);

void tm_sound(int freq, int time);

void tm_delay(int ticks);

//

int mary[] =

{

330, 294, 262, 294, 330, 330, 330,

294, 294, 294, 330, 392, 392,

330, 294, 262, 294, 330, 330, 330, 330,

294, 294, 330, 294, 262, 0

};

//

int del[] =

{

5, 5, 5, 5, 5, 5, 10,

5, 5, 10, 5, 5, 10,

5, 5, 5, 5, 5, 5, 5, 5,

5, 5, 5, 5, 20

};

int main(void)

{

int i;

for(i=0 ;mary[i] != 0 ;i++)

tm_sound(mary[i], del[i]);

return 0;

}

/**

*.Name tm_sound

*.Title

*

*.Descr

*

*

*

*.Proto void tm_sound(int freq, int time);

*

*.Params int freq - ;

* int time -

*

**/

void tm_sound(int freq, int time)

{

int cnt;

// 2

outp(0x43, 0xb6);

//

//

cnt = (int)(1193180L / freq);

// -

// ,

outp(0x42, cnt & 0x00ff);

outp(0x42, (cnt &0xff00) >> 8);

// .

// 2