Logo Search packages:      
Sourcecode: pwlib version File versions

BOOL PWAVFile::Open ( OpenMode  mode = ReadWrite,
int  opts = ModeDefault 
) [virtual]

Open the current file in the specified mode and with the specified options. If the file object already has an open file then it is closed.

If there has not been a filename attached to the file object (via SetFilePath()#, the name# parameter or a previous open) then a new unique temporary filename is generated.

TRUE if the file was successfully opened.
mode  Mode in which to open the file.
opts  Options for open operation.

Reimplemented from PFile.

Definition at line 350 of file pwavfile.cxx.

References Close(), PFile::GetLength(), PFile::Open(), PFile::ReadOnly, PFile::ReadWrite, and PFile::WriteOnly.

Referenced by Open(), and PWAVFile().

  if (!(PFile::Open(mode, opts)))
    return FALSE;

  isValidWAV = FALSE;

  // Try and process the WAV file header information.
  // Either ProcessHeader() or GenerateHeader() must be called.

  if (PFile::GetLength() > 0) {

    // try and process the WAV file header information
    if (mode == ReadOnly || mode == ReadWrite) {
      isValidWAV = ProcessHeader();
    if (mode == WriteOnly) {
      lenData = -1;
  else {

    // generate header
    if (mode == ReadWrite || mode == WriteOnly) {
      lenData = -1;
    if (mode == ReadOnly) {
      isValidWAV = FALSE; // ReadOnly on a zero length file

  // if we did not know the format when we opened, then we had better know it now
  if (formatHandler == NULL) {
    return FALSE;

  return TRUE;

Generated by  Doxygen 1.6.0   Back to index