What a student has to do when music is played in the classroom
Question

                Q in mine history class we are often talking on music.i donot hear to music . I asked my teacher that to let me go out of the class when he plays it .first he said ok1 but today he said ok you can go but its part of your course you cant understand jazz without hearing it .i dont know what i should do?strait forwardly go out of the class when he plays or should stay but pay no attention(as i did today)same is with watching film.he showed us,but i tried mine best just to conectrate on the topic not on indiviual characters,so today he also said that yeh you also wahtched the movie.(actually after that we had to do an assignment ,questions based on the movie stuf . So please i would like you to answer mine this problem and guide me to the best with the grace of god inshallah.
Praise be to Allah. 
          It is not permissible to stay in the classroom when music 
          is being played either on a tape player etc. or by a person, even if 
          that means that you will not understand the nature of a particular type 
          of music such as jazz etc., because if something evil is done in a gathering, 
          the Muslim has to denounce the one who is doing it, and if he does not 
          respond, then he (the Muslim) should leave that place, as Allaah says 
          (interpretation of the meaning):
 
          “And it has already been 
          revealed to you in the Book (this Qur’aan) that when you hear the Verses 
          of Allaah being denied and mocked at, then sit not with them, until 
          they engage in a talk other than that; (but if you stayed with them) 
          certainly in that case you would be like them. Surely, Allaah will collect 
          the hypocrites and disbelievers all together in Hell”
 
          [al-Nisaa’ 4:140]
 
          We advise you to choose subjects where you will not have 
          to study this material at all, May Allaah help you and us to obey Him.