Restore Unto me the Joy of Thy Salvation
These are among the seven penitential psalms. David said he only sinned against God. Ultimately every sin is only against God. Repentance is ongoing and we need to keep short accounts with God. Sin causes a fracture in our intimacy with God but repentance brings joy in forgiveness. David didn't have the full knowledge of the cross but these verses point to the only way man can be right with God.