Calling Synthesizer::addSound will just add the Sound to the end of an internal array, so the index of that sound will be Synthesizer::getNumSounds() - 1. Obviously, that index will only be valid as long as you do not remove any other sounds (as this will change the position of all following elements in the array).
Another way of getting the index would be to iterate over all sounds and compare the pointers, for example:
for (int i = 0; i < synth.getNumSounds(); ++i)
if (synth.getSound (i) == mySound)
You need to be careful with the above solution and make sure that no other thread is add/removing the sounds of the synthesizer while this loop is executing.