1 /*
2  * Copyright © 2018 Mozilla Foundation
3  *
4  * This program is made available under an ISC-style license.  See the
5  * accompanying file LICENSE for details.
6  */
7 
8 #include "cubeb_utils.h"
9 
10 size_t
cubeb_sample_size(cubeb_sample_format format)11 cubeb_sample_size(cubeb_sample_format format)
12 {
13   switch (format) {
14   case CUBEB_SAMPLE_S16LE:
15   case CUBEB_SAMPLE_S16BE:
16     return sizeof(int16_t);
17   case CUBEB_SAMPLE_FLOAT32LE:
18   case CUBEB_SAMPLE_FLOAT32BE:
19     return sizeof(float);
20   default:
21     // should never happen as all cases are handled above.
22     assert(false);
23     return 0;
24   }
25 }
26