OpenShot Library | libopenshot-audio  0.2.0
juce_MemoryAudioSource.h
1 
2 /** @weakgroup juce_audio_basics-sources
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  The code included in this file is provided under the terms of the ISC license
15  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16  To use, copy, modify, and/or distribute this software for any purpose with or
17  without fee is hereby granted provided that the above copyright notice and
18  this permission notice appear in all copies.
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 //==============================================================================
31 /**
32  An AudioSource which takes some float audio data as an input.
33 
34  @tags{Audio}
35 */
37 {
38 public:
39  //==============================================================================
40  /** Creates a MemoryAudioSource by providing an audio buffer.
41 
42  If copyMemory is true then the buffer will be copied into an internal
43  buffer which will be owned by the MemoryAudioSource. If copyMemory is
44  false, then you must ensure that the lifetime of the audio buffer is
45  at least as long as the MemoryAudioSource.
46  */
47  MemoryAudioSource (AudioBuffer<float>& audioBuffer, bool copyMemory, bool shouldLoop = false);
48 
49  //==============================================================================
50  /** Implementation of the AudioSource method. */
51  void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
52 
53  /** Implementation of the AudioSource method. */
54  void releaseResources() override;
55 
56  /** Implementation of the AudioSource method. */
57  void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override;
58 
59 private:
60  //==============================================================================
61  AudioBuffer<float> buffer;
62  int position = 0;
63  bool isLooping;
64 
65  //==============================================================================
66  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryAudioSource)
67 };
68 
69 } // namespace juce
70 
71 /** @}*/
juce::MemoryAudioSource
An AudioSource which takes some float audio data as an input.
Definition: juce_MemoryAudioSource.h:36
juce::AudioSource
Base class for objects that can produce a continuous stream of audio.
Definition: juce_AudioSource.h:113
juce::AudioBuffer< float >
JUCE_API
#define JUCE_API
This macro is added to all JUCE public class declarations.
Definition: juce_StandardHeader.h:143
juce::AudioSourceChannelInfo
Used by AudioSource::getNextAudioBlock().
Definition: juce_AudioSource.h:36