summaryrefslogtreecommitdiff
path: root/apps/codecs/libwavpack/bits.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-06 18:07:30 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-06 18:07:30 +0000
commit0f5cb94aa4a334366a746fcbb22f3335ca413265 (patch)
tree8f89a96628c1810d51ee9816daf78edb8c76fcd4 /apps/codecs/libwavpack/bits.c
parent0b22795e26ee09de14f6ac23219adeda12f2fd5b (diff)
downloadrockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.tar.gz
rockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.zip
Big Patch adds primarily: Samplerate and format selection to recording for SWCODEC. Supprort for samplerates changing in playback (just goes with the recording part inseparably). Samplerates to all encoders. Encoders can be configured individually on a menu specific to the encoder in the recording menu. File creation is delayed until flush time to reduce spinups when splitting. Misc: statusbar icons for numbers are individual digits to display any number. Audio buffer was rearranged to maximize memory available to recording and properly reinitialized when trashed. ColdFire PCM stuff moved to target tree to avoid a complicated mess when adding samplerate switching. Some needed API changes and to neaten up growing gap between hardware and software codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11452 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwavpack/bits.c')
-rw-r--r--apps/codecs/libwavpack/bits.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/apps/codecs/libwavpack/bits.c b/apps/codecs/libwavpack/bits.c
index 0a148e123f..0f0e79c292 100644
--- a/apps/codecs/libwavpack/bits.c
+++ b/apps/codecs/libwavpack/bits.c
@@ -15,6 +15,7 @@
15// the malloc() system is provided. 15// the malloc() system is provided.
16 16
17#include "wavpack.h" 17#include "wavpack.h"
18#include "system.h"
18 19
19#include <string.h> 20#include <string.h>
20 21
@@ -118,19 +119,16 @@ uint32_t bs_close_write (Bitstream *bs)
118void little_endian_to_native (void *data, char *format) 119void little_endian_to_native (void *data, char *format)
119{ 120{
120 uchar *cp = (uchar *) data; 121 uchar *cp = (uchar *) data;
121 int32_t temp;
122 122
123 while (*format) { 123 while (*format) {
124 switch (*format) { 124 switch (*format) {
125 case 'L': 125 case 'L':
126 temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24); 126 *(long *)cp = letoh32(*(long *)cp);
127 * (int32_t *) cp = temp;
128 cp += 4; 127 cp += 4;
129 break; 128 break;
130 129
131 case 'S': 130 case 'S':
132 temp = cp [0] + (cp [1] << 8); 131 *(short *)cp = letoh16(*(short *)cp);
133 * (short *) cp = (short) temp;
134 cp += 2; 132 cp += 2;
135 break; 133 break;
136 134
@@ -148,28 +146,22 @@ void little_endian_to_native (void *data, char *format)
148void native_to_little_endian (void *data, char *format) 146void native_to_little_endian (void *data, char *format)
149{ 147{
150 uchar *cp = (uchar *) data; 148 uchar *cp = (uchar *) data;
151 int32_t temp;
152 149
153 while (*format) { 150 while (*format) {
154 switch (*format) { 151 switch (*format) {
155 case 'L': 152 case 'L':
156 temp = * (int32_t *) cp; 153 *(long *)cp = htole32(*(long *)cp);
157 *cp++ = (uchar) temp; 154 cp += 4;
158 *cp++ = (uchar) (temp >> 8);
159 *cp++ = (uchar) (temp >> 16);
160 *cp++ = (uchar) (temp >> 24);
161 break; 155 break;
162 156
163 case 'S': 157 case 'S':
164 temp = * (short *) cp; 158 *(short *)cp = htole16(*(short *)cp);
165 *cp++ = (uchar) temp; 159 cp += 2;
166 *cp++ = (uchar) (temp >> 8);
167 break; 160 break;
168 161
169 default: 162 default:
170 if (*format >= '0' && *format <= '9') 163 if (*format >= '0' && *format <= '9')
171 cp += *format - '0'; 164 cp += *format - '0';
172
173 break; 165 break;
174 } 166 }
175 167