CopySound

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

CopySound

Post 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
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

You should not need to do that now as since PB4 B5 I believe
now support playing the same sound multiple times.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Then maybe ask Fred nicely and he may be able to tweak those functions so that is possible! :)
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post 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 ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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.
Post Reply