This paper presents an unified comprehensive model for the analysis of the spectral properties of Fabry-Perot laser diodes and conventional semiconductor optical amplifiers. We develop the model by considering the wide-band amplified spontaneous emission fields and the input optical signal fields in a general frame. Specifically, this paper discusses theoretical aspects of the model in details, which are based upon the spectra of material gain and spontaneous emission power, nonlinear gain suppression, and longitudinal spatial hole burning. This paper also presents simulation results of the model for the case of conventional semiconductor optical amplifier and the case of Fabry-Perot laser diode to demonstrate its capabilities.