1 /* |
1 /* |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
43 static final int AU_LINEAR_8 = 2; /* 8-bit linear PCM */ |
43 static final int AU_LINEAR_8 = 2; /* 8-bit linear PCM */ |
44 static final int AU_LINEAR_16 = 3; /* 16-bit linear PCM */ |
44 static final int AU_LINEAR_16 = 3; /* 16-bit linear PCM */ |
45 static final int AU_LINEAR_24 = 4; /* 24-bit linear PCM */ |
45 static final int AU_LINEAR_24 = 4; /* 24-bit linear PCM */ |
46 static final int AU_LINEAR_32 = 5; /* 32-bit linear PCM */ |
46 static final int AU_LINEAR_32 = 5; /* 32-bit linear PCM */ |
47 static final int AU_FLOAT = 6; /* 32-bit IEEE floating point */ |
47 static final int AU_FLOAT = 6; /* 32-bit IEEE floating point */ |
48 static final int AU_DOUBLE = 7; /* 64-bit IEEE floating point */ |
48 // we don't support these ... |
49 static final int AU_ADPCM_G721 = 23; /* 4-bit CCITT g.721 ADPCM */ |
49 // static final int AU_DOUBLE = 7; /* 64-bit IEEE floating point */ |
50 static final int AU_ADPCM_G722 = 24; /* CCITT g.722 ADPCM */ |
50 // static final int AU_ADPCM_G721 = 23; /* 4-bit CCITT g.721 ADPCM */ |
51 static final int AU_ADPCM_G723_3 = 25; /* CCITT g.723 3-bit ADPCM */ |
51 // static final int AU_ADPCM_G722 = 24; /* CCITT g.722 ADPCM */ |
52 static final int AU_ADPCM_G723_5 = 26; /* CCITT g.723 5-bit ADPCM */ |
52 // static final int AU_ADPCM_G723_3 = 25; /* CCITT g.723 3-bit ADPCM */ |
|
53 // static final int AU_ADPCM_G723_5 = 26; /* CCITT g.723 5-bit ADPCM */ |
53 static final int AU_ALAW_8 = 27; /* 8-bit ISDN A-law */ |
54 static final int AU_ALAW_8 = 27; /* 8-bit ISDN A-law */ |
54 |
55 |
55 static final int AU_HEADERSIZE = 24; |
56 static final int AU_HEADERSIZE = 24; |
56 |
57 |
57 private int auType; |
58 private int auType; |
62 |
63 |
63 AudioFormat.Encoding encoding = format.getEncoding(); |
64 AudioFormat.Encoding encoding = format.getEncoding(); |
64 |
65 |
65 auType = -1; |
66 auType = -1; |
66 |
67 |
67 if( AudioFormat.Encoding.ALAW.equals(encoding) ) { |
68 if (AudioFormat.Encoding.ALAW.equals(encoding)) { |
68 if( format.getSampleSizeInBits()==8 ) { |
69 if (format.getSampleSizeInBits() == 8) { |
69 auType = AU_ALAW_8; |
70 auType = AU_ALAW_8; |
70 } |
71 } |
71 } else if( AudioFormat.Encoding.ULAW.equals(encoding) ) { |
72 } else if (AudioFormat.Encoding.ULAW.equals(encoding)) { |
72 if( format.getSampleSizeInBits()==8 ) { |
73 if (format.getSampleSizeInBits() == 8) { |
73 auType = AU_ULAW_8; |
74 auType = AU_ULAW_8; |
74 } |
75 } |
75 } else if( AudioFormat.Encoding.PCM_SIGNED.equals(encoding) ) { |
76 } else if (AudioFormat.Encoding.PCM_SIGNED.equals(encoding)) { |
76 if( format.getSampleSizeInBits()==8 ) { |
77 if (format.getSampleSizeInBits() == 8) { |
77 auType = AU_LINEAR_8; |
78 auType = AU_LINEAR_8; |
78 } else if( format.getSampleSizeInBits()==16 ) { |
79 } else if (format.getSampleSizeInBits() == 16) { |
79 auType = AU_LINEAR_16; |
80 auType = AU_LINEAR_16; |
80 } else if( format.getSampleSizeInBits()==24 ) { |
81 } else if (format.getSampleSizeInBits() == 24) { |
81 auType = AU_LINEAR_24; |
82 auType = AU_LINEAR_24; |
82 } else if( format.getSampleSizeInBits()==32 ) { |
83 } else if (format.getSampleSizeInBits() == 32) { |
83 auType = AU_LINEAR_32; |
84 auType = AU_LINEAR_32; |
|
85 } |
|
86 } else if (AudioFormat.Encoding.PCM_FLOAT.equals(encoding)) { |
|
87 if (format.getSampleSizeInBits() == 32) { |
|
88 auType = AU_FLOAT; |
84 } |
89 } |
85 } |
90 } |
86 } |
91 } |
87 |
92 |
88 public int getAuType() { |
93 public int getAuType() { |