Improve audio and midi support.
This commit is contained in:
parent
9bcc0ae88e
commit
8b5f485d1e
47 changed files with 1446 additions and 634 deletions
47
src/audio/AudioSample.cpp
Normal file
47
src/audio/AudioSample.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "AudioSample.h"
|
||||
|
||||
AudioSample::AudioSample()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioSample> AudioSample::Create()
|
||||
{
|
||||
return std::make_unique<AudioSample>();
|
||||
}
|
||||
|
||||
std::size_t AudioSample::GetNumChannels() const
|
||||
{
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
unsigned AudioSample::GetSampleRate() const
|
||||
{
|
||||
return mSampleRate;
|
||||
}
|
||||
|
||||
unsigned AudioSample::GetBitDepth() const
|
||||
{
|
||||
return mBitDepth;
|
||||
}
|
||||
|
||||
void AudioSample::SetChannelData(const std::vector<short>& data, std::size_t channel)
|
||||
{
|
||||
if (mData.size() == channel)
|
||||
{
|
||||
mData.push_back(data);
|
||||
}
|
||||
else if(mData.size() > channel)
|
||||
{
|
||||
mData[channel] = data;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<short> AudioSample::GetChannelData(std::size_t channel) const
|
||||
{
|
||||
if(mData.size() > channel)
|
||||
{
|
||||
return mData[channel];
|
||||
}
|
||||
return std::vector<short>();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue