public function openWav($filename, $readData = true)
    {
        // check preconditions
        if (!file_exists($filename)) {
            throw new WavFileException('Failed to open "' . $filename . '". File not found.');
        } elseif (!is_readable($filename)) {
            throw new WavFileException('Failed to open "' . $filename . '". File is not readable.');
        } elseif (is_resource($this->_fp)) {
            $this->closeWav();
        }


        // open the file
        $this->_fp = @fopen($filename, 'rb');
        if (!is_resource($this->_fp)) {
            throw new WavFileException('Failed to open "' . $filename . '".');
        }

        // read the file
        return $this->readWav($readData);
    }
public function openWav($filename, $readData = true)
    {
        // check preconditions
        if (!file_exists($filename)) {
            throw new WavFileException('Failed to open "' . $filename . '". File not found.');
        } elseif (!is_readable($filename)) {
            throw new WavFileException('Failed to open "' . $filename . '". File is not readable.');
        } elseif (is_resource($this->_fp)) {
            $this->closeWav();
        }


        // open the file
        $this->_fp = @fopen($filename, 'rb');
        if (!is_resource($this->_fp)) {
            throw new WavFileException('Failed to open "' . $filename . '".');
        }

        // read the file
        return $this->readWav($readData);
    }
public function openWav ( $ filename , $ readData = true ) { // check preconditions if ( ! file_exists ( $ filename ) ) { throw new WavFileException ( 'Failed to open "' . $ filename . '". File not found.' ) ; } elseif ( ! is_readable ( $ filename ) ) { throw new WavFileException ( 'Failed to open "' . $ filename . '". File is not readable.' ) ; } elseif ( is_resource ( $ this -> _fp ) ) { $ this -> closeWav ( ) ; } // open the file $ this -> _fp = @ fopen ( $ filename , 'rb' ) ; if ( ! is_resource ( $ this -> _fp ) ) { throw new WavFileException ( 'Failed to open "' . $ filename . '".' ) ; } // read the file return $ this -> readWav ( $ readData ) ; }
Reads a wav header and data from a file.

@param string $filename  (Required) The path to the wav file to read.
@param bool $readData  (Optional) If true, also read the data chunk.
@throws WavFormatException
@throws WavFileException
Reads a wav header and data from a file .