Tefillah with Simchah
We find in Chazal that by tefillah too, simchah is an essential component. The Gemara (ברכות לא) states: תָּנוּ רַבָּנָן, אֵין עוֹמְדִין לְהִתְפַּלֵּל לֹא מִתּוֹךְ עַצְבוּת וְכוּ' אֶלָּא מִתּוֹךְ שִׂמְחָה שֶׁל מִצְוָה - one does not stand in tefillah from a place of sadness etc, only with joy of mitzvah performance.
The Midrash (יַלְקוּט שִׁמְעוֹנִי, תהלים תתנ"ד) says: כְּשֶׁתְּהֵא עוֹמֵד לְהִתְפַּלֵּל יְהֵא לִבְּךָ עָלֶיךָ שָׂמֵחַ, שֶׁאַתָּה עוֹבֵד לֶאֱלוֹקִים - when you begin to daven, your heart should be filled with joy, for you are serving Hashem, and there is none other besides Him.
Rabbi Chaim Vital writes that when a person davens without joy, but with despair, he cannot be a recipient of the divine light that is brought down from above through tefillah. Only when one is saying Vidui and mentioning his sins, it is correct that he should be remorseful and in pain because he has distanced himself from his Creator. However, during the rest of Tefillah, if he continues to be distressed it can cause him great loss ch"v.
(ר"ח ויטאל, תחילת שער הכוונות)