Article View: borland.public.cppbuilder.nativeapi
Article #13107Re: Play wav file from code
From: Martin C
Date: Mon, 27 Oct 2003 13:34
Date: Mon, 27 Oct 2003 13:34
66 lines
2710 bytes
2710 bytes
Thanks Ed, that was even more than what I was looking for...
"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:3f9c8805$1@newsgroups.borland.com...
>
> How you do that depends upon if it is an external *.wav file or one you
have
> built into your program as a resource.
>
>
> If you want to play the sound contained in an external file, FILENAME.WAV
>
> PlaySound("filename.wav", NULL, SND_FILENAME);
>
>
> If you want to play a sound that you have built into your program as a
> resource.
>
> Put this declaration at the top of your source file to tell it of this
> variable which was created by the compiler's startup code.
>
> -----------------
> extern HINSTANCE _hInstance;
> -----------------
>
> Create a resource file, we'll call it SOUND.RC, containing this and add
that
> file name to the project.
> -----------------
> #include "sound.rh"
>
> BIG_SOUND WAVE "filename.wav"
> -----------------
>
>
> You have created a header file named SOUND.RH containing this
> -----------------
> #define BIG_SOUND 1 /* or whatever number you want to give it */
> -----------------
>
> Your source file should include SOUND.RH so that it knows of the #define
for
> BIG_SOUND
>
> You can then give this command to play the wav file you have built into
your
> program.
>
> -----------------
> PlaySound(MAKEINTRESOURCE(BIG_SOUND),
> _hInstance, SND_RESOURCE);
>
> -----------------
>
> For more things you can do with PlaySound, look in the compiler-supplied
> help on Windows.
>
> . Ed
>
> > Martin C wrote in message
> > news:3f9c7595@newsgroups.borland.com...
> >
> > How I can play wave file programmatically ?
>
>
Technical Details
Message-ID:
<3f9d1ecb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f9c7595@newsgroups.borland.com> <3f9c8805$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,1888f9f1253de96f X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-27 05:40:07 PST From: "Martin C" <martinc@aol.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f9c7595@newsgroups.borland.com> <3f9c8805$1@newsgroups.borland.com> Subject: Re: Play wav file from code Date: Mon, 27 Oct 2003 05:34:01 -0800 Lines: 68 Organization: V Safe X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 62.135.27.42 Message-ID: <3f9d1ecb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1067261643 62.135.27.42 (27 Oct 2003 05:34:03 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail