diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/rbspeex/rbspeexenc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/rbspeex/rbspeexenc.c b/tools/rbspeex/rbspeexenc.c index 649f3b5e1c..7869602f44 100644 --- a/tools/rbspeex/rbspeexenc.c +++ b/tools/rbspeex/rbspeexenc.c | |||
@@ -30,6 +30,7 @@ | |||
30 | " -c x Complexity, increases quality for a given bitrate, but encodes\n"\ | 30 | " -c x Complexity, increases quality for a given bitrate, but encodes\n"\ |
31 | " slower, range [0-10], default 3\n"\ | 31 | " slower, range [0-10], default 3\n"\ |
32 | " -n Enable narrowband mode, will resample input to 8 kHz\n\n"\ | 32 | " -n Enable narrowband mode, will resample input to 8 kHz\n\n"\ |
33 | " -v x Volume, amplitude multiplier, default 1.0.\n"\ | ||
33 | "rbspeexenc expects a mono 16 bit WAV file as input. Files will be resampled\n"\ | 34 | "rbspeexenc expects a mono 16 bit WAV file as input. Files will be resampled\n"\ |
34 | "to either 16 kHz by default, or 8 kHz if narrowband mode is enabled.\n"\ | 35 | "to either 16 kHz by default, or 8 kHz if narrowband mode is enabled.\n"\ |
35 | "WARNING: This tool will create files that are only usable by Rockbox!\n" | 36 | "WARNING: This tool will create files that are only usable by Rockbox!\n" |
@@ -124,6 +125,7 @@ int main(int argc, char **argv) | |||
124 | int complexity = 3; | 125 | int complexity = 3; |
125 | float quality = 8.f; | 126 | float quality = 8.f; |
126 | bool narrowband = false; | 127 | bool narrowband = false; |
128 | float volume = 1.0f; | ||
127 | int target_sr; | 129 | int target_sr; |
128 | int numchan, bps, sr, numsamples; | 130 | int numchan, bps, sr, numsamples; |
129 | int frame_size; | 131 | int frame_size; |
@@ -140,6 +142,8 @@ int main(int argc, char **argv) | |||
140 | quality = atof(argv[++i]); | 142 | quality = atof(argv[++i]); |
141 | else if (strncmp(argv[i], "-c", 2) == 0) | 143 | else if (strncmp(argv[i], "-c", 2) == 0) |
142 | complexity = atoi(argv[++i]); | 144 | complexity = atoi(argv[++i]); |
145 | else if (strncmp(argv[i], "-v", 2) == 0) | ||
146 | volume = atof(argv[++i]); | ||
143 | else if (strncmp(argv[i], "-n", 2) == 0) | 147 | else if (strncmp(argv[i], "-n", 2) == 0) |
144 | narrowband = true; | 148 | narrowband = true; |
145 | ++i; | 149 | ++i; |
@@ -193,6 +197,12 @@ int main(int argc, char **argv) | |||
193 | } | 197 | } |
194 | fread(in, 2, numsamples, fin); | 198 | fread(in, 2, numsamples, fin); |
195 | fclose(fin); | 199 | fclose(fin); |
200 | |||
201 | if(volume != 1.0f) { | ||
202 | for(i=0; i<numsamples; i++) | ||
203 | in[i] *= volume; | ||
204 | } | ||
205 | |||
196 | /* There will be 'lookahead' samples of zero at the end of the array, to | 206 | /* There will be 'lookahead' samples of zero at the end of the array, to |
197 | * make sure the Speex encoder is allowed to spit out all its data at clip | 207 | * make sure the Speex encoder is allowed to spit out all its data at clip |
198 | * end */ | 208 | * end */ |