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/generator')
-rw-r--r--extern/audaspace/include/generator/Sawtooth.h66
-rw-r--r--extern/audaspace/include/generator/SawtoothReader.h86
-rw-r--r--extern/audaspace/include/generator/Silence.h48
-rw-r--r--extern/audaspace/include/generator/SilenceReader.h59
-rw-r--r--extern/audaspace/include/generator/Sine.h67
-rw-r--r--extern/audaspace/include/generator/SineReader.h77
-rw-r--r--extern/audaspace/include/generator/Square.h67
-rw-r--r--extern/audaspace/include/generator/SquareReader.h86
-rw-r--r--extern/audaspace/include/generator/Triangle.h67
-rw-r--r--extern/audaspace/include/generator/TriangleReader.h86
10 files changed, 709 insertions, 0 deletions
diff --git a/extern/audaspace/include/generator/Sawtooth.h b/extern/audaspace/include/generator/Sawtooth.h
new file mode 100644
index 00000000000..68f56ae83fd
--- /dev/null
+++ b/extern/audaspace/include/generator/Sawtooth.h
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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 Sawtooth.h
+ * @ingroup generator
+ * The Sawtooth class.
+ */
+
+#include "ISound.h"
+#include "respec/Specification.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound creates a reader that plays a sawtooth tone.
+ */
+class AUD_API Sawtooth : public ISound
+{
+private:
+ /**
+ * The frequence of the sawtooth wave.
+ */
+ const float m_frequency;
+
+ /**
+ * The target sample rate for output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ Sawtooth(const Sawtooth&) = delete;
+ Sawtooth& operator=(const Sawtooth&) = delete;
+
+public:
+ /**
+ * Creates a new sawtooth sound.
+ * \param frequency The desired frequency.
+ * \param sampleRate The target sample rate for playback.
+ */
+ Sawtooth(float frequency, SampleRate sampleRate = RATE_48000);
+
+ /**
+ * Returns the frequency of the sawtooth wave.
+ */
+ float getFrequency() const;
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/SawtoothReader.h b/extern/audaspace/include/generator/SawtoothReader.h
new file mode 100644
index 00000000000..b4045eb8820
--- /dev/null
+++ b/extern/audaspace/include/generator/SawtoothReader.h
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 SawtoothReader.h
+ * @ingroup generator
+ * The SawtoothReader class.
+ */
+
+#include "IReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This class is used for sawtooth tone playback.
+ * The output format is in the 16 bit format and stereo, the sample rate can be
+ * specified.
+ * As the two channels both play the same the output could also be mono, but
+ * in most cases this will result in having to resample for output, so stereo
+ * sound is created directly.
+ */
+class AUD_API SawtoothReader : public IReader
+{
+private:
+ /**
+ * The frequency of the sine wave.
+ */
+ float m_frequency;
+
+ /**
+ * The current position in samples.
+ */
+ int m_position;
+
+ /**
+ * The value of the current sample.
+ */
+ float m_sample;
+
+ /**
+ * The sample rate for the output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ SawtoothReader(const SawtoothReader&) = delete;
+ SawtoothReader& operator=(const SawtoothReader&) = delete;
+
+public:
+ /**
+ * Creates a new reader.
+ * \param frequency The frequency of the sine wave.
+ * \param sampleRate The output sample rate.
+ */
+ SawtoothReader(float frequency, SampleRate sampleRate);
+
+ /**
+ * Sets the frequency of the wave.
+ * @param frequency The new frequency in Hertz.
+ */
+ void setFrequency(float frequency);
+
+ virtual bool isSeekable() const;
+ virtual void seek(int position);
+ virtual int getLength() const;
+ virtual int getPosition() const;
+ virtual Specs getSpecs() const;
+ virtual void read(int & length, bool &eos, sample_t* buffer);
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/Silence.h b/extern/audaspace/include/generator/Silence.h
new file mode 100644
index 00000000000..a35b83d37fc
--- /dev/null
+++ b/extern/audaspace/include/generator/Silence.h
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 Silence.h
+ * @ingroup generator
+ * The Silence class.
+ */
+
+#include "ISound.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound creates a reader that plays silence.
+ */
+class AUD_API Silence : public ISound
+{
+private:
+ // delete copy constructor and operator=
+ Silence(const Silence&) = delete;
+ Silence& operator=(const Silence&) = delete;
+
+public:
+ /**
+ * Creates a new silence sound.
+ */
+ Silence();
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/SilenceReader.h b/extern/audaspace/include/generator/SilenceReader.h
new file mode 100644
index 00000000000..ecc0ce86da9
--- /dev/null
+++ b/extern/audaspace/include/generator/SilenceReader.h
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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 SilenceReader.h
+ * @ingroup generator
+ * The SilenceReader class.
+ */
+
+#include "IReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This class is used for silence playback.
+ * The signal generated is 44.1kHz mono.
+ */
+class AUD_API SilenceReader : public IReader
+{
+private:
+ /**
+ * The current position in samples.
+ */
+ int m_position;
+
+ // delete copy constructor and operator=
+ SilenceReader(const SilenceReader&) = delete;
+ SilenceReader& operator=(const SilenceReader&) = delete;
+
+public:
+ /**
+ * Creates a new reader.
+ */
+ SilenceReader();
+
+ virtual bool isSeekable() const;
+ virtual void seek(int position);
+ virtual int getLength() const;
+ virtual int getPosition() const;
+ virtual Specs getSpecs() const;
+ virtual void read(int& length, bool& eos, sample_t* buffer);
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/Sine.h b/extern/audaspace/include/generator/Sine.h
new file mode 100644
index 00000000000..ee78fc7d06b
--- /dev/null
+++ b/extern/audaspace/include/generator/Sine.h
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 Sine.h
+ * @ingroup generator
+ * The Sine class.
+ */
+
+#include "ISound.h"
+#include "respec/Specification.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound creates a reader that plays a sine tone.
+ */
+class AUD_API Sine : public ISound
+{
+private:
+ /**
+ * The frequence of the sine wave.
+ */
+ const float m_frequency;
+
+ /**
+ * The target sample rate for output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ Sine(const Sine&) = delete;
+ Sine& operator=(const Sine&) = delete;
+
+public:
+ /**
+ * Creates a new sine sound.
+ * \param frequency The desired frequency.
+ * \param sampleRate The target sample rate for playback.
+ */
+ Sine(float frequency,
+ SampleRate sampleRate = RATE_48000);
+
+ /**
+ * Returns the frequency of the sine wave.
+ */
+ float getFrequency() const;
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/SineReader.h b/extern/audaspace/include/generator/SineReader.h
new file mode 100644
index 00000000000..49cd571bc65
--- /dev/null
+++ b/extern/audaspace/include/generator/SineReader.h
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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 SineReader.h
+ * @ingroup generator
+ * The SineReader class.
+ */
+
+#include "IReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This class is used for sine tone playback.
+ * The sample rate can be specified, the signal is mono.
+ */
+class AUD_API SineReader : public IReader
+{
+private:
+ /**
+ * The frequency of the sine wave.
+ */
+ float m_frequency;
+
+ /**
+ * The current position in samples.
+ */
+ int m_position;
+
+ /**
+ * The sample rate for the output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ SineReader(const SineReader&) = delete;
+ SineReader& operator=(const SineReader&) = delete;
+
+public:
+ /**
+ * Creates a new reader.
+ * \param frequency The frequency of the sine wave.
+ * \param sampleRate The output sample rate.
+ */
+ SineReader(float frequency, SampleRate sampleRate);
+
+ /**
+ * Sets the frequency of the wave.
+ * @param frequency The new frequency in Hertz.
+ */
+ void setFrequency(float frequency);
+
+ virtual bool isSeekable() const;
+ virtual void seek(int position);
+ virtual int getLength() const;
+ virtual int getPosition() const;
+ virtual Specs getSpecs() const;
+ virtual void read(int& length, bool& eos, sample_t* buffer);
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/Square.h b/extern/audaspace/include/generator/Square.h
new file mode 100644
index 00000000000..0ba27677a81
--- /dev/null
+++ b/extern/audaspace/include/generator/Square.h
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 Square.h
+ * @ingroup generator
+ * The Square class.
+ */
+
+#include "ISound.h"
+#include "respec/Specification.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound creates a reader that plays a square tone.
+ */
+class AUD_API Square : public ISound
+{
+private:
+ /**
+ * The frequence of the square wave.
+ */
+ const float m_frequency;
+
+ /**
+ * The target sample rate for output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ Square(const Square&) = delete;
+ Square& operator=(const Square&) = delete;
+
+public:
+ /**
+ * Creates a new square sound.
+ * \param frequency The desired frequency.
+ * \param sampleRate The target sample rate for playback.
+ */
+ Square(float frequency,
+ SampleRate sampleRate = RATE_48000);
+
+ /**
+ * Returns the frequency of the square wave.
+ */
+ float getFrequency() const;
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/SquareReader.h b/extern/audaspace/include/generator/SquareReader.h
new file mode 100644
index 00000000000..53fc574c767
--- /dev/null
+++ b/extern/audaspace/include/generator/SquareReader.h
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 SquareReader.h
+ * @ingroup generator
+ * The SquareReader class.
+ */
+
+#include "IReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This class is used for square tone playback.
+ * The output format is in the 16 bit format and stereo, the sample rate can be
+ * specified.
+ * As the two channels both play the same the output could also be mono, but
+ * in most cases this will result in having to resample for output, so stereo
+ * sound is created directly.
+ */
+class AUD_API SquareReader : public IReader
+{
+private:
+ /**
+ * The frequency of the sine wave.
+ */
+ float m_frequency;
+
+ /**
+ * The current position in samples.
+ */
+ int m_position;
+
+ /**
+ * The value of the current sample.
+ */
+ float m_sample;
+
+ /**
+ * The sample rate for the output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ SquareReader(const SquareReader&) = delete;
+ SquareReader& operator=(const SquareReader&) = delete;
+
+public:
+ /**
+ * Creates a new reader.
+ * \param frequency The frequency of the sine wave.
+ * \param sampleRate The output sample rate.
+ */
+ SquareReader(float frequency, SampleRate sampleRate);
+
+ /**
+ * Sets the frequency of the wave.
+ * @param frequency The new frequency in Hertz.
+ */
+ void setFrequency(float frequency);
+
+ virtual bool isSeekable() const;
+ virtual void seek(int position);
+ virtual int getLength() const;
+ virtual int getPosition() const;
+ virtual Specs getSpecs() const;
+ virtual void read(int & length, bool &eos, sample_t* buffer);
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/Triangle.h b/extern/audaspace/include/generator/Triangle.h
new file mode 100644
index 00000000000..4f607fc23b5
--- /dev/null
+++ b/extern/audaspace/include/generator/Triangle.h
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 Triangle.h
+ * @ingroup generator
+ * The Triangle class.
+ */
+
+#include "ISound.h"
+#include "respec/Specification.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This sound creates a reader that plays a triangle tone.
+ */
+class AUD_API Triangle : public ISound
+{
+private:
+ /**
+ * The frequence of the triangle wave.
+ */
+ const float m_frequency;
+
+ /**
+ * The target sample rate for output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ Triangle(const Triangle&) = delete;
+ Triangle& operator=(const Triangle&) = delete;
+
+public:
+ /**
+ * Creates a new triangle sound.
+ * \param frequency The desired frequency.
+ * \param sampleRate The target sample rate for playback.
+ */
+ Triangle(float frequency,
+ SampleRate sampleRate = RATE_48000);
+
+ /**
+ * Returns the frequency of the triangle wave.
+ */
+ float getFrequency() const;
+
+ virtual std::shared_ptr<IReader> createReader();
+};
+
+AUD_NAMESPACE_END
diff --git a/extern/audaspace/include/generator/TriangleReader.h b/extern/audaspace/include/generator/TriangleReader.h
new file mode 100644
index 00000000000..15079404b75
--- /dev/null
+++ b/extern/audaspace/include/generator/TriangleReader.h
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 TriangleReader.h
+ * @ingroup generator
+ * The TriangleReader class.
+ */
+
+#include "IReader.h"
+
+AUD_NAMESPACE_BEGIN
+
+/**
+ * This class is used for sawtooth tone playback.
+ * The output format is in the 16 bit format and stereo, the sample rate can be
+ * specified.
+ * As the two channels both play the same the output could also be mono, but
+ * in most cases this will result in having to resample for output, so stereo
+ * sound is created directly.
+ */
+class AUD_API TriangleReader : public IReader
+{
+private:
+ /**
+ * The frequency of the sine wave.
+ */
+ float m_frequency;
+
+ /**
+ * The current position in samples.
+ */
+ int m_position;
+
+ /**
+ * The value of the current sample.
+ */
+ float m_sample;
+
+ /**
+ * The sample rate for the output.
+ */
+ const SampleRate m_sampleRate;
+
+ // delete copy constructor and operator=
+ TriangleReader(const TriangleReader&) = delete;
+ TriangleReader& operator=(const TriangleReader&) = delete;
+
+public:
+ /**
+ * Creates a new reader.
+ * \param frequency The frequency of the sine wave.
+ * \param sampleRate The output sample rate.
+ */
+ TriangleReader(float frequency, SampleRate sampleRate);
+
+ /**
+ * Sets the frequency of the wave.
+ * @param frequency The new frequency in Hertz.
+ */
+ void setFrequency(float frequency);
+
+ virtual bool isSeekable() const;
+ virtual void seek(int position);
+ virtual int getLength() const;
+ virtual int getPosition() const;
+ virtual Specs getSpecs() const;
+ virtual void read(int & length, bool &eos, sample_t* buffer);
+};
+
+AUD_NAMESPACE_END