On Oct 22 16:02:29, corey....@yahoo.com.cn wrote:
> hi,
> i want to write a fundemental audio file operation library,
> so i tried to seperate some functions from Sox command,

So, you are writing an audio processing library
using another audio processing library, namely libsox?
Why would you do that, instead of using libsox directly?

> such as: concatenating, mixing and trimming. According example from source 
> package,  i write a trimming program ???
> 
> #include "sox.h"
> #include <stdio.h>
> #include <assert.h>
> 
> /* 
> * usage: trim source output start length
> */
> 
> int main(int argc, char *argv[])
> {
>   static sox_format_t *in, *out; /* input and output files */
>   sox_effects_chain_t *chain;
>   sox_effect_t *e;
>   char *args[10];
> 
>   assert(argc == 5);
> 
>   assert(sox_init() == SOX_SUCCESS);
> 
>   assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
> 
>   assert(out = sox_open_write(argv[2], &in->signal, &in->encoding, NULL, 
> NULL, NULL));
> 
>   chain = sox_create_effects_chain(&in->encoding, &out->encoding);
> 
>   e = sox_create_effect(sox_find_effect("trim"));
>   args[0] = (char*)argv[3];
>   args[1] = (char*)argv[4];
>   assert(sox_effect_options(e, 2, args) == SOX_SUCCESS);
>   assert(sox_add_effect(chain, e, &in->signal, &in->signal) == SOX_SUCCESS);
>   sox_trim_get_start(e);
> 
>   sox_flow_effects(chain, NULL, NULL);
> 
>   sox_delete_effects_chain(chain);
>   sox_close(out);
>   sox_close(in);
>   sox_quit();
>   return 0;
> }
> 
> but it did not work.


If it "didn't work", it is probably "broken".  Sigh.

> So, any suggestion will be appreciated. Thanks.

man libsox


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to