38 | float * FFTRealSelect ::sel_bin (float *e_ptr, float *o_ptr)
39 | {
40 | return (o_ptr);
41 | }
42 |
43 |
44 |
45 | template <>
46 | inline float * FFTRealSelect <0>::sel_bin (float *e_ptr, float *o_ptr)
47 | {
48 | return (e_ptr);
49 | }
50 |
51 |
52 |
53 | } // namespace ffft
54 |
55 |
56 |
57 | #endif // ffft_FFTRealSelect_CODEHEADER_INCLUDED
58 |
59 | #undef ffft_FFTRealSelect_CURRENT_CODEHEADER
60 |
61 |
62 |
63 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
64 |
--------------------------------------------------------------------------------
/demo/Source/DemoHeader.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DEMO_HEADER_H
33 | #define DEMO_HEADER_H
34 |
35 | #include "JuceHeader.h"
36 |
37 | using namespace drow;
38 |
39 | #endif //DEMO_HEADER_H
40 |
--------------------------------------------------------------------------------
/iOS_example/Source/AudioManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | AudioManager.h
5 | Created: 8 Jun 2012 7:40:13am
6 | Author: David Rowland
7 |
8 | ==============================================================================
9 | */
10 |
11 | #ifndef __AUDIOMANAGER_H_76F77D43__
12 | #define __AUDIOMANAGER_H_76F77D43__
13 |
14 | #include "StandardHeader.h"
15 |
16 | //==============================================================================
17 | class AudioManager : public AudioIODeviceCallback
18 | {
19 | public:
20 | //==============================================================================
21 | AudioManager();
22 |
23 | ~AudioManager();
24 |
25 | AudioFilePlayer& getAudioFilePlayer() { return audioFilePlayer; }
26 |
27 | //==============================================================================
28 | void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
29 | int numInputChannels,
30 | float* const* outputChannelData,
31 | int numOutputChannels,
32 | int numSamples,
33 | const AudioIODeviceCallbackContext& context);
34 |
35 | void audioDeviceAboutToStart (AudioIODevice* device);
36 |
37 | void audioDeviceStopped();
38 |
39 | private:
40 | //==============================================================================
41 | AudioDeviceManager audioDeviceManager;
42 | AudioSourcePlayer audioSourcePlayer;
43 | AudioFilePlayer audioFilePlayer;
44 |
45 | //==============================================================================
46 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioManager);
47 | };
48 |
49 |
50 | #endif // __AUDIOMANAGER_H_76F77D43__
51 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealSelect.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealSelect.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_FFTRealSelect_HEADER_INCLUDED)
19 | #define ffft_FFTRealSelect_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #endif
24 |
25 |
26 |
27 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
28 |
29 | #include "def.h"
30 |
31 |
32 |
33 | namespace ffft
34 | {
35 |
36 |
37 |
38 | template
39 | class FFTRealSelect
40 | {
41 |
42 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
43 |
44 | public:
45 |
46 | ffft_FORCEINLINE static float *
47 | sel_bin (float *e_ptr, float *o_ptr);
48 |
49 |
50 |
51 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
52 |
53 | private:
54 |
55 | FFTRealSelect ();
56 | ~FFTRealSelect ();
57 | FFTRealSelect (const FFTRealSelect &other);
58 | FFTRealSelect& operator = (const FFTRealSelect &other);
59 | bool operator == (const FFTRealSelect &other);
60 | bool operator != (const FFTRealSelect &other);
61 |
62 | }; // class FFTRealSelect
63 |
64 |
65 |
66 | } // namespace ffft
67 |
68 |
69 |
70 | #include "FFTRealSelect.hpp"
71 |
72 |
73 |
74 | #endif // ffft_FFTRealSelect_HEADER_INCLUDED
75 |
76 |
77 |
78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
79 |
--------------------------------------------------------------------------------
/iOS_example/Source/Main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file was auto-generated by the Introjucer!
5 |
6 | It contains the basic startup code for a Juce application.
7 |
8 | ==============================================================================
9 | */
10 |
11 | #include "StandardHeader.h"
12 | #include "MainWindow.h"
13 |
14 |
15 | //==============================================================================
16 | class iOSAudioExampleApplication : public JUCEApplication
17 | {
18 | public:
19 | //==============================================================================
20 | iOSAudioExampleApplication()
21 | {
22 | }
23 |
24 | ~iOSAudioExampleApplication()
25 | {
26 | }
27 |
28 | //==============================================================================
29 | void initialise (const String& commandLine)
30 | {
31 | mainWindow = std::make_unique();
32 | }
33 |
34 | void shutdown()
35 | {
36 | mainWindow.reset();
37 | }
38 |
39 | //==============================================================================
40 | void systemRequestedQuit()
41 | {
42 | quit();
43 | }
44 |
45 | //==============================================================================
46 | const String getApplicationName()
47 | {
48 | return "iOS Audio Example";
49 | }
50 |
51 | const String getApplicationVersion()
52 | {
53 | return ProjectInfo::versionString;
54 | }
55 |
56 | bool moreThanOneInstanceAllowed()
57 | {
58 | return true;
59 | }
60 |
61 | void anotherInstanceStarted (const String& commandLine)
62 | {
63 | }
64 |
65 | private:
66 | std::unique_ptr mainWindow;
67 | };
68 |
69 | //==============================================================================
70 | // This macro generates the main() routine that starts the app.
71 | START_JUCE_APPLICATION(iOSAudioExampleApplication)
72 |
--------------------------------------------------------------------------------
/iOS_example/Source/AudioManager.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | AudioManager.cpp
5 | Created: 8 Jun 2012 7:40:13am
6 | Author: David Rowland
7 |
8 | ==============================================================================
9 | */
10 |
11 | #include "AudioManager.h"
12 |
13 | AudioManager::AudioManager()
14 | {
15 | audioDeviceManager.initialiseWithDefaultDevices (0, 2);
16 | audioDeviceManager.addAudioCallback (this);
17 |
18 | audioSourcePlayer.setSource (&audioFilePlayer);
19 |
20 | audioFilePlayer.getAudioFormatManager()->registerFormat (new AVAssetAudioFormat(), false);
21 | }
22 |
23 | AudioManager::~AudioManager()
24 | {
25 | audioDeviceManager.removeAudioCallback (this);
26 |
27 | audioSourcePlayer.setSource (nullptr);
28 | }
29 |
30 | //==============================================================================
31 | void AudioManager::audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
32 | int numInputChannels,
33 | float* const* outputChannelData,
34 | int numOutputChannels,
35 | int numSamples,
36 | const AudioIODeviceCallbackContext& context)
37 | {
38 | audioSourcePlayer.audioDeviceIOCallbackWithContext (inputChannelData,
39 | numInputChannels,
40 | outputChannelData,
41 | numOutputChannels,
42 | numSamples,
43 | context);
44 | }
45 |
46 | void AudioManager::audioDeviceAboutToStart (AudioIODevice* device)
47 | {
48 | audioSourcePlayer.audioDeviceAboutToStart (device);
49 | }
50 |
51 | void AudioManager::audioDeviceStopped()
52 | {
53 | audioSourcePlayer.audioDeviceStopped();
54 | }
--------------------------------------------------------------------------------
/module/dRowAudio/streams/dRowAudio_MemoryInputSource.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 |
33 |
34 | //==============================================================================
35 | MemoryInputSource::MemoryInputSource (MemoryInputStream* stream)
36 | : memoryInputStream (stream)
37 | {
38 | }
39 |
40 | MemoryInputSource::~MemoryInputSource()
41 | {
42 | }
43 |
44 | InputStream* MemoryInputSource::createInputStream()
45 | {
46 | return memoryInputStream;
47 | }
48 |
49 | InputStream* MemoryInputSource::createInputStreamFor (const juce::String& /*relatedItemPath*/)
50 | {
51 | return nullptr;
52 | }
53 |
54 | int64 MemoryInputSource::hashCode() const
55 | {
56 | int64 h = Time::getCurrentTime().toMilliseconds();
57 |
58 | return h;
59 | }
60 |
--------------------------------------------------------------------------------
/demo/Source/DemoLookAndFeel.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_DEMOLOOKANDFEEL_H
33 | #define DROWAUDIO_DEMOLOOKANDFEEL_H
34 |
35 | #include "DemoHeader.h"
36 |
37 | class DemoLookAndFeel : public juce::LookAndFeel_V3
38 | {
39 | public:
40 | DemoLookAndFeel();
41 |
42 | void drawButtonBackground (juce::Graphics& g,
43 | juce::Button& button,
44 | const juce::Colour& backgroundColour,
45 | bool isMouseOverButton,
46 | bool isButtonDown) override;
47 |
48 | private:
49 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DemoLookAndFeel)
50 | };
51 |
52 | #endif //DROWAUDIO_DEMOLOOKANDFEEL_H
53 |
--------------------------------------------------------------------------------
/iOS_example/Source/MainComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | MainComponent.h
5 | Created: 8 Jun 2012 7:39:57am
6 | Author: David Rowland
7 |
8 | ==============================================================================
9 | */
10 |
11 | #ifndef __MAINCOMPONENT_H_55E6F46C__
12 | #define __MAINCOMPONENT_H_55E6F46C__
13 |
14 | #include "StandardHeader.h"
15 | #include "AudioManager.h"
16 |
17 | //==============================================================================
18 | class MainComponent : public Component,
19 | public Timer,
20 | public Button::Listener,
21 | public Slider::Listener,
22 | public AudioPicker::Listener,
23 | public IOSAudioConverter::Listener
24 | {
25 | public:
26 | //==============================================================================
27 | MainComponent();
28 | ~MainComponent();
29 | void resized();
30 | void paint (Graphics& g);
31 |
32 | //==============================================================================
33 | void timerCallback();
34 | void buttonClicked (Button* button);
35 | void sliderValueChanged (Slider* slider);
36 |
37 | //==============================================================================
38 | void audioPickerFinished (const Array& mpMediaItems);
39 | void audioPickerCancelled();
40 |
41 | //==============================================================================
42 | void conversionFinished (const File& convertedFile);
43 |
44 | private:
45 | //==============================================================================
46 | AudioManager audioManager;
47 |
48 | TextButton pickButton, playButton;
49 | Slider positionSlider;
50 |
51 | AudioPicker audioPicker;
52 | IOSAudioConverter audioConverter;
53 |
54 | String title;
55 | String artist;
56 |
57 | //==============================================================================
58 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent);
59 | };
60 |
61 | #endif // __MAINCOMPONENT_H_55E6F46C__
62 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/Array.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | Array.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_Array_HEADER_INCLUDED)
19 | #define ffft_Array_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 |
31 |
32 | namespace ffft
33 | {
34 |
35 |
36 |
37 | template
38 | class Array
39 | {
40 |
41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
42 |
43 | public:
44 |
45 | typedef T DataType;
46 |
47 | Array ();
48 |
49 | inline const DataType &
50 | operator [] (long pos) const;
51 | inline DataType &
52 | operator [] (long pos);
53 |
54 | static inline long
55 | size ();
56 |
57 |
58 |
59 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
60 |
61 | protected:
62 |
63 |
64 |
65 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
66 |
67 | private:
68 |
69 | DataType _data_arr [LEN];
70 |
71 |
72 |
73 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
74 |
75 | private:
76 |
77 | Array (const Array &other);
78 | Array & operator = (const Array &other);
79 | bool operator == (const Array &other);
80 | bool operator != (const Array &other);
81 |
82 | }; // class Array
83 |
84 |
85 |
86 | } // namespace ffft
87 |
88 |
89 |
90 | #include "Array.hpp"
91 |
92 |
93 |
94 | #endif // ffft_Array_HEADER_INCLUDED
95 |
96 |
97 |
98 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
99 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealFixLenParam.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealFixLenParam.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_FFTRealFixLenParam_HEADER_INCLUDED)
19 | #define ffft_FFTRealFixLenParam_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 |
31 |
32 | namespace ffft
33 | {
34 |
35 |
36 |
37 | class FFTRealFixLenParam
38 | {
39 |
40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
41 |
42 | public:
43 |
44 | // Over this bit depth, we use direct calculation for sin/cos
45 | enum { TRIGO_BD_LIMIT = 12 };
46 |
47 | typedef float DataType;
48 |
49 |
50 |
51 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
52 |
53 | protected:
54 |
55 |
56 |
57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
58 |
59 | private:
60 |
61 |
62 |
63 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
64 |
65 | private:
66 |
67 | FFTRealFixLenParam ();
68 | FFTRealFixLenParam (const FFTRealFixLenParam &other);
69 | FFTRealFixLenParam &
70 | operator = (const FFTRealFixLenParam &other);
71 | bool operator == (const FFTRealFixLenParam &other);
72 | bool operator != (const FFTRealFixLenParam &other);
73 |
74 | }; // class FFTRealFixLenParam
75 |
76 |
77 |
78 | } // namespace ffft
79 |
80 |
81 |
82 | //#include "ffft/FFTRealFixLenParam.hpp"
83 |
84 |
85 |
86 | #endif // ffft_FFTRealFixLenParam_HEADER_INCLUDED
87 |
88 |
89 |
90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
91 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_CpuMeter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | CpuMeter::CpuMeter (AudioDeviceManager* deviceManagerToUse, int updateIntervalMs)
33 | : Label ("CpuMeter", "00.00%"),
34 | deviceManager (deviceManagerToUse),
35 | updateInterval (updateIntervalMs),
36 | currentCpuUsage (0.0)
37 | {
38 | if (deviceManagerToUse != nullptr)
39 | startTimer (updateInterval);
40 | }
41 |
42 | void CpuMeter::setTextColour (const Colour newTextColour)
43 | {
44 | setColour (Label::textColourId, newTextColour);
45 | }
46 |
47 | void CpuMeter::resized()
48 | {
49 | const int w = getWidth();
50 | const int h = getHeight();
51 |
52 | setFont ((h < (w * 0.24f) ? h : w * 0.24f));
53 | }
54 |
55 | void CpuMeter::timerCallback()
56 | {
57 | currentCpuUsage = (deviceManager->getCpuUsage() * 100.0);
58 | setText (String (currentCpuUsage, 2) + "%", dontSendNotification);
59 | }
60 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/Array.hpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | Array.hpp
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if defined (ffft_Array_CURRENT_CODEHEADER)
19 | #error Recursive inclusion of Array code header.
20 | #endif
21 | #define ffft_Array_CURRENT_CODEHEADER
22 |
23 | #if ! defined (ffft_Array_CODEHEADER_INCLUDED)
24 | #define ffft_Array_CODEHEADER_INCLUDED
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include
31 |
32 |
33 |
34 | namespace ffft
35 | {
36 |
37 |
38 |
39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
40 |
41 |
42 |
43 | template
44 | Array ::Array ()
45 | {
46 | // Nothing
47 | }
48 |
49 |
50 |
51 | template
52 | const typename Array ::DataType & Array ::operator [] (long pos) const
53 | {
54 | assert (pos >= 0);
55 | assert (pos < LEN);
56 |
57 | return (_data_arr [pos]);
58 | }
59 |
60 |
61 |
62 | template
63 | typename Array ::DataType & Array ::operator [] (long pos)
64 | {
65 | assert (pos >= 0);
66 | assert (pos < LEN);
67 |
68 | return (_data_arr [pos]);
69 | }
70 |
71 |
72 |
73 | template
74 | long Array ::size ()
75 | {
76 | return (LEN);
77 | }
78 |
79 |
80 |
81 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
82 |
83 |
84 |
85 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
86 |
87 |
88 |
89 | } // namespace ffft
90 |
91 |
92 |
93 | #endif // ffft_Array_CODEHEADER_INCLUDED
94 |
95 | #undef ffft_Array_CURRENT_CODEHEADER
96 |
97 |
98 |
99 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
100 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealUseTrigo.hpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealUseTrigo.hpp
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if defined (ffft_FFTRealUseTrigo_CURRENT_CODEHEADER)
19 | #error Recursive inclusion of FFTRealUseTrigo code header.
20 | #endif
21 | #define ffft_FFTRealUseTrigo_CURRENT_CODEHEADER
22 |
23 | #if ! defined (ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED)
24 | #define ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 |
31 |
32 |
33 | namespace ffft
34 | {
35 |
36 |
37 |
38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
39 |
40 |
41 |
42 | template
43 | void FFTRealUseTrigo ::prepare (OscType &osc)
44 | {
45 | osc.clear_buffers ();
46 | }
47 |
48 | template <>
49 | inline void FFTRealUseTrigo <0>::prepare (OscType &osc)
50 | {
51 | // Nothing
52 | }
53 |
54 |
55 |
56 | template
57 | void FFTRealUseTrigo ::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
58 | {
59 | osc.step ();
60 | c = osc.get_cos ();
61 | s = osc.get_sin ();
62 | }
63 |
64 | template <>
65 | inline void FFTRealUseTrigo <0>::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
66 | {
67 | c = cos_ptr [index_c];
68 | s = cos_ptr [index_s];
69 | }
70 |
71 |
72 |
73 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
74 |
75 |
76 |
77 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
78 |
79 |
80 |
81 | } // namespace ffft
82 |
83 |
84 |
85 | #endif // ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED
86 |
87 | #undef ffft_FFTRealUseTrigo_CURRENT_CODEHEADER
88 |
89 |
90 |
91 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
92 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/dRowAudio_EnvelopeFollower.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | //==============================================================================
33 | EnvelopeFollower::EnvelopeFollower()
34 | : envelope (0.0f),
35 | envAttack (1.0f), envRelease (1.0f)
36 | {
37 | }
38 |
39 | //==============================================================================
40 | void EnvelopeFollower::processEnvelope (const float* inputBuffer, float* outputBuffer, int numSamples) noexcept
41 | {
42 | for (int i = 0; i < numSamples; ++i)
43 | {
44 | float envIn = fabsf (inputBuffer[i]);
45 |
46 | if (envelope < envIn)
47 | envelope += envAttack * (envIn - envelope);
48 | else if (envelope > envIn)
49 | envelope -= envRelease * (envelope - envIn);
50 |
51 | outputBuffer[i] = envelope;
52 | }
53 | }
54 |
55 | void EnvelopeFollower::setCoefficients (float attack, float release) noexcept
56 | {
57 | envAttack = attack;
58 | envRelease = release;
59 | }
60 |
--------------------------------------------------------------------------------
/demo/Source/MainWindow.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef MAIN_WINDOW_H
33 | #define MAIN_WINDOW_H
34 |
35 | #include "DemoHeader.h"
36 | #include "DemoLookAndFeel.h"
37 |
38 | class MainAppWindow : public juce::DocumentWindow
39 | {
40 | public:
41 | MainAppWindow();
42 | ~MainAppWindow();
43 |
44 | //==============================================================================
45 | /** @internal */
46 | void closeButtonPressed() override;
47 |
48 | private:
49 | //==============================================================================
50 | DemoLookAndFeel lookAndFeel;
51 |
52 | //==============================================================================
53 | void setupColours();
54 |
55 | //==============================================================================
56 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainAppWindow)
57 | };
58 |
59 | #endif //MAIN_WINDOW_H
60 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/soundtouch/cpu_detect.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// A header file for detecting the Intel MMX instructions set extension.
4 | ///
5 | /// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the
6 | /// routine implementations for x86 Windows, x86 gnu version and non-x86
7 | /// platforms, respectively.
8 | ///
9 | /// Author : Copyright (c) Olli Parviainen
10 | /// Author e-mail : oparviai 'at' iki.fi
11 | /// SoundTouch WWW: http://www.surina.net/soundtouch
12 | ///
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Last changed : $Date: 2008-02-10 16:26:55 +0000 (Sun, 10 Feb 2008) $
16 | // File revision : $Revision: 4 $
17 | //
18 | // $Id: cpu_detect.h 11 2008-02-10 16:26:55Z oparviai $
19 | //
20 | ////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // License :
23 | //
24 | // SoundTouch audio processing library
25 | // Copyright (c) Olli Parviainen
26 | //
27 | // This library is free software; you can redistribute it and/or
28 | // modify it under the terms of the GNU Lesser General Public
29 | // License as published by the Free Software Foundation; either
30 | // version 2.1 of the License, or (at your option) any later version.
31 | //
32 | // This library is distributed in the hope that it will be useful,
33 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
34 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 | // Lesser General Public License for more details.
36 | //
37 | // You should have received a copy of the GNU Lesser General Public
38 | // License along with this library; if not, write to the Free Software
39 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 | //
41 | ////////////////////////////////////////////////////////////////////////////////
42 |
43 | #ifndef _CPU_DETECT_H_
44 | #define _CPU_DETECT_H_
45 |
46 | #include "STTypes.h"
47 |
48 | #define SUPPORT_MMX 0x0001
49 | #define SUPPORT_3DNOW 0x0002
50 | #define SUPPORT_ALTIVEC 0x0004
51 | #define SUPPORT_SSE 0x0008
52 | #define SUPPORT_SSE2 0x0010
53 |
54 | /// Checks which instruction set extensions are supported by the CPU.
55 | ///
56 | /// \return A bitmask of supported extensions, see SUPPORT_... defines.
57 | uint detectCPUextensions(void);
58 |
59 | /// Disables given set of instruction extensions. See SUPPORT_... defines.
60 | void disableExtensions(uint wDisableMask);
61 |
62 | #endif // _CPU_DETECT_H_
63 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_DefaultColours.cpp:
--------------------------------------------------------------------------------
1 | DefaultColours::DefaultColours()
2 | {
3 | fillDefaultColours();
4 | }
5 |
6 | DefaultColours& DefaultColours::getInstance()
7 | {
8 | static DefaultColours instance;
9 | return instance;
10 | }
11 |
12 | //==============================================================================
13 | Colour DefaultColours::findColour (const Component& source, const int colourId) const noexcept
14 | {
15 | if (source.isColourSpecified (colourId))
16 | return source.findColour (colourId);
17 | else if (source.getLookAndFeel().isColourSpecified (colourId))
18 | return source.getLookAndFeel().findColour (colourId);
19 |
20 | return colourIds.contains (colourId) ? colours[colourIds.indexOf (colourId)]
21 | : Colours::black;
22 | }
23 |
24 | //==============================================================================
25 | void DefaultColours::fillDefaultColours() noexcept
26 | {
27 | static const uint32 standardColours[] =
28 | {
29 | MusicLibraryTable::backgroundColourId, Colour::greyLevel (0.2f).getARGB(),
30 | MusicLibraryTable::unfocusedBackgroundColourId, Colour::greyLevel (0.2f).getARGB(),
31 | MusicLibraryTable::selectedBackgroundColourId, 0xffff8c00,//Colour (Colours::darkorange).getARGB(),
32 | MusicLibraryTable::selectedUnfocusedBackgroundColourId, Colour::greyLevel (0.6f).getARGB(),
33 | MusicLibraryTable::textColourId, Colour::greyLevel (0.9f).getARGB(),
34 | MusicLibraryTable::selectedTextColourId, Colour::greyLevel (0.2f).getARGB(),
35 | MusicLibraryTable::unfocusedTextColourId, Colour::greyLevel (0.9f).getARGB(),
36 | MusicLibraryTable::selectedUnfocusedTextColourId, Colour::greyLevel (0.9f).getARGB(),
37 | MusicLibraryTable::outlineColourId, Colour::greyLevel (0.9f).withAlpha (0.2f).getARGB(),
38 | MusicLibraryTable::selectedOutlineColourId, Colour::greyLevel (0.9f).withAlpha (0.2f).getARGB(),
39 | MusicLibraryTable::unfocusedOutlineColourId, Colour::greyLevel (0.9f).withAlpha (0.2f).getARGB(),
40 | MusicLibraryTable::selectedUnfocusedOutlineColourId, Colour::greyLevel (0.9f).withAlpha (0.2f).getARGB()
41 | };
42 |
43 | for (int i = 0; i < numElementsInArray (standardColours); i += 2)
44 | {
45 | colourIds.add ((int) standardColours [i]);
46 | colours.add (Colour ((uint32) standardColours [i + 1]));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/DynArray.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | DynArray.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_DynArray_HEADER_INCLUDED)
19 | #define ffft_DynArray_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 |
31 |
32 | namespace ffft
33 | {
34 |
35 |
36 |
37 | template
38 | class DynArray
39 | {
40 |
41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
42 |
43 | public:
44 |
45 | typedef T DataType;
46 |
47 | DynArray ();
48 | explicit DynArray (long size);
49 | ~DynArray ();
50 |
51 | inline long size () const;
52 | inline void resize (long size);
53 |
54 | inline const DataType &
55 | operator [] (long pos) const;
56 | inline DataType &
57 | operator [] (long pos);
58 |
59 |
60 |
61 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
62 |
63 | protected:
64 |
65 |
66 |
67 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
68 |
69 | private:
70 |
71 | DataType * _data_ptr;
72 | long _len;
73 |
74 |
75 |
76 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
77 |
78 | private:
79 |
80 | DynArray (const DynArray &other);
81 | DynArray & operator = (const DynArray &other);
82 | bool operator == (const DynArray &other);
83 | bool operator != (const DynArray &other);
84 |
85 | }; // class DynArray
86 |
87 |
88 |
89 | } // namespace ffft
90 |
91 |
92 |
93 | #include "DynArray.hpp"
94 |
95 |
96 |
97 | #endif // ffft_DynArray_HEADER_INCLUDED
98 |
99 |
100 |
101 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
102 |
--------------------------------------------------------------------------------
/module/dRowAudio/streams/dRowAudio_MemoryInputSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_MEMORYINPUTSOURCE_H
33 | #define DROWAUDIO_MEMORYINPUTSOURCE_H
34 |
35 | /** A type of InputSource that represents a MemoryInputStream.
36 |
37 | @see InputSource
38 | */
39 | class MemoryInputSource : public juce::InputSource
40 | {
41 | public:
42 | MemoryInputSource (juce::MemoryInputStream* stream);
43 | ~MemoryInputSource() override;
44 |
45 | //==============================================================================
46 | /** @internal */
47 | juce::InputStream* createInputStream() override;
48 | /** @internal */
49 | juce::InputStream* createInputStreamFor (const juce::String& relatedItemPath) override;
50 | /** @internal */
51 | juce::int64 hashCode() const override;
52 |
53 | private:
54 | //==============================================================================
55 | juce::MemoryInputStream* memoryInputStream;
56 |
57 | //==============================================================================
58 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryInputSource)
59 | };
60 |
61 | #endif // DROWAUDIO_MEMORYINPUTSOURCE_H
62 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealPassDirect.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealPassDirect.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_FFTRealPassDirect_HEADER_INCLUDED)
19 | #define ffft_FFTRealPassDirect_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include "def.h"
31 | #include "FFTRealFixLenParam.h"
32 | #include "OscSinCos.h"
33 |
34 |
35 |
36 | namespace ffft
37 | {
38 |
39 |
40 |
41 | template
42 | class FFTRealPassDirect
43 | {
44 |
45 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
46 |
47 | public:
48 |
49 | typedef FFTRealFixLenParam::DataType DataType;
50 | typedef OscSinCos OscType;
51 |
52 | ffft_FORCEINLINE static void
53 | process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType x_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
54 |
55 |
56 |
57 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
58 |
59 | protected:
60 |
61 |
62 |
63 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
64 |
65 | private:
66 |
67 |
68 |
69 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
70 |
71 | private:
72 |
73 | FFTRealPassDirect ();
74 | FFTRealPassDirect (const FFTRealPassDirect &other);
75 | FFTRealPassDirect &
76 | operator = (const FFTRealPassDirect &other);
77 | bool operator == (const FFTRealPassDirect &other);
78 | bool operator != (const FFTRealPassDirect &other);
79 |
80 | }; // class FFTRealPassDirect
81 |
82 |
83 |
84 | } // namespace ffft
85 |
86 |
87 |
88 | #include "FFTRealPassDirect.hpp"
89 |
90 |
91 |
92 | #endif // ffft_FFTRealPassDirect_HEADER_INCLUDED
93 |
94 |
95 |
96 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
97 |
--------------------------------------------------------------------------------
/demo/Source/playback/DistortionDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DISTORTION_DEMO_H
33 | #define DISTORTION_DEMO_H
34 |
35 | #include "DistortionComponent.h"
36 | #include "BufferTransformAudioSource.h"
37 |
38 | class DistortionDemo : public juce::Component,
39 | public juce::Button::Listener
40 | {
41 | public:
42 | DistortionDemo (BufferTransformAudioSource& bufferTransformAudioSource);
43 |
44 | //==============================================================================
45 | /** @internal */
46 | void resized() override;
47 | /** @internal */
48 | void paint (juce::Graphics& g) override;
49 | /** @internal */
50 | void buttonClicked (juce::Button* button) override;
51 |
52 | private:
53 | //==============================================================================
54 | BufferTransformAudioSource& bufferTransformAudioSource;
55 | DistortionComponent distortionComponent;
56 | juce::TextButton resetButton, bypassButton;
57 |
58 | //==============================================================================
59 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DistortionDemo)
60 | };
61 |
62 | #endif //DISTORTION_DEMO_H
63 |
--------------------------------------------------------------------------------
/module/dRowAudio/network/dRowAudio_CURLManager.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #if DROWAUDIO_USE_CURL
33 |
34 | } //namespace drow
35 |
36 | #if JUCE_WINDOWS
37 | #include "curl/include/curl/curl.h"
38 | #else
39 | #include
40 | #endif
41 |
42 | namespace drow
43 | {
44 |
45 | //==============================================================================
46 | juce_ImplementSingleton (CURLManager);
47 |
48 | CURLManager::CURLManager()
49 | : TimeSliceThread ("cURL Thread")
50 | {
51 | CURLcode result = curl_global_init (CURL_GLOBAL_ALL);
52 |
53 | (void) result;
54 | jassert (result == CURLE_OK);
55 | }
56 |
57 | CURLManager::~CURLManager()
58 | {
59 | curl_global_cleanup();
60 | clearSingletonInstance();
61 | }
62 |
63 | CURL* CURLManager::createEasyCurlHandle()
64 | {
65 | return curl_easy_init();
66 | }
67 |
68 | void CURLManager::cleanUpEasyCurlHandle (CURL* handle)
69 | {
70 | curl_easy_cleanup (handle);
71 | handle = nullptr;
72 | }
73 |
74 | StringArray CURLManager::getSupportedProtocols()
75 | {
76 | if (curl_version_info_data* info = curl_version_info (CURLVERSION_NOW))
77 | return juce::StringArray (info->protocols);
78 |
79 | return juce::StringArray();
80 | }
81 |
82 | #endif //DROWAUDIO_USE_CURL
83 |
--------------------------------------------------------------------------------
/demo/Source/fft/PitchTracker.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-12 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio can be redistributed and/or modified under the terms of the GNU General
10 | Public License (Version 2), as published by the Free Software Foundation.
11 | A copy of the license is included in the module distribution, or can be found
12 | online at www.gnu.org/licenses.
13 |
14 | dRowAudio is distributed in the hope that it will be useful, but WITHOUT ANY
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 | A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 |
18 | ==============================================================================
19 | */
20 |
21 | #ifndef __PITCHTRACKER_H__
22 | #define __PITCHTRACKER_H__
23 |
24 | #include "../../JuceLibraryCode/JuceHeader.h"
25 |
26 | //==============================================================================
27 | class PitchTracker : public GraphicalComponent
28 | {
29 | public:
30 | //==============================================================================
31 | PitchTracker (int fftSizeLog2);
32 |
33 | ~PitchTracker();
34 |
35 | void resized();
36 |
37 | void paint(Graphics &g);
38 |
39 | //============================================
40 | /* GraphicalComponent implimentations */
41 | void copySamples (const float* samples, int numSamples);
42 |
43 | void timerCallback();
44 |
45 | void process();
46 |
47 | //============================================
48 |
49 | void flagForRepaint()
50 | {
51 | needsRepaint = true;
52 | repaint();
53 | }
54 |
55 | //============================================
56 | void setLogFrequencyDisplay(bool shouldDisplayLog)
57 | {
58 | logFrequency = shouldDisplayLog;
59 | }
60 |
61 | bool getLogFrequencyDisplay() { return logFrequency; }
62 |
63 | private:
64 | //==============================================================================
65 | FFTEngine fftEngine;
66 | int numBins;
67 | bool needsRepaint;
68 | HeapBlock tempBlock;
69 | FifoBuffer circularBuffer;
70 | bool logFrequency;
71 | Image scopeImage, tempImage;
72 |
73 | CriticalSection lock;
74 |
75 | void renderScopeImage();
76 | void renderScopeLine();
77 |
78 | //==============================================================================
79 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PitchTracker);
80 | };
81 |
82 |
83 | #endif // __PITCHTRACKER_H__
84 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_DefaultColours.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_DEFAULTCOLOURS_H
33 | #define DROWAUDIO_DEFAULTCOLOURS_H
34 |
35 | /** This class is used internally by the module to handle it's own colourIds and
36 | maintain compatibility with the normal JUCE setColour etc. methods.
37 |
38 | You should never have to use this yourself.
39 | */
40 | class DefaultColours
41 | {
42 | public:
43 | DefaultColours();
44 |
45 | //==============================================================================
46 | static DefaultColours& getInstance();
47 |
48 | //==============================================================================
49 | juce::Colour findColour (const juce::Component& source, const int colourId) const noexcept;
50 |
51 | private:
52 | //==============================================================================
53 | juce::Array colourIds;
54 | juce::Array colours;
55 |
56 | //==============================================================================
57 | void fillDefaultColours() noexcept;
58 |
59 | //==============================================================================
60 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DefaultColours)
61 | };
62 |
63 | #endif //DROWAUDIO_DEFAULTCOLOURS_H
64 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealUseTrigo.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealUseTrigo.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_FFTRealUseTrigo_HEADER_INCLUDED)
19 | #define ffft_FFTRealUseTrigo_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include "def.h"
31 | #include "FFTRealFixLenParam.h"
32 | #include "OscSinCos.h"
33 |
34 |
35 |
36 | namespace ffft
37 | {
38 |
39 |
40 |
41 | template
42 | class FFTRealUseTrigo
43 | {
44 |
45 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
46 |
47 | public:
48 |
49 | typedef FFTRealFixLenParam::DataType DataType;
50 | typedef OscSinCos OscType;
51 |
52 | ffft_FORCEINLINE static void
53 | prepare (OscType &osc);
54 | ffft_FORCEINLINE static void
55 | iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s);
56 |
57 |
58 |
59 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
60 |
61 | protected:
62 |
63 |
64 |
65 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
66 |
67 | private:
68 |
69 |
70 |
71 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
72 |
73 | private:
74 |
75 | FFTRealUseTrigo ();
76 | ~FFTRealUseTrigo ();
77 | FFTRealUseTrigo (const FFTRealUseTrigo &other);
78 | FFTRealUseTrigo &
79 | operator = (const FFTRealUseTrigo &other);
80 | bool operator == (const FFTRealUseTrigo &other);
81 | bool operator != (const FFTRealUseTrigo &other);
82 |
83 | }; // class FFTRealUseTrigo
84 |
85 |
86 |
87 | } // namespace ffft
88 |
89 |
90 |
91 | #include "FFTRealUseTrigo.hpp"
92 |
93 |
94 |
95 | #endif // ffft_FFTRealUseTrigo_HEADER_INCLUDED
96 |
97 |
98 |
99 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
100 |
--------------------------------------------------------------------------------
/demo/Source/network/NetworkDemo.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #include "NetworkDemo.h"
33 |
34 | #if DROWAUDIO_USE_CURL
35 |
36 | NetworkDemo::NetworkDemo()
37 | {
38 | connectionComponent.addListener (this);
39 | connectionComponent.setCURLSessionToControl (&remoteBrowser.getCURLSession());
40 |
41 | localBrowser.setComponentID ("local");
42 | remoteBrowser.setComponentID ("remote");
43 |
44 | addAndMakeVisible (&connectionComponent);
45 | addAndMakeVisible (&localBrowser);
46 | addAndMakeVisible (&remoteBrowser);
47 | }
48 |
49 | void NetworkDemo::resized()
50 | {
51 | const int w = getWidth();
52 | const int h = getHeight();
53 |
54 | connectionComponent.setBounds (0, 0, w, 100);
55 | localBrowser.setBounds (0, connectionComponent.getBottom() + 5, w / 2 - 2, h - connectionComponent.getBottom() - 5);
56 | remoteBrowser.setBounds (localBrowser.getRight() + 2, connectionComponent.getBottom() + 5, w / 2 - 2, h - connectionComponent.getBottom() - 5);
57 | }
58 |
59 | void NetworkDemo::connectionChanged (ConnectionComponent* changedConnectionComponent)
60 | {
61 | if (changedConnectionComponent == &connectionComponent)
62 | remoteBrowser.refresh();
63 | }
64 |
65 | #endif //DROWAUDIO_USE_CURL
66 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_Clock.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | Clock::Clock()
33 | {
34 | setTimeDisplayFormat (showTime + show24Hr);
35 | }
36 |
37 | int Clock::getRequiredWidth() const
38 | {
39 | return getFont().getStringWidth (timeAsString) + 10;
40 | }
41 |
42 | void Clock::setTimeDisplayFormat (const int newFormat)
43 | {
44 | displayFormat = newFormat;
45 |
46 | if ((displayFormat & showDayShort) != 0 && (displayFormat & showDayLong) != 0)
47 | displayFormat -= showDayShort;
48 | if ((displayFormat & showTime) != 0)
49 | startTimer (5900);
50 | if ((displayFormat & showSeconds) != 0)
51 | startTimer (950);
52 |
53 | timerCallback();
54 | }
55 |
56 | void Clock::timerCallback()
57 | {
58 | timeAsString = juce::String();
59 |
60 | juce::String formatString;
61 | formatString << ((displayFormat & showDayShort) ? "%a " : "")
62 | << ((displayFormat & showDayLong) ? "%A " : "")
63 | << ((displayFormat & showDate) ? "%x " : "")
64 | << ((displayFormat & showTime) ? ((displayFormat & show24Hr) ? "%H:%M" : "%I:%M") : "")
65 | << ((displayFormat & showSeconds) ? ":%S " : "");
66 |
67 | if (formatString.isNotEmpty())
68 | timeAsString << Time::getCurrentTime().formatted (formatString);
69 |
70 | setText (timeAsString, dontSendNotification);
71 | }
72 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/dRowAudio_EnvelopeFollower.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_ENVELOPEFOLLOWER_H
33 | #define DROWAUDIO_ENVELOPEFOLLOWER_H
34 |
35 | #include "filters/dRowAudio_OnePoleFilter.h"
36 |
37 | /** EnvelopeFollower.
38 |
39 | Envelope follower class that gives an overall amplitude response of a set of
40 | samples.
41 | */
42 | class EnvelopeFollower
43 | {
44 | public:
45 | /** Constructor. */
46 | EnvelopeFollower();
47 |
48 | //==============================================================================
49 | /** Uses different exponential attack and release coefficients.
50 |
51 | Call setTimes to setup this method, ignoring the hold time.
52 | */
53 | void processEnvelope (const float* inputBuffer, float* outputBuffer, int numSamples) noexcept;
54 |
55 | /** Sets the times for the vaious stages of the envelope.
56 |
57 | 1 is an instant attack/release, 0 will never change the value.
58 | */
59 | void setCoefficients (float attack, float release) noexcept;
60 |
61 | private:
62 | //==============================================================================
63 | float envelope, envAttack, envRelease;
64 |
65 | //==============================================================================
66 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EnvelopeFollower)
67 | };
68 |
69 | #endif // DROWAUDIO_ENVELOPEFOLLOWER_H
70 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/dRowAudio_mac_FFTOperation.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #if DROWAUDIO_USE_VDSP
33 |
34 | FFTOperation::FFTOperation (int fftSizeLog2)
35 | : fftProperties (fftSizeLog2)
36 | {
37 | fftConfig = vDSP_create_fftsetup (fftProperties.fftSizeLog2, 0);
38 |
39 | fftBuffer.malloc (fftProperties.fftSize);
40 | fftBufferSplit.realp = fftBuffer.getData();
41 | fftBufferSplit.imagp = fftBufferSplit.realp + getFFTProperties().fftSizeHalved;
42 | }
43 |
44 | FFTOperation::~FFTOperation()
45 | {
46 | vDSP_destroy_fftsetup (fftConfig);
47 | }
48 |
49 | void FFTOperation::setFFTSizeLog2 (int newFFTSizeLog2)
50 | {
51 | if (newFFTSizeLog2 != fftProperties.fftSizeLog2)
52 | {
53 | vDSP_destroy_fftsetup (fftConfig);
54 |
55 | fftProperties.setFFTSizeLog2 (newFFTSizeLog2);
56 | fftBuffer.malloc (fftProperties.fftSize);
57 | fftBufferSplit.realp = fftBuffer.getData();
58 | fftBufferSplit.imagp = fftBufferSplit.realp + getFFTProperties().fftSizeHalved;
59 |
60 | fftConfig = vDSP_create_fftsetup (fftProperties.fftSizeLog2, 0);
61 | }
62 | }
63 |
64 | void FFTOperation::performFFT (float* samples)
65 | {
66 | vDSP_ctoz ((COMPLEX *) samples, 2, &fftBufferSplit, 1, fftProperties.fftSizeHalved);
67 | vDSP_fft_zrip (fftConfig, &fftBufferSplit, 1, fftProperties.fftSizeLog2, FFT_FORWARD);
68 | }
69 |
70 | #endif // DROWAUDIO_USE_VDSP
71 |
--------------------------------------------------------------------------------
/demo/Source/MainWindow.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #include "MainWindow.h"
33 | #include "MainComponent.h"
34 |
35 | MainAppWindow::MainAppWindow() :
36 | DocumentWindow (juce::JUCEApplication::getInstance()->getApplicationName(), juce::Colours::darkgrey, DocumentWindow::allButtons)
37 | {
38 | juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
39 | setupColours();
40 |
41 | setContentOwned (new MainComponent(), true);
42 | setResizable (true, false);
43 | centreWithSize (getWidth(), getHeight());
44 | setVisible (true);
45 | }
46 |
47 | MainAppWindow::~MainAppWindow()
48 | {
49 | juce::LookAndFeel::setDefaultLookAndFeel (nullptr);
50 | }
51 |
52 | void MainAppWindow::closeButtonPressed()
53 | {
54 | juce::JUCEApplication::getInstance()->systemRequestedQuit();
55 | }
56 |
57 | //==============================================================================
58 | void MainAppWindow::setupColours()
59 | {
60 | juce::LookAndFeel& laf = getLookAndFeel();
61 | laf.setColour (juce::TextButton::buttonColourId, juce::Colours::lightgrey);
62 | laf.setColour (juce::TextButton::buttonOnColourId, juce::Colours::grey);
63 | laf.setColour (juce::ToggleButton::textColourId, juce::Colours::white);
64 | laf.setColour (juce::Slider::rotarySliderFillColourId, juce::Colours::white);
65 | }
66 |
--------------------------------------------------------------------------------
/demo/Source/TrackInfoComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef TRACK_INFO_COMPONENT_H
33 | #define TRACK_INFO_COMPONENT_H
34 |
35 | #include "DemoHeader.h"
36 |
37 | class TrackInfoComponent : public juce::Component,
38 | public AudioFilePlayer::Listener,
39 | public juce::Timer
40 | {
41 | public:
42 | TrackInfoComponent (AudioFilePlayerExt& audioFilePlayer);
43 | ~TrackInfoComponent();
44 |
45 | //==============================================================================
46 | /** @internal */
47 | void resized() override;
48 | /** @internal */
49 | void paint (juce::Graphics& g) override;
50 | /** @internal */
51 | void fileChanged (AudioFilePlayer* player) override;
52 | /** @internal */
53 | void audioFilePlayerSettingChanged (AudioFilePlayer* player, int settingCode) override;
54 | /** @internal */
55 | void timerCallback() override;
56 |
57 | private:
58 | //==============================================================================
59 | AudioFilePlayerExt& audioFilePlayer;
60 | juce::Label bpmLabel, remainLabel;
61 |
62 | //==============================================================================
63 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TrackInfoComponent)
64 | };
65 |
66 | #endif //TRACK_INFO_COMPONENT_H
67 |
--------------------------------------------------------------------------------
/module/dRowAudio/maths/dRowAudio_CumulativeMovingAverage.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-12 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio can be redistributed and/or modified under the terms of the GNU General
10 | Public License (Version 2), as published by the Free Software Foundation.
11 | A copy of the license is included in the module distribution, or can be found
12 | online at www.gnu.org/licenses.
13 |
14 | dRowAudio is distributed in the hope that it will be useful, but WITHOUT ANY
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 | A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 |
18 | ==============================================================================
19 | */
20 |
21 | #ifndef DROWAUDIO_CUMULATIVEMOVINGAVERAGE_H
22 | #define DROWAUDIO_CUMULATIVEMOVINGAVERAGE_H
23 |
24 | /** Simple cumulative average class which you can add values to and will return
25 | the mean of them.
26 |
27 | This can be used when you don't know the total number of values that need to be averaged.
28 | */
29 | class CumulativeMovingAverage
30 | {
31 | public:
32 | /** Creates a blank CumulativeMovingAverage. */
33 | CumulativeMovingAverage() noexcept
34 | : currentAverage (0.0),
35 | numValues (0)
36 | {
37 | }
38 |
39 | /** Creates a copy of another CumulativeMovingAverage. */
40 | CumulativeMovingAverage (const CumulativeMovingAverage& other) noexcept
41 | {
42 | currentAverage = other.currentAverage;
43 | numValues = other.numValues;
44 | }
45 |
46 | //==============================================================================
47 | /** Resets the CumulativeMovingAverage. */
48 | void reset() noexcept
49 | {
50 | currentAverage = 0.0;
51 | numValues = 0;
52 | }
53 |
54 | /** Adds a new value to contribute to the average and returns the average. */
55 | double add (double newValue) noexcept
56 | {
57 | currentAverage = (newValue + (numValues * currentAverage)) / (numValues + 1);
58 | ++numValues;
59 |
60 | return currentAverage;
61 | }
62 |
63 | /** Returns the current average. */
64 | double getAverage() const noexcept { return currentAverage; }
65 |
66 | /** Returns the number of values that have contributed to the current average. */
67 | int getNumValues() const noexcept { return numValues; }
68 |
69 | private:
70 | //==============================================================================
71 | double currentAverage;
72 | int numValues;
73 |
74 | //==============================================================================
75 | JUCE_LEAK_DETECTOR (CumulativeMovingAverage)
76 | };
77 |
78 | #endif //DROWAUDIO_CUMULATIVEMOVINGAVERAGE_H
79 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/OscSinCos.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | OscSinCos.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_OscSinCos_HEADER_INCLUDED)
19 | #define ffft_OscSinCos_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include "def.h"
31 |
32 |
33 |
34 | namespace ffft
35 | {
36 |
37 |
38 |
39 | template
40 | class OscSinCos
41 | {
42 |
43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
44 |
45 | public:
46 |
47 | typedef T DataType;
48 |
49 | OscSinCos ();
50 |
51 | ffft_FORCEINLINE void
52 | set_step (double angle_rad);
53 |
54 | ffft_FORCEINLINE DataType
55 | get_cos () const;
56 | ffft_FORCEINLINE DataType
57 | get_sin () const;
58 | ffft_FORCEINLINE void
59 | step ();
60 | ffft_FORCEINLINE void
61 | clear_buffers ();
62 |
63 |
64 |
65 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
66 |
67 | protected:
68 |
69 |
70 |
71 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
72 |
73 | private:
74 |
75 | DataType _pos_cos; // Current phase expressed with sin and cos. [-1 ; 1]
76 | DataType _pos_sin; // -
77 | DataType _step_cos; // Phase increment per step, [-1 ; 1]
78 | DataType _step_sin; // -
79 |
80 |
81 |
82 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
83 |
84 | private:
85 |
86 | OscSinCos (const OscSinCos &other);
87 | OscSinCos & operator = (const OscSinCos &other);
88 | bool operator == (const OscSinCos &other);
89 | bool operator != (const OscSinCos &other);
90 |
91 | }; // class OscSinCos
92 |
93 |
94 |
95 | } // namespace ffft
96 |
97 |
98 |
99 | #include "OscSinCos.hpp"
100 |
101 |
102 |
103 | #endif // ffft_OscSinCos_HEADER_INCLUDED
104 |
105 |
106 |
107 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
108 |
--------------------------------------------------------------------------------
/demo/Source/TransportComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef TRANSPORT_COMPONENT_H
33 | #define TRANSPORT_COMPONENT_H
34 |
35 | #include "DemoHeader.h"
36 |
37 | class TransportComponent : public juce::Component,
38 | public juce::Button::Listener
39 | {
40 | public:
41 | TransportComponent (juce::AudioDeviceManager& audioDeviceManager, AudioFilePlayerExt& audioFilePlayer);
42 | ~TransportComponent();
43 |
44 | //==============================================================================
45 | /** @internal */
46 | void resized() override;
47 | /** @internal */
48 | void buttonClicked (juce::Button* button) override;
49 |
50 | private:
51 | juce:://==============================================================================
52 | LookAndFeel_V3 settingsLaf;
53 | std::unique_ptr settingsComp;
54 | juce::AudioDeviceManager& audioDeviceManager;
55 | AudioFilePlayerExt& audioFilePlayer;
56 | juce::OwnedArray buttons;
57 |
58 | enum Buttons
59 | {
60 | play,
61 | stop,
62 | loop,
63 | reverse,
64 | numButtons
65 | };
66 |
67 | void showAudioSettings();
68 |
69 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TransportComponent)
70 | };
71 |
72 | #endif //TRANSPORT_COMPONENT_H
73 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/dRowAudio_LTAS.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #if DROWAUDIO_USE_FFTREAL || DROWAUDIO_USE_VDSP
33 |
34 | LTAS::LTAS (int fftSizeLog2)
35 | : fftEngine (fftSizeLog2),
36 | ltasBuffer (fftEngine.getMagnitudesBuffer().getSize()),
37 | fftSize (fftEngine.getFFTSize()),
38 | numBins (int (ltasBuffer.getSize())),
39 | tempBuffer (fftSize)
40 | {
41 | ltasBuffer.reset();
42 |
43 | ltasAvg.insertMultiple (0, CumulativeMovingAverage(), numBins);
44 | }
45 |
46 | void LTAS::updateLTAS (float* input, int numSamples)
47 | {
48 | if (input != nullptr)
49 | {
50 | Buffer& fftBuffer (fftEngine.getMagnitudesBuffer());
51 | for (int i = 0; i < numBins; ++i)
52 | ltasAvg.getReference (i).reset();
53 |
54 | while (numSamples >= fftSize)
55 | {
56 | memcpy (tempBuffer, input, size_t (fftSize) * sizeof (float));
57 | fftEngine.performFFT (tempBuffer);
58 | fftEngine.findMagnitudes();
59 |
60 | for (int i = 0; i < numBins; ++i)
61 | ltasAvg.getReference (i).add (fftBuffer[i]);
62 |
63 | input += fftSize;
64 | numSamples -= fftSize;
65 | }
66 |
67 | for (int i = 0; i < numBins; ++i)
68 | ltasBuffer.getReference (i) = (float) ltasAvg.getReference (i).getAverage();
69 |
70 | ltasBuffer.updateListeners();
71 | }
72 | }
73 |
74 | #endif //DROWAUDIO_USE_FFTREAL
75 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_CpuMeter.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_CPUMETER_H
33 | #define DROWAUDIO_CPUMETER_H
34 |
35 | /** Handy class that will display the cpu usage of a given AudioDeviceManager
36 | as a percentage.
37 | */
38 | class CpuMeter : public juce::Label,
39 | public juce::Timer
40 | {
41 | public:
42 | /** Creates a CpuMeter.
43 |
44 | You need to provide the device manager to monitor and optionally the refresh
45 | rate of the display.
46 | */
47 | CpuMeter (juce::AudioDeviceManager* deviceManagerToUse, int updateIntervalMs = 50);
48 |
49 | /** Returns the current cpu usage as a percentage. */
50 | double getCurrentCpuUsage() const { return currentCpuUsage; }
51 |
52 | /** Changes the colour of the text. */
53 | void setTextColour (juce::Colour newTextColour);
54 |
55 | //==============================================================================
56 | /** @internal */
57 | void resized() override;
58 | /** @internal */
59 | void timerCallback() override;
60 |
61 | private:
62 | //==============================================================================
63 | juce::AudioDeviceManager* deviceManager;
64 | int updateInterval;
65 | double currentCpuUsage;
66 |
67 | //==============================================================================
68 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CpuMeter)
69 | };
70 |
71 | #endif //DROWAUDIO_CPUMETER_H
72 |
--------------------------------------------------------------------------------
/module/dRowAudio/network/curl/include/curl/curlver.h:
--------------------------------------------------------------------------------
1 | #ifndef CURL_CURLVER_H
2 | #define CURL_CURLVER_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* This header file contains nothing but libcurl version info, generated by
26 | a script at release-time. This was made its own header file in 7.11.2 */
27 |
28 | /* This is the global package copyright */
29 | #define LIBCURL_COPYRIGHT "1996 - 2011 Daniel Stenberg, ."
30 |
31 | /* This is the version number of the libcurl package from which this header
32 | file origins: */
33 | #define LIBCURL_VERSION "7.23.1"
34 |
35 | /* The numeric version number is also available "in parts" by using these
36 | defines: */
37 | #define LIBCURL_VERSION_MAJOR 7
38 | #define LIBCURL_VERSION_MINOR 23
39 | #define LIBCURL_VERSION_PATCH 1
40 |
41 | /* This is the numeric version of the libcurl version number, meant for easier
42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
43 | always follow this syntax:
44 |
45 | 0xXXYYZZ
46 |
47 | Where XX, YY and ZZ are the main version, release and patch numbers in
48 | hexadecimal (using 8 bits each). All three numbers are always represented
49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7
50 | appears as "0x090b07".
51 |
52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number,
53 | and it is always a greater number in a more recent release. It makes
54 | comparisons with greater than and less than work.
55 | */
56 | #define LIBCURL_VERSION_NUM 0x071701
57 |
58 | /*
59 | * This is the date and time when the full source package was created. The
60 | * timestamp is not stored in git, as the timestamp is properly set in the
61 | * tarballs by the maketgz script.
62 | *
63 | * The format of the date should follow this template:
64 | *
65 | * "Mon Feb 12 11:35:33 UTC 2007"
66 | */
67 | #define LIBCURL_TIMESTAMP "Thu Nov 17 17:17:45 UTC 2011"
68 |
69 | #endif /* CURL_CURLVER_H */
70 |
--------------------------------------------------------------------------------
/module/dRowAudio/utility/dRowAudio_Constants.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_CONSTANTS_H
33 | #define DROWAUDIO_CONSTANTS_H
34 |
35 | //==============================================================================
36 | /** @file
37 |
38 | This file contains some useful constants for calculations such as reciprocals
39 | to avoid using expensive divides in programs.
40 | */
41 |
42 | static const double oneOver60 = 1.0 / 60.0;
43 | static const double oneOver60Squared = 1.0 / (60.0 * 60.0);
44 | static const double oneOver180 = 1.0 / 180.0;
45 | static const double oneOverPi = 1.0 / juce::MathConstants::pi;
46 | static const double twoTimesPi = 2.0 * juce::MathConstants::pi;
47 | static const double fourTimesPi = 4.0 * juce::MathConstants::pi;
48 | static const double sixTimesPi = 6.0 * juce::MathConstants::pi;
49 | static const double root2 = sqrt (2.0);
50 | static const double oneOverRoot2 = 1.0 / sqrt (2.0);
51 | static const double root3 = sqrt (3.0);
52 | static const double oneOverRoot3 = 1.0 / sqrt (3.0);
53 |
54 | template
55 | inline Type squareNumber (Type input)
56 | {
57 | return input * input;
58 | }
59 |
60 | template
61 | inline Type cubeNumber (Type input)
62 | {
63 | return input * input * input;
64 | }
65 |
66 | #if JUCE_WINDOWS
67 | template
68 | inline Type log2 (Type input)
69 | {
70 | return log (input) / log ((Type) 2);
71 | }
72 | #endif
73 |
74 | #endif //DROWAUDIO_CONSTANTS_H
75 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/OscSinCos.hpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | OscSinCos.hpp
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if defined (ffft_OscSinCos_CURRENT_CODEHEADER)
19 | #error Recursive inclusion of OscSinCos code header.
20 | #endif
21 | #define ffft_OscSinCos_CURRENT_CODEHEADER
22 |
23 | #if ! defined (ffft_OscSinCos_CODEHEADER_INCLUDED)
24 | #define ffft_OscSinCos_CODEHEADER_INCLUDED
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include
31 |
32 | namespace std { }
33 |
34 |
35 |
36 | namespace ffft
37 | {
38 |
39 |
40 |
41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
42 |
43 |
44 |
45 | template
46 | OscSinCos ::OscSinCos ()
47 | : _pos_cos (1)
48 | , _pos_sin (0)
49 | , _step_cos (1)
50 | , _step_sin (0)
51 | {
52 | // Nothing
53 | }
54 |
55 |
56 |
57 | template
58 | void OscSinCos ::set_step (double angle_rad)
59 | {
60 | using namespace std;
61 |
62 | _step_cos = static_cast (cos (angle_rad));
63 | _step_sin = static_cast (sin (angle_rad));
64 | }
65 |
66 |
67 |
68 | template
69 | typename OscSinCos ::DataType OscSinCos ::get_cos () const
70 | {
71 | return (_pos_cos);
72 | }
73 |
74 |
75 |
76 | template
77 | typename OscSinCos ::DataType OscSinCos ::get_sin () const
78 | {
79 | return (_pos_sin);
80 | }
81 |
82 |
83 |
84 | template
85 | void OscSinCos ::step ()
86 | {
87 | const DataType old_cos = _pos_cos;
88 | const DataType old_sin = _pos_sin;
89 |
90 | _pos_cos = old_cos * _step_cos - old_sin * _step_sin;
91 | _pos_sin = old_cos * _step_sin + old_sin * _step_cos;
92 | }
93 |
94 |
95 |
96 | template
97 | void OscSinCos ::clear_buffers ()
98 | {
99 | _pos_cos = static_cast (1);
100 | _pos_sin = static_cast (0);
101 | }
102 |
103 |
104 |
105 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
106 |
107 |
108 |
109 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
110 |
111 |
112 |
113 | } // namespace ffft
114 |
115 |
116 |
117 | #endif // ffft_OscSinCos_CODEHEADER_INCLUDED
118 |
119 | #undef ffft_OscSinCos_CURRENT_CODEHEADER
120 |
121 |
122 |
123 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
124 |
--------------------------------------------------------------------------------
/demo/Source/Main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #include "MainWindow.h"
33 |
34 | class dRowAudioDemoApplication : public juce::JUCEApplication
35 | {
36 | public:
37 | dRowAudioDemoApplication()
38 | {
39 | }
40 |
41 | void initialise (const juce::String&) override
42 | {
43 | #if JUCE_DEBUG && DROWAUDIO_UNIT_TESTS
44 | juce::UnitTestRunner testRunner;
45 | testRunner.runAllTests();
46 | #endif
47 |
48 | mainWindow = std::make_unique();
49 | }
50 |
51 | void shutdown() override
52 | {
53 | mainWindow = nullptr;
54 | }
55 |
56 | void systemRequestedQuit() override { quit(); }
57 | const juce::String getApplicationName() override { return ProjectInfo::projectName; }
58 | const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }
59 | bool moreThanOneInstanceAllowed() override { return true; }
60 | void anotherInstanceStarted (const juce::String&) override { }
61 |
62 | private:
63 | std::unique_ptr mainWindow;
64 |
65 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (dRowAudioDemoApplication)
66 | };
67 |
68 | //==============================================================================
69 | // This macro generates the main() routine that starts the app.
70 | START_JUCE_APPLICATION(dRowAudioDemoApplication)
71 |
--------------------------------------------------------------------------------
/demo/Source/playback/BufferTransformAudioSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef BUFFER_TRANSFORM_AUDIO_SOURCE_H
33 | #define BUFFER_TRANSFORM_AUDIO_SOURCE_H
34 |
35 | #include "../DemoHeader.h"
36 |
37 | class BufferTransformAudioSource : public juce::AudioSource
38 | {
39 | public:
40 | BufferTransformAudioSource (AudioSource* source,
41 | bool deleteSourceWhenDeleted = false);
42 |
43 | //==============================================================================
44 | /** Setting this to true does not apply the buffer. */
45 | void setBypass (bool shouldBypass);
46 |
47 | /** Returns all of the settings. */
48 | Buffer& getBuffer() { return buffer; }
49 |
50 | //==============================================================================
51 | /** @internal */
52 | void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
53 | /** @internal */
54 | void releaseResources() override;
55 | /** @internal */
56 | void getNextAudioBlock (const juce::AudioSourceChannelInfo& info) override;
57 |
58 | private:
59 | //==============================================================================
60 | juce::OptionalScopedPointer source;
61 | Buffer buffer;
62 | bool isBypassed;
63 |
64 | //==============================================================================
65 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferTransformAudioSource)
66 | };
67 |
68 | #endif //BUFFER_TRANSFORM_AUDIO_SOURCE_H
69 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/soundtouch/soundtouch_config.h:
--------------------------------------------------------------------------------
1 | /* include/soundtouch_config.h. Generated from soundtouch_config.h.in by configure. */
2 | /* include/soundtouch_config.h.in. Generated from configure.ac by autoheader. */
3 |
4 | /* Define to 1 if you have the header file. */
5 | #define HAVE_DLFCN_H 1
6 |
7 | /* Define to 1 if you have the header file. */
8 | #define HAVE_INTTYPES_H 1
9 |
10 | /* Define to 1 if you have the `m' library (-lm). */
11 | #define HAVE_LIBM 1
12 |
13 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
14 | to 0 otherwise. */
15 | #define HAVE_MALLOC 1
16 |
17 | /* Define to 1 if you have the header file. */
18 | #define HAVE_MEMORY_H 1
19 |
20 | /* Define to 1 if you have the header file. */
21 | #define HAVE_STDINT_H 1
22 |
23 | /* Define to 1 if you have the header file. */
24 | #define HAVE_STDLIB_H 1
25 |
26 | /* Define to 1 if you have the header file. */
27 | #define HAVE_STRINGS_H 1
28 |
29 | /* Define to 1 if you have the header file. */
30 | #define HAVE_STRING_H 1
31 |
32 | /* Define to 1 if you have the header file. */
33 | #define HAVE_SYS_STAT_H 1
34 |
35 | /* Define to 1 if you have the header file. */
36 | #define HAVE_SYS_TYPES_H 1
37 |
38 | /* Define to 1 if you have the header file. */
39 | #define HAVE_UNISTD_H 1
40 |
41 | /* Define to the sub-directory in which libtool stores uninstalled libraries.
42 | */
43 | #define LT_OBJDIR ".libs/"
44 |
45 | /* Name of package */
46 | #define PACKAGE "soundtouch"
47 |
48 | /* Define to the address where bug reports for this package should be sent. */
49 | #define PACKAGE_BUGREPORT "http://www.surina.net/soundtouch"
50 |
51 | /* Define to the full name of this package. */
52 | #define PACKAGE_NAME "SoundTouch"
53 |
54 | /* Define to the full name and version of this package. */
55 | #define PACKAGE_STRING "SoundTouch 1.6.1"
56 |
57 | /* Define to the one symbol short name of this package. */
58 | #define PACKAGE_TARNAME "soundtouch"
59 |
60 | /* Define to the version of this package. */
61 | #define PACKAGE_VERSION "1.6.1"
62 |
63 | /* Define as the return type of signal handlers (`int' or `void'). */
64 | #define RETSIGTYPE void
65 |
66 | /* Do not use x86 optimizations */
67 | /* #undef SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS */
68 |
69 | /* Use Float as Sample type */
70 | #define SOUNDTOUCH_FLOAT_SAMPLES 1
71 |
72 | /* Use Integer as Sample type */
73 | /* #undef SOUNDTOUCH_INTEGER_SAMPLES */
74 |
75 | /* Define to 1 if you have the ANSI C header files. */
76 | #define STDC_HEADERS 1
77 |
78 | /* Version number of package */
79 | #define VERSION "1.6.1"
80 |
81 | /* Define to empty if `const' does not conform to ANSI C. */
82 | /* #undef const */
83 |
84 | /* Define to `__inline__' or `__inline' if that's what the C compiler
85 | calls it, or to nothing if 'inline' is not supported under any name. */
86 | #ifndef __cplusplus
87 | /* #undef inline */
88 | #endif
89 |
90 | /* Define to rpl_malloc if the replacement function should be used. */
91 | /* #undef malloc */
92 |
--------------------------------------------------------------------------------
/demo/Source/network/NetworkDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef NETWORK_DEMO_H
33 | #define NETWORK_DEMO_H
34 |
35 | #include "ConnectionComponent.h"
36 | #include "LocalDirectoryListBox.h"
37 | #include "RemoteDirectoryListBox.h"
38 |
39 | #if DROWAUDIO_USE_CURL
40 |
41 | /** @todo
42 | Refresh directory on right click
43 | Better look of file list
44 | Thread CURLEasySession
45 | */
46 | class NetworkDemo : public juce::Component,
47 | public juce::DragAndDropContainer,
48 | public ConnectionComponent::Listener
49 | {
50 | public:
51 | NetworkDemo();
52 |
53 | //==============================================================================
54 | /** @internal */
55 | void resized();
56 | /** @internal */
57 | void connectionChanged (ConnectionComponent* connectionComponent);
58 |
59 | private:
60 | //==============================================================================
61 | ConnectionComponent connectionComponent;
62 | LocalDirectoryListBox localBrowser;
63 | RemoteDirectoryListBox remoteBrowser;
64 |
65 | // unused:
66 | std::unique_ptr inputStream;
67 | std::unique_ptr curlSession;
68 |
69 | //==============================================================================
70 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NetworkDemo)
71 | };
72 |
73 | #endif //DROWAUDIO_USE_CURL
74 | #endif //NETWORK_DEMO_H
75 |
--------------------------------------------------------------------------------
/module/dRowAudio/network/curl/include/curl/mprintf.h:
--------------------------------------------------------------------------------
1 | #ifndef CURL_MPRINTF_H
2 | #define CURL_MPRINTF_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include
26 | #include /* needed for FILE */
27 |
28 | #include "curl.h"
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | CURL_EXTERN int curl_mprintf(const char *format, ...);
35 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
36 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
37 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
38 | const char *format, ...);
39 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
40 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
41 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
42 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
43 | const char *format, va_list args);
44 | CURL_EXTERN char *curl_maprintf(const char *format, ...);
45 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
46 |
47 | #ifdef _MPRINTF_REPLACE
48 | # undef printf
49 | # undef fprintf
50 | # undef sprintf
51 | # undef vsprintf
52 | # undef snprintf
53 | # undef vprintf
54 | # undef vfprintf
55 | # undef vsnprintf
56 | # undef aprintf
57 | # undef vaprintf
58 | # define printf curl_mprintf
59 | # define fprintf curl_mfprintf
60 | #ifdef CURLDEBUG
61 | /* When built with CURLDEBUG we define away the sprintf() functions since we
62 | don't want internal code to be using them */
63 | # define sprintf sprintf_was_used
64 | # define vsprintf vsprintf_was_used
65 | #else
66 | # define sprintf curl_msprintf
67 | # define vsprintf curl_mvsprintf
68 | #endif
69 | # define snprintf curl_msnprintf
70 | # define vprintf curl_mvprintf
71 | # define vfprintf curl_mvfprintf
72 | # define vsnprintf curl_mvsnprintf
73 | # define aprintf curl_maprintf
74 | # define vaprintf curl_mvaprintf
75 | #endif
76 |
77 | #ifdef __cplusplus
78 | }
79 | #endif
80 |
81 | #endif /* CURL_MPRINTF_H */
82 |
--------------------------------------------------------------------------------
/demo/Source/fft/PitchDetectorComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef PITCH_DETECTOR_COMPONENT_H
33 | #define PITCH_DETECTOR_COMPONENT_H
34 |
35 | #include "../DemoHeader.h"
36 |
37 | class PitchDetectorComponent : public juce::Component,
38 | public juce::Timer
39 | {
40 | public:
41 | PitchDetectorComponent();
42 |
43 | //==============================================================================
44 | void setLogFrequencyDisplay (bool shouldDisplayLogFrequency);
45 |
46 | void setSampleRate (double newSampleRate);
47 |
48 | void processBlock (const float* inputChannelData, int numSamples);
49 |
50 | //==============================================================================
51 | void paint (juce::Graphics&) override;
52 | void resized() override;
53 | void timerCallback() override;
54 |
55 | private:
56 | //==============================================================================
57 | bool displayLogFrequency;
58 | double sampleRate, pitch;
59 | juce::AudioSampleBuffer sampleBuffer;
60 | PitchDetector pitchDetector;
61 |
62 | StateVariable pitchXCoord;
63 | juce::String pitchString;
64 | juce::Label pitchLabel;
65 |
66 | juce::CriticalSection detectorLock;
67 |
68 | //==============================================================================
69 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PitchDetectorComponent)
70 | };
71 |
72 | #endif // PITCH_DETECTOR_COMPONENT_H
73 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/soundtouch/cpu_detect_x64_gcc.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// Generic version of the x64 CPU detect routine.
4 | ///
5 | /// This file is for GNU & other non-Windows compilers, see 'cpu_detect_x64_win.cpp'
6 | /// for the Microsoft compiler version.
7 | ///
8 | /// Author : Copyright (c) Olli Parviainen
9 | /// Author e-mail : oparviai 'at' iki.fi
10 | /// SoundTouch WWW: http://www.surina.net/soundtouch
11 | ///
12 | ////////////////////////////////////////////////////////////////////////////////
13 | //
14 | // Last changed : $Date: 2009-06-04 22:22:00 -0400 (Sun, 04 June 2009) $
15 | // File revision : $Revision: 1 $
16 | //
17 | // $Id: cpu_detect_x64_gcc.cpp 1 2009-06-04 22:22:00Z pegasus $
18 | //
19 | ////////////////////////////////////////////////////////////////////////////////
20 | //
21 | // License :
22 | //
23 | // SoundTouch audio processing library
24 | // Copyright (c) Olli Parviainen
25 | //
26 | // This library is free software; you can redistribute it and/or
27 | // modify it under the terms of the GNU Lesser General Public
28 | // License as published by the Free Software Foundation; either
29 | // version 2.1 of the License, or (at your option) any later version.
30 | //
31 | // This library is distributed in the hope that it will be useful,
32 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
33 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 | // Lesser General Public License for more details.
35 | //
36 | // You should have received a copy of the GNU Lesser General Public
37 | // License along with this library; if not, write to the Free Software
38 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 | //
40 | ////////////////////////////////////////////////////////////////////////////////
41 |
42 | #include "cpu_detect.h"
43 |
44 | //////////////////////////////////////////////////////////////////////////////
45 | //
46 | // processor instructions extension detection routines
47 | //
48 | //////////////////////////////////////////////////////////////////////////////
49 |
50 | // Flag variable indicating whick ISA extensions are disabled (for debugging)
51 | static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions
52 |
53 |
54 | // Disables given set of instruction extensions. See SUPPORT_... defines.
55 | void disableExtensions(uint dwDisableMask)
56 | {
57 | _dwDisabledISA = dwDisableMask;
58 | }
59 |
60 |
61 |
62 | /// Checks which instruction set extensions are supported by the CPU.
63 | uint detectCPUextensions(void)
64 | {
65 | uint res = 0;
66 |
67 | if (_dwDisabledISA == 0xffffffff) return 0;
68 |
69 | // cpu_detect_x86_gcc segfaults on "%edx", "%eax", "%ecx", "%esi" );
70 | // Since I don't know how to fix that and just need something working for Mixxx...
71 |
72 | // All 64-bit processors support MMX, SSE, and SSE2
73 | res = SUPPORT_MMX + SUPPORT_SSE + SUPPORT_SSE2;
74 |
75 | #ifdef x86_64
76 | res += SUPPORT_3DNOW;
77 | #endif
78 |
79 | return res & ~_dwDisabledISA;
80 | }
81 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/dRowAudio_AudioSampleBufferAudioFormat.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_AUDIOSAMPLEBUFFERAUDIOFORMAT_H
33 | #define DROWAUDIO_AUDIOSAMPLEBUFFERAUDIOFORMAT_H
34 |
35 | /** Streams data from an AudioSampleBuffer.
36 |
37 | This reads from a stream that has been initialised from the AudioSampleBuffer
38 | method getArrayOfChannels(). The AudioSampleBuffer needs to stay in exisistance
39 | for the duration of this object and not be changed as the stream is unique to
40 | the memory layout of the buffer.
41 |
42 | @see AudioFormat
43 | */
44 | class AudioSampleBufferAudioFormat : public juce::AudioFormat
45 | {
46 | public:
47 | /** Creates a format object. */
48 | AudioSampleBufferAudioFormat();
49 |
50 | //==============================================================================
51 | juce::Array getPossibleSampleRates() override;
52 | juce::Array getPossibleBitDepths() override;
53 | bool canDoStereo() override;
54 | bool canDoMono() override;
55 | juce::AudioFormatReader* createReaderFor (juce::InputStream* sourceStream,
56 | bool deleteStreamIfOpeningFails) override;
57 |
58 | std::unique_ptr createWriterFor (std::unique_ptr& streamToWriteTo, const AudioFormatWriterOptions& options);
59 |
60 | private:
61 | //==============================================================================
62 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioSampleBufferAudioFormat)
63 | };
64 |
65 | #endif // DROWAUDIO_AUDIOSAMPLEBUFFERAUDIOFORMAT_H
66 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/filters/dRowAudio_OnePoleFilter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 |
33 |
34 | OnePoleFilter::OnePoleFilter() noexcept
35 | : y1 (0.0f), b0 (1.0f), a1 (0.0f)
36 | {
37 | }
38 |
39 | OnePoleFilter::~OnePoleFilter() noexcept
40 | {
41 | }
42 |
43 | void OnePoleFilter::processSamples (float* const samples,
44 | const int numSamples) noexcept
45 | {
46 | // make sure sample values are locked
47 | const ScopedLock sl (lock);
48 |
49 | for (int i = 0; i < numSamples; ++i)
50 | {
51 | samples[i] = (b0 * samples[i]) + (a1 * y1);
52 | y1 = samples[i];
53 | }
54 | }
55 |
56 |
57 | void OnePoleFilter::makeLowPass (const double sampleRate,
58 | const double frequency) noexcept
59 | {
60 | const double w0 = 2.0 * juce::MathConstants::pi * (frequency / sampleRate);
61 | const double cos_w0 = cos (w0);
62 |
63 | const double alpha = (2.0f - cos_w0) - sqrt ((2.0 - cos_w0) * (2.0 - cos_w0) - 1.0);
64 |
65 | const ScopedLock sl (lock);
66 |
67 | b0 = 1.0f - (float) alpha;
68 | a1 = (float) alpha;
69 | }
70 |
71 | void OnePoleFilter::makeHighPass (const double sampleRate,
72 | const double frequency) noexcept
73 | {
74 | const double w0 = 2.0 * juce::MathConstants::pi * (frequency / sampleRate);
75 | const double cos_w0 = cos (w0);
76 |
77 | const double alpha = (2.0 + cos_w0) - sqrt ((2.0 + cos_w0) * (2.0 + cos_w0) - 1.0);
78 |
79 | const ScopedLock sl (lock);
80 |
81 | b0 = (float) alpha - 1.0f;
82 | a1 = (float) -alpha;
83 | }
84 |
--------------------------------------------------------------------------------
/demo/Source/fft/FFTDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIODEMO_FFTDEMO_H
33 | #define DROWAUDIODEMO_FFTDEMO_H
34 |
35 | #include "PitchDetectorComponent.h"
36 |
37 | //==============================================================================
38 | class FFTDemo : public juce::Component,
39 | public juce::Button::Listener,
40 | public juce::Slider::Listener
41 | {
42 | public:
43 | FFTDemo();
44 | ~FFTDemo();
45 |
46 | //==============================================================================
47 | void setSampleRate (double sampleRate);
48 | void processBlock (const float* inputChannelData, int numSamples);
49 |
50 | //==============================================================================
51 | void resized() override;
52 | void buttonClicked (juce::Button* button) override;
53 | void sliderValueChanged (juce::Slider* slider) override;
54 |
55 | void visibilityChanged() override;
56 | bool isCurrentlyShowing = false;
57 | private:
58 | //==============================================================================
59 | juce::TimeSliceThread renderThread;
60 | AudioOscilloscope audioOscilloscope;
61 | Spectroscope spectroscope;
62 | PitchDetectorComponent pitchDetector;
63 | Sonogram sonogram;
64 |
65 | juce::ToggleButton logSpectroscopeButton, logSonogramButton;
66 | juce::Slider sonogramSpeedSlider;
67 |
68 | //==============================================================================
69 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFTDemo)
70 | };
71 |
72 | #endif //DROWAUDIODEMO_FFTDEMO_H
73 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/FFTRealPassInverse.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | FFTRealPassInverse.h
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if ! defined (ffft_FFTRealPassInverse_HEADER_INCLUDED)
19 | #define ffft_FFTRealPassInverse_HEADER_INCLUDED
20 |
21 | #if defined (_MSC_VER)
22 | #pragma once
23 | #pragma warning (4 : 4250) // "Inherits via dominance."
24 | #endif
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include "def.h"
31 | #include "FFTRealFixLenParam.h"
32 | #include "OscSinCos.h"
33 |
34 |
35 |
36 |
37 | namespace ffft
38 | {
39 |
40 |
41 |
42 | template
43 | class FFTRealPassInverse
44 | {
45 |
46 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
47 |
48 | public:
49 |
50 | typedef FFTRealFixLenParam::DataType DataType;
51 | typedef OscSinCos OscType;
52 |
53 | ffft_FORCEINLINE static void
54 | process (long len, DataType dest_ptr [], DataType src_ptr [], const DataType f_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
55 | ffft_FORCEINLINE static void
56 | process_rec (long len, DataType dest_ptr [], DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
57 | ffft_FORCEINLINE static void
58 | process_internal (long len, DataType dest_ptr [], const DataType src_ptr [], const DataType cos_ptr [], long cos_len, const long br_ptr [], OscType osc_list []);
59 |
60 |
61 |
62 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
63 |
64 | protected:
65 |
66 |
67 |
68 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
69 |
70 | private:
71 |
72 |
73 |
74 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
75 |
76 | private:
77 |
78 | FFTRealPassInverse ();
79 | FFTRealPassInverse (const FFTRealPassInverse &other);
80 | FFTRealPassInverse &
81 | operator = (const FFTRealPassInverse &other);
82 | bool operator == (const FFTRealPassInverse &other);
83 | bool operator != (const FFTRealPassInverse &other);
84 |
85 | }; // class FFTRealPassInverse
86 |
87 |
88 |
89 | } // namespace ffft
90 |
91 |
92 |
93 | #include "FFTRealPassInverse.hpp"
94 |
95 |
96 |
97 | #endif // ffft_FFTRealPassInverse_HEADER_INCLUDED
98 |
99 |
100 |
101 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
102 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # A JUCE module for high level audio application development.
2 |
3 | dRowAudio is a 3rd party JUCE module designed for rapid audio application development. It contains classes for audio processing and GUI elements.
4 |
5 | Additionally, there are several wrappers around 3rd party libraries including:
6 | * [cURL](https://github.com/bagder/curl)
7 | * [FFTReal](http://ldesoras.free.fr/prod.html)
8 | * [SoundTouch](http://www.surina.net/soundtouch/index.html)
9 |
10 | dRowAudio is written following JUCE's [Coding Standard](http://www.juce.com/learn/coding-standards).
11 |
12 | This library is hosted on [GitHub](https://github.com/m-rest/drowaudio).
13 | Please find the online documentation [here](http://drowaudio.co.uk/docs/).
14 |
15 | ## Prerequisites
16 |
17 | This documentation assumes that the reader has a working knowledge of [JUCE](https://github.com/julianstorer/JUCE).
18 |
19 | ## Integration
20 |
21 | This fork of dRowAudio requires JUCE 7.0.3.
22 |
23 |
24 | ## Platforms
25 |
26 | All platforms supported by JUCE are also supported by dRowAudio.
27 |
28 | Currently, these platforms include:
29 | * **Windows**: Applications and VST/VST3/RTAS/AAX/NPAPI/ActiveX plugins can be built
30 | using MS Visual Studio. The results are all fully compatible with Windows XP, Vista, 7, 8, 8.1 and 10.
31 | * **Mac OS X**: Applications and VST/VST3/AudioUnit/RTAS/AAX/NPAPI plugins with Xcode.
32 | * **GNU/Linux**: Applications and plugins can be built for any kernel 2.6 or later.
33 | * **iOS**: Native iPhone and iPad apps.
34 | * **Android**: Supported.
35 |
36 | ## License
37 |
38 | Copyright (C) 2013 - Present by [David Rowland](mailto:dave@drowaudio.co.uk)
39 |
40 | dRowAudio is provided under the terms of The MIT License (MIT):
41 |
42 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
43 |
44 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
45 |
46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 |
48 | Some portions of the software including but not limited to [SoundTouch](http://www.surina.net/soundtouch/index.html) and [FFTReal](http://ldesoras.free.fr/prod.html) are included with in the repository but released under separate licences. Please see the individual source files for details.
49 |
50 | ## Other Contributors
51 |
52 | * [Joël R. Langlois](https://github.com/jrlanglois)
53 | * [Maximilian Rest](https://github.com/m-rest)
54 | * [Roland Rabien](https://github.com/FigBug)
55 | * [Atilio Menéndez](https://github.com/atiliomf)
56 |
57 |
--------------------------------------------------------------------------------
/demo/Source/playback/DistortionComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DISTORTION_COMPONENT_H
33 | #define DISTORTION_COMPONENT_H
34 |
35 | #include "CurvePoint.h"
36 |
37 | class DistortionComponent : public juce::Component,
38 | public Buffer::Listener,
39 | public juce::ComponentListener
40 | {
41 | public:
42 | DistortionComponent (Buffer& bufferToControl);
43 |
44 | ~DistortionComponent();
45 |
46 | void resetBuffer();
47 |
48 | //==============================================================================
49 | void resized() override;
50 | void paint (juce::Graphics& g) override;
51 | void bufferChanged (Buffer* buffer) override;
52 | void componentMovedOrResized (juce::Component& component, bool wasMoved, bool wasResized) override;
53 |
54 | private:
55 | //==============================================================================
56 | enum CurvePoints
57 | {
58 | pointX1,
59 | pointY1,
60 | pointX2,
61 | pointY2,
62 | numPoints,
63 | };
64 |
65 | //==============================================================================
66 | Buffer& buffer;
67 | juce::Path path;
68 |
69 | juce::OwnedArray curvePoints;
70 | juce::OwnedArray values;
71 |
72 | void refreshPath();
73 | void refillBuffer (float x1, float y1, float x2, float y2);
74 | void resetPoints();
75 |
76 | juce::Image background;
77 | bool isInitialised;
78 |
79 | //==============================================================================
80 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DistortionComponent)
81 | };
82 |
83 | #endif //DISTORTION_COMPONENT_H
84 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/soundtouch/cpu_detect_x64_win.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// Win32 version of the x64 CPU detect routine.
4 | ///
5 | /// This file is to be compiled in Windows platform with Microsoft Visual C++
6 | /// Compiler. Please see 'cpu_detect_x86_gcc.cpp' for the gcc compiler version
7 | /// for all GNU platforms.
8 | ///
9 | /// Author : Copyright (c) Olli Parviainen
10 | /// Author e-mail : oparviai 'at' iki.fi
11 | /// SoundTouch WWW: http://www.surina.net/soundtouch
12 | ///
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // Last changed : $Date: 2009-05-03 23:20:00 -0400 (Sun, 03 May 2009) $
16 | // File revision : $Revision: 1 $
17 | //
18 | // $Id: cpu_detect_x64_win.cpp 1 2009-05-03 23:20:00Z pegasus $
19 | //
20 | ////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // License :
23 | //
24 | // SoundTouch audio processing library
25 | // Copyright (c) Olli Parviainen
26 | //
27 | // This library is free software; you can redistribute it and/or
28 | // modify it under the terms of the GNU Lesser General Public
29 | // License as published by the Free Software Foundation; either
30 | // version 2.1 of the License, or (at your option) any later version.
31 | //
32 | // This library is distributed in the hope that it will be useful,
33 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
34 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 | // Lesser General Public License for more details.
36 | //
37 | // You should have received a copy of the GNU Lesser General Public
38 | // License along with this library; if not, write to the Free Software
39 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 | //
41 | ////////////////////////////////////////////////////////////////////////////////
42 |
43 | #include "cpu_detect.h"
44 |
45 | #ifndef _WIN64
46 | #error wrong platform - this source code file is exclusively for Win64 platform
47 | #endif
48 |
49 | //////////////////////////////////////////////////////////////////////////////
50 | //
51 | // processor instructions extension detection routines
52 | //
53 | //////////////////////////////////////////////////////////////////////////////
54 |
55 | // Flag variable indicating whick ISA extensions are disabled (for debugging)
56 | static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions
57 |
58 |
59 | // Disables given set of instruction extensions. See SUPPORT_... defines.
60 | void disableExtensions(uint dwDisableMask)
61 | {
62 | _dwDisabledISA = dwDisableMask;
63 | }
64 |
65 |
66 |
67 | /// Checks which instruction set extensions are supported by the CPU.
68 | uint detectCPUextensions(void)
69 | {
70 | uint res = 0;
71 |
72 | if (_dwDisabledISA == 0xffffffff) return 0;
73 |
74 | // MSVC doesn't support inline assembly and wants you to use intrinsics instead
75 | // Since I don't know how to do that and just need something working for Mixxx...
76 |
77 | // All 64-bit processors support MMX, SSE, and SSE2
78 | res = SUPPORT_MMX + SUPPORT_SSE + SUPPORT_SSE2;
79 |
80 | #ifdef AMD64
81 | res += SUPPORT_3DNOW;
82 | #endif
83 |
84 | return res & ~_dwDisabledISA;
85 | }
86 |
--------------------------------------------------------------------------------
/module/dRowAudio/network/dRowAudio_CURLManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_CURLMANAGER_H
33 | #define DROWAUDIO_CURLMANAGER_H
34 |
35 | #if DROWAUDIO_USE_CURL || DOXYGEN
36 |
37 | }
38 |
39 | typedef void CURL;
40 |
41 | namespace drow
42 | {
43 |
44 | //==============================================================================
45 | class CURLManager : public juce::TimeSliceThread,
46 | public juce::DeletedAtShutdown
47 | {
48 | public:
49 | //==============================================================================
50 | juce_DeclareSingleton (CURLManager, true);
51 |
52 | CURLManager();
53 |
54 | ~CURLManager();
55 |
56 | //==============================================================================
57 | /** Creates a new easy curl session handle.
58 |
59 | This simply creates the handle for you, it is the caller's responsibility
60 | to clean up when the handle is no longer needed. This can be done with
61 | cleanUpEasyCurlHandle().
62 | */
63 | CURL* createEasyCurlHandle();
64 |
65 | /** Cleans up an easy curl session for you.
66 |
67 | You can pass this a handle generated with createEasyCurlHandle() to clean
68 | up any resources associated with it. Be careful not to use the handle after
69 | calling this function as it will be a nullptr.
70 | */
71 | void cleanUpEasyCurlHandle (CURL* handle);
72 |
73 | /** Returns a list of the supported protocols. */
74 | juce::StringArray getSupportedProtocols();
75 |
76 | private:
77 | //==============================================================================
78 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CURLManager)
79 | };
80 |
81 | #endif //DROWAUDIO_USE_CURL || DOXYGEN
82 | #endif //DROWAUDIO_CURLMANAGER_H
83 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/soundtouch/AAFilter.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | ///
3 | /// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
4 | /// while maintaining the original pitch by using a time domain WSOLA-like method
5 | /// with several performance-increasing tweaks.
6 | ///
7 | /// Anti-alias filter is used to prevent folding of high frequencies when
8 | /// transposing the sample rate with interpolation.
9 | ///
10 | /// Author : Copyright (c) Olli Parviainen
11 | /// Author e-mail : oparviai 'at' iki.fi
12 | /// SoundTouch WWW: http://www.surina.net/soundtouch
13 | ///
14 | ////////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Last changed : $Date: 2008-02-10 16:26:55 +0000 (Sun, 10 Feb 2008) $
17 | // File revision : $Revision: 4 $
18 | //
19 | // $Id: AAFilter.h 11 2008-02-10 16:26:55Z oparviai $
20 | //
21 | ////////////////////////////////////////////////////////////////////////////////
22 | //
23 | // License :
24 | //
25 | // SoundTouch audio processing library
26 | // Copyright (c) Olli Parviainen
27 | //
28 | // This library is free software; you can redistribute it and/or
29 | // modify it under the terms of the GNU Lesser General Public
30 | // License as published by the Free Software Foundation; either
31 | // version 2.1 of the License, or (at your option) any later version.
32 | //
33 | // This library is distributed in the hope that it will be useful,
34 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 | // Lesser General Public License for more details.
37 | //
38 | // You should have received a copy of the GNU Lesser General Public
39 | // License along with this library; if not, write to the Free Software
40 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 | //
42 | ////////////////////////////////////////////////////////////////////////////////
43 |
44 | #ifndef AAFilter_H
45 | #define AAFilter_H
46 |
47 | #include "STTypes.h"
48 |
49 | namespace soundtouch
50 | {
51 |
52 | class AAFilter
53 | {
54 | protected:
55 | class FIRFilter *pFIR;
56 |
57 | /// Low-pass filter cut-off frequency, negative = invalid
58 | double cutoffFreq;
59 |
60 | /// num of filter taps
61 | uint length;
62 |
63 | /// Calculate the FIR coefficients realizing the given cutoff-frequency
64 | void calculateCoeffs();
65 | public:
66 | AAFilter(uint length);
67 |
68 | ~AAFilter();
69 |
70 | /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling
71 | /// frequency (nyquist frequency = 0.5). The filter will cut off the
72 | /// frequencies than that.
73 | void setCutoffFreq(double newCutoffFreq);
74 |
75 | /// Sets number of FIR filter taps, i.e. ~filter complexity
76 | void setLength(uint newLength);
77 |
78 | uint getLength() const;
79 |
80 | /// Applies the filter to the given sequence of samples.
81 | /// Note : The amount of outputted samples is by value of 'filter length'
82 | /// smaller than the amount of input samples.
83 | uint evaluate(SAMPLETYPE *dest,
84 | const SAMPLETYPE *src,
85 | uint numSamples,
86 | uint numChannels) const;
87 | };
88 |
89 | }
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/fftreal/DynArray.hpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 |
3 | DynArray.hpp
4 | By Laurent de Soras
5 |
6 | --- Legal stuff ---
7 |
8 | This program is free software. It comes without any warranty, to
9 | the extent permitted by applicable law. You can redistribute it
10 | and/or modify it under the terms of the Do What The Fuck You Want
11 | To Public License, Version 2, as published by Sam Hocevar. See
12 | http://sam.zoy.org/wtfpl/COPYING for more details.
13 |
14 | *Tab=3***********************************************************************/
15 |
16 |
17 |
18 | #if defined (ffft_DynArray_CURRENT_CODEHEADER)
19 | #error Recursive inclusion of DynArray code header.
20 | #endif
21 | #define ffft_DynArray_CURRENT_CODEHEADER
22 |
23 | #if ! defined (ffft_DynArray_CODEHEADER_INCLUDED)
24 | #define ffft_DynArray_CODEHEADER_INCLUDED
25 |
26 |
27 |
28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 |
30 | #include
31 |
32 |
33 |
34 | namespace ffft
35 | {
36 |
37 |
38 |
39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
40 |
41 |
42 |
43 | template
44 | DynArray ::DynArray ()
45 | : _data_ptr (nullptr)
46 | , _len (0)
47 | {
48 | // Nothing
49 | }
50 |
51 |
52 |
53 | template
54 | DynArray ::DynArray (long size)
55 | : _data_ptr (nullptr)
56 | , _len (0)
57 | {
58 | assert (size >= 0);
59 | if (size > 0)
60 | {
61 | _data_ptr = new DataType [size_t (size)];
62 | _len = size;
63 | }
64 | }
65 |
66 |
67 |
68 | template
69 | DynArray ::~DynArray ()
70 | {
71 | delete [] _data_ptr;
72 | _data_ptr = nullptr;
73 | _len = 0;
74 | }
75 |
76 |
77 |
78 | template
79 | long DynArray ::size () const
80 | {
81 | return (_len);
82 | }
83 |
84 |
85 |
86 | template
87 | void DynArray ::resize (long size)
88 | {
89 | assert (size >= 0);
90 | if (size > 0)
91 | {
92 | DataType * old_data_ptr = _data_ptr;
93 | DataType * tmp_data_ptr = new DataType [size_t (size)];
94 |
95 | _data_ptr = tmp_data_ptr;
96 | _len = size;
97 |
98 | delete [] old_data_ptr;
99 | }
100 | }
101 |
102 |
103 |
104 | template
105 | const typename DynArray ::DataType & DynArray ::operator [] (long pos) const
106 | {
107 | assert (pos >= 0);
108 | assert (pos < _len);
109 |
110 | return (_data_ptr [pos]);
111 | }
112 |
113 |
114 |
115 | template
116 | typename DynArray ::DataType & DynArray ::operator [] (long pos)
117 | {
118 | assert (pos >= 0);
119 | assert (pos < _len);
120 |
121 | return (_data_ptr [pos]);
122 | }
123 |
124 |
125 |
126 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
127 |
128 |
129 |
130 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
131 |
132 |
133 |
134 | } // namespace ffft
135 |
136 |
137 |
138 | #endif // ffft_DynArray_CODEHEADER_INCLUDED
139 |
140 | #undef ffft_DynArray_CURRENT_CODEHEADER
141 |
142 |
143 |
144 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
145 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/fft/dRowAudio_LTAS.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_LTAS_H
33 | #define DROWAUDIO_LTAS_H
34 |
35 | #if DROWAUDIO_USE_FFTREAL || DROWAUDIO_USE_VDSP || defined (DOXYGEN)
36 |
37 | #include "../../maths/dRowAudio_CumulativeMovingAverage.h"
38 |
39 | //==============================================================================
40 | /** Calculates the Long Term Average Spectrum of a set of samples.
41 |
42 | This is a simple LTAS calculator that uses finds the spectrum of a block of
43 | audio samples and then computes the average weights across the number of
44 | FFTs performed.
45 | */
46 | class LTAS
47 | {
48 | public:
49 | /** Creates an LTAS.
50 |
51 | This will use a given FFT size, remember this is the log2 of the FFT size
52 | so 11 will be a 2048 point FFT.
53 |
54 | @see FFTEngine
55 | */
56 | LTAS (int fftSizeLog2);
57 |
58 | //==============================================================================
59 | /** Calculates the LTAS based on a set of samples.
60 |
61 | For this to work the number of samples must be at least as many as the size
62 | of the FFT.
63 | */
64 | void updateLTAS (float* input, int numSamples);
65 |
66 | /** Returns the computed LTAS buffer.
67 |
68 | This can be used to find pitch, tone information etc.
69 |
70 | @see Buffer
71 | */
72 | Buffer& getLTASBuffer() { return ltasBuffer; }
73 |
74 | private:
75 | //==============================================================================
76 | FFTEngine fftEngine;
77 | Buffer ltasBuffer;
78 | const int fftSize, numBins;
79 | juce::HeapBlock tempBuffer;
80 | juce::Array ltasAvg;
81 |
82 | //==============================================================================
83 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LTAS)
84 | };
85 |
86 | #endif
87 | #endif // DROWAUDIO_LTAS_H
88 |
--------------------------------------------------------------------------------
/module/dRowAudio/utility/dRowAudio_ITunesLibrary.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 |
33 |
34 | juce_ImplementSingleton(ITunesLibrary)
35 |
36 | ITunesLibrary::ITunesLibrary()
37 | : libraryTree (MusicColumns::libraryIdentifier)
38 | {
39 | }
40 |
41 | ITunesLibrary::~ITunesLibrary()
42 | {
43 | clearSingletonInstance();
44 | }
45 |
46 | void ITunesLibrary::setLibraryFile (File newFile)
47 | {
48 | if (newFile.existsAsFile())
49 | {
50 | listeners.call (&Listener::libraryChanged, this);
51 | parser = std::make_unique (newFile, libraryTree, parserLock);
52 | startTimer(500);
53 | }
54 | }
55 |
56 | //==============================================================================
57 | const File ITunesLibrary::getDefaultITunesLibraryFile()
58 | {
59 | return juce::File::getSpecialLocation (File::userMusicDirectory).getChildFile ("iTunes/iTunes Music Library.xml");
60 | }
61 |
62 | //==============================================================================
63 | void ITunesLibrary::setLibraryTree (ValueTree& newTreeToUse)
64 | {
65 | if (! newTreeToUse.isValid())
66 | newTreeToUse = juce::ValueTree (MusicColumns::libraryIdentifier);
67 |
68 | libraryTree = newTreeToUse;
69 | }
70 |
71 | void ITunesLibrary::timerCallback()
72 | {
73 | if (parser != nullptr)
74 | {
75 | listeners.call (&Listener::libraryUpdated, this);
76 |
77 | if (parser->hasFinished())
78 | {
79 | stopTimer();
80 | parser = nullptr;
81 | listeners.call (&Listener::libraryFinished, this);
82 | }
83 | }
84 | }
85 |
86 | //==============================================================================
87 | void ITunesLibrary::addListener (ITunesLibrary::Listener* const listener)
88 | {
89 | listeners.add (listener);
90 | }
91 |
92 | void ITunesLibrary::removeListener (ITunesLibrary::Listener* const listener)
93 | {
94 | listeners.remove (listener);
95 | }
96 |
--------------------------------------------------------------------------------
/demo/Source/playback/CurvePoint.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef CURVE_POINT_H
33 | #define CURVE_POINT_H
34 |
35 | #include "../DemoHeader.h"
36 |
37 | class CurvePoint : public juce::Component,
38 | public juce::ComponentDragger
39 | {
40 | public:
41 | CurvePoint() :
42 | mouseIsOver (false)
43 | {
44 | }
45 |
46 | //==============================================================================
47 | void resized() override
48 | {
49 | int halfWidth = getWidth() / 2;
50 | int halfHeight = getHeight() / 2;
51 | constrainer.setMinimumOnscreenAmounts (halfHeight, halfWidth, halfHeight, halfWidth);
52 | }
53 |
54 | void paint (juce::Graphics& g) override
55 | {
56 | g.setColour (juce::Colours::grey);
57 | g.fillAll();
58 |
59 | if (mouseIsOver)
60 | {
61 | g.setColour (juce::Colours::lightgrey);
62 | g.drawRect (0, 0, getWidth(), getHeight(), 2);
63 | }
64 | }
65 |
66 | void mouseDown (const juce::MouseEvent& e) override
67 | {
68 | startDraggingComponent (this, e);
69 | }
70 |
71 | void mouseDrag (const juce::MouseEvent& e) override
72 | {
73 | dragComponent (this, e, &constrainer);
74 | }
75 |
76 | void mouseEnter (const juce::MouseEvent&) override
77 | {
78 | mouseIsOver = true;
79 | repaint();
80 | }
81 |
82 | void mouseExit (const juce::MouseEvent&) override
83 | {
84 | mouseIsOver = false;
85 | repaint();
86 | }
87 |
88 | private:
89 | //==============================================================================
90 | juce::ComponentBoundsConstrainer constrainer;
91 | bool mouseIsOver;
92 |
93 | //==============================================================================
94 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CurvePoint)
95 | };
96 |
97 | #endif //CURVE_POINT_H
98 |
--------------------------------------------------------------------------------
/module/dRowAudio/utility/dRowAudio_LockedPointer.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_LOCKEDPOINTER_H
33 | #define DROWAUDIO_LOCKEDPOINTER_H
34 |
35 | /** Wrapper for a pointer that automatically locks a provided lock whilst the LockedPointer
36 | stays in scope. This is similar using a narrowly scoped ScopedPointer.
37 |
38 | @code
39 | if ((LockedPointer pointer (getObject(), getLock()) != nullptr)
40 | {
41 | // object is now safely locked
42 | pointer->unthreadSafeMethodCall();
43 | }
44 |
45 | // as pointer goes out of scope the lock will be released
46 | @endcode
47 | */
48 | template
49 | class LockedPointer
50 | {
51 | public:
52 | /** Creates a LockedPointer for a given pointer and corresponding lock.
53 |
54 | You can create one of these on the stack to makes sure the provided lock is
55 | locked during all operations on the object provided.
56 | */
57 | LockedPointer (Type* pointer_, LockType& l) :
58 | pointer (pointer_),
59 | lock (l),
60 | scopedLock (l)
61 | {
62 | jassert (pointer != nullptr);
63 | }
64 |
65 | /** Provides access to the objects methods. */
66 | Type* operator->() { return pointer; }
67 |
68 | /** Provides access to the objects methods. */
69 | Type const* operator->() const { return pointer; }
70 |
71 | /** Returns the type of scoped lock to use for locking this pointer. */
72 | typedef typename LockType::ScopedLockType ScopedLockType;
73 |
74 | private:
75 | //==============================================================================
76 | Type* pointer;
77 | LockType& lock;
78 | const ScopedLockType scopedLock;
79 |
80 | //==============================================================================
81 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LockedPointer)
82 | };
83 |
84 | #endif //DROWAUDIO_LOCKEDPOINTER_H
85 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_Clock.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_CLOCK_H
33 | #define DROWAUDIO_CLOCK_H
34 |
35 | /** A handy digital graphical clock.
36 |
37 | Just add one of these to your component and it will display the time,
38 | continually updating itself. Set the look and feel of it as you would
39 | a normal label.
40 | */
41 | class Clock : public juce::Label,
42 | public juce::Timer
43 | {
44 | public:
45 | /** A number of flags to set what sort of clock is displayed */
46 | enum TimeDisplayFormat
47 | {
48 | showDate = 1,
49 | showTime = 2,
50 | showSeconds = 4,
51 | show24Hr = 8,
52 | showDayShort = 16,
53 | showDayLong = 32,
54 | };
55 |
56 | /** Constructor.
57 |
58 | Just add and make visible one of these to your component and it
59 | will display the current time and continually update itself.
60 | */
61 | Clock();
62 |
63 | /** Sets the display format of the clock.
64 |
65 | To specify what sort of clock to display pass in a number of the
66 | TimeDisplayFormat flags. This is semi-inteligent so may choose to
67 | ignore certain flags such as the short day name if you have also
68 | specified the long day name.
69 | */
70 | void setTimeDisplayFormat (const int newFormat);
71 |
72 | /** Returns the width required to display all of the clock's information. */
73 | int getRequiredWidth() const;
74 |
75 | //==============================================================================
76 | /** @internal */
77 | void timerCallback() override;
78 |
79 | private:
80 | //==============================================================================
81 | int displayFormat;
82 | juce::String timeAsString;
83 |
84 | //==============================================================================
85 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Clock)
86 | };
87 |
88 | #endif // DROWAUDIO_CLOCK_H
89 |
--------------------------------------------------------------------------------
/demo/Source/network/ConnectionComponent.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef CONNECTION_COMPONENT_H
33 | #define CONNECTION_COMPONENT_H
34 |
35 | #include "../DemoHeader.h"
36 |
37 | #if DROWAUDIO_USE_CURL
38 |
39 | class ConnectionComponent : public juce::Component,
40 | public juce::Button::Listener
41 | {
42 | public:
43 | ConnectionComponent();
44 |
45 | void setCURLSessionToControl (CURLEasySession* sessionToControl);
46 |
47 | //==============================================================================
48 | /** Used to receive callbacks when a connection is changed. */
49 | class Listener
50 | {
51 | public:
52 | /** Destructor */
53 | virtual ~Listener() {}
54 |
55 | /** Called when the button is clicked. */
56 | virtual void connectionChanged (ConnectionComponent* /*connectionComponent*/) {}
57 | };
58 |
59 | void addListener (Listener* newListener);
60 |
61 | void removeListener (Listener* listener);
62 |
63 | //==============================================================================
64 | /** @internal */
65 | void resized() override;
66 | /** @internal */
67 | void buttonClicked (juce::Button* button) override;
68 |
69 | private:
70 | //==============================================================================
71 | CURLEasySession* curlSession;
72 | juce::ListenerList listeners;
73 |
74 | juce::Label urlLabel, hostnameLabel, usernameLabel, passwordLabel, protocolLabel;
75 | juce::TextEditor urlEditor, hostnameEditor, usernameEditor, passwordEditor;
76 | juce::ComboBox protocolBox;
77 | juce::TextButton connectButton;
78 |
79 | //==============================================================================
80 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConnectionComponent)
81 | };
82 |
83 | #endif //DROWAUDIO_USE_CURL
84 | #endif //CONNECTION_COMPONENT_H
85 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/filebrowser/dRowAudio_ColumnFileBrowser.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_COLUMNFILEBROWSER_H
33 | #define DROWAUDIO_COLUMNFILEBROWSER_H
34 |
35 | #include "dRowAudio_BasicFileBrowser.h"
36 |
37 | class ColumnFileBrowserContents;
38 | class ColumnFileBrowserLookAndFeel;
39 |
40 | //==================================================================================
41 | /** A type of FileBrowser persented in columns.
42 |
43 | This is similar to OSX's Finder column view. You can navigate around the columns
44 | using the keyboard or the mouse. Highligting a number of files and then dragging
45 | them will perform an external drag and drop procedure.
46 | */
47 | class ColumnFileBrowser : public juce::Viewport
48 | {
49 | public:
50 | /** Creates a ColumnFileBrowser with a given file filter.
51 | */
52 | ColumnFileBrowser (juce::WildcardFileFilter* filesToDisplay);
53 |
54 | //==================================================================================
55 | /** Sets the highlight colour for the active column.
56 |
57 | For the rest of the colours, use the normal DirectoryContentsDisplayComponent
58 | colourIds.
59 | */
60 | void setActiveColumHighlightColour (juce::Colour colour);
61 |
62 | //==================================================================================
63 | /** @internal */
64 | void resized() override;
65 | /** @internal */
66 | void visibleAreaChanged (const juce::Rectangle& newVisibleArea) override;
67 | /** @internal */
68 | void mouseWheelMove (const juce::MouseEvent& event, const juce::MouseWheelDetails& wheel) override;
69 |
70 | private:
71 | //==================================================================================
72 | std::unique_ptr wildcard;
73 | std::unique_ptr fileBrowser;
74 |
75 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ColumnFileBrowser)
76 | };
77 |
78 | #endif //DROWAUDIO_COLUMNFILEBROWSER_H
79 |
--------------------------------------------------------------------------------
/module/dRowAudio/audio/dRowAudio_ReversibleAudioSource.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | //==============================================================================
33 | ReversibleAudioSource::ReversibleAudioSource (PositionableAudioSource* const inputSource,
34 | const bool deleteInputWhenDeleted)
35 | : input (inputSource, deleteInputWhenDeleted),
36 | previousReadPosition (0),
37 | isForwards (true)
38 | {
39 | jassert (input != nullptr);
40 | }
41 |
42 | void ReversibleAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
43 | {
44 | input->prepareToPlay (samplesPerBlockExpected, sampleRate);
45 | }
46 |
47 | void ReversibleAudioSource::releaseResources()
48 | {
49 | input->releaseResources();
50 | }
51 |
52 | void ReversibleAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
53 | {
54 | if (isForwards)
55 | {
56 | input->getNextAudioBlock (info);
57 | previousReadPosition = input->getNextReadPosition();
58 | }
59 | else
60 | {
61 | int64 nextReadPosition = previousReadPosition - info.numSamples;
62 |
63 | if (nextReadPosition < 0 && input->isLooping())
64 | nextReadPosition += input->getTotalLength();
65 |
66 | input->setNextReadPosition (nextReadPosition);
67 | input->getNextAudioBlock (info);
68 |
69 | if (info.buffer->getNumChannels() == 1)
70 | {
71 | reverseArray (info.buffer->getWritePointer (0) + info.startSample, info.numSamples);
72 | }
73 | else if (info.buffer->getNumChannels() == 2)
74 | {
75 | reverseTwoArrays (info.buffer->getWritePointer (0) + info.startSample,
76 | info.buffer->getWritePointer (1) + info.startSample,
77 | info.numSamples);
78 | }
79 | else
80 | {
81 | for (int c = 0; c < info.buffer->getNumChannels(); c++)
82 | reverseArray (info.buffer->getWritePointer (c) + info.startSample, info.numSamples);
83 | }
84 |
85 | previousReadPosition = nextReadPosition;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/demo/Source/playback/BufferTransformAudioSource.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #include "BufferTransformAudioSource.h"
33 |
34 | BufferTransformAudioSource::BufferTransformAudioSource (AudioSource* source_,
35 | bool deleteSourceWhenDeleted) :
36 | source (source_, deleteSourceWhenDeleted),
37 | buffer (512)
38 | {
39 | jassert (source_ != nullptr);
40 |
41 | const float xScale = 1.0f / (buffer.getSize() - 1);
42 |
43 | for (size_t i = 0; i < buffer.getSize(); ++i)
44 | buffer.getReference ((int) i) = (float) i * xScale;
45 | }
46 |
47 | void BufferTransformAudioSource::setBypass (bool shouldBypass)
48 | {
49 | isBypassed = shouldBypass;
50 | }
51 |
52 | void BufferTransformAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
53 | {
54 | source->prepareToPlay (samplesPerBlockExpected, sampleRate);
55 | }
56 |
57 | void BufferTransformAudioSource::releaseResources()
58 | {
59 | source->releaseResources();
60 | }
61 |
62 | void BufferTransformAudioSource::getNextAudioBlock (const juce::AudioSourceChannelInfo& info)
63 | {
64 | source->getNextAudioBlock (info);
65 |
66 | if (! isBypassed)
67 | {
68 | const int bufferSize = (int) buffer.getSize() - 1;
69 | float** channelData = (float**) info.buffer->getArrayOfWritePointers();
70 |
71 | for (int c = 0; c < info.buffer->getNumChannels(); ++c)
72 | {
73 | for (int s = 0; s < info.numSamples; ++s)
74 | {
75 | float sample = channelData[c][s];
76 |
77 | if (sample < 0.0f && sample >= -1.0f)
78 | {
79 | sample *= -1.0f;
80 | sample = linearInterpolate (buffer.getData(), bufferSize, sample * bufferSize);
81 | sample *= -1.0f;
82 | }
83 | else if (sample >= 0.0f && sample <= 1.0f)
84 | {
85 | sample = linearInterpolate (buffer.getData(), bufferSize, sample * bufferSize);
86 | }
87 |
88 | channelData[c][s] = sample;
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/module/dRowAudio/utility/dRowAudio_ITunesLibraryParser.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef DROWAUDIO_ITUNESLIBRARYPARSER_H
33 | #define DROWAUDIO_ITUNESLIBRARYPARSER_H
34 |
35 | #include "dRowAudio_Utility.h"
36 |
37 | /** Parses an iTunes Xml library into a ValueTree using a background thread.
38 |
39 | If the tree passed in already contains a generated library this will merge
40 | any new data from the file into it preserving any sub-trees or attributes
41 | that may have been added.
42 |
43 | You shouldn't need to use this directly, use the higher-level iTunesLibrary
44 | instead.
45 | */
46 | class ITunesLibraryParser : public juce::Thread
47 | {
48 | public:
49 | /** Creates a parser with a given valid library file and a ValueTree with which
50 | to put the parsed data.
51 | */
52 | ITunesLibraryParser (const juce::File& iTunesLibraryFileToUse,
53 | const juce::ValueTree& elementToFill,
54 | const juce::CriticalSection& lockToUse);
55 |
56 | /** Destructor. */
57 | ~ITunesLibraryParser() override;
58 |
59 | //==============================================================================
60 | /** Returns true if the parser has finished. */
61 | bool hasFinished() const { return finished; }
62 |
63 | /** Returns the lock being used. */
64 | const juce::CriticalSection& getLock() const { return lock; }
65 |
66 | //==============================================================================
67 | /** @internal */
68 | void run() override;
69 |
70 | private:
71 | //==============================================================================
72 | const juce::CriticalSection& lock;
73 |
74 | const juce::File iTunesLibraryFile;
75 | juce::ValueTree treeToFill, partialTree;
76 | std::unique_ptr iTunesDatabase;
77 | juce::XmlElement *iTunesLibraryTracks, *currentElement;
78 |
79 | int numAdded;
80 | bool finished;
81 |
82 | //==============================================================================
83 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ITunesLibraryParser)
84 | };
85 |
86 | #endif // DROWAUDIO_ITUNESLIBRARYPARSER_H
87 |
--------------------------------------------------------------------------------
/demo/Source/playback/AudioPlaybackDemo.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #ifndef AUDIO_PLAYBACK_DEMO_H
33 | #define AUDIO_PLAYBACK_DEMO_H
34 |
35 | #include "LoopComponent.h"
36 | #include "DistortionDemo.h"
37 | #include "BufferTransformAudioSource.h"
38 |
39 | class AudioPlaybackDemo : public juce::Component,
40 | public juce::Slider::Listener
41 | {
42 | public:
43 | AudioPlaybackDemo (AudioFilePlayerExt& audioFilePlayer,
44 | BufferTransformAudioSource& bufferTransformAudioSource);
45 |
46 | //==============================================================================
47 | void resized() override;
48 | void paint (juce::Graphics& g) override;
49 | void sliderValueChanged (juce::Slider* slider) override;
50 |
51 | private:
52 | //==============================================================================
53 | enum PlayerControls
54 | {
55 | lowEQ,
56 | midEQ,
57 | highEQ,
58 | rate,
59 | tempo,
60 | pitch,
61 | numControls
62 | };
63 |
64 | AudioFilePlayerExt& audioFilePlayer;
65 |
66 | LoopComponent loopComponent;
67 |
68 | juce::GroupComponent filterGroup, rateGroup;
69 | juce::Slider resolutionSlider, zoomSlider;
70 | juce::Label resolutionLabel, zoomLabel;
71 |
72 | juce::OwnedArray playerControls;
73 | juce::OwnedArray playerControlLabels;
74 |
75 | juce::TimeSliceThread backgroundThread;
76 | juce::AudioThumbnailCache audioThumbnailCache;
77 | #if JUCE_MAC
78 | ColouredAudioThumbnail audioThumbnail;
79 | #else
80 | AudioThumbnail audioThumbnail;
81 | #endif
82 | std::unique_ptr audioThumbnailImage;
83 | std::unique_ptr positionableWaveDisplay;
84 | std::unique_ptr draggableWaveDisplay;
85 |
86 | DistortionDemo distortionDemo;
87 |
88 | friend class LoopComponent;
89 |
90 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPlaybackDemo)
91 | };
92 |
93 | #endif //AUDIO_PLAYBACK_DEMO_H
94 |
--------------------------------------------------------------------------------
/demo/Source/DemoLookAndFeel.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | #include "DemoLookAndFeel.h"
33 |
34 | DemoLookAndFeel::DemoLookAndFeel()
35 | {
36 | }
37 |
38 | void DemoLookAndFeel::drawButtonBackground (juce::Graphics& g,
39 | juce::Button& button,
40 | const juce::Colour& backgroundColour,
41 | bool isMouseOverButton,
42 | bool isButtonDown)
43 | {
44 | const int width = button.getWidth();
45 | const int height = button.getHeight();
46 |
47 | const juce::Colour baseColour (GuiHelpers::createBaseColour (backgroundColour,
48 | button.hasKeyboardFocus (true),
49 | isMouseOverButton, isButtonDown)
50 | .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));
51 |
52 | juce::ColourGradient cg (baseColour.brighter (0.5f), 0.0f, 0.0f,
53 | baseColour.darker (0.5f), 0.0f, (float)height,
54 | false);
55 |
56 | juce::Rectangle bounds (g.getClipBounds().toFloat().reduced (0.0f, 1.0f));
57 | g.setGradientFill (cg);
58 | g.fillRoundedRectangle (bounds, 4.0f);
59 |
60 | bounds.setX (bounds.getX() + 0.5f);
61 | bounds.setWidth (bounds.getWidth() - 1.0f);
62 | bounds.setY (bounds.getY() - 0.5f);
63 | bounds.setHeight (bounds.getHeight());
64 |
65 | g.setColour (juce::Colours::black);
66 | g.drawRoundedRectangle (bounds, 4.0f, 1.0f);
67 |
68 | juce::ColourGradient highlight (juce::Colours::white.withAlpha (0.1f), 2.0f, (float)height,
69 | juce::Colours::white.withAlpha (0.1f), width - 2.0f, (float)height,
70 | false);
71 | highlight.addColour (2.0f / (width - 4.0f),
72 | juce::Colours::white.withAlpha (0.5f));
73 | highlight.addColour (1.0f - (2.0f / (width - 4.0f)),
74 | juce::Colours::white.withAlpha (0.5f));
75 | g.setGradientFill (highlight);
76 | g.drawLine (2.0f, height - 0.5f, width - 2.0f, height - 0.5f, 0.5f);
77 | }
78 |
--------------------------------------------------------------------------------
/module/dRowAudio/gui/dRowAudio_GraphicalComponent.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file is part of the dRowAudio JUCE module
5 | Copyright 2004-13 by dRowAudio.
6 |
7 | ------------------------------------------------------------------------------
8 |
9 | dRowAudio is provided under the terms of The MIT License (MIT):
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy
12 | of this software and associated documentation files (the "Software"), to deal
13 | in the Software without restriction, including without limitation the rights
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | copies of the Software, and to permit persons to whom the Software is
16 | furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | SOFTWARE.
28 |
29 | ==============================================================================
30 | */
31 |
32 | GraphicalComponent::GraphicalComponent()
33 | : paused (false),
34 | needToProcess (true),
35 | sleepTime (5),
36 | numSamples (0)
37 | {
38 | samples.malloc (numSamples);
39 |
40 | startTimer (30);
41 | }
42 |
43 | int GraphicalComponent::useTimeSlice()
44 | {
45 | if (paused)
46 | {
47 | return sleepTime;
48 | }
49 |
50 | if (needToProcess)
51 | {
52 | process();
53 | needToProcess = false;
54 |
55 | return sleepTime;
56 | }
57 |
58 | return sleepTime;
59 | }
60 |
61 | void GraphicalComponent::copySamples (const float *values, int numSamples_)
62 | {
63 | // allocate new memory only if needed
64 | if (numSamples != numSamples_)
65 | {
66 | numSamples = numSamples_;
67 | samples.malloc (numSamples);
68 | }
69 |
70 | // lock whilst copying
71 | ScopedLock sl (lock);
72 | std::memcpy (samples, values, size_t (numSamples) * sizeof (float));
73 |
74 | needToProcess = true;
75 | }
76 |
77 | void GraphicalComponent::copySamples (float **values, int numSamples_, int numChannels)
78 | {
79 | // allocate new memory only if needed
80 | if (numSamples != numSamples_)
81 | {
82 | numSamples = numSamples_;
83 | samples.malloc (numSamples);
84 | }
85 |
86 | // lock whilst copying
87 | ScopedLock sl (lock);
88 |
89 | if (numChannels == 1)
90 | {
91 | std::memcpy (samples, values[0], size_t (numSamples) * sizeof (float));
92 | }
93 | else if (numChannels == 2)
94 | { //This is quicker than the generic method below
95 | for (int i = 0; i < numSamples; ++i)
96 | samples[i] = (std::abs (values[0][i]) > std::abs (values[1][i])) ? values[0][i] : values[1][i];
97 | }
98 | else
99 | {
100 | samples.clear (numSamples);
101 |
102 | for (int c = 0; c < numChannels; ++c)
103 | for (int i = 0; i < numSamples; ++i)
104 | if (std::abs (values[c][i]) > samples[i])
105 | samples[i] = values[c][i];
106 | }
107 |
108 | needToProcess = true;
109 | }
110 |
--------------------------------------------------------------------------------