Would be very useful to have something like; playSound(Sound, NoteNr, Channel);
Lots of times it would be way better,..
calling sounds from script,. .
Moderator: Moderators
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
calling sounds from script,. .
iterationGAMES.com
Would be handy indeed .. but as long as variable types such as Sound / Mesh / Material aren't supported, functions like these won't be possible ( as far as I know ).
However, you can set this up yourself.
So you have a Repeat loop ( after all your logic ) that goes through a Array containing all the sounds that need to be played this frame. Each loop the PlaySound component is updated using something like this.
Code: Select all
int S = SoundRepeat.Iteration;
switch(Sound[S,0])
{
case 0: Play.Sound = Bass; break;
case 1: Play.Sound = Kick; break;
}
Play.NoteNr = Sound[S,1];
Play.Channel = Sound[S,2];
Code: Select all
void playSound(int Sound, float Note, int Channel)
{
int S = SoundSize;
Sound[S,0] = Sound;
Sound[S,1] = Note;
Sound[S,2] = Channel;
SoundSize++;
}