File: Bus.h

package info (click to toggle)
pd-vstplugin 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,008 kB
  • sloc: cpp: 22,794; lisp: 2,860; makefile: 37; sh: 26
file content (44 lines) | stat: -rw-r--r-- 941 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include "Interface.h"

namespace vst {

struct Bus : AudioBus {
    Bus() {
        numChannels = 0;
        channelData32 = nullptr;
    }
    Bus(int n) {
        numChannels = n;
        if (n > 0){
            channelData32 = new float *[n];
        } else {
            channelData32 = nullptr;
        }
    }
    ~Bus(){
        if (channelData32){
            delete[] (float **)channelData32;
        }
    }

    Bus(const Bus&) = delete;
    Bus& operator=(const Bus&) = delete;

    Bus(Bus&& other) noexcept  {
        numChannels = other.numChannels;
        channelData32 = other.channelData32;
        other.numChannels = 0;
        other.channelData32 = nullptr;
    }
    Bus& operator=(Bus&& other) noexcept {
        numChannels = other.numChannels;
        channelData32 = other.channelData32;
        other.numChannels = 0;
        other.channelData32 = nullptr;
        return *this;
    }
};

} // vst