e5dc49e2ff4230d5e8c34545287e1fe0e9407c6b
2 ** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU Lesser General Public License as published by
6 ** the Free Software Foundation; either version 2.1 of the License, or
7 ** (at your option) any later version.
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU Lesser General Public License for more details.
14 ** You should have received a copy of the GNU Lesser General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /*------------------------------------------------------------------------------
31 raw_open (SF_PRIVATE
*psf
)
32 { int subformat
, error
= SFE_NO_ERROR
;
34 subformat
= SF_CODEC (psf
->sf
.format
) ;
36 psf
->endian
= SF_ENDIAN (psf
->sf
.format
) ;
38 if (CPU_IS_BIG_ENDIAN
&& (psf
->endian
== 0 || psf
->endian
== SF_ENDIAN_CPU
))
39 psf
->endian
= SF_ENDIAN_BIG
;
40 else if (CPU_IS_LITTLE_ENDIAN
&& (psf
->endian
== 0 || psf
->endian
== SF_ENDIAN_CPU
))
41 psf
->endian
= SF_ENDIAN_LITTLE
;
43 psf
->blockwidth
= psf
->bytewidth
* psf
->sf
.channels
;
45 psf
->datalength
= psf
->filelength
;
48 { case SF_FORMAT_PCM_S8
:
49 error
= pcm_init (psf
) ;
52 case SF_FORMAT_PCM_U8
:
53 error
= pcm_init (psf
) ;
56 case SF_FORMAT_PCM_16
:
57 case SF_FORMAT_PCM_24
:
58 case SF_FORMAT_PCM_32
:
59 error
= pcm_init (psf
) ;
63 error
= ulaw_init (psf
) ;
67 error
= alaw_init (psf
) ;
70 case SF_FORMAT_GSM610
:
71 error
= gsm610_init (psf
) ;
74 /* Lite remove start */
75 case SF_FORMAT_FLOAT
:
76 error
= float32_init (psf
) ;
79 case SF_FORMAT_DOUBLE
:
80 error
= double64_init (psf
) ;
83 case SF_FORMAT_DWVW_12
:
84 error
= dwvw_init (psf
, 12) ;
87 case SF_FORMAT_DWVW_16
:
88 error
= dwvw_init (psf
, 16) ;
91 case SF_FORMAT_DWVW_24
:
92 error
= dwvw_init (psf
, 24) ;
95 case SF_FORMAT_VOX_ADPCM
:
96 error
= vox_adpcm_init (psf
) ;
100 default : return SFE_BAD_OPEN_FORMAT
;