diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-02-06 10:19:58 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-02-06 10:33:01 -0500 |
commit | 63a1b56560df7f56c8d25c93d0ffeb30997e9325 (patch) | |
tree | ba6caa599202d757899998ad295609c4c96fc231 /libs/ardour/globals.cc | |
parent | 6b9415aedb35d03561ef16d846f08bc0fc7c57c7 (diff) |
fix (and comment) on subtle bug with audio file data width function
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r-- | libs/ardour/globals.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 1ccb169bfc..ea99420ff5 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -609,3 +609,26 @@ ARDOUR::get_microseconds () return (microseconds_t) ts.tv_sec * 1000000 + (ts.tv_nsec/1000); #endif } + +/** Return the number of bits per sample for a given sample format. + * + * This is closely related to sndfile_data_width() but does NOT + * return a "magic" value to differentiate between 32 bit integer + * and 32 bit floating point values. + */ + +int +format_data_width (ARDOUR::SampleFormat format) +{ + + + + switch (format) { + case ARDOUR::FormatInt16: + return 16; + case ARDOUR::FormatInt24: + return 24; + default: + return 32; + } +} |