BVB Source Codes

cmus Show sf.h Source code

Return Download cmus: download sf.h Source code - Download cmus Source code - Type:.h
  1. /*
  2.  * Copyright 2008-2013 Various Authors
  3.  * Copyright 2004 Timo Hirvonen
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License as
  7.  * published by the Free Software Foundation; either version 2 of the
  8.  * License, or (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. #ifndef CMUS_SF_H
  20. #define CMUS_SF_H
  21.  
  22. /*
  23.  *  0     1 big_endian 0-1
  24.  *  1     1 is_signed  0-1
  25.  *  2     1 unused     0
  26.  *  3-5   3 bits >> 3  0-7 (* 8 = 0-56)
  27.  *  6-23 18 rate       0-262143
  28.  * 24-31  8 channels   0-255
  29.  */
  30. typedef unsigned int sample_format_t;
  31.  
  32. #define SF_BIGENDIAN_MASK       0x00000001
  33. #define SF_SIGNED_MASK          0x00000002
  34. #define SF_BITS_MASK            0x00000038
  35. #define SF_RATE_MASK            0x00ffffc0
  36. #define SF_CHANNELS_MASK        0xff000000
  37.  
  38. #define SF_BIGENDIAN_SHIFT      0
  39. #define SF_SIGNED_SHIFT         1
  40. #define SF_BITS_SHIFT           0
  41. #define SF_RATE_SHIFT           6
  42. #define SF_CHANNELS_SHIFT       24
  43.  
  44. #define sf_get_bigendian(sf)    (((sf) & SF_BIGENDIAN_MASK) >> SF_BIGENDIAN_SHIFT)
  45. #define sf_get_signed(sf)       (((sf) & SF_SIGNED_MASK   ) >> SF_SIGNED_SHIFT)
  46. #define sf_get_bits(sf)         (((sf) & SF_BITS_MASK     ) >> SF_BITS_SHIFT)
  47. #define sf_get_rate(sf)         (((sf) & SF_RATE_MASK     ) >> SF_RATE_SHIFT)
  48. #define sf_get_channels(sf)     (((sf) & SF_CHANNELS_MASK ) >> SF_CHANNELS_SHIFT)
  49.  
  50. #define sf_signed(val)          (((val) << SF_SIGNED_SHIFT   ) & SF_SIGNED_MASK)
  51. #define sf_bits(val)            (((val) << SF_BITS_SHIFT     ) & SF_BITS_MASK)
  52. #define sf_rate(val)            (((val) << SF_RATE_SHIFT     ) & SF_RATE_MASK)
  53. #define sf_channels(val)        (((val) << SF_CHANNELS_SHIFT ) & SF_CHANNELS_MASK)
  54. #define sf_bigendian(val)       (((val) << SF_BIGENDIAN_SHIFT) & SF_BIGENDIAN_MASK)
  55. #ifdef WORDS_BIGENDIAN
  56. #       define sf_host_endian() sf_bigendian(1)
  57. #else
  58. #       define sf_host_endian() sf_bigendian(0)
  59. #endif
  60.  
  61. #define sf_get_sample_size(sf)  (sf_get_bits((sf)) >> 3)
  62. #define sf_get_frame_size(sf)   (sf_get_sample_size((sf)) * sf_get_channels((sf)))
  63. #define sf_get_second_size(sf)  (sf_get_rate((sf)) * sf_get_frame_size((sf)))
  64.  
  65. #endif
  66.  
downloadsf.h Source code - Download cmus Source code
Related Source Codes/Software:
Ink - An HTML5/CSS3 framework used at SAPO for fast and ... 2017-04-22
memory-stats.js - minimal monitor for JS Heap Size via performance.m... 2017-04-22
LayoutKit - LayoutKit is a fast view layout library for iOS, m... 2017-04-22
Cpp-Primer - C++ Primer 5 answer 2017-04-22
RBBAnimation - Block-based animations made easy, comes with easin... 2017-04-22
phpDocumentor2 - Documentation Generator for PHP ... 2017-04-22
flexboxfroggy - A game for learning CSS flexbox ... 2017-04-22
wicked - Use wicked to turn your controller into a wizard ... 2017-04-22
Begin-Latex-in-minutes - Brief Intro to LaTeX for beginners that helps you ... 2017-04-22
guard-livereload - Guard::LiveReload automatically reload your browse... 2017-04-22
swifter - Tiny http server engine written in Swift programmi... 2017-04-29
Chartbuilder - A front-end charting application that facilitates ... 2017-04-29
offline-first - 2017-04-29
plotly.py - An interactive, browser-based graphing library for... 2017-04-29
statsmodels - Statsmodels: statistical modeling and econometrics... 2017-04-29
android-maps-utils - Handy extensions to the Google Maps Android API. 2017-04-29
enyo - A JavaScript application framework emphasizing mod... 2017-04-29
darkforestGo - DarkForest, the Facebook Go engine. 2017-04-29
erpnext - ERP made Simple http://erpn... 2017-04-29
SwiftInFlux - An attempt to gather all that is in flux in Swift. 2017-04-29

 Back to top