27 #include <libvisual/lv_buffer.h>
34 #define VISUAL_AUDIO_CHANNEL_LEFT "left"
35 #define VISUAL_AUDIO_CHANNEL_RIGHT "right"
38 VISUAL_AUDIO_SAMPLE_RATE_NONE = 0,
39 VISUAL_AUDIO_SAMPLE_RATE_8000,
40 VISUAL_AUDIO_SAMPLE_RATE_11250,
41 VISUAL_AUDIO_SAMPLE_RATE_22500,
42 VISUAL_AUDIO_SAMPLE_RATE_32000,
43 VISUAL_AUDIO_SAMPLE_RATE_44100,
44 VISUAL_AUDIO_SAMPLE_RATE_48000,
45 VISUAL_AUDIO_SAMPLE_RATE_96000,
46 VISUAL_AUDIO_SAMPLE_RATE_LAST
47 } VisAudioSampleRateType;
50 VISUAL_AUDIO_SAMPLE_FORMAT_NONE = 0,
51 VISUAL_AUDIO_SAMPLE_FORMAT_U8,
52 VISUAL_AUDIO_SAMPLE_FORMAT_S8,
53 VISUAL_AUDIO_SAMPLE_FORMAT_U16,
54 VISUAL_AUDIO_SAMPLE_FORMAT_S16,
55 VISUAL_AUDIO_SAMPLE_FORMAT_U32,
56 VISUAL_AUDIO_SAMPLE_FORMAT_S32,
57 VISUAL_AUDIO_SAMPLE_FORMAT_FLOAT,
58 VISUAL_AUDIO_SAMPLE_FORMAT_LAST
59 } VisAudioSampleFormatType;
62 VISUAL_AUDIO_SAMPLE_CHANNEL_NONE = 0,
63 VISUAL_AUDIO_SAMPLE_CHANNEL_STEREO
64 } VisAudioSampleChannelType;
117 bool get_sample (
BufferPtr const& buffer, std::string
const& channel_name);
128 void get_sample_mixed_simple (
BufferPtr const& buffer,
unsigned int channels, ...);
130 void get_sample_mixed_simple (
BufferPtr const& buffer,
unsigned int channels, va_list args);
142 void get_sample_mixed (
BufferPtr const& buffer,
bool divide,
unsigned int channels, ...);
144 void get_sample_mixed (
BufferPtr const& buffer,
bool divide,
unsigned int channels, va_list args);
156 void get_spectrum (
BufferPtr const& buffer, std::size_t sample_count, std::string
const& channel_name,
bool normalised);
158 void get_spectrum (
BufferPtr const& buffer, std::size_t sample_count, std::string
const& channel_name,
bool normalised,
float multiplier);
171 static void get_spectrum_for_sample (
BufferPtr const& buffer,
BufferConstPtr const& samples,
bool normalised,
float multiplier);
173 static void normalise_spectrum (
BufferPtr const& buffer);
184 VisAudioSampleRateType rate,
185 VisAudioSampleFormatType format,
186 VisAudioSampleChannelType channel_type);
197 VisAudioSampleRateType rate,
198 VisAudioSampleFormatType format,
199 std::string
const& channel_name);
205 std::unique_ptr<Impl> m_impl;
221 LV_API
VisAudio *visual_audio_new (
void);
222 LV_API
void visual_audio_free (
VisAudio *audio);
224 LV_API
int visual_audio_get_sample (
VisAudio *audio,
VisBuffer *buffer,
const char *channelid);
225 LV_API
void visual_audio_get_sample_mixed_simple (
VisAudio *audio,
VisBuffer *buffer,
unsigned int channels, ...);
226 LV_API
void visual_audio_get_sample_mixed (
VisAudio *audio,
VisBuffer *buffer,
int divide,
unsigned int channels, ...);
228 LV_API
void visual_audio_get_spectrum (
VisAudio *audio,
VisBuffer *buffer,
int samplelen,
const char *channelid,
int normalised);
229 LV_API
void visual_audio_get_spectrum_multiplied (
VisAudio *audio,
VisBuffer *buffer,
int samplelen,
const char *channelid,
int normalised,
float multiplier);
230 LV_API
void visual_audio_get_spectrum_for_sample (
VisBuffer *buffer,
VisBuffer *sample,
int normalised);
231 LV_API
void visual_audio_get_spectrum_for_sample_multiplied (
VisBuffer *buffer,
VisBuffer *sample,
int normalised,
float multiplier);
233 LV_API
void visual_audio_input (
VisAudio *audio,
235 VisAudioSampleRateType rate,
236 VisAudioSampleFormatType format,
237 VisAudioSampleChannelType channeltype);
239 LV_API
void visual_audio_input_channel (
VisAudio *audio,
241 VisAudioSampleRateType rate,
242 VisAudioSampleFormatType format,
243 const char *channelid);
245 LV_API
void visual_audio_normalise_spectrum (
VisBuffer *buffer);
247 LV_API visual_size_t visual_audio_sample_rate_get_length (VisAudioSampleRateType rate);
248 LV_API visual_size_t visual_audio_sample_format_get_size (VisAudioSampleFormatType format);
249 LV_API
int visual_audio_sample_format_is_signed (VisAudioSampleFormatType format);