Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/audaspace/include')
-rw-r--r--extern/audaspace/include/IReader.h6
-rw-r--r--extern/audaspace/include/file/File.h23
-rw-r--r--extern/audaspace/include/file/FileInfo.h42
-rw-r--r--extern/audaspace/include/file/FileManager.h24
-rw-r--r--extern/audaspace/include/file/IFileInput.h24
-rw-r--r--extern/audaspace/include/fx/VolumeReader.h2
6 files changed, 108 insertions, 13 deletions
diff --git a/extern/audaspace/include/IReader.h b/extern/audaspace/include/IReader.h
index f6070b0f23b..c29900ca579 100644
--- a/extern/audaspace/include/IReader.h
+++ b/extern/audaspace/include/IReader.h
@@ -71,12 +71,6 @@ public:
virtual int getPosition() const=0;
/**
- * Returns the start offset the sound should have to line up with related sources.
- * \return The required start offset in seconds.
- */
- virtual double getStartOffset() const { return 0.0;}
-
- /**
* Returns the specification of the reader.
* \return The Specs structure.
*/
diff --git a/extern/audaspace/include/file/File.h b/extern/audaspace/include/file/File.h
index 24745a757e8..ac490acba38 100644
--- a/extern/audaspace/include/file/File.h
+++ b/extern/audaspace/include/file/File.h
@@ -23,9 +23,11 @@
*/
#include "ISound.h"
+#include "FileInfo.h"
#include <string>
#include <memory>
+#include <vector>
AUD_NAMESPACE_BEGIN
@@ -48,6 +50,14 @@ private:
*/
std::shared_ptr<Buffer> m_buffer;
+ /**
+ * The index of the stream within the file if it contains multiple.
+ * The first audio stream in the file has index 0 and the index increments by one
+ * for every other audio stream in the file. Other types of streams in the file
+ * do not count.
+ */
+ int m_stream;
+
// delete copy constructor and operator=
File(const File&) = delete;
File& operator=(const File&) = delete;
@@ -57,16 +67,25 @@ public:
* Creates a new sound.
* The file is read from the file system using the given path.
* \param filename The sound file path.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/
- File(std::string filename);
+ File(std::string filename, int stream = 0);
/**
* Creates a new sound.
* The file is read from memory using the supplied buffer.
* \param buffer The buffer to read from.
* \param size The size of the buffer.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
+ */
+ File(const data_t* buffer, int size, int stream = 0);
+
+ /**
+ * Queries the streams of the file.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
*/
- File(const data_t* buffer, int size);
+ std::vector<StreamInfo> queryStreams();
virtual std::shared_ptr<IReader> createReader();
};
diff --git a/extern/audaspace/include/file/FileInfo.h b/extern/audaspace/include/file/FileInfo.h
new file mode 100644
index 00000000000..53ba99a5f67
--- /dev/null
+++ b/extern/audaspace/include/file/FileInfo.h
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright 2009-2016 Jörg Müller
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#pragma once
+
+/**
+ * @file FileInfo.h
+ * @ingroup file
+ * The FileInfo data structures.
+ */
+
+#include "respec/Specification.h"
+
+AUD_NAMESPACE_BEGIN
+
+/// Specification of a sound source.
+struct StreamInfo
+{
+ /// Start time in seconds.
+ double start;
+
+ /// Duration in seconds. May be estimated or 0 if unknown.
+ double duration;
+
+ /// Audio data parameters.
+ DeviceSpecs specs;
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/file/FileManager.h b/extern/audaspace/include/file/FileManager.h
index 56708607ea6..e19eef65b1c 100644
--- a/extern/audaspace/include/file/FileManager.h
+++ b/extern/audaspace/include/file/FileManager.h
@@ -22,12 +22,14 @@
* The FileManager class.
*/
+#include "FileInfo.h"
#include "respec/Specification.h"
#include "IWriter.h"
#include <list>
#include <memory>
#include <string>
+#include <vector>
AUD_NAMESPACE_BEGIN
@@ -66,18 +68,36 @@ public:
/**
* Creates a file reader for the given filename if a registed IFileInput is able to read it.
* @param filename The path to the file.
+ * @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown.
*/
- static std::shared_ptr<IReader> createReader(std::string filename);
+ static std::shared_ptr<IReader> createReader(std::string filename, int stream = 0);
/**
* Creates a file reader for the given buffer if a registed IFileInput is able to read it.
* @param buffer The buffer to read the file from.
+ * @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown.
*/
- static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
+ static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0);
+
+ /**
+ * Queries the streams of a sound file.
+ * \param filename Path to the file to be read.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
+ */
+ static std::vector<StreamInfo> queryStreams(std::string filename);
+
+ /**
+ * Queries the streams of a sound file.
+ * \param buffer The in-memory file buffer.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
+ */
+ static std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
/**
* Creates a file writer that writes a sound to the given file path.
diff --git a/extern/audaspace/include/file/IFileInput.h b/extern/audaspace/include/file/IFileInput.h
index 64074910d13..4a3fe446852 100644
--- a/extern/audaspace/include/file/IFileInput.h
+++ b/extern/audaspace/include/file/IFileInput.h
@@ -23,9 +23,11 @@
*/
#include "Audaspace.h"
+#include "FileInfo.h"
#include <memory>
#include <string>
+#include <vector>
AUD_NAMESPACE_BEGIN
@@ -48,18 +50,36 @@ public:
/**
* Creates a reader for a file to be read.
* \param filename Path to the file to be read.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
- virtual std::shared_ptr<IReader> createReader(std::string filename)=0;
+ virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0)=0;
/**
* Creates a reader for a file to be read from memory.
* \param buffer The in-memory file buffer.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
- virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer)=0;
+ virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0)=0;
+
+ /**
+ * Queries the streams of a sound file.
+ * \param filename Path to the file to be read.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
+ */
+ virtual std::vector<StreamInfo> queryStreams(std::string filename)=0;
+
+ /**
+ * Queries the streams of a sound file.
+ * \param buffer The in-memory file buffer.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
+ */
+ virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer)=0;
};
AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/fx/VolumeReader.h b/extern/audaspace/include/fx/VolumeReader.h
index f7169f4c78b..13b6845e931 100644
--- a/extern/audaspace/include/fx/VolumeReader.h
+++ b/extern/audaspace/include/fx/VolumeReader.h
@@ -67,4 +67,4 @@ public:
virtual void read(int& length, bool& eos, sample_t* buffer);
};
-AUD_NAMESPACE_END
+AUD_NAMESPACE_END \ No newline at end of file