Code explanation please

Jeffrey Drake jpt.d at rogers.com
Thu Jan 3 22:43:26 CET 2002


I believe the most reasonable explaination (a guess) would be the same
reason you use glFlush() in opengl. To feed a buffer. Whether or not
that applies I do not know.

Regards,
jptd

On 3 Jan 2002 13:33:22 -0800, craigesmith at hotmail.com (Craig E. Smith)
wrote:

>The piece of code below is taken from the Myp3 project. Can someone
>explain to me the need/reason for the flush() call after each write()
>to pin? Thanks in advance.
>
>
>
>def play(self, filename):
>		# play a file
>		
>		self.initvars()
>
>		self.debug("PLAY " + filename)
>		
>		self.state = "play"
>
>		# stop the player, then flush to send the command
>		if self.state == "play":
>			self.pin.write("stop\012")
>			self.pin.flush()
>
>
>		# as long as the file is present, then open the file, and start to
>play it
>		if (len(filename) > 0):
>			self.pin.write("input_open " + filename + "\012play\012")
>			
>		#between commenting this and the timeout value of 0.1 in
>handle_audio (see below)
>		#considerable speedups and timer accuracy can be had
>		#self.pin.write("input_position_range 1\012")
>		        self.pin.flush()




More information about the Python-list mailing list