Hey All,
I am trying to create a piano, but i want to be able to switch between the sounds the piano makes (eg I want to be able to have the piano sound like a trumpet, then a harp, then a piano with button clicks). I have achieved this using BASS.dll, however i am doing it in a very redundant way.
Here is what I am currently doing:
1) Create stream variables for all the sounds (if I have 25 notes on the piano, ill need 25*3 variables for the three instruments)
2) Assign each of these streams to an audio file (75 duplicated lines of code)
3) Have buttons assign a sound to the OnMouseDown of a piano key.
Here are examples of the code I used:
1)Create stream variables: [Example: HSTREAM;]
2)Assign stream: [Example := BASS_StreamCreateFile(False, pansichar('FileName.wav'), 0, 0, 0);]
3)Play stream: [BASS_ChannelPlay(Example, True);]
Clearly, my method means dozens of Copy/Paste lines of code, and since I am using this for a school project, I cannot expect a very good grade for the method I am using. I was wondering if there was some way that I could create an array to assign sounds and such simply by looping through the array.
I am trying to create a piano, but i want to be able to switch between the sounds the piano makes (eg I want to be able to have the piano sound like a trumpet, then a harp, then a piano with button clicks). I have achieved this using BASS.dll, however i am doing it in a very redundant way.
Here is what I am currently doing:
1) Create stream variables for all the sounds (if I have 25 notes on the piano, ill need 25*3 variables for the three instruments)
2) Assign each of these streams to an audio file (75 duplicated lines of code)
3) Have buttons assign a sound to the OnMouseDown of a piano key.
Here are examples of the code I used:
1)Create stream variables: [Example: HSTREAM;]
2)Assign stream: [Example := BASS_StreamCreateFile(False, pansichar('FileName.wav'), 0, 0, 0);]
3)Play stream: [BASS_ChannelPlay(Example, True);]
Clearly, my method means dozens of Copy/Paste lines of code, and since I am using this for a school project, I cannot expect a very good grade for the method I am using. I was wondering if there was some way that I could create an array to assign sounds and such simply by looping through the array.