| 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 void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFr
ames) final; | 49 void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFr
ames) final; |
| 50 | 50 |
| 51 size_t currentSampleFrame() const { return acquireLoad(&m_currentSampleFrame
); } | 51 size_t currentSampleFrame() const { return acquireLoad(&m_currentSampleFrame
); } |
| 52 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } | 52 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } |
| 53 | 53 |
| 54 virtual unsigned long maxChannelCount() const { return 0; } | 54 virtual unsigned long maxChannelCount() const { return 0; } |
| 55 | 55 |
| 56 virtual void startRendering() = 0; | 56 virtual void startRendering() = 0; |
| 57 virtual void stopRendering() = 0; | 57 virtual void stopRendering() = 0; |
| 58 | 58 |
| 59 unsigned numberOfConnections() const; |
| 60 |
| 59 protected: | 61 protected: |
| 60 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for lo
cal/live audio input. | 62 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for lo
cal/live audio input. |
| 61 // If there is local/live audio input, we call set() with the audio input da
ta every render quantum. | 63 // If there is local/live audio input, we call set() with the audio input da
ta every render quantum. |
| 62 class LocalAudioInputProvider final : public AudioSourceProvider { | 64 class LocalAudioInputProvider final : public AudioSourceProvider { |
| 63 public: | 65 public: |
| 64 LocalAudioInputProvider() | 66 LocalAudioInputProvider() |
| 65 : m_sourceBus(AudioBus::create(2, ProcessingSizeInFrames)) // FIXME:
handle non-stereo local input. | 67 : m_sourceBus(AudioBus::create(2, ProcessingSizeInFrames)) // FIXME:
handle non-stereo local input. |
| 66 { | 68 { |
| 67 } | 69 } |
| 68 | 70 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 destinationBus->copyFrom(*m_sourceBus); | 83 destinationBus->copyFrom(*m_sourceBus); |
| 82 } | 84 } |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 RefPtr<AudioBus> m_sourceBus; | 87 RefPtr<AudioBus> m_sourceBus; |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 // Counts the number of sample-frames processed by the destination. | 90 // Counts the number of sample-frames processed by the destination. |
| 89 size_t m_currentSampleFrame; | 91 size_t m_currentSampleFrame; |
| 90 | 92 |
| 93 // Represents the number of incoming connections toward this destination |
| 94 // node. It is updated every render quantum atomically, and it proxies |
| 95 // the connection count for the rendering operation used in |
| 96 // AudioSummingJuntion. |
| 97 unsigned m_numberOfConnections; |
| 98 |
| 91 LocalAudioInputProvider m_localAudioInputProvider; | 99 LocalAudioInputProvider m_localAudioInputProvider; |
| 92 }; | 100 }; |
| 93 | 101 |
| 94 class AudioDestinationNode : public AudioNode { | 102 class AudioDestinationNode : public AudioNode { |
| 95 DEFINE_WRAPPERTYPEINFO(); | 103 DEFINE_WRAPPERTYPEINFO(); |
| 96 public: | 104 public: |
| 97 AudioDestinationHandler& audioDestinationHandler() const; | 105 AudioDestinationHandler& audioDestinationHandler() const; |
| 98 | 106 |
| 99 unsigned long maxChannelCount() const; | 107 unsigned long maxChannelCount() const; |
| 100 | 108 |
| 109 bool hasConnection() const; |
| 110 |
| 101 protected: | 111 protected: |
| 102 AudioDestinationNode(BaseAudioContext&); | 112 AudioDestinationNode(BaseAudioContext&); |
| 103 }; | 113 }; |
| 104 | 114 |
| 105 } // namespace blink | 115 } // namespace blink |
| 106 | 116 |
| 107 #endif // AudioDestinationNode_h | 117 #endif // AudioDestinationNode_h |
| OLD | NEW |