How would I make this Cloned Function Copy to an endless amount?

This shows how each if will bring a copy of AddSoundObjectRec(1); and it will copy then increase each time. There is definitely a better way to write this that isn’t manual?

if(layeramount==1)
   {
 AddSoundObjectRec(1);
   } 
  if(layeramount==2)
   {
 AddSoundObjectRec(1);
 AddSoundObjectRec(2); 
   } 
if(layeramount==3)
   {
AddSoundObjectRec(1);
AddSoundObjectRec(2); 
AddSoundObjectRec(3); 
   }

im writing this in browser, so take it as pseudocode:

for(int i = 0; i < layeramount; i++)
{
    AddSoundObjectRec(i + 1);
}

or

for(int i = 1; i <= layeramount; i++)
{
    AddSoundObjectRec(i);
}