mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
add function to get data width for ARDOUR::SampleFormat
This commit is contained in:
parent
ccd881d518
commit
5ff6402dad
2 changed files with 16 additions and 0 deletions
|
|
@ -23,6 +23,8 @@
|
|||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ardour/types.h"
|
||||
|
||||
// Use this define when initializing arrarys for use in sndfile_*_format()
|
||||
#define SNDFILE_STR_LENGTH 32
|
||||
|
||||
|
|
@ -47,6 +49,7 @@ int sndfile_header_format_by_index (int);
|
|||
int sndfile_endian_format_by_index (int);
|
||||
|
||||
int sndfile_data_width (int format);
|
||||
int sndfile_data_width (ARDOUR::SampleFormat);
|
||||
|
||||
// It'd be nice if libsndfile did this for us
|
||||
std::string sndfile_major_format (int);
|
||||
|
|
|
|||
|
|
@ -140,6 +140,19 @@ sndfile_data_width (int format)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
sndfile_data_width (ARDOUR::SampleFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case ARDOUR::FormatInt16:
|
||||
return sndfile_data_width (SF_FORMAT_PCM_16);
|
||||
case ARDOUR::FormatInt24:
|
||||
return sndfile_data_width (SF_FORMAT_PCM_24);
|
||||
default:
|
||||
return sndfile_data_width (SF_FORMAT_FLOAT);
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
sndfile_major_format(int format)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue