mirror of
https://github.com/AxioDL/boo.git
synced 2025-06-20 05:23:34 +00:00
Add API for reporting submix sample rate and format
This commit is contained in:
parent
4a74a0ad7c
commit
89b0fa5cd6
@ -12,6 +12,13 @@ class IAudioVoiceCallback;
|
|||||||
struct ChannelMap;
|
struct ChannelMap;
|
||||||
struct IAudioSubmixCallback;
|
struct IAudioSubmixCallback;
|
||||||
|
|
||||||
|
enum class SubmixFormat
|
||||||
|
{
|
||||||
|
Int16,
|
||||||
|
Int32,
|
||||||
|
Float
|
||||||
|
};
|
||||||
|
|
||||||
struct IAudioSubmix
|
struct IAudioSubmix
|
||||||
{
|
{
|
||||||
virtual ~IAudioSubmix() = default;
|
virtual ~IAudioSubmix() = default;
|
||||||
@ -31,6 +38,12 @@ struct IAudioSubmix
|
|||||||
|
|
||||||
/** Sets gain factors for each channel once accumulated by the submix */
|
/** Sets gain factors for each channel once accumulated by the submix */
|
||||||
virtual void setChannelGains(const float gains[8])=0;
|
virtual void setChannelGains(const float gains[8])=0;
|
||||||
|
|
||||||
|
/** Gets fixed sample rate of submix this way */
|
||||||
|
virtual double getSampleRate() const=0;
|
||||||
|
|
||||||
|
/** Gets fixed sample format of submix this way */
|
||||||
|
virtual SubmixFormat getSampleFormat() const=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IAudioSubmixCallback
|
struct IAudioSubmixCallback
|
||||||
|
@ -178,4 +178,23 @@ const AudioVoiceEngineMixInfo& AudioSubmix::mixInfo() const
|
|||||||
return m_parent.mixInfo();
|
return m_parent.mixInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double AudioSubmix::getSampleRate() const
|
||||||
|
{
|
||||||
|
return mixInfo().m_sampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubmixFormat AudioSubmix::getSampleFormat() const
|
||||||
|
{
|
||||||
|
switch (mixInfo().m_sampleFormat)
|
||||||
|
{
|
||||||
|
case SOXR_INT16_I:
|
||||||
|
default:
|
||||||
|
return SubmixFormat::Int16;
|
||||||
|
case SOXR_INT32_I:
|
||||||
|
return SubmixFormat::Int32;
|
||||||
|
case SOXR_FLOAT32_I:
|
||||||
|
return SubmixFormat::Float;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,11 @@ public:
|
|||||||
bool dynamicPitch=false);
|
bool dynamicPitch=false);
|
||||||
|
|
||||||
std::unique_ptr<IAudioSubmix> allocateNewSubmix(IAudioSubmixCallback* cb=nullptr);
|
std::unique_ptr<IAudioSubmix> allocateNewSubmix(IAudioSubmixCallback* cb=nullptr);
|
||||||
|
|
||||||
void setChannelGains(const float gains[8]);
|
void setChannelGains(const float gains[8]);
|
||||||
|
|
||||||
void unbindSubmix();
|
void unbindSubmix();
|
||||||
|
|
||||||
const AudioVoiceEngineMixInfo& mixInfo() const;
|
const AudioVoiceEngineMixInfo& mixInfo() const;
|
||||||
|
double getSampleRate() const;
|
||||||
|
SubmixFormat getSampleFormat() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user