Paul Batchelorinitial work for libsndkit759997e5 years agoHistory
2394 lines · 34.4 KB · C
RawDownload
/*4:*/#line 117 "./patchwerk.w" #include <stdlib.h> #include <stdio.h> #include "patchwerk.h"/*8:*/#line 5 "./node.w" /*9:*/#line 11 "./node.w" struct pw_node{/*10:*/#line 19 "./node.w" pw_patch*patch; /*:10*//*11:*/#line 26 "./node.w" int id; /*:11*//*12:*/#line 30 "./node.w" pw_function setup; /*:12*//*13:*/#line 35 "./node.w" pw_function destroy; /*:13*//*14:*/#line 39 "./node.w" pw_function compute; /*:14*//*15:*/#line 44 "./node.w" void*ud; /*:15*//*16:*/#line 48 "./node.w" pw_cable*cables;int ncables; /*:16*//*17:*/#line 53 "./node.w" int blksize; /*:17*//*18:*/#line 58 "./node.w" int type; /*:18*//*19:*/#line 64 "./node.w" int group; /*:19*//*20:*/#line 69 "./node.w" pw_node*next; /*:20*/#line 13 "./node.w" }; /*:9*//*23:*/#line 79 "./node.w" size_t pw_node_size(){return sizeof(pw_node);} /*:23*//*25:*/#line 96 "./node.w" static void empty(pw_node*node){}static void free_cables(pw_node*node){pw_node_cables_free(node);}void pw_node_init(pw_node*node,int blksize){node->id= -1;node->setup= empty;node->compute= empty;node->destroy= free_cables;node->ncables= 0;node->blksize= blksize;node->type= -1;node->group= -1;node->next= NULL;} /*:25*//*27:*/#line 119 "./node.w" int pw_node_get_id(pw_node*node){return node->id;} /*:27*//*29:*/#line 129 "./node.w" void pw_node_set_id(pw_node*node,int id){node->id= id;} /*:29*//*31:*/#line 144 "./node.w" void pw_node_set_setup(pw_node*node,pw_function fun){node->setup= fun;} void pw_node_set_compute(pw_node*node,pw_function fun){node->compute= fun;} void pw_node_set_destroy(pw_node*node,pw_function fun){node->destroy= fun;} /*:31*//*33:*/#line 168 "./node.w" void pw_node_setup(pw_node*node){node->setup(node);} void pw_node_compute(pw_node*node){node->compute(node);} void pw_node_destroy(pw_node*node){node->destroy(node);} /*:33*//*35:*/#line 191 "./node.w" void pw_node_set_data(pw_node*node,void*data){node->ud= data;} void*pw_node_get_data(pw_node*node){return node->ud;} /*:35*//*37:*/#line 207 "./node.w" int pw_node_cables_alloc(pw_node*node,int ncables){int n;int rc;if(node->patch==NULL)return PW_NOT_OK;rc= pw_memory_alloc(node->patch,sizeof(pw_cable)*ncables,(void**)&node->cables);if(rc!=PW_OK)return rc;node->ncables= ncables;for(n= 0;n<ncables;n++){pw_cable_init(node,&node->cables[n]);} return PW_OK;} /*:37*//*39:*/#line 230 "./node.w" int pw_node_cables_free(pw_node*node){int n;if(node->patch==NULL)return PW_NOT_OK;if(node->ncables> 0){for(n= 0;n<node->ncables;n++){pw_cable_free(&node->cables[n]);}return pw_memory_free(node->patch,(void**)&node->cables);} return PW_NOT_OK;} /*:39*//*41:*/#line 251 "./node.w" int pw_node_get_cable(pw_node*node,int id,pw_cable**cable){if(id>=node->ncables){return PW_INVALID_CABLE;} *cable= &node->cables[id]; return PW_OK;} /*:41*//*43:*/#line 267 "./node.w" int pw_node_blksize(pw_node*node){return node->blksize;} /*:43*//*45:*/#line 285 "./node.w" int pw_node_set_block(pw_node*node,int id){int rc;if(id> node->ncables){return PW_INVALID_CABLE;} rc= pw_cable_make_block(&node->cables[id],pw_patch_stack(node->patch),node->blksize); if(rc!=PW_OK){pw_patch_err(node->patch,PW_POOL_FULL);} return rc;} /*:45*//*47:*/#line 309 "./node.w" int pw_node_get_ncables(pw_node*node){return node->ncables;} /*:47*//*49:*/#line 321 "./node.w" int pw_node_get_type(pw_node*node){return node->type;} void pw_node_set_type(pw_node*node,int type){node->type= type;} /*:49*//*51:*/#line 340 "./node.w" void pw_node_set_patch(pw_node*node,pw_patch*patch){node->patch= patch;} int pw_node_get_patch(pw_node*node,pw_patch**patch){*patch= node->patch;return PW_OK;} /*:51*//*53:*/#line 358 "./node.w" pw_node*pw_node_get_next(pw_node*node){return node->next;} void pw_node_set_next(pw_node*node,pw_node*next){node->next= next;}#line 1 "./cable.w"/*:53*/#line 6 "./node.w"  /*:8*//*54:*/#line 7 "./cable.w" /*61:*/#line 61 "./cable.w" enum{CABLE_IVAL,CABLE_BLOCK}; /*:61*/#line 8 "./cable.w" /*66:*/#line 91 "./cable.w" void pw_cable_init(pw_node*node,pw_cable*cable){cable->ival= 0;cable->blksize= 0;cable->blk= NULL;cable->type= CABLE_IVAL;cable->val= &cable->ival;cable->node= node;cable->pcable= cable;cable->buf= NULL;} /*:66*//*68:*/#line 111 "./cable.w" void pw_cable_free(pw_cable*cable){if(cable->blksize!=0){ }} /*:68*//*69:*/#line 121 "./cable.w" void pw_cable_set_block(pw_cable*cable,PWFLT*blk,int blksize){cable->blk= blk;cable->blksize= blksize;cable->val= cable->blk;cable->type= CABLE_BLOCK;} /*:69*//*72:*/#line 137 "./cable.w" void pw_cable_set_constant(pw_cable*cable,PWFLT val){cable->val= &cable->ival;cable->ival= val;cable->type= CABLE_IVAL;} /*:72*//*74:*/#line 153 "./cable.w" void pw_cable_set_value(pw_cable*c,PWFLT val){*c->val= val;} /*:74*//*76:*/#line 166 "./cable.w" PWFLT pw_cable_get(pw_cable*cable,int pos){if(cable->type==CABLE_IVAL){return*cable->val;}else{return cable->val[pos];}} /*:76*//*78:*/#line 179 "./cable.w" void pw_cable_set(pw_cable*cable,int pos,PWFLT val){if(cable->type==CABLE_IVAL){*cable->val= val;}else{cable->val[pos]= val;}}  /*:78*//*80:*/#line 201 "./cable.w" int pw_cable_connect(pw_cable*c1,pw_cable*c2){int id1,id2; id1= pw_node_get_id(c1->node);id2= pw_node_get_id(c2->node); if(id1> id2)return PW_CONNECTION_MISMATCH; pw_cable_connect_nocheck(c1,c2); return PW_OK;} /*:80*//*82:*/#line 224 "./cable.w" void pw_cable_connect_nocheck(pw_cable*c1,pw_cable*c2){c2->type= c1->type;pw_cable_override(c1,c2);} /*:82*//*83:*/#line 238 "./cable.w"  int pw_cable_pop(pw_cable*cab){pw_stack*stack;pw_node*node;pw_buffer*tmp; if(!pw_cable_is_block(cab))return PW_NOT_OK; node= cab->node;stack= pw_patch_stack(node->patch);pw_stack_pop(stack,&tmp); return PW_OK;} /*:83*//*85:*/#line 258 "./cable.w"  void pw_cable_push(pw_cable*cab){pw_stack*stack;pw_node*node;pw_buffer*tmp;tmp= NULL; node= cab->node;stack= pw_patch_stack(node->patch);pw_stack_push(stack,&tmp);} /*:85*//*87:*/#line 278 "./cable.w" int pw_cable_is_block(pw_cable*cab){return cab->type==CABLE_BLOCK;} /*:87*//*89:*/#line 290 "./cable.w" int pw_cable_is_constant(pw_cable*cab){return cab->type==CABLE_IVAL;} /*:89*//*91:*/#line 305 "./cable.w" pw_buffer*pw_cable_get_buffer(pw_cable*cab){return cab->buf;} void pw_cable_set_buffer(pw_cable*cab,pw_buffer*buf){cab->buf= buf;} /*:91*//*93:*/#line 332 "./cable.w" int pw_cable_make_block(pw_cable*cable,pw_stack*stack,int blksize){pw_buffer*buf;PWFLT*blk; buf= NULL; if(pw_stack_push(stack,&buf)!=PW_OK){return PW_NOT_OK;} blk= pw_buffer_data(buf);pw_cable_set_block(cable,blk,blksize);

Lines 1–500 of 2394.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t