<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
Dear all,<br>
<br>
I'm curious about the following. Sometimes several data are
retrieved from a file using several read operations, such as in this
code from function wavread:<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:16.0;"><span style="color:rgb(0,0,0);">wFormatTag</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mget</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">us</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(75,149,50);font-style:italic;">// Data encoding format</span>
<span style="color:rgb(0,0,0);">nChannels</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mget</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">us</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(75,149,50);font-style:italic;">// Number of channels</span>
<span style="color:rgb(0,0,0);">nSamplesPerSec</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mget</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">ui</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(75,149,50);font-style:italic;">// Samples per second</span>
<span style="color:rgb(0,0,0);">nAvgBytesPerSec</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mget</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">ui</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(75,149,50);font-style:italic;">// Avg transfer rate</span>
<span style="color:rgb(0,0,0);">nBlockAlign</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">mget</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">us</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">fid</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(75,149,50);font-style:italic;">// Block alignment</span></pre>
This could well have been done reading all data at once. It would be
a bit more complicated to convert the data to the final form because
of the heterogenuous size of the fields (some are two-byte and
others four-byte).<br>
<br>
Doesn't this approach impose more mechanical stress on the hard
drive? Or even larger access time?<br>
<br>
Or upon the first read a full sector is transferred to a buffer? <br>
<br>
Thanks for any insight!<br>
<br>
Regards,<br>
<br>
Federico Miyara<br>
</body>
</html>