1 /* ------------------------------------------------------------------
2 * Copyright (C) 2009 Martin Storsjo
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
22 #include <interf_enc.h>
24 int main(int argc, char *argv[]) {
30 amr = Encoder_Interface_init(0);
31 out = fopen("out.amr", "wb");
33 fwrite("#!AMR\n", 1, 6, out);
34 for (i = 0; i < 1000; i++) {
38 for (j = 0; j < 160; j++) {
39 buf[j] = 32767*sin(440*2*3.141592654*sample_pos/8000);
42 n = Encoder_Interface_Encode(amr, MR475, buf, outbuf, 0);
43 fwrite(outbuf, 1, n, out);
46 Encoder_Interface_exit(amr);