1 /* 2 * GNUitar 3 * Pump module - processing sound 4 * Copyright (C) 2000,2001,2003 Max Rudensky <fonin@ziet.zhitomir.ua> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program 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 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 * $Id: pump.h,v 1.12 2004/08/10 15:07:31 fonin Exp $ 21 */ 22 23 #ifndef PUMP_H 24 #define PUMP_H 1 25 26 #include <gtk/gtk.h> 27 28 #ifdef FLOAT_DSP 29 typedef double DSP_SAMPLE; 30 #else 31 typedef int DSP_SAMPLE; 32 #endif 33 34 typedef short SAMPLE; 35 36 #ifdef _WIN32 37 #define MAX_BUFFERS 1024 /* number of input/output sound buffers */ 38 #endif 39 typedef signed char SAMPLE8; 40 #define MAX_SAMPLE 32767 41 42 #define MIN_BUFFER_SIZE 128 43 #define MAX_BUFFER_SIZE 65536 44 #define MAX_CHANNELS 2 45 #define MAX_SAMPLE_RATE 48000 /* 48000 produces more noise */ 46 #define MAX_EFFECTS 50 47 #define EFFECT_AMOUNT 13 48 49 /* 50 * Indices in effect_creator[] array 51 */ 52 #define AUTOWAH 0 53 #define DISTORT 1 54 #define DELAY 2 55 #define REVERB 3 56 #define VIBRATO 4 57 #define CHORUS 5 58 #define ECHO 6 59 #define PHASOR 7 60 #define TREMOLO 8 61 #define SUSTAIN 9 62 #define DISTORT2 10 63 #define NOISE 11 64 #define EQBANK 12 65 66 struct data_block { 67 DSP_SAMPLE *data; 68 unsigned int len; 69 }; 70 71 struct effect { 72 void *params; 73 void (*proc_init) (struct effect *); 74 void (*proc_done) (struct effect *); 75 void (*proc_filter) (struct effect *, struct data_block *); 76 void (*proc_save) (struct effect *, int fd); 77 void (*proc_load) (struct effect *, int fd); 78 short toggle; 79 unsigned short id; 80 GtkWidget *control; 81 }; 82 83 struct effect_creator { 84 char *str; 85 void (*create_f) (struct effect *); 86 }; 87 88 extern unsigned short nchannels; 89 extern unsigned int sample_rate; 90 extern unsigned short bits; 91 extern unsigned int buffer_size; 92 #ifdef _WIN32 93 extern unsigned int nbuffers; 94 #endif 95 96 extern unsigned short audio_lock; 97 extern int n; 98 extern struct effect *effects[MAX_EFFECTS]; 99 extern struct effect_creator effect_list[]; 100 101 extern int pump_sample(DSP_SAMPLE *s, int size); 102 extern void pump_start(int argc, char **argv); 103 extern void pump_stop(void); 104 extern void save_pump(char *fname); 105 extern void load_pump(char *fname); 106 extern void passthru(struct effect *p, struct data_block *db); 107 108 #endif 109