From: "Damian Yerrick" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: Sound stream corruption with Allegro? Lines: 62 Organization: Pin Eight Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Message-ID: X-Trace: +Li/tS21NsOrdPc3uswc+zIhiznCSESbOE6k4OmcR2Wba6Pw1tugvFqwHi2PZupVusrsVFSGVfXV!YSmnR/VaaeKsDhlvXzMoKJ2GFJJDGIEkSU3ZLxJhaGHBeWadgw8hDmvk2K8/QdSx4NntBInCrw== X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Thu, 02 Dec 1999 05:35:39 GMT Distribution: world Date: Thu, 02 Dec 1999 05:35:39 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Luca Bisti" wrote in message news:Pine DOT BSF DOT 4 DOT 10 DOT 9912020027390 DOT 39597-100000 AT studenti DOT ing DOT unipi DOT it... > Hi Allegro gurus, > > I have the following problem with the Allegro audio stream routines: for some reason that I haven't been able to find out myself, the sound samples generated by my program are somewhat distorted by the Allegro play routines, that is the music which comes out of the soundcard is a bit "scratchy". I say that because I dump the same sample buffer to a WAV file just before passing it to the free_audio_stream() function and the music recorded into that WAV sounds perfectly (not distorted at all) when played back with any other sound player (such as Windows' Media Player itself). Coded with WinAPI. Uses native Windows. >This "corruption" does not consist in noise clicks at regular intervals or things like that, but it's rather like a continuos sample "cut" which seems to reduce sound dynamics... sorry, I can't explain it in words :-) > > Just to clarify, the situation is the following: > > mix_samples(buffer, size); // generate some music samples > write_wav(buffer, size); // write them to the WAV file, which will play back clean music > free_audio_stream(); // pass the buffer to Allegro, which plays it slightly distorted > > I am using a single audio stream (with a single voice) which can be mono/stereo and 8/16 bit. Depending on the voice mode set, I mix a sample of the same type myself and then play it through that voice. I use my own mixing routines because I need to do some postprocessing on the final result and Allegro won't let me do that if I open several independent voices and let it mix them. In all the four combinations, the result is always the same. Note that the sound corruption is particularly evident only when playing certain sounds, while in general it's hardly audible. Anyway, I'd like to get rid of this problem, since I don't want a player of waveform-dependant quality! > > The voice frequency is the same as the soundcard playback rate, centered voice panning, max volume, and my samples have amplitude 64 (just to make sure that clipping cannot occur). Nothing changes if I use signed or unsigned samples, or if I allocate a mono/stereo - 8/16 bit voice. My soundcard is a Creative SB 32. > > What could be wrong? Since the WAV data is clean, my suspect is that the waveform is altered by Allegro's mixing code (volume tables and so on). If so, how can I make sure that my buffer is passed directly to the DMA without any further processing by the Allegro routines? Happens to me under NESticle, loopyNES, any DOS Allegro program, or for that matter any Sound Blaster program that plays waves. Windows tends to fsck up DMA because its timer's resolution is too low. What happens when you run from M$-DOS mode? Damian Yerrick Windows. Who gives a ScanDisk?