Texas Code of Criminal Procedure 38.22 only applies to statements that are taken while the defendant is subject to custodial interrogation. If either the “custodial” or “interrogation” predicates are not me then that section does not apply.
Arizona v. Miranda was the seminal case that guarded against custodial interrogations without the suspect being afforded an attorney. Most people have heard the Miranda Rights read aloud on T.V….”You have the right to remain silent, you have the right to an attorney, anything that you say can and will be used against you in a court of law…etc.”
However, if someone is not in “custody” then the protections do not apply. In other words, if an objectively reasonable person would feel free to leave the encounter with the police then that person is not in custody.
On the other hand, if someone is face down on the pavement with handcuffs on and the police officer standing there with a gun to the back of the defendant’s head, then he is definitely in “custody.” However, if the cop does not ask him a question and does not read him his Miranda Rights and the defendant blurts out an admission then that may be admissible in court because there was no “interrogation.”