1. How to play more wav files
- Posted by vkusnirak at usske.sk
Dec 10, 2001
Hello,
I was made simple program, that play 50 *.wav files. But I can play only 40
files. When I'm playing
41 .. 50, there is only some "creak sound"... correct is only first 40. can
somebody help me ?
Sorry for my poor English...
I'm begginer in Euphoria...
Also I was trying to use function LoadSound Effects() always before playing a
wav,
but after 40th it was play again "creak sound" :(
-- steps:
-- 1) load all sounds in buffers, use LoadSoundEffects().
-- 2) Open volumes (master, voice) set speaker on with SpeakerOn()
-- 3) when you need a sound effect call PlaySoundEffect() (see below)
-- **** NOTE: it plays only 8 bits wave files.
-- NOTE: don't forget to set WAV_DIR to your own wave directory
without warning
include file.e
include delay.e
include doswrap.e
include soundfx.e
DmaChannel = DMA8 -- only play 8 bit sound.
integer counter
counter = 1
-- 1) Load sound effect in DMA buffers
sequence SoundEffects -- contain parameter for each sound effect.
-- needed parameters: {buffer,Size,TimeConstant, channels}
constant -- list of wave files to load in buffers.
SoundFiles = {"1.wav","2.wav","3.wav","4.wav","5.wav","6.wav",
"7.wav","8.wav","9.wav","10.wav","11.wav","12.wav",
"13.wav","14.wav","15.wav","16.wav","17.wav","18.wav",
"19.wav","20.wav","21.wav","22.wav","23.wav","24.wav",
"25.wav","26.wav","27.wav","28.wav","29.wav","30.wav",
"31.wav","32.wav","33.wav","34.wav","35.wav","36.wav",
"37.wav","38.wav","39.wav","40.wav","41.wav","42.wav",
"43.wav","44.wav","45.wav","46.wav","47.wav","48.wav",
"49.wav","50.wav"}
SoundEffects = LoadSoundEffects(SoundFiles)
integer key
key = 0
-- 2) open volume
SetVolume(MASTER_VOLUME,VOL_MAX)
SetVolume(VOICE_VOLUME,2)
while key != 27 do
key = get_key()
poke(#41A,peek({#41C,2})) -- clean keyboard buffer
PlaySoundEffect(SoundEffects[counter])
counter = counter + 1
if counter = 50 then
counter = 1
end if
delay(2.0)
end while
2. Re: How to play more wav files
On 10 Dec 2001, at 17:05, vkusnirak at usske.sk wrote:
>
> Hello,
>
> I was made simple program, that play 50 *.wav files. But I can play only 40
> files. When I'm playing 41 .. 50, there is only some "creak sound"... correct
> is
> only first 40. can somebody help me ?
There is a limit to how many files you can have open at one time, are you
closing the *.wav files after you load them, before you play them?
Kat
> Sorry for my poor English...
> I'm begginer in Euphoria...
>
> Also I was trying to use function LoadSound Effects() always before playing a
> wav, but after 40th it was play again "creak sound" :(
>
> -- steps:
> -- 1) load all sounds in buffers, use LoadSoundEffects().
> -- 2) Open volumes (master, voice) set speaker on with SpeakerOn()
> -- 3) when you need a sound effect call PlaySoundEffect() (see below)
> -- **** NOTE: it plays only 8 bits wave files.
>
> -- NOTE: don't forget to set WAV_DIR to your own wave directory
>
> without warning
> include file.e
> include delay.e
> include doswrap.e
> include soundfx.e
>
> DmaChannel = DMA8 -- only play 8 bit sound.
>
> integer counter
> counter = 1
> -- 1) Load sound effect in DMA buffers
>
> sequence SoundEffects -- contain parameter for each sound effect.
> -- needed parameters: {buffer,Size,TimeConstant, channels}
>
> constant -- list of wave files to load in buffers.
> SoundFiles = {"1.wav","2.wav","3.wav","4.wav","5.wav","6.wav",
> "7.wav","8.wav","9.wav","10.wav","11.wav","12.wav",
> "13.wav","14.wav","15.wav","16.wav","17.wav","18.wav",
> "19.wav","20.wav","21.wav","22.wav","23.wav","24.wav",
> "25.wav","26.wav","27.wav","28.wav","29.wav","30.wav",
> "31.wav","32.wav","33.wav","34.wav","35.wav","36.wav",
> "37.wav","38.wav","39.wav","40.wav","41.wav","42.wav",
> "43.wav","44.wav","45.wav","46.wav","47.wav","48.wav",
> "49.wav","50.wav"}
>
> SoundEffects = LoadSoundEffects(SoundFiles)
>
>
> integer key
> key = 0
> -- 2) open volume
> SetVolume(MASTER_VOLUME,VOL_MAX)
> SetVolume(VOICE_VOLUME,2)
> while key != 27 do
>
> key = get_key()
> poke(#41A,peek({#41C,2})) -- clean keyboard buffer
>
> PlaySoundEffect(SoundEffects[counter])
> counter = counter + 1
> if counter = 50 then
> counter = 1
> end if
> delay(2.0)
>
> end while
>
>
>
>
>