36 | #endif
37 |
38 |
39 | #include "lame.h"
40 | #include "machine.h"
41 |
42 | #include "version.h" /* macros of version numbers */
43 |
44 |
45 |
46 |
47 |
48 | /*! Get the LAME version string. */
49 | /*!
50 | \param void
51 | \return a pointer to a string which describes the version of LAME.
52 | */
53 | const char *
54 | get_lame_version(void) { /* primary to write screen reports */
55 | /* Here we can also add informations about compile time configurations */
56 |
57 | #if LAME_ALPHA_VERSION
58 | static /*@observer@ */ const char *const str =
59 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
60 | "(alpha " STR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")";
61 | #elif LAME_BETA_VERSION
62 | static /*@observer@ */ const char *const str =
63 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " "
64 | "(beta " STR(LAME_PATCH_VERSION) ", " __DATE__ ")";
65 | #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
66 | static /*@observer@ */ const char *const str =
67 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
68 | #else
69 | static /*@observer@ */ const char *const str =
70 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
71 | #endif
72 |
73 | return str;
74 | }
75 |
76 |
77 | /*! Get the short LAME version string. */
78 | /*!
79 | It's mainly for inclusion into the MP3 stream.
80 |
81 | \param void
82 | \return a pointer to the short version of the LAME version string.
83 | */
84 | const char *
85 | get_lame_short_version(void) {
86 | /* adding date and time to version string makes it harder for output
87 | validation */
88 |
89 | #if LAME_ALPHA_VERSION
90 | static /*@observer@ */ const char *const str =
91 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (alpha " STR(LAME_PATCH_VERSION) ")";
92 | #elif LAME_BETA_VERSION
93 | static /*@observer@ */ const char *const str =
94 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (beta " STR(LAME_PATCH_VERSION) ")";
95 | #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
96 | static /*@observer@ */ const char *const str =
97 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION);
98 | #else
99 | static /*@observer@ */ const char *const str =
100 | STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION);
101 | #endif
102 |
103 | return str;
104 | }
105 |
106 | /*! Get the _very_ short LAME version string. */
107 | /*!
108 | It's used in the LAME VBR tag only.
109 |
110 | \param void
111 | \return a pointer to the short version of the LAME version string.
112 | */
113 | const char *
114 | get_lame_very_short_version(void) {
115 | /* adding date and time to version string makes it harder for output
116 | validation */
117 | #if LAME_ALPHA_VERSION
118 | #define P "a"
119 | #elif LAME_BETA_VERSION
120 | #define P "b"
121 | #elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0)
122 | #define P "r"
123 | #else
124 | #define P " "
125 | #endif
126 | static /*@observer@ */ const char *const str =
127 | #if (LAME_PATCH_VERSION > 0)
128 | "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P STR(LAME_PATCH_VERSION)
129 | #else
130 | "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P
131 | #endif
132 | ;
133 | return str;
134 | }
135 |
136 | /*! Get the _very_ short LAME version string. */
137 | /*!
138 | It's used in the LAME VBR tag only, limited to 9 characters max.
139 | Due to some 3rd party HW/SW decoders, it has to start with LAME.
140 |
141 | \param void
142 | \return a pointer to the short version of the LAME version string.
143 | */
144 | const char *
145 | get_lame_tag_encoder_short_version(void) {
146 | static /*@observer@ */ const char *const str =
147 | /* FIXME: new scheme / new version counting / drop versioning here ? */
148 | "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P;
149 | return str;
150 | }
151 |
152 | /*! Get the version string for GPSYCHO. */
153 | /*!
154 | \param void
155 | \return a pointer to a string which describes the version of GPSYCHO.
156 | */
157 | const char *
158 | get_psy_version(void) {
159 | #if PSY_ALPHA_VERSION > 0
160 | static /*@observer@ */ const char *const str =
161 | STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
162 | " (alpha " STR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")";
163 | #elif PSY_BETA_VERSION > 0
164 | static /*@observer@ */ const char *const str =
165 | STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION)
166 | " (beta " STR(PSY_BETA_VERSION) ", " __DATE__ ")";
167 | #else
168 | static /*@observer@ */ const char *const str =
169 | STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION);
170 | #endif
171 |
172 | return str;
173 | }
174 |
175 |
176 | /*! Get the URL for the LAME website. */
177 | /*!
178 | \param void
179 | \return a pointer to a string which is a URL for the LAME website.
180 | */
181 | const char *
182 | get_lame_url(void) {
183 | static /*@observer@ */ const char *const str = LAME_URL;
184 |
185 | return str;
186 | }
187 |
188 |
189 | /*! Get the numerical representation of the version. */
190 | /*!
191 | Writes the numerical representation of the version of LAME and
192 | GPSYCHO into lvp.
193 |
194 | \param lvp
195 | */
196 | void
197 | get_lame_version_numerical(lame_version_t *lvp) {
198 | static /*@observer@ */ const char *const features = ""; /* obsolete */
199 |
200 | /* generic version */
201 | lvp->major = LAME_MAJOR_VERSION;
202 | lvp->minor = LAME_MINOR_VERSION;
203 | #if LAME_ALPHA_VERSION
204 | lvp->alpha = LAME_PATCH_VERSION;
205 | lvp->beta = 0;
206 | #elif LAME_BETA_VERSION
207 | lvp->alpha = 0;
208 | lvp->beta = LAME_PATCH_VERSION;
209 | #else
210 | lvp->alpha = 0;
211 | lvp->beta = 0;
212 | #endif
213 |
214 | /* psy version */
215 | lvp->psy_major = PSY_MAJOR_VERSION;
216 | lvp->psy_minor = PSY_MINOR_VERSION;
217 | lvp->psy_alpha = PSY_ALPHA_VERSION;
218 | lvp->psy_beta = PSY_BETA_VERSION;
219 |
220 | /* compile time features */
221 | /*@-mustfree@ */
222 | lvp->features = features;
223 | /*@=mustfree@ */
224 | }
225 |
226 |
227 | const char *
228 | get_lame_os_bitness(void) {
229 | static /*@observer@ */ const char *const strXX = "";
230 | static /*@observer@ */ const char *const str32 = "32bits";
231 | static /*@observer@ */ const char *const str64 = "64bits";
232 |
233 | switch (sizeof(void *)) {
234 | case 4:
235 | return str32;
236 |
237 | case 8:
238 | return str64;
239 |
240 | default:
241 | return strXX;
242 | }
243 | }
244 |
245 | /* end of version.c */
246 |
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/cpp/lamemp3/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version numbering for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VERSION_H
23 | #define LAME_VERSION_H
24 |
25 |
26 | /*
27 | * To make a string from a token, use the # operator:
28 | */
29 | #ifndef STR
30 | # define __STR(x) #x
31 | # define STR(x) __STR(x)
32 | #endif
33 |
34 | # define LAME_URL "http://lame.sf.net"
35 |
36 |
37 | # define LAME_MAJOR_VERSION 3 /* Major version number */
38 | # define LAME_MINOR_VERSION 100 /* Minor version number */
39 | # define LAME_TYPE_VERSION 2 /* 0:alpha 1:beta 2:release */
40 | # define LAME_PATCH_VERSION 0 /* Patch level */
41 | # define LAME_ALPHA_VERSION (LAME_TYPE_VERSION==0)
42 | # define LAME_BETA_VERSION (LAME_TYPE_VERSION==1)
43 | # define LAME_RELEASE_VERSION (LAME_TYPE_VERSION==2)
44 |
45 | # define PSY_MAJOR_VERSION 1 /* Major version number */
46 | # define PSY_MINOR_VERSION 0 /* Minor version number */
47 | # define PSY_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */
48 | # define PSY_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */
49 |
50 | #if LAME_ALPHA_VERSION
51 | #define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION)
52 | #endif
53 | #if LAME_BETA_VERSION
54 | #define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION)
55 | #endif
56 | #if LAME_RELEASE_VERSION
57 | #if LAME_PATCH_VERSION
58 | #define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION)
59 | #else
60 | #define LAME_PATCH_LEVEL_STRING ""
61 | #endif
62 | #endif
63 |
64 | # define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING
65 |
66 | #endif /* LAME_VERSION_H */
67 |
68 | /* End of version.h */
69 |
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/arm64-v8a/liblame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/arm64-v8a/liblame.so
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/arm64-v8a/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/arm64-v8a/libmp3lame.so
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/armeabi-v7a/liblame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/armeabi-v7a/liblame.so
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/armeabi-v7a/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/armeabi-v7a/libmp3lame.so
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/x86_64/liblame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/x86_64/liblame.so
--------------------------------------------------------------------------------
/Lame/LameMP3/CMake/src/main/jniLibs/x86_64/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/Lame/LameMP3/CMake/src/main/jniLibs/x86_64/libmp3lame.so
--------------------------------------------------------------------------------
/Lame/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | javasource = JavaVersion.VERSION_1_8
6 | javatarget = JavaVersion.VERSION_1_8
7 |
8 | compileVersion = 28
9 | targetVersion = 28
10 | minVersion = 14
11 | buildVersion = '29.0.0'
12 | supportLibVersion = '28.0.0'
13 | lifecycleLibVersion = '1.1.1'
14 | runnerVersion = '0.5'
15 | rulesVersion = '0.5'
16 | UiAutomatorLibVersion = '2.1.2'
17 | FirebaseLibVersion = '11.8.0'
18 | versionName = '0.0.0'
19 | protobufVersion = '3.6.1'
20 | grpcVersion = '1.14.0' // CURRENT_GRPC_VERSION
21 | nettyTcNativeVersion = '2.0.7.Final'
22 | okHttp3Version = '3.11.0'
23 | retrofit2Version = '2.4.0'
24 | gsonVersion = '2.8.5'
25 | }
26 | repositories {
27 | maven { url "https://maven.google.com" }
28 | google()
29 | jcenter()
30 | maven { // The google mirror is less flaky than mavenCentral()
31 | url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
32 | }
33 | maven { url 'https://jitpack.io' }
34 | maven { url "https://plugins.gradle.org/m2/" }
35 | }
36 | dependencies {
37 | classpath 'com.android.tools.build:gradle:3.4.1'
38 |
39 |
40 | // NOTE: Do not place your application dependencies here; they belong
41 | // in the individual module build.gradle files
42 | }
43 | }
44 |
45 | allprojects {
46 | repositories {
47 | maven { url "https://maven.google.com" }
48 | google()
49 | jcenter()
50 | maven { // The google mirror is less flaky than mavenCentral()
51 | url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
52 | }
53 | mavenLocal()
54 | maven { url "https://jitpack.io" }
55 | maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
56 | }
57 | }
58 |
59 | def buildTime() {
60 | return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
61 | }
62 |
63 | ext {
64 | javasource = JavaVersion.VERSION_1_8
65 | javatarget = JavaVersion.VERSION_1_8
66 |
67 | compileVersion = 28
68 | targetVersion = 28
69 | minVersion = 14
70 | buildVersion = '29.0.0'
71 | supportLibVersion = '28.0.0'
72 | lifecycleLibVersion = '1.1.1'
73 | runnerVersion = '0.5'
74 | rulesVersion = '0.5'
75 | UiAutomatorLibVersion = '2.1.2'
76 | FirebaseLibVersion = '11.8.0'
77 | versionName = '0.0.0'
78 | protobufVersion = '3.6.1'
79 | grpcVersion = '1.14.0' // CURRENT_GRPC_VERSION
80 | nettyTcNativeVersion = '2.0.7.Final'
81 | okHttp3Version = '3.11.0'
82 | retrofit2Version = '2.4.0'
83 | gsonVersion = '2.8.5'
84 | appbuildTime = buildTime()
85 | }
86 |
87 | task clean(type: Delete) {
88 | delete rootProject.buildDir
89 | }
90 |
--------------------------------------------------------------------------------
/Lame/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Lame/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/Lame/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/Lame/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Lame/settings.gradle:
--------------------------------------------------------------------------------
1 | //Library
2 | include ':LameMP3'
3 | project(":LameMP3").projectDir = file("./LameMP3/CMake")
4 |
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## CZRecorder
2 | [](https://jitpack.io/#chezi008/CZRecorder)
3 | ### 一、功能说明
4 | 1、通过libmp3lame库将PCM转成MP3的音频格式。
5 | 2、添加一个自定义的录音控件。
6 | #### 1.1对外开放方法说明:
7 | ```
8 | /**
9 | * 设置保存文件的路径
10 | *
11 | * @param filePath 录制文件的地址
12 | */
13 | void setAudioPath(String filePath);
14 |
15 | /**
16 | * 设置回调
17 | *
18 | * @param audioListener 回调接口
19 | */
20 | void setAudioListener(AudioRecordListener audioListener);
21 |
22 | /**
23 | * 开始录制音频
24 | */
25 | void startRecord();
26 |
27 | /**
28 | * 暂停录制
29 | */
30 | void onPause();
31 |
32 | /**
33 | * 继续录制
34 | */
35 | void onResume();
36 |
37 | /**
38 | * 停止录制
39 | */
40 | void stopRecord();
41 | ```
42 | #### 1.2 mp3录制方法说明:
43 | ```
44 | /**
45 | * Initialize LAME.
46 | *
47 | * @param inSamplerate
48 | * input sample rate in Hz.
49 | * @param inChannel
50 | * number of channels in input stream.
51 | * @param outSamplerate
52 | * output sample rate in Hz.
53 | * @param outBitrate
54 | * brate compression ratio in KHz.
55 | * @param quality
56 | * quality=0..9. 0=best (very slow). 9=worst.
57 | * recommended:
58 | * 2 near-best quality, not too slow
59 | * 5 good quality, fast
60 | * 7 ok quality, really fast
61 | */
62 | public native static void init(int inSamplerate, int inChannel,
63 | int outSamplerate, int outBitrate, int quality);
64 |
65 | /**
66 | * Encode buffer to mp3.
67 | *
68 | * @param bufferLeft
69 | * PCM data for left channel.
70 | * @param bufferRight
71 | * PCM data for right channel.
72 | * @param samples
73 | * number of samples per channel.
74 | * @param mp3buf
75 | * result encoded MP3 stream. You must specified
76 | * "7200 + (1.25 * buffer_l.length)" length array.
77 | * @return number of bytes output in mp3buf. Can be 0.
78 | * -1: mp3buf was too small
79 | * -2: malloc() problem
80 | * -3: lame_init_params() not called
81 | * -4: psycho acoustic problems
82 | */
83 | public native static int encode(short[] bufferLeft, short[] bufferRight,
84 | int samples, byte[] mp3buf);
85 |
86 | /**
87 | * Flush LAME buffer.
88 | *
89 | * REQUIRED:
90 | * lame_encode_flush will flush the intenal PCM buffers, padding with
91 | * 0's to make sure the final frame is complete, and then flush
92 | * the internal MP3 buffers, and thus may return a
93 | * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long
94 | * to hold all possible emitted data.
95 | *
96 | * will also write id3v1 tags (if any) into the bitstream
97 | *
98 | * return code = number of bytes output to mp3buf. Can be 0
99 | * @param mp3buf
100 | * result encoded MP3 stream. You must specified at least 7200
101 | * bytes.
102 | * @return number of bytes output to mp3buf. Can be 0.
103 | */
104 | public native static int flush(byte[] mp3buf);
105 |
106 | /**
107 | * Close LAME.
108 | */
109 | public native static void close();
110 | ```
111 | #### 1.3 自定义录音控件
112 | 喜欢的可以用用,不喜欢也没办法,反正我是打包在里面了。
113 |
114 | ### 二、所做修改
115 | 原作者博客中,原理和过程已经写的很清楚了。这里就不再进行赘述了。只是作者之前使用.mk文件进行编译的。但是最新的as软件需要使用cmake进行编译。所以我在这里进行整理了一下。在最新的编译软件下面也可以使用。
116 |
117 | ### 三、修改记录
118 | 1. 使用cmake编译mp3lame库。
119 | 2. include文件中,只保留头文件。
120 | 3. 删除DataEncodeThread类,转换mp3放在录制线程中。
121 | 4. 添加录音暂停,继续功能。
122 | 5. 重新封装mp3record。
123 |
124 | ### 四、新增功能:
125 |
126 | #### 4.1 暂停,继续功能
127 | 在开发的过程中,我想有些同学肯定用得到录制暂停的功能,所以我在原来的基础上面增加了暂停的功能。实现的原理是,当用户点击暂停时,就不再往MP3文件中写流,也不在MP3文件写入MP3结尾信息。当用户点击继续是,在原来文件流的基础上继续增加数据,只有当用户停止录制的时候才写入MP3尾部信息。
128 | #### 4.2 自定义了麦克风录制控件
129 | 效果图如下:
130 | 1、长按进行MP3文件录制。
131 | 2、松开按钮结束录制。
132 | 
133 |
134 |
135 | #### 4.3 自定义了频谱控件
136 | 效果如上图
137 | 
138 |
139 | ### 五、如何使用
140 | You need to make sure you have the JCenter and Google repositories included in the build.gradle file in the root of your project:
141 | ```
142 | repositories {
143 | jcenter()
144 | maven { url 'https://jitpack.io' }
145 | }
146 |
147 | ```
148 | Next add a dependency in the build.gradle file of your app module. The following will add a dependency to the full library:
149 | ```
150 | dependencies {
151 | implementation 'com.github.chezi008:CZRecorder:1.0.9'
152 | }
153 |
154 | ```
155 |
156 | ### github: https://github.com/chezi008/CZRecorder
157 | ### [参考]
158 | 1. 编译libmp3lame库: http://www.cnblogs.com/ct2011/p/4080193.html
159 | 2. 自定义圆形录制控件的动画参考:不记得了
160 | 3. 频谱波动控件参考:https://www.jianshu.com/p/76aceacbc243
161 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 30
5 | buildToolsVersion "30.0.0"
6 | defaultConfig {
7 | applicationId "com.chezi008.mp3recorddemo"
8 | minSdkVersion 24
9 | targetSdkVersion 30
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 |
21 | }
22 |
23 | dependencies {
24 | testImplementation 'junit:junit:4.13.2'
25 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
26 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
27 |
28 | implementation fileTree(include: ['*.jar'], dir: 'libs')
29 | implementation 'com.google.android.material:material:1.4.0'
30 | implementation project(path: ':recorder-audio')
31 | // implementation 'com.github.chezi008:AndroidMp3Recorder:v1.0.4'
32 | // implementation project(path: ':lamemp3')
33 |
34 | // 权限请求框架:https://github.com/getActivity/XXPermissions
35 | implementation 'com.github.getActivity:XXPermissions:18.5'
36 | }
37 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/chezi/mp3recorddemo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.chezi.mp3recorddemo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.chezi008.mp3recorddemo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/chezi/mp3recorder/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.chezi.mp3recorder;
2 |
3 | import android.os.Environment;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.Toast;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.appcompat.app.AppCompatActivity;
12 |
13 | import com.chezi.recorder.IAudioRecorder;
14 | import com.chezi.recorder.Mp3Recorder;
15 | import com.chezi.recorder.SpectrumView;
16 | import com.chezi.recorder.listener.AudioRecordListener;
17 | import com.chezi.recorder.RecorderView;
18 | import com.chezi.mp3recorddemo.R;
19 | import com.hjq.permissions.OnPermissionCallback;
20 | import com.hjq.permissions.Permission;
21 | import com.hjq.permissions.XXPermissions;
22 |
23 | import java.io.File;
24 | import java.io.IOException;
25 | import java.util.List;
26 |
27 | public class MainActivity extends AppCompatActivity {
28 | private String TAG = getClass().getSimpleName();
29 |
30 | // Used to load the 'native-lib' library on application startup.
31 |
32 | private IAudioRecorder mRecorder;
33 | private String filePath;
34 | private SpectrumView spectrum_view;
35 |
36 | private RecorderView mic_view;
37 |
38 | @Override
39 | public void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_main);
42 | filePath = getFilesDir().getAbsolutePath()+ "/test.mp3";
43 | // createFile();
44 | requestPermission();
45 | mRecorder = new Mp3Recorder();
46 | mRecorder.setAudioListener(new AudioRecordListener() {
47 | @Override
48 | public void onGetVolume(int volume) {
49 | Log.d(TAG, "onGetVolume: -->" + volume);
50 | }
51 | });
52 | Button startButton = (Button) findViewById(R.id.StartButton);
53 | startButton.setOnClickListener(new View.OnClickListener() {
54 | @Override
55 | public void onClick(View v) {
56 | mRecorder.start(filePath);
57 | spectrum_view.start();
58 | }
59 | });
60 | Button stopButton = (Button) findViewById(R.id.StopButton);
61 | stopButton.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | mRecorder.stop();
65 | spectrum_view.stop();
66 | }
67 | });
68 | Button btnPause = findViewById(R.id.btn_pause);
69 | btnPause.setOnClickListener(new View.OnClickListener() {
70 | @Override
71 | public void onClick(View v) {
72 | mRecorder.onPause();
73 | }
74 | });
75 | Button btnResume = findViewById(R.id.btn_resume);
76 | btnResume.setOnClickListener(new View.OnClickListener() {
77 | @Override
78 | public void onClick(View v) {
79 | mRecorder.onResume();
80 | }
81 | });
82 |
83 | spectrum_view = findViewById(R.id.spectrum_view);
84 |
85 | mic_view = findViewById(R.id.mic_view);
86 | mic_view.setRecorderViewListener(new RecorderView.RecorderViewListener() {
87 | @Override
88 | public void onStart() {
89 | mRecorder.start(filePath);
90 | }
91 |
92 | @Override
93 | public void onStop() {
94 | mRecorder.stop();
95 | String strFinish = String.format("录制完成,保存在:%s",filePath);
96 | Toast.makeText(MainActivity.this, strFinish, Toast.LENGTH_SHORT).show();
97 | }
98 | });
99 | }
100 |
101 | private void requestPermission() {
102 | XXPermissions.with(this)
103 | // 申请单个权限
104 | .permission(Permission.RECORD_AUDIO)
105 | // 申请多个权限
106 | // 设置权限请求拦截器(局部设置)
107 | //.interceptor(new PermissionInterceptor())
108 | // 设置不触发错误检测机制(局部设置)
109 | //.unchecked()
110 | .request(new OnPermissionCallback() {
111 |
112 | @Override
113 | public void onGranted(@NonNull List permissions, boolean allGranted) {
114 | if (!allGranted) {
115 | return;
116 | }
117 | }
118 |
119 | @Override
120 | public void onDenied(@NonNull List permissions, boolean doNotAskAgain) {
121 | if (doNotAskAgain) {
122 | // 如果是被永久拒绝就跳转到应用权限系统设置页面
123 | XXPermissions.startPermissionActivity(MainActivity.this, permissions);
124 | } else {
125 | }
126 | }
127 | });
128 | }
129 |
130 | private void createFile() {
131 | File file = new File(filePath);
132 | if (!file.exists()){
133 | try {
134 | file.createNewFile();
135 | } catch (IOException e) {
136 | e.printStackTrace();
137 | }
138 | }
139 | }
140 |
141 | @Override
142 | protected void onDestroy() {
143 | super.onDestroy();
144 | mRecorder.stop();
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
27 |
28 |
29 |
34 |
35 |
41 |
42 |
48 |
49 |
50 |
54 |
55 |
62 |
63 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Mp3RecordDemo
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/chezi/mp3recorddemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.chezi.mp3recorddemo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:4.1.3'
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | maven { url 'https://jitpack.io' }
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 | android.useAndroidX=true
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/recorder-audio/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/recorder-audio/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | set(LIBMP3_DIR ${CMAKE_SOURCE_DIR}/libs)
14 |
15 | add_library( mp3lame
16 | SHARED
17 | IMPORTED )
18 |
19 | set_target_properties( mp3lame
20 | PROPERTIES
21 | IMPORTED_LOCATION ${LIBMP3_DIR}/${ANDROID_ABI}/libmp3lame.so)
22 |
23 | include_directories(libs/include)
24 |
25 | add_library( # Sets the name of the library.
26 | mp3recorder
27 |
28 | # Sets the library as a shared library.
29 | SHARED
30 |
31 | # Provides a relative path to your source file(s).
32 | src/main/cpp/lame_util.c)
33 |
34 |
35 |
36 | # Searches for a specified prebuilt library and stores the path as a
37 | # variable. Because CMake includes system libraries in the search path by
38 | # default, you only need to specify the name of the public NDK library
39 | # you want to add. CMake verifies that the library exists before
40 | # completing its build.
41 |
42 | find_library( # Sets the name of the path variable.
43 | log-lib
44 |
45 | # Specifies the name of the NDK library that
46 | # you want CMake to locate.
47 | log )
48 |
49 | # Specifies libraries CMake should link to your target library. You
50 | # can link multiple libraries, such as libraries you define in this
51 | # build script, prebuilt third-party libraries, or system libraries.
52 |
53 | target_link_libraries( # Specifies the target library.
54 | mp3recorder
55 |
56 | mp3lame
57 |
58 | # Links the target library to the log library
59 | # included in the NDK.
60 | ${log-lib} )
--------------------------------------------------------------------------------
/recorder-audio/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 30
5 | defaultConfig {
6 | minSdkVersion 24
7 | targetSdkVersion 30
8 | versionCode 1
9 | versionName "1.0"
10 |
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | externalNativeBuild {
13 | cmake {
14 | cppFlags "-std=c++11"
15 | // abiFilters "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
16 | }
17 | }
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | externalNativeBuild {
27 | cmake {
28 | path "CMakeLists.txt"
29 | }
30 | }
31 |
32 | }
33 |
34 | dependencies {
35 | testImplementation 'junit:junit:4.13.2'
36 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
38 |
39 | implementation fileTree(dir: 'libs', include: ['*.jar'])
40 |
41 | // implementation project(path: ':lamemp3')
42 | }
43 |
--------------------------------------------------------------------------------
/recorder-audio/libs/arm64-v8a/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder-audio/libs/arm64-v8a/libmp3lame.so
--------------------------------------------------------------------------------
/recorder-audio/libs/armeabi-v7a/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder-audio/libs/armeabi-v7a/libmp3lame.so
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/VbrTag.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Xing VBR tagging for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VRBTAG_H
23 | #define LAME_VRBTAG_H
24 |
25 |
26 | /* -----------------------------------------------------------
27 | * A Vbr header may be present in the ancillary
28 | * data field of the first frame of an mp3 bitstream
29 | * The Vbr header (optionally) contains
30 | * frames total number of audio frames in the bitstream
31 | * bytes total number of bytes in the bitstream
32 | * toc table of contents
33 |
34 | * toc (table of contents) gives seek points
35 | * for random access
36 | * the ith entry determines the seek point for
37 | * i-percent duration
38 | * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
39 | * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
40 | */
41 |
42 |
43 | #define FRAMES_FLAG 0x0001
44 | #define BYTES_FLAG 0x0002
45 | #define TOC_FLAG 0x0004
46 | #define VBR_SCALE_FLAG 0x0008
47 |
48 | #define NUMTOCENTRIES 100
49 |
50 | #ifndef lame_internal_flags_defined
51 | #define lame_internal_flags_defined
52 | struct lame_internal_flags;
53 | typedef struct lame_internal_flags lame_internal_flags;
54 | #endif
55 |
56 |
57 | /*structure to receive extracted header */
58 | /* toc may be NULL*/
59 | typedef struct {
60 | int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */
61 | int samprate; /* determined from MPEG header */
62 | int flags; /* from Vbr header data */
63 | int frames; /* total bit stream frames from Vbr header data */
64 | int bytes; /* total bit stream bytes from Vbr header data */
65 | int vbr_scale; /* encoded vbr scale from Vbr header data */
66 | unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired */
67 | int headersize; /* size of VBR header, in bytes */
68 | int enc_delay; /* encoder delay */
69 | int enc_padding; /* encoder paddign added at end of stream */
70 | } VBRTAGDATA;
71 |
72 | int GetVbrTag(VBRTAGDATA * pTagData, const unsigned char *buf);
73 |
74 | int InitVbrTag(lame_global_flags * gfp);
75 | int PutVbrTag(lame_global_flags const *gfp, FILE * fid);
76 | void AddVbrFrame(lame_internal_flags * gfc);
77 | void UpdateMusicCRC(uint16_t * crc, const unsigned char *buffer, int size);
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/bitstream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 bitstream Output interface for LAME
3 | *
4 | * Copyright (c) 1999 Takehiro TOMINAGA
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_BITSTREAM_H
23 | #define LAME_BITSTREAM_H
24 |
25 | int getframebits(const lame_internal_flags * gfc);
26 |
27 | int format_bitstream(lame_internal_flags * gfc);
28 |
29 | void flush_bitstream(lame_internal_flags * gfc);
30 | void add_dummy_byte(lame_internal_flags * gfc, unsigned char val, unsigned int n);
31 |
32 | int copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int buffer_size,
33 | int update_crc);
34 | void init_bit_stream_w(lame_internal_flags * gfc);
35 | void CRC_writeheader(lame_internal_flags const *gfc, char *buffer);
36 | int compute_flushbits(const lame_internal_flags * gfp, int *nbytes);
37 |
38 | int get_max_frame_buffer_size_by_constraint(SessionConfig_t const * cfg, int constraint);
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/encoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * encoder.h include file
3 | *
4 | * Copyright (c) 2000 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 |
23 | #ifndef LAME_ENCODER_H
24 | #define LAME_ENCODER_H
25 |
26 | /***********************************************************************
27 | *
28 | * encoder and decoder delays
29 | *
30 | ***********************************************************************/
31 |
32 | /*
33 | * layer III enc->dec delay: 1056 (1057?) (observed)
34 | * layer II enc->dec delay: 480 (481?) (observed)
35 | *
36 | * polyphase 256-16 (dec or enc) = 240
37 | * mdct 256+32 (9*32) (dec or enc) = 288
38 | * total: 512+16
39 | *
40 | * My guess is that delay of polyphase filterbank is actualy 240.5
41 | * (there are technical reasons for this, see postings in mp3encoder).
42 | * So total Encode+Decode delay = ENCDELAY + 528 + 1
43 | */
44 |
45 | /*
46 | * ENCDELAY The encoder delay.
47 | *
48 | * Minimum allowed is MDCTDELAY (see below)
49 | *
50 | * The first 96 samples will be attenuated, so using a value less than 96
51 | * will result in corrupt data for the first 96-ENCDELAY samples.
52 | *
53 | * suggested: 576
54 | * set to 1160 to sync with FhG.
55 | */
56 |
57 | #define ENCDELAY 576
58 |
59 |
60 |
61 | /*
62 | * make sure there is at least one complete frame after the
63 | * last frame containing real data
64 | *
65 | * Using a value of 288 would be sufficient for a
66 | * a very sophisticated decoder that can decode granule-by-granule instead
67 | * of frame by frame. But lets not assume this, and assume the decoder
68 | * will not decode frame N unless it also has data for frame N+1
69 | *
70 | */
71 | /*#define POSTDELAY 288*/
72 | #define POSTDELAY 1152
73 |
74 |
75 |
76 | /*
77 | * delay of the MDCT used in mdct.c
78 | * original ISO routines had a delay of 528!
79 | * Takehiro's routines:
80 | */
81 |
82 | #define MDCTDELAY 48
83 | #define FFTOFFSET (224+MDCTDELAY)
84 |
85 | /*
86 | * Most decoders, including the one we use, have a delay of 528 samples.
87 | */
88 |
89 | #define DECDELAY 528
90 |
91 |
92 | /* number of subbands */
93 | #define SBLIMIT 32
94 |
95 | /* parition bands bands */
96 | #define CBANDS 64
97 |
98 | /* number of critical bands/scale factor bands where masking is computed*/
99 | #define SBPSY_l 21
100 | #define SBPSY_s 12
101 |
102 | /* total number of scalefactor bands encoded */
103 | #define SBMAX_l 22
104 | #define SBMAX_s 13
105 | #define PSFB21 6
106 | #define PSFB12 6
107 |
108 |
109 |
110 | /* FFT sizes */
111 | #define BLKSIZE 1024
112 | #define HBLKSIZE (BLKSIZE/2 + 1)
113 | #define BLKSIZE_s 256
114 | #define HBLKSIZE_s (BLKSIZE_s/2 + 1)
115 |
116 |
117 | /* #define switch_pe 1800 */
118 | #define NORM_TYPE 0
119 | #define START_TYPE 1
120 | #define SHORT_TYPE 2
121 | #define STOP_TYPE 3
122 |
123 | /*
124 | * Mode Extention:
125 | * When we are in stereo mode, there are 4 possible methods to store these
126 | * two channels. The stereo modes -m? are using a subset of them.
127 | *
128 | * -ms: MPG_MD_LR_LR
129 | * -mj: MPG_MD_LR_LR and MPG_MD_MS_LR
130 | * -mf: MPG_MD_MS_LR
131 | * -mi: all
132 | */
133 | #if 0
134 | #define MPG_MD_LR_LR 0
135 | #define MPG_MD_LR_I 1
136 | #define MPG_MD_MS_LR 2
137 | #define MPG_MD_MS_I 3
138 | #endif
139 | enum MPEGChannelMode
140 | { MPG_MD_LR_LR = 0
141 | , MPG_MD_LR_I = 1
142 | , MPG_MD_MS_LR = 2
143 | , MPG_MD_MS_I = 3
144 | };
145 |
146 | #ifndef lame_internal_flags_defined
147 | #define lame_internal_flags_defined
148 | struct lame_internal_flags;
149 | typedef struct lame_internal_flags lame_internal_flags;
150 | #endif
151 |
152 | int lame_encode_mp3_frame(lame_internal_flags * gfc,
153 | sample_t const *inbuf_l,
154 | sample_t const *inbuf_r, unsigned char *mp3buf, int mp3buf_size);
155 |
156 | #endif /* LAME_ENCODER_H */
157 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/fft.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Fast Fourier Transform include file
3 | *
4 | * Copyright (c) 2000 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_FFT_H
23 | #define LAME_FFT_H
24 |
25 | void fft_long(lame_internal_flags const *const gfc, FLOAT x_real[BLKSIZE],
26 | int chn, const sample_t *const data[2]);
27 |
28 | void fft_short(lame_internal_flags const *const gfc, FLOAT x_real[3][BLKSIZE_s],
29 | int chn, const sample_t *const data[2]);
30 |
31 | void init_fft(lame_internal_flags * const gfc);
32 |
33 | #endif
34 |
35 | /* End of fft.h */
36 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/gain_analysis.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ReplayGainAnalysis - analyzes input samples and give the recommended dB change
3 | * Copyright (C) 2001 David Robinson and Glen Sawyer
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * concept and filter values by David Robinson (David@Robinson.org)
20 | * -- blame him if you think the idea is flawed
21 | * coding by Glen Sawyer (mp3gain@hotmail.com) 735 W 255 N, Orem, UT 84057-4505 USA
22 | * -- blame him if you think this runs too slowly, or the coding is otherwise flawed
23 | *
24 | * For an explanation of the concepts and the basic algorithms involved, go to:
25 | * http://www.replaygain.org/
26 | */
27 |
28 | #ifndef GAIN_ANALYSIS_H
29 | #define GAIN_ANALYSIS_H
30 |
31 | #ifdef HAVE_INTTYPES_H
32 | # include
33 | #else
34 | # ifdef HAVE_STDINT_H
35 | # include
36 | # endif
37 | #endif
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 |
44 | typedef sample_t Float_t; /* Type used for filtering */
45 |
46 |
47 | #define PINK_REF 64.82 /* 298640883795 */ /* calibration value for 89dB */
48 |
49 |
50 | #define YULE_ORDER 10
51 | #define BUTTER_ORDER 2
52 | #define YULE_FILTER filterYule
53 | #define BUTTER_FILTER filterButter
54 | #define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */
55 | #define MAX_SAMP_FREQ 48000L /* maximum allowed sample frequency [Hz] */
56 | #define RMS_WINDOW_TIME_NUMERATOR 1L
57 | #define RMS_WINDOW_TIME_DENOMINATOR 20L /* numerator / denominator = time slice size [s] */
58 | #define STEPS_per_dB 100 /* Table entries per dB */
59 | #define MAX_dB 120 /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */
60 |
61 | enum { GAIN_NOT_ENOUGH_SAMPLES = -24601, GAIN_ANALYSIS_ERROR = 0, GAIN_ANALYSIS_OK =
62 | 1, INIT_GAIN_ANALYSIS_ERROR = 0, INIT_GAIN_ANALYSIS_OK = 1
63 | };
64 |
65 | enum { MAX_ORDER = (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
66 | , MAX_SAMPLES_PER_WINDOW = ((MAX_SAMP_FREQ * RMS_WINDOW_TIME_NUMERATOR) / RMS_WINDOW_TIME_DENOMINATOR + 1) /* max. Samples per Time slice */
67 | };
68 |
69 | struct replaygain_data {
70 | Float_t linprebuf[MAX_ORDER * 2];
71 | Float_t *linpre; /* left input samples, with pre-buffer */
72 | Float_t lstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
73 | Float_t *lstep; /* left "first step" (i.e. post first filter) samples */
74 | Float_t loutbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
75 | Float_t *lout; /* left "out" (i.e. post second filter) samples */
76 | Float_t rinprebuf[MAX_ORDER * 2];
77 | Float_t *rinpre; /* right input samples ... */
78 | Float_t rstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
79 | Float_t *rstep;
80 | Float_t routbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
81 | Float_t *rout;
82 | long sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */
83 | long totsamp;
84 | double lsum;
85 | double rsum;
86 | int freqindex;
87 | int first;
88 | uint32_t A[STEPS_per_dB * MAX_dB];
89 | uint32_t B[STEPS_per_dB * MAX_dB];
90 |
91 | };
92 | #ifndef replaygain_data_defined
93 | #define replaygain_data_defined
94 | typedef struct replaygain_data replaygain_t;
95 | #endif
96 |
97 |
98 |
99 |
100 | int InitGainAnalysis(replaygain_t * rgData, long samplefreq);
101 | int AnalyzeSamples(replaygain_t * rgData, const Float_t * left_samples,
102 | const Float_t * right_samples, size_t num_samples, int num_channels);
103 | Float_t GetTitleGain(replaygain_t * rgData);
104 |
105 |
106 | #ifdef __cplusplus
107 | }
108 | #endif
109 | #endif /* GAIN_ANALYSIS_H */
110 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/i386/nasm.h:
--------------------------------------------------------------------------------
1 |
2 | ; Copyright (C) 1999 URURI
3 |
4 | ; nasm�ѥޥ���
5 | ; 1999/08/21 ���
6 | ; 1999/10/10 ���Ĥ��ɲ�
7 | ; 1999/10/27 aout�б�
8 | ; 1999/11/07 pushf, popf ��NASM�ΥХ��б�
9 | ; 1999/12/02 for BCC ( Thanks to Miquel )
10 |
11 | ; for Windows Visual C++ -> define WIN32
12 | ; Borland or cygwin -> WIN32 and COFF
13 | ; for FreeBSD 2.x -> AOUT
14 | ; for TownsOS -> __tos__
15 | ; otherwise -> none
16 |
17 | ;̾����դ���
18 |
19 | BITS 32
20 |
21 | section .note.GNU-stack noalloc noexec nowrite progbits
22 |
23 | %ifdef YASM
24 | %define segment_code segment .text align=16 use32
25 | %define segment_data segment .data align=16 use32
26 | %define segment_bss segment .bss align=16 use32
27 | %elifdef WIN32
28 | %define segment_code segment .text align=16 class=CODE use32
29 | %define segment_data segment .data align=16 class=DATA use32
30 | %ifdef __BORLANDC__
31 | %define segment_bss segment .data align=16 class=DATA use32
32 | %else
33 | %define segment_bss segment .bss align=16 class=DATA use32
34 | %endif
35 | %elifdef AOUT
36 | %define _NAMING
37 | %define segment_code segment .text
38 | %define segment_data segment .data
39 | %define segment_bss segment .bss
40 | %else
41 | %ifidn __OUTPUT_FORMAT__,elf
42 | section .note.GNU-stack progbits noalloc noexec nowrite align=1
43 | %endif
44 | %define segment_code segment .text align=16 class=CODE use32
45 | %define segment_data segment .data align=16 class=DATA use32
46 | %define segment_bss segment .bss align=16 class=DATA use32
47 | %endif
48 |
49 | %ifdef WIN32
50 | %define _NAMING
51 | %endif
52 |
53 | %ifdef __tos__
54 | group CGROUP text
55 | group DGROUP data
56 | %endif
57 |
58 | ;ñ�����ư��������
59 |
60 | %idefine float dword
61 | %idefine fsize 4
62 | %idefine fsizen(a) (fsize*(a))
63 |
64 | ;��ɷ��
65 |
66 | %idefine wsize 2
67 | %idefine wsizen(a) (wsize*(a))
68 | %idefine dwsize 4
69 | %idefine dwsizen(a) (dwsize*(a))
70 |
71 | ;REG
72 |
73 | %define r0 eax
74 | %define r1 ebx
75 | %define r2 ecx
76 | %define r3 edx
77 | %define r4 esi
78 | %define r5 edi
79 | %define r6 ebp
80 | %define r7 esp
81 |
82 | ;MMX,3DNow!,SSE
83 |
84 | %define pmov movq
85 | %define pmovd movd
86 |
87 | %define pupldq punpckldq
88 | %define puphdq punpckhdq
89 | %define puplwd punpcklwd
90 | %define puphwd punpckhwd
91 |
92 | %define xm0 xmm0
93 | %define xm1 xmm1
94 | %define xm2 xmm2
95 | %define xm3 xmm3
96 | %define xm4 xmm4
97 | %define xm5 xmm5
98 | %define xm6 xmm6
99 | %define xm7 xmm7
100 |
101 | ;�����åե��Ѥ�4�ʥޥ���
102 |
103 | %define R4(a,b,c,d) (a*64+b*16+c*4+d)
104 |
105 | ;C�饤���ʴʰץޥ���
106 |
107 | %imacro globaldef 1
108 | %ifdef _NAMING
109 | %define %1 _%1
110 | %endif
111 | global %1
112 | %endmacro
113 |
114 | %imacro externdef 1
115 | %ifdef _NAMING
116 | %define %1 _%1
117 | %endif
118 | extern %1
119 | %endmacro
120 |
121 | %imacro proc 1
122 | %push proc
123 | %ifdef _NAMING
124 | global _%1
125 | %else
126 | global %1
127 | %endif
128 |
129 | align 32
130 | %1:
131 | _%1:
132 |
133 | %assign %$STACK 0
134 | %assign %$STACKN 0
135 | %assign %$ARG 4
136 | %endmacro
137 |
138 | %imacro endproc 0
139 | %ifnctx proc
140 | %error expected 'proc' before 'endproc'.
141 | %else
142 | %if %$STACK > 0
143 | add esp, %$STACK
144 | %endif
145 |
146 | %if %$STACK <> (-%$STACKN)
147 | %error STACKLEVEL mismatch check 'local', 'alloc', 'pushd', 'popd'
148 | %endif
149 |
150 | ret
151 | %pop
152 | %endif
153 | %endmacro
154 |
155 | %idefine sp(a) esp+%$STACK+a
156 |
157 | %imacro arg 1
158 | %00 equ %$ARG
159 | %assign %$ARG %$ARG+%1
160 | %endmacro
161 |
162 | %imacro local 1
163 | %assign %$STACKN %$STACKN-%1
164 | %00 equ %$STACKN
165 | %endmacro
166 |
167 | %imacro alloc 0
168 | sub esp, (-%$STACKN)-%$STACK
169 | %assign %$STACK (-%$STACKN)
170 | %endmacro
171 |
172 | %imacro pushd 1-*
173 | %rep %0
174 | push %1
175 | %assign %$STACK %$STACK+4
176 | %rotate 1
177 | %endrep
178 | %endmacro
179 |
180 | %imacro popd 1-*
181 | %rep %0
182 | %rotate -1
183 | pop %1
184 | %assign %$STACK %$STACK-4
185 | %endrep
186 | %endmacro
187 |
188 | ; bug of NASM-0.98
189 | %define pushf db 0x66, 0x9C
190 | %define popf db 0x66, 0x9D
191 |
192 | %define ge16(n) ((((n) / 16)*0xFFFFFFFF) & 0xFFFFFFFF)
193 | %define ge15(n) ((((n) / 15)*0xFFFFFFFF) & 0xFFFFFFFF)
194 | %define ge14(n) ((((n) / 14)*0xFFFFFFFF) & 0xFFFFFFFF)
195 | %define ge13(n) ((((n) / 13)*0xFFFFFFFF) & 0xFFFFFFFF)
196 | %define ge12(n) ((((n) / 12)*0xFFFFFFFF) & 0xFFFFFFFF)
197 | %define ge11(n) ((((n) / 11)*0xFFFFFFFF) & 0xFFFFFFFF)
198 | %define ge10(n) ((((n) / 10)*0xFFFFFFFF) & 0xFFFFFFFF)
199 | %define ge9(n) ((((n) / 9)*0xFFFFFFFF) & 0xFFFFFFFF)
200 | %define ge8(n) (ge9(n) | ((((n) / 8)*0xFFFFFFFF) & 0xFFFFFFFF))
201 | %define ge7(n) (ge9(n) | ((((n) / 7)*0xFFFFFFFF) & 0xFFFFFFFF))
202 | %define ge6(n) (ge9(n) | ((((n) / 6)*0xFFFFFFFF) & 0xFFFFFFFF))
203 | %define ge5(n) (ge9(n) | ((((n) / 5)*0xFFFFFFFF) & 0xFFFFFFFF))
204 | %define ge4(n) (ge5(n) | ((((n) / 4)*0xFFFFFFFF) & 0xFFFFFFFF))
205 | %define ge3(n) (ge5(n) | ((((n) / 3)*0xFFFFFFFF) & 0xFFFFFFFF))
206 | %define ge2(n) (ge3(n) | ((((n) / 2)*0xFFFFFFFF) & 0xFFFFFFFF))
207 | %define ge1(n) (ge2(n) | ((((n) / 1)*0xFFFFFFFF) & 0xFFFFFFFF))
208 |
209 | ; macro to align for begining of loop
210 | ; %1 does not align if it LE bytes to next alignment
211 | ; 4..16
212 | ; default is 12
213 |
214 | %imacro loopalignK6 0-1 12
215 | %%here:
216 | times (($$-%%here) & 15 & ge1(($$-%%here) & 15) & ~ge4(($$-%%here) & 15)) nop
217 | times (1 & ge4(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) jmp short %%skip
218 | times (((($$-%%here) & 15)-2) & ge4(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) nop
219 | %%skip:
220 | %endmacro
221 |
222 | %imacro loopalignK7 0-1 12
223 | %%here:
224 | times (1 & ge1(($$-%%here) & 15) & ~ge2(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) nop
225 | times (1 & ge2(($$-%%here) & 15) & ~ge3(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Bh,0C0h
226 | times (1 & ge3(($$-%%here) & 15) & ~ge4(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,020h
227 | times (1 & ge4(($$-%%here) & 15) & ~ge5(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,044h,020h,000h
228 | times (1 & ge5(($$-%%here) & 15) & ~ge6(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,044h,020h,000h,090h
229 | times (1 & ge6(($$-%%here) & 15) & ~ge7(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,080h,0,0,0,0
230 | times (1 & ge7(($$-%%here) & 15) & ~ge8(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,005h,0,0,0,0
231 | times (1 & ge8(($$-%%here) & 15) & ~ge9(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 08Dh,004h,005h,0,0,0,0,90h
232 | times (1 & ge9(($$-%%here) & 15) & ~ge10(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,007h,90h,90h,90h,90h,90h,90h,90h
233 | times (1 & ge10(($$-%%here) & 15) & ~ge11(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,008h,90h,90h,90h,90h,90h,90h,90h,90h
234 | times (1 & ge11(($$-%%here) & 15) & ~ge12(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,009h,90h,90h,90h,90h,90h,90h,90h,90h,90h
235 | times (1 & ge12(($$-%%here) & 15) & ~ge13(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Ah,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
236 | times (1 & ge13(($$-%%here) & 15) & ~ge14(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Bh,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
237 | times (1 & ge14(($$-%%here) & 15) & ~ge15(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Ch,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
238 | times (1 & ge15(($$-%%here) & 15) & ~ge16(($$-%%here) & 15) & ~ge%1(($$-%%here) & 15)) DB 0EBh,00Dh,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h,90h
239 | %%skip:
240 | %endmacro
241 |
242 | %imacro loopalign 0-1 12
243 | loopalignK7 %1
244 | %endmacro
245 | %define PACK(x,y,z,w) (x*64+y*16+z*4+w)
246 |
247 | %ifidn __OUTPUT_FORMAT__,elf
248 |
249 | %idefine PIC_BASE(A) _GLOBAL_OFFSET_TABLE_ + $$ - $ wrt ..gotpc
250 | %idefine PIC_EBP_REL(A) ebp + A wrt ..gotoff
251 | %macro PIC_OFFSETTABLE 0
252 | extern _GLOBAL_OFFSET_TABLE_
253 | get_pc.bp:
254 | mov ebp, [esp]
255 | retn
256 | %endmacro
257 |
258 | %else
259 |
260 | %define PIC_BASE(A) (0)
261 | %define PIC_EBP_REL(A) (A)
262 | %macro PIC_OFFSETTABLE 0
263 | get_pc.bp:
264 | mov ebp, [esp]
265 | retn
266 | %endmacro
267 |
268 | %endif
269 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/id3tag.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef LAME_ID3_H
3 | #define LAME_ID3_H
4 |
5 |
6 | #define CHANGED_FLAG (1U << 0)
7 | #define ADD_V2_FLAG (1U << 1)
8 | #define V1_ONLY_FLAG (1U << 2)
9 | #define V2_ONLY_FLAG (1U << 3)
10 | #define SPACE_V1_FLAG (1U << 4)
11 | #define PAD_V2_FLAG (1U << 5)
12 |
13 | enum {
14 | MIMETYPE_NONE = 0,
15 | MIMETYPE_JPEG,
16 | MIMETYPE_PNG,
17 | MIMETYPE_GIF,
18 | };
19 |
20 | typedef struct FrameDataNode {
21 | struct FrameDataNode *nxt;
22 | uint32_t fid; /* Frame Identifier */
23 | char lng[4]; /* 3-character language descriptor */
24 | struct {
25 | union {
26 | char *l; /* ptr to Latin-1 chars */
27 | unsigned short *u; /* ptr to UCS-2 text */
28 | unsigned char *b; /* ptr to raw bytes */
29 | } ptr;
30 | size_t dim;
31 | int enc; /* 0:Latin-1, 1:UCS-2, 2:RAW */
32 | } dsc , txt;
33 | } FrameDataNode;
34 |
35 |
36 | typedef struct id3tag_spec {
37 | /* private data members */
38 | unsigned int flags;
39 | int year;
40 | char *title;
41 | char *artist;
42 | char *album;
43 | char *comment;
44 | int track_id3v1;
45 | int genre_id3v1;
46 | unsigned char *albumart;
47 | unsigned int albumart_size;
48 | unsigned int padding_size;
49 | int albumart_mimetype;
50 | FrameDataNode *v2_head, *v2_tail;
51 | } id3tag_spec;
52 |
53 |
54 | /* write tag into stream at current position */
55 | extern int id3tag_write_v2(lame_global_flags * gfp);
56 | extern int id3tag_write_v1(lame_global_flags * gfp);
57 | /*
58 | * NOTE: A version 2 tag will NOT be added unless one of the text fields won't
59 | * fit in a version 1 tag (e.g. the title string is longer than 30 characters),
60 | * or the "id3tag_add_v2" or "id3tag_v2_only" functions are used.
61 | */
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/l3side.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Layer 3 side include file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_L3SIDE_H
23 | #define LAME_L3SIDE_H
24 |
25 | /* max scalefactor band, max(SBMAX_l, SBMAX_s*3, (SBMAX_s-3)*3+8) */
26 | #define SFBMAX (SBMAX_s*3)
27 |
28 | /* Layer III side information. */
29 | typedef struct {
30 | int l[1 + SBMAX_l];
31 | int s[1 + SBMAX_s];
32 | int psfb21[1 + PSFB21];
33 | int psfb12[1 + PSFB12];
34 | } scalefac_struct;
35 |
36 |
37 | typedef struct {
38 | FLOAT l[SBMAX_l];
39 | FLOAT s[SBMAX_s][3];
40 | } III_psy_xmin;
41 |
42 | typedef struct {
43 | III_psy_xmin thm;
44 | III_psy_xmin en;
45 | } III_psy_ratio;
46 |
47 | typedef struct {
48 | FLOAT xr[576];
49 | int l3_enc[576];
50 | int scalefac[SFBMAX];
51 | FLOAT xrpow_max;
52 |
53 | int part2_3_length;
54 | int big_values;
55 | int count1;
56 | int global_gain;
57 | int scalefac_compress;
58 | int block_type;
59 | int mixed_block_flag;
60 | int table_select[3];
61 | int subblock_gain[3 + 1];
62 | int region0_count;
63 | int region1_count;
64 | int preflag;
65 | int scalefac_scale;
66 | int count1table_select;
67 |
68 | int part2_length;
69 | int sfb_lmax;
70 | int sfb_smin;
71 | int psy_lmax;
72 | int sfbmax;
73 | int psymax;
74 | int sfbdivide;
75 | int width[SFBMAX];
76 | int window[SFBMAX];
77 | int count1bits;
78 | /* added for LSF */
79 | const int *sfb_partition_table;
80 | int slen[4];
81 |
82 | int max_nonzero_coeff;
83 | char energy_above_cutoff[SFBMAX];
84 | } gr_info;
85 |
86 | typedef struct {
87 | gr_info tt[2][2];
88 | int main_data_begin;
89 | int private_bits;
90 | int resvDrain_pre;
91 | int resvDrain_post;
92 | int scfsi[2][4];
93 | } III_side_info_t;
94 |
95 | #endif
96 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/lame-analysis.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GTK plotting routines source file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_GTKANAL_H
23 | #define LAME_GTKANAL_H
24 |
25 |
26 | #define READ_AHEAD 40 /* number of frames to read ahead */
27 | #define MAXMPGLAG READ_AHEAD /* if the mpg123 lag becomes bigger than this
28 | we have to stop */
29 | #define NUMBACK 6 /* number of frames we can back up */
30 | #define NUMPINFO (NUMBACK+READ_AHEAD+1)
31 |
32 |
33 |
34 | struct plotting_data {
35 | int frameNum; /* current frame number */
36 | int frameNum123;
37 | int num_samples; /* number of pcm samples read for this frame */
38 | double frametime; /* starting time of frame, in seconds */
39 | double pcmdata[2][1600];
40 | double pcmdata2[2][1152 + 1152 - DECDELAY];
41 | double xr[2][2][576];
42 | double mpg123xr[2][2][576];
43 | double ms_ratio[2];
44 | double ms_ener_ratio[2];
45 |
46 | /* L,R, M and S values */
47 | double energy_save[4][BLKSIZE]; /* psymodel is one ahead */
48 | double energy[2][4][BLKSIZE];
49 | double pe[2][4];
50 | double thr[2][4][SBMAX_l];
51 | double en[2][4][SBMAX_l];
52 | double thr_s[2][4][3 * SBMAX_s];
53 | double en_s[2][4][3 * SBMAX_s];
54 | double ers_save[4]; /* psymodel is one ahead */
55 | double ers[2][4];
56 |
57 | double sfb[2][2][SBMAX_l];
58 | double sfb_s[2][2][3 * SBMAX_s];
59 | double LAMEsfb[2][2][SBMAX_l];
60 | double LAMEsfb_s[2][2][3 * SBMAX_s];
61 |
62 | int LAMEqss[2][2];
63 | int qss[2][2];
64 | int big_values[2][2];
65 | int sub_gain[2][2][3];
66 |
67 | double xfsf[2][2][SBMAX_l];
68 | double xfsf_s[2][2][3 * SBMAX_s];
69 |
70 | int over[2][2];
71 | double tot_noise[2][2];
72 | double max_noise[2][2];
73 | double over_noise[2][2];
74 | int over_SSD[2][2];
75 | int blocktype[2][2];
76 | int scalefac_scale[2][2];
77 | int preflag[2][2];
78 | int mpg123blocktype[2][2];
79 | int mixed[2][2];
80 | int mainbits[2][2];
81 | int sfbits[2][2];
82 | int LAMEmainbits[2][2];
83 | int LAMEsfbits[2][2];
84 | int framesize, stereo, js, ms_stereo, i_stereo, emph, bitrate, sampfreq, maindata;
85 | int crc, padding;
86 | int scfsi[2], mean_bits, resvsize;
87 | int totbits;
88 | };
89 | #ifndef plotting_data_defined
90 | #define plotting_data_defined
91 | typedef struct plotting_data plotting_data;
92 | #endif
93 | #if 0
94 | extern plotting_data *pinfo;
95 | #endif
96 | #endif
97 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/lameerror.h:
--------------------------------------------------------------------------------
1 | /*
2 | * A collection of LAME Error Codes
3 | *
4 | * Please use the constants defined here instead of some arbitrary
5 | * values. Currently the values starting at -10 to avoid intersection
6 | * with the -1, -2, -3 and -4 used in the current code.
7 | *
8 | * May be this should be a part of the include/lame.h.
9 | */
10 |
11 | typedef enum {
12 | LAME_OKAY = 0,
13 | LAME_NOERROR = 0,
14 | LAME_GENERICERROR = -1,
15 | LAME_NOMEM = -10,
16 | LAME_BADBITRATE = -11,
17 | LAME_BADSAMPFREQ = -12,
18 | LAME_INTERNALERROR = -13,
19 |
20 | FRONTEND_READERROR = -80,
21 | FRONTEND_WRITEERROR = -81,
22 | FRONTEND_FILETOOLARGE = -82,
23 |
24 | } lame_errorcodes_t;
25 |
26 | /* end of lameerror.h */
27 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/machine.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Machine dependent defines/includes for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_MACHINE_H
23 | #define LAME_MACHINE_H
24 |
25 | #include "version.h"
26 |
27 | #if (LAME_RELEASE_VERSION == 0)
28 | #undef NDEBUG
29 | #endif
30 |
31 | #include
32 | #include
33 |
34 | #ifdef STDC_HEADERS
35 | # include
36 | # include
37 | #else
38 | # ifndef HAVE_STRCHR
39 | # define strchr index
40 | # define strrchr rindex
41 | # endif
42 | char *strchr(), *strrchr();
43 | # ifndef HAVE_MEMCPY
44 | # define memcpy(d, s, n) bcopy ((s), (d), (n))
45 | # define memmove(d, s, n) bcopy ((s), (d), (n))
46 | # endif
47 | #endif
48 |
49 | #if defined(__riscos__) && defined(FPA10)
50 | # include "ymath.h"
51 | #else
52 | # include
53 | #endif
54 | #include
55 |
56 | #include
57 |
58 | #ifdef HAVE_ERRNO_H
59 | # include
60 | #endif
61 | #ifdef HAVE_FCNTL_H
62 | # include
63 | #endif
64 |
65 | #if defined(macintosh)
66 | # include
67 | # include
68 | #else
69 | # include
70 | # include
71 | #endif
72 |
73 | #ifdef HAVE_INTTYPES_H
74 | # include
75 | #else
76 | # ifdef HAVE_STDINT_H
77 | # include
78 | # endif
79 | #endif
80 |
81 | #ifdef WITH_DMALLOC
82 | #include
83 | #endif
84 |
85 | /*
86 | * 3 different types of pow() functions:
87 | * - table lookup
88 | * - pow()
89 | * - exp() on some machines this is claimed to be faster than pow()
90 | */
91 |
92 | #define POW20(x) (assert(0 <= (x+Q_MAX2) && x < Q_MAX), pow20[x+Q_MAX2])
93 | /*#define POW20(x) pow(2.0,((double)(x)-210)*.25) */
94 | /*#define POW20(x) exp( ((double)(x)-210)*(.25*LOG2) ) */
95 |
96 | #define IPOW20(x) (assert(0 <= x && x < Q_MAX), ipow20[x])
97 | /*#define IPOW20(x) exp( -((double)(x)-210)*.1875*LOG2 ) */
98 | /*#define IPOW20(x) pow(2.0,-((double)(x)-210)*.1875) */
99 |
100 | /* in case this is used without configure */
101 | #ifndef inline
102 | # define inline
103 | #endif
104 |
105 | #if defined(_MSC_VER)
106 | # undef inline
107 | # define inline _inline
108 | #elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC)
109 | /* if __GNUC__ we always want to inline, not only if the user requests it */
110 | # undef inline
111 | # define inline __inline
112 | #endif
113 |
114 | #if defined(_MSC_VER)
115 | # pragma warning( disable : 4244 )
116 | /*# pragma warning( disable : 4305 ) */
117 | #endif
118 |
119 | /*
120 | * FLOAT for variables which require at least 32 bits
121 | * FLOAT8 for variables which require at least 64 bits
122 | *
123 | * On some machines, 64 bit will be faster than 32 bit. Also, some math
124 | * routines require 64 bit float, so setting FLOAT=float will result in a
125 | * lot of conversions.
126 | */
127 |
128 | #if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) )
129 | # define WIN32_LEAN_AND_MEAN
130 | # include
131 | # include
132 | # define FLOAT_MAX FLT_MAX
133 | #else
134 | # ifndef FLOAT
135 | typedef float FLOAT;
136 | # ifdef FLT_MAX
137 | # define FLOAT_MAX FLT_MAX
138 | # else
139 | # define FLOAT_MAX 1e37 /* approx */
140 | # endif
141 | # endif
142 | #endif
143 |
144 | #ifndef FLOAT8
145 | typedef double FLOAT8;
146 | # ifdef DBL_MAX
147 | # define FLOAT8_MAX DBL_MAX
148 | # else
149 | # define FLOAT8_MAX 1e99 /* approx */
150 | # endif
151 | #else
152 | # ifdef FLT_MAX
153 | # define FLOAT8_MAX FLT_MAX
154 | # else
155 | # define FLOAT8_MAX 1e37 /* approx */
156 | # endif
157 | #endif
158 |
159 | /* sample_t must be floating point, at least 32 bits */
160 | typedef FLOAT sample_t;
161 |
162 | #define dimension_of(array) (sizeof(array)/sizeof(array[0]))
163 | #define beyond(array) (array+dimension_of(array))
164 | #define compiletime_assert(expression) extern char static_assert_##FILE##_##LINE[expression?1:0]
165 |
166 | #if 1
167 | #define EQ(a,b) (\
168 | (fabs(a) > fabs(b)) \
169 | ? (fabs((a)-(b)) <= (fabs(a) * 1e-6f)) \
170 | : (fabs((a)-(b)) <= (fabs(b) * 1e-6f)))
171 | #else
172 | #define EQ(a,b) (fabs((a)-(b))<1E-37)
173 | #endif
174 |
175 | #define NEQ(a,b) (!EQ(a,b))
176 |
177 | #endif
178 |
179 | #ifdef _MSC_VER
180 | # if _MSC_VER < 1400
181 | # define fabsf fabs
182 | # define powf pow
183 | # define log10f log10
184 | # endif
185 | #endif
186 |
187 |
188 | /* end of machine.h */
189 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/newmdct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * New Modified DCT include file
3 | *
4 | * Copyright (c) 1999 Takehiro TOMINAGA
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_NEWMDCT_H
23 | #define LAME_NEWMDCT_H
24 |
25 | void mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1);
26 |
27 | #endif /* LAME_NEWMDCT_H */
28 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/psymodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * psymodel.h
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_PSYMODEL_H
23 | #define LAME_PSYMODEL_H
24 |
25 |
26 | int L3psycho_anal_ns(lame_internal_flags * gfc,
27 | const sample_t *const buffer[2], int gr,
28 | III_psy_ratio ratio[2][2],
29 | III_psy_ratio MS_ratio[2][2],
30 | FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
31 |
32 | int L3psycho_anal_vbr(lame_internal_flags * gfc,
33 | const sample_t *const buffer[2], int gr,
34 | III_psy_ratio ratio[2][2],
35 | III_psy_ratio MS_ratio[2][2],
36 | FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
37 |
38 |
39 | int psymodel_init(lame_global_flags const* gfp);
40 |
41 |
42 | #define rpelev 2
43 | #define rpelev2 16
44 | #define rpelev_s 2
45 | #define rpelev2_s 16
46 |
47 | /* size of each partition band, in barks: */
48 | #define DELBARK .34
49 |
50 |
51 | /* tuned for output level (sensitive to energy scale) */
52 | #define VO_SCALE (1./( 14752*14752 )/(BLKSIZE/2))
53 |
54 | #define temporalmask_sustain_sec 0.01
55 |
56 | #define NS_PREECHO_ATT0 0.8
57 | #define NS_PREECHO_ATT1 0.6
58 | #define NS_PREECHO_ATT2 0.3
59 |
60 | #define NS_MSFIX 3.5
61 | #define NSATTACKTHRE 4.4
62 | #define NSATTACKTHRE_S 25
63 |
64 | #endif /* LAME_PSYMODEL_H */
65 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/quantize.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 quantization
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_QUANTIZE_H
23 | #define LAME_QUANTIZE_H
24 |
25 | void CBR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
26 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
27 |
28 | void VBR_old_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
29 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
30 |
31 | void VBR_new_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
32 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
33 |
34 | void ABR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
35 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
36 |
37 |
38 | #endif /* LAME_QUANTIZE_H */
39 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/quantize_pvt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * quantize_pvt include file
3 | *
4 | * Copyright (c) 1999 Takehiro TOMINAGA
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_QUANTIZE_PVT_H
23 | #define LAME_QUANTIZE_PVT_H
24 |
25 | #define IXMAX_VAL 8206 /* ix always <= 8191+15. see count_bits() */
26 |
27 | /* buggy Winamp decoder cannot handle values > 8191 */
28 | /* #define IXMAX_VAL 8191 */
29 |
30 | #define PRECALC_SIZE (IXMAX_VAL+2)
31 |
32 |
33 | extern const int nr_of_sfb_block[6][3][4];
34 | extern const int pretab[SBMAX_l];
35 | extern const int slen1_tab[16];
36 | extern const int slen2_tab[16];
37 |
38 | extern const scalefac_struct sfBandIndex[9];
39 |
40 | extern FLOAT pow43[PRECALC_SIZE];
41 | #ifdef TAKEHIRO_IEEE754_HACK
42 | extern FLOAT adj43asm[PRECALC_SIZE];
43 | #else
44 | extern FLOAT adj43[PRECALC_SIZE];
45 | #endif
46 |
47 | #define Q_MAX (256+1)
48 | #define Q_MAX2 116 /* minimum possible number of
49 | -cod_info->global_gain
50 | + ((scalefac[] + (cod_info->preflag ? pretab[sfb] : 0))
51 | << (cod_info->scalefac_scale + 1))
52 | + cod_info->subblock_gain[cod_info->window[sfb]] * 8;
53 |
54 | for long block, 0+((15+3)<<2) = 18*4 = 72
55 | for short block, 0+(15<<2)+7*8 = 15*4+56 = 116
56 | */
57 |
58 | extern FLOAT pow20[Q_MAX + Q_MAX2 + 1];
59 | extern FLOAT ipow20[Q_MAX];
60 |
61 | typedef struct calc_noise_result_t {
62 | FLOAT over_noise; /* sum of quantization noise > masking */
63 | FLOAT tot_noise; /* sum of all quantization noise */
64 | FLOAT max_noise; /* max quantization noise */
65 | int over_count; /* number of quantization noise > masking */
66 | int over_SSD; /* SSD-like cost of distorted bands */
67 | int bits;
68 | } calc_noise_result;
69 |
70 |
71 | /**
72 | * allows re-use of previously
73 | * computed noise values
74 | */
75 | typedef struct calc_noise_data_t {
76 | int global_gain;
77 | int sfb_count1;
78 | int step[39];
79 | FLOAT noise[39];
80 | FLOAT noise_log[39];
81 | } calc_noise_data;
82 |
83 |
84 | int on_pe(lame_internal_flags * gfc, const FLOAT pe[2][2],
85 | int targ_bits[2], int mean_bits, int gr, int cbr);
86 |
87 | void reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits);
88 |
89 |
90 | void iteration_init(lame_internal_flags * gfc);
91 |
92 |
93 | int calc_xmin(lame_internal_flags const *gfc,
94 | III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * l3_xmin);
95 |
96 | int calc_noise(const gr_info * const cod_info,
97 | const FLOAT * l3_xmin,
98 | FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise);
99 |
100 | void set_frame_pinfo(lame_internal_flags * gfc, const III_psy_ratio ratio[2][2]);
101 |
102 |
103 |
104 |
105 | /* takehiro.c */
106 |
107 | int count_bits(lame_internal_flags const *const gfc, const FLOAT * const xr,
108 | gr_info * const cod_info, calc_noise_data * prev_noise);
109 | int noquant_count_bits(lame_internal_flags const *const gfc,
110 | gr_info * const cod_info, calc_noise_data * prev_noise);
111 |
112 |
113 | void best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const cod_info);
114 |
115 | void best_scalefac_store(const lame_internal_flags * gfc, const int gr, const int ch,
116 | III_side_info_t * const l3_side);
117 |
118 | int scale_bitcount(const lame_internal_flags * gfc, gr_info * cod_info);
119 |
120 | void huffman_init(lame_internal_flags * const gfc);
121 |
122 | void init_xrpow_core_init(lame_internal_flags * const gfc);
123 |
124 | FLOAT athAdjust(FLOAT a, FLOAT x, FLOAT athFloor, float ATHfixpoint);
125 |
126 | #define LARGE_BITS 100000
127 |
128 | #endif /* LAME_QUANTIZE_PVT_H */
129 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/reservoir.h:
--------------------------------------------------------------------------------
1 | /*
2 | * bit reservoir include file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_RESERVOIR_H
23 | #define LAME_RESERVOIR_H
24 |
25 | int ResvFrameBegin(lame_internal_flags * gfc, int *mean_bits);
26 | void ResvMaxBits(lame_internal_flags * gfc, int mean_bits, int *targ_bits, int *max_bits,
27 | int cbr);
28 | void ResvAdjust(lame_internal_flags * gfc, gr_info const *gi);
29 | void ResvFrameEnd(lame_internal_flags * gfc, int mean_bits);
30 |
31 | #endif /* LAME_RESERVOIR_H */
32 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/set_get.h:
--------------------------------------------------------------------------------
1 | /*
2 | * set_get.h -- Internal set/get definitions
3 | *
4 | * Copyright (C) 2003 Gabriel Bouvigne / Lame project
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 | */
20 |
21 | #ifndef __SET_GET_H__
22 | #define __SET_GET_H__
23 |
24 | #include "lame.h"
25 |
26 | #if defined(__cplusplus)
27 | extern "C" {
28 | #endif
29 |
30 | /* select psychoacoustic model */
31 |
32 | /* manage short blocks */
33 | int CDECL lame_set_short_threshold(lame_global_flags *, float, float);
34 | int CDECL lame_set_short_threshold_lrm(lame_global_flags *, float);
35 | float CDECL lame_get_short_threshold_lrm(const lame_global_flags *);
36 | int CDECL lame_set_short_threshold_s(lame_global_flags *, float);
37 | float CDECL lame_get_short_threshold_s(const lame_global_flags *);
38 |
39 |
40 | int CDECL lame_set_maskingadjust(lame_global_flags *, float);
41 | float CDECL lame_get_maskingadjust(const lame_global_flags *);
42 |
43 | int CDECL lame_set_maskingadjust_short(lame_global_flags *, float);
44 | float CDECL lame_get_maskingadjust_short(const lame_global_flags *);
45 |
46 | /* select ATH formula 4 shape */
47 | int CDECL lame_set_ATHcurve(lame_global_flags *, float);
48 | float CDECL lame_get_ATHcurve(const lame_global_flags *);
49 |
50 | int CDECL lame_set_preset_notune(lame_global_flags *, int);
51 |
52 | /* substep shaping method */
53 | int CDECL lame_set_substep(lame_global_flags *, int);
54 | int CDECL lame_get_substep(const lame_global_flags *);
55 |
56 | /* scalefactors scale */
57 | int CDECL lame_set_sfscale(lame_global_flags *, int);
58 | int CDECL lame_get_sfscale(const lame_global_flags *);
59 |
60 | /* subblock gain */
61 | int CDECL lame_set_subblock_gain(lame_global_flags *, int);
62 | int CDECL lame_get_subblock_gain(const lame_global_flags *);
63 |
64 |
65 |
66 | /*presets*/
67 | int apply_preset(lame_global_flags *, int preset, int enforce);
68 |
69 | void CDECL lame_set_tune(lame_t, float); /* FOR INTERNAL USE ONLY */
70 | void CDECL lame_set_msfix(lame_t gfp, double msfix);
71 |
72 |
73 | #if defined(__cplusplus)
74 | }
75 | #endif
76 | #endif
77 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/tables.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MPEG layer 3 tables include file
3 | *
4 | * Copyright (c) 1999 Albert L Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_TABLES_H
23 | #define LAME_TABLES_H
24 |
25 | #if 0
26 | typedef struct {
27 | unsigned char no;
28 | unsigned char width;
29 | unsigned char minval_2;
30 | float quiet_thr;
31 | float norm;
32 | float bark;
33 | } type1_t;
34 |
35 | typedef struct {
36 | unsigned char no;
37 | unsigned char width;
38 | float quiet_thr;
39 | float norm;
40 | float SNR;
41 | float bark;
42 | } type2_t;
43 |
44 | typedef struct {
45 | unsigned int no:5;
46 | unsigned int cbw:3;
47 | unsigned int bu:6;
48 | unsigned int bo:6;
49 | unsigned int w1_576:10;
50 | unsigned int w2_576:10;
51 | } type34_t;
52 |
53 | typedef struct {
54 | size_t len1;
55 | const type1_t *const tab1;
56 | size_t len2;
57 | const type2_t *const tab2;
58 | size_t len3;
59 | const type34_t *const tab3;
60 | size_t len4;
61 | const type34_t *const tab4;
62 | } type5_t;
63 |
64 | extern const type5_t table5[6];
65 |
66 | #endif
67 |
68 | #define HTN 34
69 |
70 | struct huffcodetab {
71 | const unsigned int xlen; /* max. x-index+ */
72 | const unsigned int linmax; /* max number to be stored in linbits */
73 | const uint16_t *table; /* pointer to array[xlen][ylen] */
74 | const uint8_t *hlen; /* pointer to array[xlen][ylen] */
75 | };
76 |
77 | extern const struct huffcodetab ht[HTN];
78 | /* global memory block */
79 | /* array of all huffcodtable headers */
80 | /* 0..31 Huffman code table 0..31 */
81 | /* 32,33 count1-tables */
82 |
83 | extern const uint8_t t32l[];
84 | extern const uint8_t t33l[];
85 |
86 | extern const uint32_t largetbl[16 * 16];
87 | extern const uint32_t table23[3 * 3];
88 | extern const uint32_t table56[4 * 4];
89 |
90 | extern const int scfsi_band[5];
91 |
92 | extern const int bitrate_table [3][16];
93 | extern const int samplerate_table [3][ 4];
94 |
95 | #endif /* LAME_TABLES_H */
96 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/vbrquantize.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 VBR quantization
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VBRQUANTIZE_H
23 | #define LAME_VBRQUANTIZE_H
24 |
25 | int VBR_encode_frame(lame_internal_flags * gfc, const FLOAT xr34orig[2][2][576],
26 | const FLOAT l3_xmin[2][2][SFBMAX], const int maxbits[2][2]);
27 |
28 | #endif /* LAME_VBRQUANTIZE_H */
29 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/vector/lame_intrin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * lame_intrin.h include file
3 | *
4 | * Copyright (c) 2006 Gabriel Bouvigne
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 |
23 | #ifndef LAME_INTRIN_H
24 | #define LAME_INTRIN_H
25 |
26 |
27 | void
28 | init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum);
29 |
30 | void
31 | fht_SSE2(FLOAT* , int);
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/recorder-audio/libs/include/libmp3lame/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version numbering for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VERSION_H
23 | #define LAME_VERSION_H
24 |
25 |
26 | /*
27 | * To make a string from a token, use the # operator:
28 | */
29 | #ifndef STR
30 | # define __STR(x) #x
31 | # define STR(x) __STR(x)
32 | #endif
33 |
34 | # define LAME_URL "http://lame.sf.net"
35 |
36 |
37 | # define LAME_MAJOR_VERSION 3 /* Major version number */
38 | # define LAME_MINOR_VERSION 99 /* Minor version number */
39 | # define LAME_TYPE_VERSION 2 /* 0:alpha 1:beta 2:release */
40 | # define LAME_PATCH_VERSION 5 /* Patch level */
41 | # define LAME_ALPHA_VERSION (LAME_TYPE_VERSION==0)
42 | # define LAME_BETA_VERSION (LAME_TYPE_VERSION==1)
43 | # define LAME_RELEASE_VERSION (LAME_TYPE_VERSION==2)
44 |
45 | # define PSY_MAJOR_VERSION 1 /* Major version number */
46 | # define PSY_MINOR_VERSION 0 /* Minor version number */
47 | # define PSY_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */
48 | # define PSY_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */
49 |
50 | #if LAME_ALPHA_VERSION
51 | #define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION)
52 | #endif
53 | #if LAME_BETA_VERSION
54 | #define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION)
55 | #endif
56 | #if LAME_RELEASE_VERSION
57 | #if LAME_PATCH_VERSION
58 | #define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION)
59 | #else
60 | #define LAME_PATCH_LEVEL_STRING ""
61 | #endif
62 | #endif
63 |
64 | # define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING
65 |
66 | #endif /* LAME_VERSION_H */
67 |
68 | /* End of version.h */
69 |
--------------------------------------------------------------------------------
/recorder-audio/libs/x86/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder-audio/libs/x86/libmp3lame.so
--------------------------------------------------------------------------------
/recorder-audio/libs/x86_64/libmp3lame.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder-audio/libs/x86_64/libmp3lame.so
--------------------------------------------------------------------------------
/recorder-audio/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/recorder-audio/src/androidTest/java/com/chezi/recorder/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.ibbhub.mp3recorderlib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/cpp/lame_util.c:
--------------------------------------------------------------------------------
1 | #include "libmp3lame/lame.h"
2 | #include
3 | #include
4 |
5 | static lame_global_flags *lame = NULL;
6 |
7 | JNIEXPORT void JNICALL Java_com_chezi_recorder_utils_LameUtil_init(
8 | JNIEnv *env, jclass cls, jint inSamplerate, jint inChannel, jint outSamplerate, jint outBitrate, jint quality) {
9 | if (lame != NULL) {
10 | lame_close(lame);
11 | lame = NULL;
12 | }
13 | lame = lame_init();
14 | lame_set_in_samplerate(lame, inSamplerate);
15 | lame_set_num_channels(lame, inChannel);//输入流的声道
16 | lame_set_out_samplerate(lame, outSamplerate);
17 | lame_set_brate(lame, outBitrate);
18 | lame_set_quality(lame, quality);
19 | lame_init_params(lame);
20 | }
21 |
22 | JNIEXPORT jint JNICALL Java_com_chezi_recorder_utils_LameUtil_encode(
23 | JNIEnv *env, jclass cls, jshortArray buffer_l, jshortArray buffer_r,
24 | jint samples, jbyteArray mp3buf) {
25 | jshort* j_buffer_l = (*env)->GetShortArrayElements(env, buffer_l, NULL);
26 |
27 | jshort* j_buffer_r = (*env)->GetShortArrayElements(env, buffer_r, NULL);
28 |
29 | const jsize mp3buf_size = (*env)->GetArrayLength(env, mp3buf);
30 | jbyte* j_mp3buf = (*env)->GetByteArrayElements(env, mp3buf, NULL);
31 |
32 | int result = lame_encode_buffer(lame, j_buffer_l, j_buffer_r,
33 | samples, j_mp3buf, mp3buf_size);
34 |
35 | (*env)->ReleaseShortArrayElements(env, buffer_l, j_buffer_l, 0);
36 | (*env)->ReleaseShortArrayElements(env, buffer_r, j_buffer_r, 0);
37 | (*env)->ReleaseByteArrayElements(env, mp3buf, j_mp3buf, 0);
38 |
39 | return result;
40 | }
41 |
42 | JNIEXPORT jint JNICALL Java_com_chezi_recorder_utils_LameUtil_flush(
43 | JNIEnv *env, jclass cls, jbyteArray mp3buf) {
44 | const jsize mp3buf_size = (*env)->GetArrayLength(env, mp3buf);
45 | jbyte* j_mp3buf = (*env)->GetByteArrayElements(env, mp3buf, NULL);
46 |
47 | int result = lame_encode_flush(lame, j_mp3buf, mp3buf_size);
48 |
49 | (*env)->ReleaseByteArrayElements(env, mp3buf, j_mp3buf, 0);
50 |
51 | return result;
52 | }
53 |
54 | JNIEXPORT void JNICALL Java_com_chezi_recorder_utils_LameUtil_close
55 | (JNIEnv *env, jclass cls) {
56 | lame_close(lame);
57 | lame = NULL;
58 | }
59 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/IAudioRecorder.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import com.chezi.recorder.listener.AudioRecordListener;
4 |
5 | /**
6 | * @author :chezi008 on 2018/1/15 16:36
7 | * @description :
8 | * @email :chezi008@163.com
9 | */
10 |
11 | public interface IAudioRecorder {
12 |
13 | /**
14 | * 设置回调
15 | *
16 | * @param audioListener 回调接口
17 | */
18 | void setAudioListener(AudioRecordListener audioListener);
19 |
20 | /**
21 | * 开始录制音频
22 | * @param path 录制文件的地址
23 | */
24 | void start(String path);
25 |
26 | /**
27 | * 暂停录制
28 | */
29 | void onPause();
30 |
31 | /**
32 | * 继续录制
33 | */
34 | void onResume();
35 |
36 | /**
37 | * 停止录制
38 | *
39 | * @return 返回录制的时长 ,millisecond
40 | */
41 | long stop();
42 | }
43 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/PCMFormat.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import android.media.AudioFormat;
4 |
5 | enum PCMFormat {
6 | PCM_8BIT(1, AudioFormat.ENCODING_PCM_8BIT),
7 | PCM_16BIT(2, AudioFormat.ENCODING_PCM_16BIT);
8 |
9 | private int bytesPerFrame;
10 | private int audioFormat;
11 |
12 | PCMFormat(int bytesPerFrame, int audioFormat) {
13 | this.bytesPerFrame = bytesPerFrame;
14 | this.audioFormat = audioFormat;
15 | }
16 |
17 | public int getBytesPerFrame() {
18 | return bytesPerFrame;
19 | }
20 |
21 | public int getAudioFormat() {
22 | return audioFormat;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/RecorderView.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Handler;
6 | import android.os.Message;
7 | import android.util.AttributeSet;
8 | import android.view.Gravity;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.LinearLayout;
13 | import android.widget.TextView;
14 |
15 | import com.chezi.recorder.utils.DateUtils;
16 |
17 | /**
18 | * @author :chezi008 on 2018/4/17 21:03
19 | * @description :自定义麦克风录音控件,带录音时长
20 | * @email :chezi008@163.com
21 | */
22 | public class RecorderView extends LinearLayout {
23 |
24 | private TextView mTvTime;
25 | private RecorderProgressView mRecorderProgressView;
26 |
27 | private long startTime = 0;
28 | private boolean isAnimationStart;
29 | private Handler mHandler;
30 | private Runnable mTimeRunnable;
31 | private RecorderViewListener recorderViewListener;
32 |
33 | public RecorderView(Context context) {
34 | this(context, null);
35 | }
36 |
37 | public RecorderView(Context context, AttributeSet attrs) {
38 | super(context, attrs);
39 | initView();
40 | }
41 |
42 | public void setRecorderViewListener(RecorderViewListener recorderViewListener) {
43 | this.recorderViewListener = recorderViewListener;
44 | }
45 |
46 | private void initView() {
47 | setOrientation(VERTICAL);
48 | setGravity(Gravity.CENTER);
49 |
50 | mHandler = new Handler() {
51 | @Override
52 | public void handleMessage(Message msg) {
53 | super.handleMessage(msg);
54 | String seconds = DateUtils.toTime((int) (System.currentTimeMillis() - startTime));
55 | mTvTime.setText(seconds);
56 | }
57 | };
58 | mTimeRunnable = new Runnable() {
59 | @Override
60 | public void run() {
61 | while (isAnimationStart) {
62 | try {
63 | mHandler.sendEmptyMessage(0);
64 | Thread.sleep(100);
65 | } catch (InterruptedException e) {
66 | e.printStackTrace();
67 | }
68 | }
69 | }
70 | };
71 |
72 |
73 | mTvTime = new TextView(getContext());
74 | mTvTime.setTextColor(Color.argb(255, 230, 85, 35));
75 |
76 | LinearLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
77 | addView(mTvTime, params);
78 |
79 | mRecorderProgressView = new RecorderProgressView(getContext());
80 | addView(mRecorderProgressView, params);
81 |
82 | mRecorderProgressView.setOnTouchListener(new OnTouchListener() {
83 | @Override
84 | public boolean onTouch(View v, MotionEvent event) {
85 | switch (event.getAction()) {
86 | case MotionEvent.ACTION_DOWN:
87 | startAnimation();
88 | return true;
89 | case MotionEvent.ACTION_MOVE:
90 | if (event.getY() < 0) {
91 | stopAnimation();
92 | } else {
93 |
94 | }
95 | return true;
96 | case MotionEvent.ACTION_UP:
97 | stopAnimation();
98 | return true;
99 | default:
100 | break;
101 | }
102 | return false;
103 | }
104 | });
105 |
106 | }
107 |
108 | private void startAnimation() {
109 | if (!isAnimationStart) {
110 | isAnimationStart = true;
111 | startTime = System.currentTimeMillis();
112 | mRecorderProgressView.startAnimation();
113 | mTvTime.setVisibility(VISIBLE);
114 | new Thread(mTimeRunnable).start();
115 | if (recorderViewListener != null) {
116 | recorderViewListener.onStart();
117 | }
118 | }
119 | }
120 |
121 | private void stopAnimation() {
122 | isAnimationStart = false;
123 | startTime = 0;
124 | mRecorderProgressView.stopAnimation();
125 | mTvTime.setVisibility(GONE);
126 | if (recorderViewListener != null) {
127 | recorderViewListener.onStop();
128 | }
129 | }
130 |
131 | public interface RecorderViewListener {
132 | void onStart();
133 |
134 | void onStop();
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/SpectrumView.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.os.Handler;
9 | import android.os.Message;
10 | import android.util.AttributeSet;
11 | import android.util.Log;
12 | import android.view.View;
13 |
14 |
15 | import com.chezi.recorder.R;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 | import java.util.Random;
20 | import java.util.concurrent.ExecutorService;
21 | import java.util.concurrent.Executors;
22 |
23 | /**
24 | * @author :chezi008 on 2018/4/15 16:30
25 | * @description :频谱视图,借用https://www.jianshu.com/p/76aceacbc243。优化改善
26 | * @email :chezi008@163.com
27 | */
28 | public class SpectrumView extends View {
29 | private String TAG = getClass().getSimpleName();
30 |
31 | //画笔
32 | private Paint paint;
33 |
34 | //跳动指针的集合
35 | private List pointers;
36 |
37 | //跳动指针的数量
38 | private int pointerNum;
39 |
40 | //逻辑坐标 原点
41 | private float basePointX;
42 | private float basePointY;
43 |
44 | //指针间的间隙 默认5dp
45 | private float pointerPadding;
46 |
47 | //每个指针的宽度 默认3dp
48 | private float pointerWidth;
49 |
50 | //指针的颜色
51 | private int pointerColor = Color.RED;
52 |
53 | //控制开始/停止
54 | private boolean isPlaying;
55 |
56 |
57 | //指针波动速率
58 | private int pointerSpeed;
59 |
60 | private Runnable mAnimationRunnable;
61 | private ExecutorService mExecutorService;
62 |
63 |
64 | public SpectrumView(Context context) {
65 | super(context);
66 | init();
67 | }
68 |
69 | public SpectrumView(Context context, AttributeSet attrs) {
70 | super(context, attrs);
71 | initAttrs(context, attrs);
72 | init();
73 | }
74 |
75 |
76 | public SpectrumView(Context context, AttributeSet attrs, int defStyleAttr) {
77 | super(context, attrs, defStyleAttr);
78 | initAttrs(context, attrs);
79 | init();
80 | }
81 |
82 | private void initAttrs(Context context, AttributeSet attrs) {
83 | //取出自定义属性
84 | TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SpectrumView);
85 | pointerColor = ta.getColor(R.styleable.SpectrumView_rectangle_color, Color.RED);
86 | //指针的数量,默认为4
87 | pointerNum = ta.getInt(R.styleable.SpectrumView_rectangle_num, 4);
88 | //指针的宽度,默认5dp
89 | pointerWidth = ta.getDimension(R.styleable.SpectrumView_rectangle_width, 5f);
90 | pointerSpeed = ta.getInt(R.styleable.SpectrumView_rectangle_speed, 40);
91 | }
92 |
93 | /**
94 | * 初始化画笔与指针的集合
95 | */
96 | private void init() {
97 | paint = new Paint();
98 | paint.setAntiAlias(true);
99 | paint.setColor(pointerColor);
100 | pointers = new ArrayList<>();
101 |
102 | mExecutorService = Executors.newSingleThreadExecutor();
103 | mAnimationRunnable = new Runnable() {
104 | @Override
105 | public void run() {
106 | float i = 0;
107 | while (isPlaying) {
108 | try {
109 | //循环改变每个指针高度
110 | for (int j = 0; j < pointers.size(); j++) {
111 | //利用正弦有规律的获取0~1的数。
112 | float rate = (float) Math.abs(Math.sin(i + j));
113 | // Log.d(TAG, "run: i:" + i);
114 | //rate 乘以 可绘制高度,来改变每个指针的高度
115 | pointers.get(j).setHeight((basePointY - getPaddingTop()) * rate);
116 | }
117 | //休眠一下下,可自行调节
118 | Thread.sleep(pointerSpeed);
119 | //控制开始/暂停
120 | myHandler.sendEmptyMessage(0);
121 | } catch (InterruptedException e) {
122 | e.printStackTrace();
123 | }
124 | i += 0.1;
125 | }
126 | }
127 | };
128 | }
129 |
130 |
131 | /**
132 | * 在onLayout中做一些,宽高方面的初始化
133 | *
134 | * @param changed
135 | * @param left
136 | * @param top
137 | * @param right
138 | * @param bottom
139 | */
140 | @Override
141 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
142 | super.onLayout(changed, left, top, right, bottom);
143 | //获取逻辑原点的,也就是画布左下角的坐标。这里减去了paddingBottom的距离
144 | basePointY = getHeight() - getPaddingBottom();
145 | Random random = new Random();
146 | if (pointers != null)
147 | pointers.clear();
148 | for (int i = 0; i < pointerNum; i++) {
149 | //创建指针对象,利用0~1的随机数 乘以 可绘制区域的高度。作为每个指针的初始高度。
150 | pointers.add(new Pointer((float) (0.1 * (random.nextInt(10) + 1) * (getHeight() - getPaddingBottom() - getPaddingTop()))));
151 | }
152 | //计算每个指针之间的间隔 总宽度 - 左右两边的padding - 所有指针占去的宽度 然后再除以间隔的数量
153 | pointerPadding = (getWidth() - getPaddingLeft() - getPaddingRight() - pointerWidth * pointerNum) / (pointerNum - 1);
154 | }
155 |
156 |
157 | /**
158 | * 开始绘画
159 | *
160 | * @param canvas
161 | */
162 | @Override
163 | protected void onDraw(Canvas canvas) {
164 | super.onDraw(canvas);
165 | //将x坐标移动到逻辑原点,也就是左下角
166 | basePointX = 0f + getPaddingLeft();
167 | //循环绘制每一个指针。
168 | for (int i = 0; i < pointers.size(); i++) {
169 | //绘制指针,也就是绘制矩形
170 | canvas.drawRect(basePointX,
171 | basePointY - pointers.get(i).getHeight(),
172 | basePointX + pointerWidth,
173 | basePointY,
174 | paint);
175 | basePointX += (pointerPadding + pointerWidth);
176 | }
177 | }
178 |
179 | /**
180 | * 开始播放
181 | */
182 | public void start() {
183 | if (!isPlaying) {
184 | //控制子线程中的循环
185 | isPlaying = true;
186 | mExecutorService.submit(mAnimationRunnable);
187 | }
188 | }
189 |
190 | /**
191 | * 停止子线程,并刷新画布
192 | */
193 | public void stop() {
194 | isPlaying = false;
195 | invalidate();
196 | }
197 |
198 | /**
199 | * 处理子线程发出来的指令,然后刷新布局
200 | */
201 | private Handler myHandler = new Handler() {
202 | @Override
203 | public void handleMessage(Message msg) {
204 | super.handleMessage(msg);
205 | invalidate();
206 | }
207 | };
208 |
209 |
210 | /**
211 | * 指针类
212 | */
213 | public class Pointer {
214 | private float height;
215 |
216 | public Pointer(float height) {
217 | this.height = height;
218 | }
219 |
220 | public float getHeight() {
221 | return height;
222 | }
223 |
224 | public void setHeight(float height) {
225 | this.height = height;
226 | }
227 | }
228 | }
229 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/listener/AudioRecordListener.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder.listener;
2 |
3 | /**
4 | * @author :chezi008 on 2018/1/15 16:37
5 | * @description :
6 | * @email :chezi008@163.com
7 | */
8 |
9 | public interface AudioRecordListener {
10 | /**
11 | * 获取录制音量的大小
12 | *
13 | * @param volume
14 | */
15 | void onGetVolume(int volume);
16 | }
17 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder.utils;
2 |
3 | import android.annotation.SuppressLint;
4 |
5 | /**
6 | * @author :chezi008 on 2018/4/17 22:24
7 | * @description :
8 | * @email :chezi008@163.com
9 | */
10 | public class DateUtils {
11 | @SuppressLint({"DefaultLocale"})
12 | public static String toTime(int var0) {
13 | var0 /= 1000;
14 | int var1 = var0 / 60;
15 | boolean var2 = false;
16 | if (var1 >= 60) {
17 | int var4 = var1 / 60;
18 | var1 %= 60;
19 | }
20 | int var3 = var0 % 60;
21 | if (var1>0){
22 | return String.format("%d′%d\"", new Object[]{Integer.valueOf(var1), Integer.valueOf(var3)});
23 | }
24 | return String.format("%d\"", Integer.valueOf(var3));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/java/com/chezi/recorder/utils/LameUtil.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder.utils;
2 |
3 | public class LameUtil {
4 | static{
5 | System.loadLibrary("mp3recorder");
6 | }
7 |
8 | /**
9 | * Initialize LAME.
10 | *
11 | * @param inSamplerate
12 | * input sample rate in Hz.
13 | * @param inChannel
14 | * number of channels in input stream.
15 | * @param outSamplerate
16 | * output sample rate in Hz.
17 | * @param outBitrate
18 | * brate compression ratio in KHz.
19 | * @param quality
20 | * quality=0..9. 0=best (very slow). 9=worst.
21 | * recommended:
22 | * 2 near-best quality, not too slow
23 | * 5 good quality, fast
24 | * 7 ok quality, really fast
25 | */
26 | public native static void init(int inSamplerate, int inChannel,
27 | int outSamplerate, int outBitrate, int quality);
28 |
29 | /**
30 | * Encode buffer to mp3.
31 | *
32 | * @param bufferLeft
33 | * PCM data for left channel.
34 | * @param bufferRight
35 | * PCM data for right channel.
36 | * @param samples
37 | * number of samples per channel.
38 | * @param mp3buf
39 | * result encoded MP3 stream. You must specified
40 | * "7200 + (1.25 * buffer_l.length)" length array.
41 | * @return number of bytes output in mp3buf. Can be 0.
42 | * -1: mp3buf was too small
43 | * -2: malloc() problem
44 | * -3: lame_init_params() not called
45 | * -4: psycho acoustic problems
46 | */
47 | public native static int encode(short[] bufferLeft, short[] bufferRight,
48 | int samples, byte[] mp3buf);
49 |
50 | /**
51 | * Flush LAME buffer.
52 | *
53 | * REQUIRED:
54 | * lame_encode_flush will flush the intenal PCM buffers, padding with
55 | * 0's to make sure the final frame is complete, and then flush
56 | * the internal MP3 buffers, and thus may return a
57 | * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long
58 | * to hold all possible emitted data.
59 | *
60 | * will also write id3v1 tags (if any) into the bitstream
61 | *
62 | * return code = number of bytes output to mp3buf. Can be 0
63 | * @param mp3buf
64 | * result encoded MP3 stream. You must specified at least 7200
65 | * bytes.
66 | * @return number of bytes output to mp3buf. Can be 0.
67 | */
68 | public native static int flush(byte[] mp3buf);
69 |
70 | /**
71 | * Close LAME.
72 | */
73 | public native static void close();
74 | }
75 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/res/drawable/ve_mic_white.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/res/mipmap-xhdpi/ic_mic_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder-audio/src/main/res/mipmap-xhdpi/ic_mic_white.png
--------------------------------------------------------------------------------
/recorder-audio/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Mp3RecorderLib
3 |
4 |
--------------------------------------------------------------------------------
/recorder-audio/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/recorder-audio/src/test/java/com/chezi/recorder/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.chezi.recorder;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/recorder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder.gif
--------------------------------------------------------------------------------
/recorder_2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chezi008/CZRecorder/a72219594fb49b7b2ad9e407dcc23b5b2973936e/recorder_2.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':recorder-audio'
2 |
3 | //include ':lamemp3'
4 | //project(":lamemp3").projectDir = file("./Lame/LameMP3/CMake")
--------------------------------------------------------------------------------