Hii All,
I am doing my first project in Arduino, Since I am not an expert in Arduino, I am facing lot of difficulties but learn a lot.
Right now I am working with INI file and it contains Sound Profiles. It can be 1 or more than 1 Sound Profiles.
My idea is I want to read the first section "PROFILES" i.e How many Sound Profile it contains and in which order?
So everytime, when user press a button, it should get new Sound Profile and get new parameters from section. I am reffering, Stevemarple library Using his library I am able to read the ini files but now my task to choose specific Sound profile based on button pressed
For that I have sampler class contains 3 objects each object has one wave file.
My problem is, I want to read the first section "PROFILES" i.e How many Sound Profile it contains and in which order?
I was planning to use do while loop to get how many number of Sound Profile I have.
Please find the code snippet and ini file and how to link the button pressed with sound Profile?
In the code snippet I am giving manually the number 1,2 which is not flexible and we cannot say it as stand alone device. if suppose user want 10 profile he has to manually change the code. So I want read beginning 1 from section PROFILES until you have no value.
if (ini.getValue("PROFILES", "1", buffer1, bufferLen)) {
Serial.print("section 'PROFILES' has an entry '1' with value ");
Serial.println(buffer1);
}
if (ini.getValue("PROFILES", "2", buffer1, bufferLen)) {
Serial.print("section 'PROFILES' has an entry '2' with value ");
Serial.println(buffer1);
}
INI
[PROFILES]
1=PROFILE1
2=PROFILE5
3=PROFILE4
4=PROFILE2
5=PROFILE3
[PROFILE1]
sound_file_name1 = "/SoundP~1/bell.wav"
#Volume Parameters#
A1 = 10
B1 = 0
#Speed Parameters#
C1 = 0
D1 = 1
#Silence Parameters#
E = 0
F = 1000
[PROFILE2]
sound_file_name2 = /SoundP~1/steam.wav
#Volume Parameters#
A2 = 1
B2 = 1
#Speed Parameters#
C2 = 20
D2 = 0
#Silence Parameters#
E = 1
F = 0
[PROFILE3]
sound_file_name3 = /SoundP~1/ferrari.wav
#Volume Parameters#
A3 = 1
B3 = 1
#Speed Parameters#
C3 = 0
D3 = 1
#Silence Parameters#
E = 0
F = 1000
[PROFILE4]
#PROFILE2
sound_file_name2 = /SoundP~1/steam.wav
#Volume Parameters#
A2 = 1
B2 = 1
#Speed Parameters#
C2 = 20
D2 = 0
#Silence Parameters#
E = 0
F = 1000
#PROFILE3
sound_file_name3 = /SoundP~1/ferrari.wav
#Volume Parameters#
A3 = 1
B3 = 1
#Speed Parameters#
C3 = 20
D3 = 0
#Silence Parameters#
E = 0
F = 1000
#Mixing factor #
H1 = 1
H2 = 1
H11 = 0
H22 = 0
[PROFILE5]
#PROFILE1
sound_file_name1 = /SoundP~1/bell.wav
#Volume Parameters#
A1 = 1
B1 = 1
#Speed Parameters#
C1 = 0
D1 = 1
#Silence Parameters#
E = 0
F = 1000
#PROFILE2
sound_file_name2 = /SoundP~1/steam.wav
#Volume Parameters#
A2 = 1
B2 = 1
#Speed Parameters#
C2 = 0
D2 = 1
#Silence Parameters#
E = 0
F = 1000
#PROFILE3
sound_file_name3 = /SoundP~1/ferrari.wav
#Volume Parameters#
A3 = 1
B3 = 1
#Speed Parameters#
C3 = 0
D3 = 1
#Silence Parameters#
E = 0
F = 1000
H0 = 0
H1 = 0
H2 = 0
H00 = 0.3
H11 = 0.3
H22 = 0.3