diff options
Diffstat (limited to 'orkaudio/audiofile/AudioFile.cpp')
-rw-r--r-- | orkaudio/audiofile/AudioFile.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/orkaudio/audiofile/AudioFile.cpp b/orkaudio/audiofile/AudioFile.cpp new file mode 100644 index 0000000..377963b --- /dev/null +++ b/orkaudio/audiofile/AudioFile.cpp @@ -0,0 +1,58 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "AudioFile.h" +#include "ace/OS_NS_unistd.h" + +void AudioFile::Open(fileOpenModeEnum mode, bool stereo , int sampleRate) +{ + Open(m_filename, mode, stereo, sampleRate); +} + + +void AudioFile::RecursiveMkdir(CStdString& path) +{ + int position = 0; + bool done = false; + while (!done) + { + position = path.Find('/', position+1); + if (position == -1) + { + done = true; + } + else + { + CStdString level = path.Left(position); + ACE_OS::mkdir((PCSTR)level); + } + } +} + +void AudioFile::MoveOrig() +{ + CStdString newName = m_filename + ".orig"; + if (ACE_OS::rename((PCSTR)m_filename, (PCSTR)newName) == 0) + { + m_filename = newName; + } + else + { + throw(CStdString("AudioFile::MoveOrig: could not rename file:" + m_filename)); + } +} + +void AudioFile::Delete() +{ + ACE_OS::unlink((PCSTR)m_filename); +} |