70 lines
1.6 KiB
C++
70 lines
1.6 KiB
C++
/**
|
|
This file is a part of our_dick
|
|
Copyright (C) 2020 rexy712
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef OUR_DICK_AUDIO_MIXDATA_HPP
|
|
#define OUR_DICK_AUDIO_MIXDATA_HPP
|
|
|
|
#include <cstdlib> //size_t
|
|
|
|
namespace audio{
|
|
|
|
struct mixdata {
|
|
float* data = nullptr;
|
|
size_t frames = 0;
|
|
size_t channels = 0;
|
|
size_t samplerate = 0;
|
|
float volume = 1;
|
|
bool allocated = true;
|
|
};
|
|
|
|
class mixchunk
|
|
{
|
|
private:
|
|
mixdata m_data;
|
|
|
|
public:
|
|
constexpr mixchunk() = default;
|
|
mixchunk(size_t frames, size_t channels, size_t samplerate);
|
|
mixchunk(const mixdata&);
|
|
mixchunk(mixdata&&);
|
|
mixchunk(const mixchunk&);
|
|
mixchunk(mixchunk&&);
|
|
~mixchunk();
|
|
|
|
mixchunk& operator=(const mixchunk&);
|
|
mixchunk& operator=(mixchunk&&);
|
|
|
|
const float* data()const;
|
|
float* data();
|
|
|
|
size_t floats()const;
|
|
size_t frames()const;
|
|
size_t channels()const;
|
|
size_t samplerate()const;
|
|
float volume()const;
|
|
|
|
void set_samplerate(size_t s);
|
|
void set_volume(float v);
|
|
|
|
const mixdata& raw()const;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|