Add Chromium-only Blender WebEngine parity work
This commit is contained in:
66
blender-5.2.0/extern/audaspace/include/generator/Sawtooth.h
vendored
Normal file
66
blender-5.2.0/extern/audaspace/include/generator/Sawtooth.h
vendored
Normal file
@@ -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
|
||||
86
blender-5.2.0/extern/audaspace/include/generator/SawtoothReader.h
vendored
Normal file
86
blender-5.2.0/extern/audaspace/include/generator/SawtoothReader.h
vendored
Normal file
@@ -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
|
||||
55
blender-5.2.0/extern/audaspace/include/generator/Silence.h
vendored
Normal file
55
blender-5.2.0/extern/audaspace/include/generator/Silence.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* 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"
|
||||
#include "respec/Specification.h"
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* This sound creates a reader that plays silence.
|
||||
*/
|
||||
class AUD_API Silence : public ISound
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The target sample rate for output.
|
||||
*/
|
||||
const SampleRate m_sampleRate;
|
||||
|
||||
// delete copy constructor and operator=
|
||||
Silence(const Silence&) = delete;
|
||||
Silence& operator=(const Silence&) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new silence sound.
|
||||
* \param sampleRate The target sample rate for playback.
|
||||
*/
|
||||
Silence(SampleRate sampleRate = RATE_48000);
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader();
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
65
blender-5.2.0/extern/audaspace/include/generator/SilenceReader.h
vendored
Normal file
65
blender-5.2.0/extern/audaspace/include/generator/SilenceReader.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The sample rate for the output.
|
||||
*/
|
||||
const SampleRate m_sampleRate;
|
||||
|
||||
// delete copy constructor and operator=
|
||||
SilenceReader(const SilenceReader&) = delete;
|
||||
SilenceReader& operator=(const SilenceReader&) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new reader.
|
||||
* \param sampleRate The output sample rate.
|
||||
*/
|
||||
SilenceReader(SampleRate sampleRate);
|
||||
|
||||
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
|
||||
66
blender-5.2.0/extern/audaspace/include/generator/Sine.h
vendored
Normal file
66
blender-5.2.0/extern/audaspace/include/generator/Sine.h
vendored
Normal file
@@ -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 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
|
||||
77
blender-5.2.0/extern/audaspace/include/generator/SineReader.h
vendored
Normal file
77
blender-5.2.0/extern/audaspace/include/generator/SineReader.h
vendored
Normal file
@@ -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
|
||||
67
blender-5.2.0/extern/audaspace/include/generator/Square.h
vendored
Normal file
67
blender-5.2.0/extern/audaspace/include/generator/Square.h
vendored
Normal file
@@ -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
|
||||
86
blender-5.2.0/extern/audaspace/include/generator/SquareReader.h
vendored
Normal file
86
blender-5.2.0/extern/audaspace/include/generator/SquareReader.h
vendored
Normal file
@@ -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
|
||||
67
blender-5.2.0/extern/audaspace/include/generator/Triangle.h
vendored
Normal file
67
blender-5.2.0/extern/audaspace/include/generator/Triangle.h
vendored
Normal file
@@ -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
|
||||
86
blender-5.2.0/extern/audaspace/include/generator/TriangleReader.h
vendored
Normal file
86
blender-5.2.0/extern/audaspace/include/generator/TriangleReader.h
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user