History

port to Plan 9

Sigrid Solveig Haflínudóttir committed 6 years ago

Commit f87eb661 parent ca5618d13 files · +68 −12Browse files

Unified · Split

13 files
  1. src/mkfile +25 −0
  2. src/plan9.c +19 −0
  3. src/plan9/assert.h +0 −0
  4. src/plan9/config.h +17 −0
  5. src/plan9/math.h +0 −0
  6. src/plan9/stdint.h +0 −0
  7. src/plan9/stdio.h +0 −0
  8. src/plan9/stdlib.h +0 −0
  9. src/plan9/string.h +0 −0
  10. src/samplerate.h +1 −0
  11. src/src_linear.c +2 −4
  12. src/src_sinc.c +4 −6
  13. src/src_zoh.c +0 −2
src/mkfile+25−0
@@ -0,0 +1,25 @@
1+</$objtype/mkfile
2+LIB=/$objtype/lib/libsamplerate.a
3+
4+CFLAGS=$CFLAGS -p -Iplan9 -DHAVE_CONFIG_H
5+
6+OFILES=\
7+ plan9.$O\
8+ samplerate.$O\
9+ src_linear.$O\
10+ src_sinc.$O\
11+ src_zoh.$O\
12+
13+HFILES=\
14+ /sys/include/samplerate.h\
15+ common.h\
16+ fastest_coeffs.h\
17+ high_qual_coeffs.h\
18+ mid_qual_coeffs.h\
19+ samplerate.h\
20+ src_config.h\
21+
22+/sys/include/%.h: %.h
23+ cp $stem.h /sys/include/$stem.h
24+
25+</sys/src/cmd/mksyslib
src/plan9.c+19−0
@@ -0,0 +1,19 @@
1+int
2+lrintf(float f)
3+{
4+ int i;
5+
6+ *((float*)&i) = f + 12582912.0f;
7+
8+ return (i & 0x7fffff) - 0x400000;
9+}
10+
11+long
12+lrint(double d)
13+{
14+ long long l;
15+
16+ *((double*)&l) = d + 6755399441055744.0;
17+
18+ return l;
19+}
src/plan9/assert.h+0−0

Empty file added.

src/plan9/config.h+17−0
@@ -0,0 +1,17 @@
1+#include <u.h>
2+#include <libc.h>
3+
4+#define SIZEOF_INT sizeof(int)
5+#define SIZEOF_LONG sizeof(long)
6+#define CPU_IS_LITTLE_ENDIAN
7+#define PACKAGE "libsamplerate"
8+#define VERSION "nein"
9+
10+#define NULL nil
11+#define UNUSED(x) USED(x)
12+
13+typedef enum { false, true } bool;
14+typedef s32int int32_t;
15+
16+int lrintf(float f);
17+long lrint(double d);
src/plan9/math.h+0−0

Empty file added.

src/plan9/stdint.h+0−0

Empty file added.

src/plan9/stdio.h+0−0

Empty file added.

src/plan9/stdlib.h+0−0

Empty file added.

src/plan9/string.h+0−0

Empty file added.

src/samplerate.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 extern "C" {
1919 #endif /* __cplusplus */
2020
21+#pragma lib "libsamplerate.a"
2122
2223 /* Opaque data type SRC_STATE. */
2324 typedef struct SRC_STATE_tag SRC_STATE ;
src/src_linear.c+2−4
@@ -228,7 +228,7 @@ linear_state_new (int channels, SRC_ERROR *error) · 227 unmodified lines
228228
229229 static void
230230 linear_reset (SRC_STATE *state)
231−{ LINEAR_DATA *priv = NULL ;
231+{ LINEAR_DATA *priv ;
232232
233233 priv = (LINEAR_DATA*) state->private_data ;
234234 if (priv == NULL)
@@ -240,7 +240,7 @@ linear_reset (SRC_STATE *state) · 5 unmodified lines
240240 return ;
241241 } /* linear_reset */
242242
243−SRC_STATE *
243+static SRC_STATE *
244244 linear_copy (SRC_STATE *state)
245245 {
246246 assert (state != NULL) ;
@@ -290,9 +290,7 @@ linear_close (SRC_STATE *state) · 43 unmodified lines
290290 linear->last_value = NULL ;
291291 }
292292 free (linear) ;
293− linear = NULL ;
294293 }
295294 free (state) ;
296− state = NULL ;
297295 }
298296 } /* linear_close */
src/src_sinc.c+4−6
@@ -570,7 +570,7 @@ calc_output_stereo (SINC_FILTER *filter, int channels, increment_t increment, in · 569 unmodified lines
570570 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
571571 } /* calc_output_stereo */
572572
573−SRC_ERROR
573+static SRC_ERROR
574574 sinc_stereo_vari_process (SRC_STATE *state, SRC_DATA *data)
575575 { SINC_FILTER *filter ;
576576 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -726,7 +726,7 @@ calc_output_quad (SINC_FILTER *filter, int channels, increment_t increment, incr · 149 unmodified lines
726726 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
727727 } /* calc_output_quad */
728728
729−SRC_ERROR
729+static SRC_ERROR
730730 sinc_quad_vari_process (SRC_STATE *state, SRC_DATA *data)
731731 { SINC_FILTER *filter ;
732732 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -881,7 +881,7 @@ calc_output_hex (SINC_FILTER *filter, int channels, increment_t increment, incre · 148 unmodified lines
881881 output [ch] = (float) (scale * (left [ch] + right [ch])) ;
882882 } /* calc_output_hex */
883883
884−SRC_ERROR
884+static SRC_ERROR
885885 sinc_hex_vari_process (SRC_STATE *state, SRC_DATA *data)
886886 { SINC_FILTER *filter ;
887887 double input_index, src_ratio, count, float_increment, terminate, rem ;
@@ -1143,7 +1143,7 @@ sinc_multichan_vari_process (SRC_STATE *state, SRC_DATA *data) · 255 unmodified lines
11431143
11441144 static SRC_ERROR
11451145 prepare_data (SINC_FILTER *filter, int channels, SRC_DATA *data, int half_filter_chan_len)
1146−{ int len = 0 ;
1146+{ int len ;
11471147
11481148 if (filter->b_real_end >= 0)
11491149 return SRC_ERR_NO_ERROR ; /* Should be terminating. Just return. */
@@ -1231,9 +1231,7 @@ sinc_close (SRC_STATE *state) · 81 unmodified lines
12311231 sinc->buffer = NULL ;
12321232 }
12331233 free (sinc) ;
1234− sinc = NULL ;
12351234 }
12361235 free (state) ;
1237− state = NULL ;
12381236 }
12391237 } /* sinc_close */
src/src_zoh.c+0−2
@@ -279,9 +279,7 @@ zoh_close (SRC_STATE *state) · 278 unmodified lines
279279 zoh->last_value = NULL ;
280280 }
281281 free (zoh) ;
282− zoh = NULL ;
283282 }
284283 free (state) ;
285− state = NULL ;
286284 }
287285 } /* zoh_close */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t