TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Mark Harris
from: Frank Adam
date: 1996-05-21 22:38:16
subject: New comer ..

G'Day Mark,
 
-=> Quoting Mark Harris to All <=-
 MH> Hey,
 MH> I have only recently started learning C .. I wanna know how to
 MH> play a WAV or make sounds with the pc-speaker .. Can someone also show
Create a window glass, allocate space for the speaker on top of it. 
Assign the speaker to it, now increment the x,y position of the speaker..
Voila, sound.            
You can attempt to overload the glass to get a different pitch, but be 
careful this sort of thing is known to lead to crashed stacks.

 MH> me how to load and display GIF's or whatever ?? Or any cool stuff ..
free(z);

 MH> Thanx in advance ..
No probs.

Just kidding, but that other post of yours with the dots, deserves worse 
treatment than the above. I don't know or care what went on between who
ever, but neither the language nor the message was appropriate here.
Ahhnyway..

Displaying GIFs is not all that easy, as well as playing WAVs.I found the 
best thing is to look around for a library, where someone crazy enough has 
done the work for you. Ruck*.arj or zip will handle most common sound 
formats and SB compatible sound cards, GUS too i think.
I can't think of a Gif display routine, but look in C programming areas
on your BBS.

As far as sound on the speaker, that's fairly easy, but will get a bit 
more complicated if you're trying to play music.I'm also unaware of any
portable way of doing this.
If you're lucky enough to have borlandc or turboc this will work. 

A very crude piano, you'll need the ascii chart handy to play music :-)

#include   /* for getch() and kbhit() */
#include     /* for sound() and nosound() */

int main()
{
 int freq,key = 0;
                                                   
 printf("\nPress ESC to end.");
 
 while(key != 27)  /* loop until esc was pressed */
 {
  key = getch();   /* get a key from console */
  if(key && key != 27)          /* if the key is not 0 and not ESC */
  {
   freq = key*3;                /* set a good audible frequency */
   while(!kbhit()) sound(freq); /* play until another key is hit */
   nosound();                   /* switch off this sound */
   }                            
 }                              /* do it again */

 return 0;
 }

Hope this gets you going.

 MH> Thanx in advance ..
Again, no probs :-)


  L8r Frank (fadam{at}ozemail.com.au).
                                                               
___ Blue Wave/DOS v2.21
                                      

--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413
SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/544 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.