Page 1 of 1

CopySound

Posted: Wed Mar 15, 2006 12:40 am
by Hroudtwolf
Hello Fred and PureBasic-Team,

A nice function for any future version of PureBasic would be a CopySound function.

at Ex.

Code: Select all

LoadSound (1,"bla.wav")
CopySound (1,2)
PlaySound (2)
I need copied sounds very often to create sfx.


Best regards

Hroudtwolf

Posted: Wed Mar 15, 2006 1:04 am
by Rescator
You should not need to do that now as since PB4 B5 I believe
now support playing the same sound multiple times.

Posted: Wed Mar 15, 2006 1:07 am
by Hroudtwolf
That isn't the same solution.
If I want to play the same sound with different volumes and balances, this doesn't work.

Posted: Wed Mar 15, 2006 1:15 am
by Rescator
Then maybe ask Fred nicely and he may be able to tweak those functions so that is possible! :)

Posted: Wed Mar 15, 2006 2:11 am
by va!n
i dont see any sence in such a command! Please dont tell me, you are planing to play one wave with different volumes and you want save each sample (volume10, another copy of your sample (volume20), next one volume(30) and so on to your memory? This is just wasting memory! Why not requesting something like...


PlaySound(#sound, [mode], [volume])

#sound = number of sound/wave
mode = #loop #forward #backward #pingpong
volume = as the name says....


Another way and maybe good soltution would be to have something like (i dont know the commands atm, so i will write it in a hurry by pseudo code ;)

SoundVolume,0,20) : PlaySound(0)
SoundVolume,0,10) : PlaySound(0)
SoundVolume,0,40) : PlaySound(0)
SoundVolume,0,10) : PlaySound(0)
SoundVolume,0,30) : PlaySound(0)

first you set the volume of the wavefile, then the wave will copy internaly to a special allocated sound (mixing memory)! The sound will be stored in this memory with your defined volume! Doing this internally for each sound/wave will solve your problem (as its a feature of internally sound management/mixing and we dont need new nor changed commands ;)

Posted: Wed Mar 15, 2006 2:26 am
by Rescator
I like the PlaySound options idea Vain, I think that might be best.

EDIT:
It would also need to support panning and frequency too though.
Not sure what to suggest here, ideas folks? Fred?

Posted: Wed Mar 15, 2006 4:26 am
by Hroudtwolf
Please dont tell me, you are planing to play one wave with different volumes and you want save each sample (volume10, another copy of your sample (volume20), next one volume(30) and so on to your memory? This is just wasting memory! Why not requesting something like...
Sure. I want do exactly this.
But in my project, it haves a sence.
And there isn't memorywasting if i remove the sounds after playing.
For a lot of effects it is meaningful to copy the sample to play it with other balance or volume again.