| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // The audio hardware calls render() to get the next render quantum of audio
into destinationBus. | 49 // The audio hardware calls render() to get the next render quantum of audio
into destinationBus. |
| 50 // It will optionally give us local/live audio input in sourceBus (if it's n
ot 0). | 50 // It will optionally give us local/live audio input in sourceBus (if it's n
ot 0). |
| 51 virtual void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t nu
mberOfFrames) override final; | 51 virtual void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t nu
mberOfFrames) override final; |
| 52 | 52 |
| 53 size_t currentSampleFrame() const { return m_currentSampleFrame; } | 53 size_t currentSampleFrame() const { return m_currentSampleFrame; } |
| 54 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } | 54 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } |
| 55 | 55 |
| 56 virtual unsigned long maxChannelCount() const { return 0; } | 56 virtual unsigned long maxChannelCount() const { return 0; } |
| 57 | 57 |
| 58 virtual void startRendering() = 0; | 58 virtual void startRendering() = 0; |
| 59 virtual void stopRendering() = 0; | |
| 60 | 59 |
| 61 protected: | 60 protected: |
| 62 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for lo
cal/live audio input. | 61 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for lo
cal/live audio input. |
| 63 // If there is local/live audio input, we call set() with the audio input da
ta every render quantum. | 62 // If there is local/live audio input, we call set() with the audio input da
ta every render quantum. |
| 64 class LocalAudioInputProvider final : public AudioSourceProvider { | 63 class LocalAudioInputProvider final : public AudioSourceProvider { |
| 65 public: | 64 public: |
| 66 LocalAudioInputProvider() | 65 LocalAudioInputProvider() |
| 67 : m_sourceBus(AudioBus::create(2, AudioNode::ProcessingSizeInFrames)
) // FIXME: handle non-stereo local input. | 66 : m_sourceBus(AudioBus::create(2, AudioNode::ProcessingSizeInFrames)
) // FIXME: handle non-stereo local input. |
| 68 { | 67 { |
| 69 } | 68 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 92 | 91 |
| 93 // Counts the number of sample-frames processed by the destination. | 92 // Counts the number of sample-frames processed by the destination. |
| 94 size_t m_currentSampleFrame; | 93 size_t m_currentSampleFrame; |
| 95 | 94 |
| 96 LocalAudioInputProvider m_localAudioInputProvider; | 95 LocalAudioInputProvider m_localAudioInputProvider; |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 } // namespace blink | 98 } // namespace blink |
| 100 | 99 |
| 101 #endif // AudioDestinationNode_h | 100 #endif // AudioDestinationNode_h |
| OLD | NEW |