Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d30292e in mainline


Ignore:
Timestamp:
2012-07-15T00:41:24Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
afa7c17
Parents:
2d9197e
Message:

Add another audio format helper function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/pcm_sample_format.h

    r2d9197e rd30292e  
    3737#define PCM_SAMPLE_FORMAT_H_
    3838
     39#include <bool.h>
     40
    3941typedef enum {
    4042        PCM_SAMPLE_UINT8,
     
    5759        PCM_SAMPLE_SINT32_BE,
    5860        PCM_SAMPLE_FLOAT32,
     61        PCM_SAMPLE_FORMAT_LAST = PCM_SAMPLE_FLOAT32,
    5962} pcm_sample_format_t;
     63
     64static inline bool pcm_sample_format_is_signed(pcm_sample_format_t format)
     65{
     66        switch(format) {
     67        case PCM_SAMPLE_SINT8:
     68        case PCM_SAMPLE_SINT16_LE:
     69        case PCM_SAMPLE_SINT16_BE:
     70        case PCM_SAMPLE_SINT24_LE:
     71        case PCM_SAMPLE_SINT24_BE:
     72        case PCM_SAMPLE_SINT24_32_LE:
     73        case PCM_SAMPLE_SINT24_32_BE:
     74        case PCM_SAMPLE_SINT32_LE:
     75        case PCM_SAMPLE_SINT32_BE:
     76                return true;
     77        case PCM_SAMPLE_UINT8:
     78        case PCM_SAMPLE_UINT16_LE:
     79        case PCM_SAMPLE_UINT16_BE:
     80        case PCM_SAMPLE_UINT24_LE:
     81        case PCM_SAMPLE_UINT24_BE:
     82        case PCM_SAMPLE_UINT24_32_LE:
     83        case PCM_SAMPLE_UINT24_32_BE:
     84        case PCM_SAMPLE_UINT32_LE:
     85        case PCM_SAMPLE_UINT32_BE:
     86        case PCM_SAMPLE_FLOAT32:
     87        default:
     88                return false;
     89        }
     90}
    6091
    6192static inline size_t pcm_sample_format_size(pcm_sample_format_t format)
Note: See TracChangeset for help on using the changeset viewer.