We present a general theoretical methodology and related open-access computer program for carrying out the calculation of photoelectron, Auger electron, and x-ray emission intensities in the presence of several x-ray optical effects, including total reflection at grazing incidence, excitation with standing-waves produced by reflection from synthetic multilayers and at core-level resonance conditions, and the use of variable polarization to produce magnetic circular dichroism. Calculations illustrating all of these effects are presented, including in some cases comparisons to experimental results. Sample types include both semi-infinite flat surfaces and arbitrary multilayer configurations, with interdiffusion/roughness at their interfaces. These x-ray optical effects can significantly alter observed photoelectron, Auger, and x-ray intensities, and in fact lead to several generally useful techniques for enhancing surface and buried-layer sensitivity, including layer-resolved densities of states and depth profiles of element-specific magnetization. The computer program used in this study should thus be useful for a broad range of studies in which x-ray optical effects are involved or are to be exploited in next-generation surface and interface studies of nanoscale systems. © 2013 American Institute of Physics.