Update the manual
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 12 Feb 2013 21:47:19 +0000 (21:47 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 12 Feb 2013 21:47:19 +0000 (21:47 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_freecap/trunk@71152 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Utility/WavContentUtility.php
Classes/View/AudioPlayer/PlayWav.php

index 63df0af..af184f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-12  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Cleanup audio file rendering
+
 2013-02-11  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Update the manual
index 0ae96a3..d7e6243 100644 (file)
@@ -78,28 +78,13 @@ class WavContentUtility {
                                // Read SubChunk2ID
                        $headerPart3 .= fread($fp, 4);
                                // Read Subchunk2Size
-                       $size = unpack('vsize', fread($fp, 4));
-                       $size = $size['size'];
+                       $size = unpack('VSubChunk2Size', fread($fp, 4));
+                       $size = $size['SubChunk2Size'];
                                // Read data
                        $data .= fread($fp, $size);
+                       fclose($fp);
                }
                return $headerPart1 . pack('V', 36 + strlen($data)) . $headerPart3 . pack('V', strlen($data)) . $data;
        }
-
-       /**
-        * Sends headers appropriate for wav content
-        *
-        * @param string $audioContent: the audio content that will be sent
-        *
-        * @return      void
-        */
-       public static function sendHeaders ($audioContent) {
-               header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-               header('Last-Modified: ' . gmdate('D,d M YH:i:s') . ' GMT');
-               header('Pragma: no-cache');
-               header('Cache-Control: no-cache, no-store, must-revalidate');
-               header('Content-Type: audio/x-wav');
-               header('Content-Length: ' . strlen($audioContent));
-       }
 }
 ?>
\ No newline at end of file
index 62ebbbe..5f5c6b6 100644 (file)
@@ -109,7 +109,7 @@ class PlayWav implements \TYPO3\CMS\Extbase\MVC\View\ViewInterface {
                // Join the files
                $audioContent = \SJBR\SrFreecap\Utility\WavContentUtility::joinWaveFiles($letterRenderingWaveFiles);
                // Output proper headers
-               \SJBR\SrFreecap\Utility\WavContentUtility::sendHeaders($audioContent);
+               $this->sendHeaders($audioContent);
                // Return the audio content
                return $audioContent;
        }
@@ -171,6 +171,23 @@ class PlayWav implements \TYPO3\CMS\Extbase\MVC\View\ViewInterface {
                }
                return $voicesDirectory;
        }
+
+       /**
+        * Sends headers appropriate for wav content
+        *
+        * @param string $audioContent: the audio content that will be sent
+        *
+        * @return      void
+        */
+       protected function sendHeaders ($audioContent) {
+               header('Content-Type: audio/x-wav');
+               header('Content-Transfer-Encoding: binary');
+               header('Content-Length: ' . strlen($audioContent));
+               header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+               header('Last-Modified: ' . gmdate('D,d M YH:i:s') . ' GMT');
+               header('Pragma: no-cache');
+               header('Cache-Control: no-cache, no-store, must-revalidate');
+       }
 }
 class_alias('SJBR\SrFreecap\View\AudioPlayer\PlayWav', 'Tx_SrFreecap_View_AudioPlayer_PlayWav');
 ?>
\ No newline at end of file