| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #define AudioChannel_h | 30 #define AudioChannel_h |
| 31 | 31 |
| 32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
| 33 #include "platform/audio/AudioArray.h" | 33 #include "platform/audio/AudioArray.h" |
| 34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
| 35 #include "wtf/PtrUtil.h" | 35 #include "wtf/PtrUtil.h" |
| 36 #include <memory> | 36 #include <memory> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 // An AudioChannel represents a buffer of non-interleaved floating-point audio s
amples. | 40 // An AudioChannel represents a buffer of non-interleaved floating-point audio |
| 41 // samples. |
| 41 // The PCM samples are normally assumed to be in a nominal range -1.0 -> +1.0 | 42 // The PCM samples are normally assumed to be in a nominal range -1.0 -> +1.0 |
| 42 class PLATFORM_EXPORT AudioChannel { | 43 class PLATFORM_EXPORT AudioChannel { |
| 43 USING_FAST_MALLOC(AudioChannel); | 44 USING_FAST_MALLOC(AudioChannel); |
| 44 WTF_MAKE_NONCOPYABLE(AudioChannel); | 45 WTF_MAKE_NONCOPYABLE(AudioChannel); |
| 45 | 46 |
| 46 public: | 47 public: |
| 47 // Memory can be externally referenced, or can be internally allocated with an
AudioFloatArray. | 48 // Memory can be externally referenced, or can be internally allocated with an |
| 49 // AudioFloatArray. |
| 48 | 50 |
| 49 // Reference an external buffer. | 51 // Reference an external buffer. |
| 50 AudioChannel(float* storage, size_t length) | 52 AudioChannel(float* storage, size_t length) |
| 51 : m_length(length), m_rawPointer(storage), m_silent(false) {} | 53 : m_length(length), m_rawPointer(storage), m_silent(false) {} |
| 52 | 54 |
| 53 // Manage storage for us. | 55 // Manage storage for us. |
| 54 explicit AudioChannel(size_t length) | 56 explicit AudioChannel(size_t length) |
| 55 : m_length(length), m_rawPointer(nullptr), m_silent(true) { | 57 : m_length(length), m_rawPointer(nullptr), m_silent(true) { |
| 56 m_memBuffer = wrapUnique(new AudioFloatArray(length)); | 58 m_memBuffer = wrapUnique(new AudioFloatArray(length)); |
| 57 } | 59 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 size_t m_length; | 126 size_t m_length; |
| 125 | 127 |
| 126 float* m_rawPointer; | 128 float* m_rawPointer; |
| 127 std::unique_ptr<AudioFloatArray> m_memBuffer; | 129 std::unique_ptr<AudioFloatArray> m_memBuffer; |
| 128 bool m_silent; | 130 bool m_silent; |
| 129 }; | 131 }; |
| 130 | 132 |
| 131 } // namespace blink | 133 } // namespace blink |
| 132 | 134 |
| 133 #endif // AudioChannel_h | 135 #endif // AudioChannel_h |
| OLD | NEW |