delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/17/01:35:55

From: "Marp" <Marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: This may be a stupid Allegro question, but I'm out of my wits on sound.
Date: Sat, 17 Jul 1999 00:46:05 -0400
Organization: Netcom
Lines: 42
Message-ID: <7mp1qg$c2c@dfw-ixnews15.ix.netcom.com>
References: <379005BA DOT 151A7A89 AT dallas DOT crosswinds DOT net>
NNTP-Posting-Host: prn-nj1-11.ix.netcom.com
X-NETCOM-Date: Fri Jul 16 11:46:08 PM CDT 1999
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

First change:
if (Value == -1)

to:
if (Value)

There's no guarantee that install_sound returns -1 on error, but it will
return a non-zero value on failure.

Ok now here's your problem. When you call play_sample(), it returns as soon
as it starts playing, not when its finished. If it did, how would it return
if you tell it to continuously loop? Since you call destroy_sample()
immediately after, you don't hear anything. You should have it wait for
something like a keypress. Try inserting getch() in-between these two
functions like this:

play_sample(Sound,255,100,22050,1);
getch(); // Wait for any keypress.
destroy_sample(Sound);


Wei-shi Tsai <perdita AT dallas DOT crosswinds DOT net> wrote in message
news:379005BA DOT 151A7A89 AT dallas DOT crosswinds DOT net...
> This is driving me up the wall.  I am trying to figure out the digital
> audio functions by writing a sample program (I'm going use this to
> create a video player).
>
> However, no sound is generated.  What is wrong?
>
> The code is attached to this message.  Yes, the file exists.
>
>
> --
> Wei-shi Tsai
> Cymbeline on #descent, Kahn, and ICQ(UIN:2801023)
> The Lost Material Defender Page:
> http://www.crosswinds.net/dallas/~perdita/index.html
> MoonieCode(1.8.11):
> SM:5+ F:sMe++>Mo+>:vZo<Bl+>:aLu+Ry+:pClR2 D:sMa<:vBe-Wi-> X:a0s|35d++
> O:d+:s?:?o?:a--:h--- P:a+:s6:w-:f?:eBrD:hBkm:t-:cAs:y---:r+|


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019