| 1 | /* |
| 2 | * Copyright (C) 2015, Mike Walters <[email protected]> |
| 3 | * |
| 4 | * This file is part of inspectrum. |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include <QMutexLocker> |
| 21 | #include <string.h> |
| 22 | #include "samplebuffer.h"cxx . . $ `<file>/src/samplebuffer.h`/ |
| 23 | |
| 24 | template <typename Tin, typename Tout> |
| 25 | SampleBuffercxx . . $ SampleBuffer#<Tin, Tout>::SampleBuffercxx . . $ SampleBuffer#`SampleBuffer<Tin, Tout>`(e56b1ac432f4bb17).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<SampleSourcecxx . . $ SampleSource#<Tin>> src) : srccxx . . $ SampleBuffer#src.(src) |
| 26 | { |
| 27 | src->subscribe(this); |
| 28 | } |
| 29 | |
| 30 | template <typename Tin, typename Tout> |
| 31 | SampleBuffercxx . . $ SampleBuffer#<Tin, Tout>::~cxx . . $ SampleBuffer#`~SampleBuffer<Tin, Tout>`(49f6e7a06ebc5aa8).SampleBuffer() |
| 32 | { |
| 33 | srccxx . . $ SampleBuffer#src.->unsubscribe(this); |
| 34 | } |
| 35 | |
| 36 | template <typename Tin, typename Tout> |
| 37 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<Tout[]> SampleBuffercxx . . $ SampleBuffer#<Tin, Tout>::getSamplescxx . . $ SampleBuffer#getSamples(a5b25bfb67e8cd12).(size_t start, size_t length) |
| 38 | { |
| 39 | // TODO: base this on the actual history required |
| 40 | auto history = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(start, (size_t)256); |
| 41 | auto samples = srccxx . . $ SampleBuffer#src.->getSamples(start - history, length + history); |
| 42 | if (samples ==cxx . . $ `operator==`(8f8a8e6a6f1fc74b). nullptr) |
| 43 | return nullptr; |
| 44 | |
| 45 | auto temp = stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<Tout[]>(history + length); |
| 46 | auto dest = stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<Tout[]>(length); |
| 47 | QMutexLockercxx . . $ QMutexLocker# mlcxx . . $ QMutexLocker#QMutexLocker(7f4403e141ba7eba).(&mutexcxx . . $ SampleBuffer#mutex.); |
| 48 | workcxx . . $ SampleBuffer#work(cf607f79dc20ecb0).(samples.get(), temp.get(), history + length, start); |
| 49 | memcpy(dest.get(), temp.get() +cxx . . $ operator+(f3789794639247d3). history, length * sizeof(Tout)); |
| 50 | return dest; |
| 51 | } |
| 52 | |
| 53 | template <typename Tin, typename Tout> |
| 54 | void SampleBuffercxx . . $ SampleBuffer#<Tin, Tout>::invalidateEventcxx . . $ SampleBuffer#invalidateEvent(49f6e7a06ebc5aa8).() |
| 55 | { |
| 56 | SampleSourcecxx . . $ SampleSource#<Tout>::invalidate(); |
| 57 | } |
| 58 | |
| 59 | template class SampleBuffercxx . . $ SampleBuffer#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>; |
| 60 | template class SampleBuffercxx . . $ SampleBuffer#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>, float>; |
| 61 | template class SampleBuffercxx . . $ SampleBuffer#<float, float>; |