| # Description: |
| # Sox is a cross-platform sound utility that can convert |
| # between various audio formats. Sox can also apply various effects to sound |
| # files. |
| # |
| |
| licenses(["restricted"]) # LGPL |
| |
| exports_files(["LICENSE"]) |
| |
| package( |
| default_hdrs_check = "loose", |
| features = [ |
| "-layering_check", |
| "-parse_headers", |
| ], |
| ) |
| |
| SOX_INCLUDES = ["includes/third_party/sox/src"] |
| |
| SOX_LIB_HDRS = [ |
| "src/sox.h", |
| "src/util.h", |
| ] |
| |
| SOX_LIB_COPTS = [ |
| "-w", |
| "-DHAVE_CONFIG_H", |
| # Supported file formats |
| "-DHAVE_FLAC", |
| "-DHAVE_MP3", |
| "-DHAVE_LAME_398", |
| "-DHAVE_LAME_H", |
| "-DHAVE_OGG_VORBIS", |
| ] |
| |
| SOX_LIB_SRCS = [ |
| "src/8svx.c", |
| "src/adpcm.c", |
| "src/adpcm.h", |
| "src/adpcms.c", |
| "src/adpcms.h", |
| "src/aifc-fmt.c", |
| "src/aiff.c", |
| "src/aiff.h", |
| "src/aiff-fmt.c", |
| "src/al-fmt.c", |
| "src/au.c", |
| "src/avr.c", |
| "src/bend.c", |
| "src/biquad.c", |
| "src/biquad.h", |
| "src/biquads.c", |
| "src/cdr.c", |
| "src/chorus.c", |
| "src/compand.c", |
| "src/compandt.c", |
| "src/compandt.h", |
| "src/contrast.c", |
| "src/cvsd.c", |
| "src/cvsd.h", |
| "src/cvsd-fmt.c", |
| "src/dat.c", |
| "src/dcshift.c", |
| "src/delay.c", |
| "src/dft_filter.c", |
| "src/dft_filter.h", |
| "src/dither.c", |
| "src/dither.h", |
| "src/divide.c", |
| "src/downsample.c", |
| "src/dvms-fmt.c", |
| "src/earwax.c", |
| "src/echo.c", |
| "src/echos.c", |
| "src/effects.c", |
| "src/effects.h", |
| "src/effects_i.c", |
| "src/effects_i_dsp.c", |
| "src/f4-fmt.c", |
| "src/f8-fmt.c", |
| "src/fade.c", |
| "src/fft4g.c", |
| "src/fft4g.h", |
| "src/fir.c", |
| "src/firfit.c", |
| "src/flac.c", |
| "src/flanger.c", |
| "src/formats.c", |
| "src/formats.h", |
| "src/formats_i.c", |
| "src/g711.c", |
| "src/g711.h", |
| "src/g721.c", |
| "src/g723_24.c", |
| "src/g723_40.c", |
| "src/g72x.c", |
| "src/g72x.h", |
| "src/gain.c", |
| "src/getopt.c", |
| "src/gsm.c", |
| "src/gsrt.c", |
| "src/hcom.c", |
| "src/hilbert.c", |
| "src/htk.c", |
| "src/ima-fmt.c", |
| "src/ima_rw.c", |
| "src/ima_rw.h", |
| "src/input.c", |
| "src/la-fmt.c", |
| "src/ladspa.c", |
| "src/libsox.c", |
| "src/libsox_i.c", |
| "src/loudness.c", |
| "src/lpc10.c", |
| "src/lu-fmt.c", |
| "src/maud.c", |
| "src/mcompand.c", |
| "src/mp3.c", |
| "src/noiseprof.c", |
| "src/noisered.c", |
| "src/noisered.h", |
| "src/nulfile.c", |
| "src/oss.c", |
| "src/output.c", |
| "src/overdrive.c", |
| "src/pad.c", |
| "src/phaser.c", |
| "src/prc.c", |
| "src/rate.c", |
| "src/raw.c", |
| "src/raw.h", |
| "src/raw-fmt.c", |
| "src/remix.c", |
| "src/repeat.c", |
| "src/reverb.c", |
| "src/reverse.c", |
| "src/s1-fmt.c", |
| "src/s2-fmt.c", |
| "src/s3-fmt.c", |
| "src/s4-fmt.c", |
| "src/sf.c", |
| "src/silence.c", |
| "src/sinc.c", |
| "src/skeleff.c", |
| "src/skelform.c", |
| "src/smp.c", |
| "src/sounder.c", |
| "src/soundtool.c", |
| "src/sox-fmt.c", |
| "src/sox_i.h", |
| "src/speed.c", |
| "src/sphere.c", |
| "src/splice.c", |
| "src/stat.c", |
| "src/stats.c", |
| "src/stretch.c", |
| "src/swap.c", |
| "src/synth.c", |
| "src/tempo.c", |
| "src/tremolo.c", |
| "src/trim.c", |
| "src/tx16w.c", |
| "src/u1-fmt.c", |
| "src/u2-fmt.c", |
| "src/u3-fmt.c", |
| "src/u4-fmt.c", |
| "src/ul-fmt.c", |
| "src/upsample.c", |
| "src/util.c", |
| "src/vad.c", |
| "src/voc.c", |
| "src/vol.c", |
| "src/vorbis.c", |
| "src/vox.c", |
| "src/vox.h", |
| "src/vox-fmt.c", |
| "src/wav.c", |
| "src/wve.c", |
| "src/xa.c", |
| "src/xmalloc.c", |
| "src/xmalloc.h", |
| ] |
| |
| filegroup( |
| name = "headers", |
| srcs = glob( |
| [ |
| "src/*.h", |
| ], |
| exclude = ["src/win32-*.h"], |
| ), |
| ) |
| |
| cc_library( |
| name = "lpc10", |
| srcs = [ |
| "lpc10/analys.c", |
| "lpc10/bsynz.c", |
| "lpc10/chanwr.c", |
| "lpc10/dcbias.c", |
| "lpc10/decode.c", |
| "lpc10/deemp.c", |
| "lpc10/difmag.c", |
| "lpc10/dyptrk.c", |
| "lpc10/encode.c", |
| "lpc10/energy.c", |
| "lpc10/f2c.h", |
| "lpc10/f2clib.c", |
| "lpc10/ham84.c", |
| "lpc10/hp100.c", |
| "lpc10/invert.c", |
| "lpc10/irc2pc.c", |
| "lpc10/ivfilt.c", |
| "lpc10/lpcdec.c", |
| "lpc10/lpcenc.c", |
| "lpc10/lpcini.c", |
| "lpc10/lpfilt.c", |
| "lpc10/median.c", |
| "lpc10/mload.c", |
| "lpc10/onset.c", |
| "lpc10/pitsyn.c", |
| "lpc10/placea.c", |
| "lpc10/placev.c", |
| "lpc10/preemp.c", |
| "lpc10/prepro.c", |
| "lpc10/random.c", |
| "lpc10/rcchk.c", |
| "lpc10/synths.c", |
| "lpc10/tbdm.c", |
| "lpc10/voicin.c", |
| "lpc10/vparms.c", |
| ], |
| hdrs = ["lpc10/lpc10.h"], |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = [ |
| "-w", |
| "-DHAVE_CONFIG_H", |
| ], |
| includes = SOX_INCLUDES, |
| linkopts = [ |
| "-lm", |
| ], |
| ) |
| |
| cc_library( |
| name = "gsm", |
| srcs = [ |
| "libgsm/add.c", |
| "libgsm/code.c", |
| "libgsm/decode.c", |
| "libgsm/gsm_create.c", |
| "libgsm/gsm_decode.c", |
| "libgsm/gsm_destroy.c", |
| "libgsm/gsm_encode.c", |
| "libgsm/gsm_option.c", |
| "libgsm/long_term.c", |
| "libgsm/lpc.c", |
| "libgsm/preprocess.c", |
| "libgsm/private.h", |
| "libgsm/rpe.c", |
| "libgsm/short_term.c", |
| "libgsm/table.c", |
| ], |
| hdrs = ["libgsm/gsm.h"], |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = [ |
| "-w", |
| "-DFAST", |
| "-DHAVE_CONFIG_H", |
| "-DSASR", |
| "-DWAV49", |
| ], |
| includes = SOX_INCLUDES, |
| linkopts = [ |
| "-lm", |
| ], |
| ) |
| |
| cc_library( |
| name = "sox_lib", |
| srcs = SOX_LIB_SRCS, |
| hdrs = SOX_LIB_HDRS, |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = SOX_LIB_COPTS + [ |
| "-DHAVE_MAD_H", # prefer libmad over lame |
| ], |
| includes = SOX_INCLUDES, |
| deps = [ |
| ":gsm", |
| ":lpc10", |
| "//third_party/flac", |
| "//third_party/lame/v3_99_5:lame", |
| "//third_party/libmad", |
| "//third_party/libogg", |
| "//third_party/libvorbis", |
| ], |
| ) |
| |
| cc_library( |
| name = "redistributable_sox_lib", |
| srcs = SOX_LIB_SRCS, |
| hdrs = SOX_LIB_HDRS, |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = SOX_LIB_COPTS + ["-DSOX_NO_MAIN"], |
| includes = SOX_INCLUDES, |
| deps = [ |
| ":gsm", |
| ":lpc10", |
| "//third_party/flac", |
| "//third_party/lame/v3_99_5:lame", |
| "//third_party/libogg", |
| "//third_party/libvorbis", |
| ], |
| ) |
| |
| cc_binary( |
| name = "sox", |
| srcs = [ |
| "src/sox.c", |
| ], |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = [ |
| "-w", |
| "-DHAVE_CONFIG_H", |
| ], |
| includes = SOX_INCLUDES, |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":sox_lib", |
| ], |
| ) |
| |
| cc_binary( |
| name = "libsox.so", |
| srcs = [ |
| "src/sox.c", |
| ], |
| compatible_with = ["//buildenv/target:vendor"], |
| copts = [ |
| "-w", |
| "-DHAVE_CONFIG_H", |
| ], |
| includes = SOX_INCLUDES, |
| linkshared = 1, |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":redistributable_sox_lib", |
| ], |
| ) |
| |
| cc_library( |
| name = "src", |
| srcs = [ |
| "google-sox-14.4.2.c", |
| ], |
| copts = [ |
| "-w", |
| "-DHAVE_CONFIG_H", |
| ], |
| includes = SOX_INCLUDES, |
| deps = [ |
| ":sox_lib", |
| ], |
| ) |