void main() { char t; int y=0; /* defining frequencies of piano */ float f[]={261.63,293.66,329.63,349.23,392.0,440.0,493.88,523.25,277.18,311.13,369.99,415.13,466.16,523.25,587.33,659.26,698.46,783.99,880.0,987.77,1046.5,554.37,622.25,739.99,830.61,932.33,0.0}; /* mapping frequencies to keyboard keys! */ char keyboard[]={'z','x','c','v','b','n','m',',','s','d','g','h','j','w','e','r','t','y','u','i','o','2','3','5','6','7','\0'}; nosound(); printf("----System Sound Piano----\nUse keys z to , and s to k for lower notes\n w to o and 2 to 8 for higher notes.\n Press '+' sign (i.e shift + =) to exit."); while(1){ delay(100); if(kbhit()){ t=getch(); sound(f[loc(t,keyboard)]); y=0; if(t=='+') { nosound(); break; } } y++; if(y==3) { nosound(); y=0; } } }
/* plays different types of music */ bell ( int m_no ) { /* natural frequencies of 7 notes */ float wave[6] = { 120.81, 136.83, 144.81, 154.61, 216, 240 } ; int n, i ; switch ( m_no ) { case 1 : for ( i = 0 ; i < 6 ; i++ ) { sound ( wave[i] * 1 ) ; delay ( 30 ) ; } nosound() ; break ; case 2 : for ( i = 0 ; i < 15 ; i++ ) { n = random ( 6 ) ; sound ( wave[n] * 2 ) ; delay ( 100 ) ; } nosound() ; break ; case 3 : while ( !kbhit() ) { n = random ( 6 ) ; sound ( wave[n] * 2 ) ; delay ( 100 ) ; } nosound() ; /* flush the keyboard buffer */ if ( getch() == 0 ) getch() ; break ; case 4 : for ( i = 5 ; i >= 0 ; i-- ) { sound ( wave[i] * 4 ) ; delay ( 15 ) ; } nosound() ; break ; case 5 : sound ( wave[2] * 5 ) ; delay ( 50 ) ; nosound() ; } }
void Get_Set_Go() { textbackground(BLACK); gotoxy(11,3); textcolor(DARKGRAY); cprintf("O"); gotoxy(11,4); textcolor(DARKGRAY); cprintf("O"); textcolor(DARKGRAY); gotoxy(11,5); cprintf("O"); sleep(1); sound(1000); delay(100); nosound(); gotoxy(11,3); textcolor(LIGHTRED); cprintf("O"); sleep(1); sound(1000); delay(100); nosound(); gotoxy(11,4); textcolor(LIGHTRED); cprintf("O"); sleep(1); sound(1000); delay(100); nosound(); textcolor(LIGHTRED); gotoxy(11,5); cprintf("O"); sleep(1); gotoxy(11,3); textcolor(LIGHTGREEN+BLINK); cprintf("O"); gotoxy(11,4); textcolor(LIGHTGREEN+BLINK); cprintf("O"); textcolor(LIGHTGREEN+BLINK); gotoxy(11,5); cprintf("O"); sound(1000); delay(500); nosound(); }
streng *os2_beep( tsd_t *TSD, cparamboxptr parms ) { int freq=0,dur=1; checkparam( parms, 2, 1 , "BEEP" ) ; if (parms && parms->value) { freq = atopos( TSD, parms->value, "BEEP", 1 ) ; if (freq < 37 || freq > 32767) exiterror( ERR_INCORRECT_CALL, 0 ); } if (parms->next && parms->next->value) { dur = atopos( TSD, parms->next->value, "BEEP", 2 ) ; if (dur < 1 || freq > 60000) exiterror( ERR_INCORRECT_CALL, 0 ); } #if defined(WIN32) Beep( (DWORD)freq, (DWORD)dur ); #elif defined (__EMX__) if (_osmode != DOS_MODE) DosBeep( freq, dur ); else { int hdl; /* stdout and/or stderr may be redirected */ if ((hdl = open("con", O_WRONLY)) != -1) { write(hdl, "\x07" /* ^G == bell */, 1); close(hdl); } } #elif defined(DOS) putchar(7); #elif defined(OS2) DosBeep( freq, dur ); #elif defined(__QNX__) printf("\a"); #elif defined(__WATCOMC__) sound( freq ); delay( dur ); nosound( ); #elif defined(__DJGPP__) sound( freq ); delay( dur ); nosound( ); #elif defined(__WINS__) || defined(__EPOC32__) beep( freq, dur ); #endif return nullstringptr(); }
void main() { long ct=0,cnt=0; char frase[80], *mai, mor[300],ch,morse[40][6]={{".-" },{"-..." },{"-.-." },{"-.." },{"." },{"..-." },{"--." },{"...." },{".." },{".---" },{"-.-" },{".-.." },{"--" },{"-." },{"---" },{".--." },{"--.-" },{".-." },{"..." },{"-" },{"..-" },{"...-" },{".--" },{"-..-" },{"-.--" },{"--.." },{"-----"},{".----"},{"..---"},{"...--"},{"....-"},{"....."},{"-...."},{"--..."},{"---.."},{"----."}}; clrscr(); puts("Digite uma frase para ser transformada em codigo morse!(max. 80 caracteres.):"); gets(frase); mai = strupr(frase); for(;*mai!='\0';mai++) { int i=0; ch = *mai; if(ch>='A' && ch<='Z') { for(i=0;morse[(*mai)-65][i]!='\0';i++) { *(mor + ct++) = morse[(*mai)-65][i]; } } else { if(ch>='0' && ch<='9') { for(i=0;morse[(*mai)-22][i]!='\0';i++) { *(mor + ct++) = morse[(*mai)-22][i]; } } } } *(mor + ct) = '\0'; printf("\n %s ",mor); while(cnt<ct) { ch = *(mor+cnt); if(ch=='.') { sound(300); delay(50); nosound(); delay(100); } else if(ch=='-') { sound(300); delay(500); nosound(); delay(100); } cnt++; } }
void main() { int gd=DETECT,gm,x,y,button,i; randomize(); for(i=0;i<20;i++) {n[i]=20;} for(i=0;i<20;i++) {n1[i]=20;} initgraph(&gd,&gm," "); sound(2350); outtextxy(250,150,"WELCOME TO PUZZLSE "); sleep(1); nosound();cleardevice(); setbkcolor(GREEN); mouse(); rectangle(200,200,300,230); rectangle(400,200,450,230); outtextxy(203,203,"START");outtextxy(403,203,"EXIT"); while(flag==0) { getmousepos(&button,&x,&y); if(button==1&&x>200&&x<300&&y>200&&y<230) {delay(500);hidemouseptr();number();} if(button==1&&x>400&&x<450&&y>200&&y<230)exit(0); } }
//************* void press (int x1,int y1,int x2, int y2, int c1,int c2, int c3, int n){ int y; sound(800); delay(50); nosound(); for(y=0;y<n;y++) { setcolor(c2); line(x1-y,y2+y,x2+y,y2+y); line(x2+y,y1-y,x2+y,y2+y); setcolor(c1); line(x1-y,y1-y,x1-y,y2+y); line(x1-y,y1-y,x2+y,y1-y); } delay(330); for(y=0;y<n;y++) { setcolor(c1); line(x1-y,y2+y,x2+y,y2+y); line(x2+y,y1-y,x2+y,y2+y); setcolor(c2); line(x1-y,y1-y,x1-y,y2+y); line(x1-y,y1-y,x2+y,y1-y); } delay(230); }
void TOutputDevice::checkStatus() { if( formDef->oldDevice ) return; //!!!!!!!!!!!!! int counter = 0; char status; char cr; readBytes( &cr, 1 ); do { status = cr; readBytes( &cr, 1 ); counter++; } while( (cr != '\r') && (counter <= 3) ); if( status != '!' ) { sound( 1000 ); delay( 1000 ); nosound(); } }
void score(int i,int l,int shots) { int n; for(n=0;n<3;n++) {sound(200); cleardevice(); delay(250); nosound(); settextstyle(4,0,8); setcolor(6); outtextxy(150,150,"Game Over"); setcolor(RED); rect(i); delay(350);} delay(100); getch(); cleardevice(); setbkcolor(RED); gotoxy(34,16); printf("Your Score:: %d",l*1000-::shots*150); gotoxy(33,17); printf("Highest Score:: 20000"); delay(2500); getch(); if(shots>=25)loose(i); else won(i); }
int hh() { sound(300); delay(300); nosound(); return(0); }
void beep_low(void) { sound(900); delay(400); nosound(); delay(100); }
void beep_low(void) { sound(900); delay(200); /* 400 */ nosound(); delay(100); }
void getvoc (int c) { int n,a,lasta; unsigned int lastused; nosound(); if ((voclen[c]!=0) && (vocnum[c]==-1)) { // Free an old voc if necessary n=0; lasta=-1; lastused=65535; for (a=0; a<num_samps; a++) if (vocnum[a]!=-1) { n++; if (vocused[a]<lastused) { lastused=vocused[a]; lasta=a; }; } if (n>=(memvocs-1)) { vocnum[c]=vocnum[lasta]; vocnum[lasta]=-1; } else { vocnum[c]=n; }; // Load this voc n=vocnum[c]; memcpy (memvoc+n*maxvoclen,vochdr,0x20); *(memvoc+n*maxvoclen+0x1b)=(char)(voclen[c]); *(memvoc+n*maxvoclen+0x1c)=(char)((voclen[c])>>8); *(memvoc+n*maxvoclen+0x1e)=96; // Speed = 256-1,000,000/rate lseek (vocfilehandle,vocposn[c],SEEK_SET); read (vocfilehandle,memvoc+n*maxvoclen+0x20,voclen[c]); };
void __init amiga_init_sound(void) { static struct resource beep_res = { .name = "Beep" }; snd_data = amiga_chip_alloc_res(sizeof(sine_data), &beep_res); if (!snd_data) { printk (KERN_CRIT "amiga init_sound: failed to allocate chipmem\n"); return; } memcpy (snd_data, sine_data, sizeof(sine_data)); /* setup divisor */ clock_constant = (amiga_colorclock+DATA_SIZE/2)/DATA_SIZE; /* without amifb, turn video off and enable high quality sound */ #ifndef CONFIG_FB_AMIGA amifb_video_off(); #endif } static void nosound( unsigned long ignored ); static DEFINE_TIMER(sound_timer, nosound, 0, 0); void amiga_mksound( unsigned int hz, unsigned int ticks ) { unsigned long flags; if (!snd_data) return; local_irq_save(flags); del_timer( &sound_timer ); if (hz > 20 && hz < 32767) { unsigned long period = (clock_constant / hz); if (period < amiga_audio_min_period) period = amiga_audio_min_period; if (period > MAX_PERIOD) period = MAX_PERIOD; /* setup pointer to data, period, length and volume */ custom.aud[2].audlc = snd_data; custom.aud[2].audlen = sizeof(sine_data)/2; custom.aud[2].audper = (unsigned short)period; custom.aud[2].audvol = 32; /* 50% of maxvol */ if (ticks) { sound_timer.expires = jiffies + ticks; add_timer( &sound_timer ); } /* turn on DMA for audio channel 2 */ custom.dmacon = DMAF_SETCLR | DMAF_AUD2; } else nosound( 0 ); local_irq_restore(flags); }
void pno(int x) { sound(x); delay(130); nosound(); return; }
int main(void) { int i; int fre=1000; for(i=1;i<5;i++)//kbhit()) { sound(fre); fre+=50; delay(200); nosound(); //delay(200); if(kbhit()) break; } delay(100); sound(fre+100);delay(100);sound(fre+100); nosound(); return 0; }
/* * Turn PC speaker on at specified frequency. */ static void sound(unsigned freq) { int es; #ifndef S_SPLINT_S #asm mov bx, [bp+.sound.freq] ! frequency mov ax, #$34dd mov dx, #$0012 cmp dx, bx jnb none div bx mov bx, ax in al, $61 test al, #3 jne j1 or al, #3 out $61, al j1: mov al, #$b6 out $43, al mov al, bl out $42, al mov al, bh out $42, al none: #endasm #endif } /* * Turn PC speaker off. */ static void nosound(void) { #ifndef S_SPLINT_S #asm in al, $61 and al, #$fc out $61, al #endasm #endif } /* * Actually sound the speaker. */ void bell(void) { register char *pi = (char *) 60000U; sound(800); while (--pi) /* Do nothing */ ; nosound(); }
void Guide::ProcessGuide(void) { static AZInt Sound; static AZInt HoldPECIx; // only write to file if PEC index changes if(PECIx.A!=HoldPECIx.A) { if(!PECIx.A) { sound(1000); Sound.A=!Sound.A; } else if(Sound.A) { Sound.A=!Sound.A; nosound(); } Guides[GuideIx.A].A.PECIx=PECIx.A; Guides[GuideIx.A].A.TenthsArcsec=AccumGuide.A*RadToTenthsArcsec; HoldPECIx.A=PECIx.A; GuideIx.A++; } if(PECIx.Z!=HoldPECIx.Z) { if(!PECIx.Z) { sound(500); Sound.Z=!Sound.Z; } else if(Sound.Z) { Sound.Z=!Sound.Z; nosound(); } Guides[GuideIx.Z].Z.PECIx=PECIx.Z; Guides[GuideIx.Z].Z.TenthsArcsec=AccumGuide.Z*RadToTenthsArcsec; HoldPECIx.Z=PECIx.Z; GuideIx.Z++; } if(GuideIx.A>=MaxGuideIx || GuideIx.Z>=MaxGuideIx) EndAndSaveGuide(); }
void SoundDrop() { if(SoundOn) //SoundOn is a variable for on/off sound { for(int i=5; i<10; i++) { sound(200*i); delay(1); nosound(); } } }
void inv(void) { sound(700); outtextxy(300,430,"INVALID INPUT"); delay(500); nosound(); setcolor(0); outtextxy(300,430,"INVALID INPUT"); }
void init_sound() { play_sound ( 1000 ); sleep ( 1 ); play_sound ( 990 ); sleep ( 1 ); play_sound ( 1000 ); sleep ( 1 ); nosound(); exit(); }
main() { void interrupt(*oldTimer)(); oldTimer=getvect(0X1c); setvect(0X1c,beNoisy); playtune(song); DoSomething(); setvect(0X1c,oldTimer); nosound(); }
int beep(int length, int freq, int time) { if (time > length) return 1; sound(freq); delay(time); nosound(); delay(length - time); return 0; }
void salir(void) { textmode(C80); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); puts("DPA Software. 1997"); puts("Jairo Alejandro Duarte Avenda¤o."); _setcursortype(_NORMALCURSOR); /* mostrar de nuevo el cursor */ nosound(); exit(0); }
void bullet(int i) { setbkcolor(0); int j; for(j=425;j>=0;j-=25) {circle(325+i,j,3); floodfill(327+i,j+1,RED); if((322+i<=::x)&&(328+i>=::x)&&(j==::y)) {::l++;if(::l<20){blast(i,j);break;} if(::l==20){getch();delay(1000);blast(i,j);score(i,::l,::shots);}} delay(15); sound(600);delay(1);nosound(); target(i);} }
void killsystem(void) { freebloc(&mousebloc); freebloc(&mousefond); if (dacport) killspl(); if (sndblast) sendinit(0xd3); if (speaker) nosound(); killmse(); killkbd(); textmode(3); }
void close_all() { nosound(); /* Release(OldHeapLimit); video_mode(3); if OldHeapSize <> memavail then begin writeln('Achtung Heapmanipulationen waren nicht erfolgreich!'); readkey; end; */ FileMode = OldFileMode; }
void celebrar(void) { int num; clrscr(); for(num = 0; num < 500; num++) { sound(num + 50); delay(3); } nosound(); }
//current clip is done, stop it void stop_hostage_clip() { get_hostage_window_coords(&Hostage_monitor_x,&Hostage_monitor_y,&Hostage_monitor_w,&Hostage_monitor_h); nosound(); // Turn off sound Hostage_animation_time = -1; // Consider this vclip done if (N_hostage_clips) //more in queue? start_hostage_clip(); return; }
void PlaceQueen(int row, int column) { if (column == 0)/*Queen was in HOme*/ { setfillstyle(SOLID_FILL, LIGHTBLUE) ; setcolor(LIGHTBLUE); pieslice(SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0, 360, 4); } delay(100);sound(400);delay(DELAY);nosound(); setfillstyle(SOLID_FILL, BLUE) ; setcolor(BLUE); pieslice((column + 1) * SQSIZE + SQSIZE / 2, row * SQSIZE + SQSIZE / 2, 0,360, 4); }