/* Use libvorbis for ogg support */
#undef USE_VORBIS_INPUT
+/* Use libaudiofile support */
+#undef USE_AUDIOFILE_INPUT
+
/* Use ALSA*/
#undef USE_ALSA
AC_ARG_ENABLE(mpg123, [ --enable-mpg123 use mpg123 as input converter. (default=auto) ])
AC_ARG_ENABLE(ogg123, [ --enable-ogg123 use ogg123 as input converter. (default=auto) ])
dnl AC_ARG_ENABLE(wavonly, [ --enable-wavonly enable the builtin wav routines. ])
-AC_ARG_ENABLE(scheduler,[ --enable-scheduler enable rt-scheduling (req. root-priv). (default=yes) ])
+dnl AC_ARG_ENABLE(scheduler,[ --enable-scheduler enable rt-scheduling (req. root-priv). (default=yes) ])
AC_ARG_ENABLE(debug, [ --enable-debug enable debug output. (default=no) ])
dnl AC_ARG_ENABLE(3dnow, [ --enable-3dnow enables 3DNow! support. (default=no) ])
dnl AC_ARG_ENABLE(benchmark,[ --enable-benchmark creates a non-functional test version (default=no) ])
dnl AC_ARG_ENABLE(bigdial, [ --enable-bigdial use BIG dials (default=yes) ])
dnl AC_ARG_ENABLE(dga2, [ --enable-dga2 use DGA2 instead of DGA1. (experimental) (default=no) ])
AC_ARG_ENABLE(libxml2, [ --disable-libxml2 use libxml even if verion 2 detected (default=auto) ])
-AC_ARG_ENABLE(libmad, [ --disable-mad disable mad for mp3 support (default=auto) ])
-AC_ARG_ENABLE(libvorbis, [ --disable-vorbis disable libvorbis support (default=auto) ])
+AC_ARG_ENABLE(mad, [ --disable-mad disable mad for mp3 support (default=auto) ])
+AC_ARG_ENABLE(vorbis, [ --disable-vorbis disable libvorbis support (default=auto) ])
+AC_ARG_ENABLE(audiofile, [ --disable-audiofile disable audiofile support (default=auto) ])
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_RANLIB
+OPTION_SOX="no"
+OPTION_MPG123="no"
+OPTION_MAD="no"
+OPTION_OGG123="no"
+OPTION_VORBIS="no"
+OPTION_AUDIOFILE="no"
+OPTION_WAV="no"
+OPTION_GTK_VERSION="none"
+OPTION_GNOME="no"
+
dnl Checks for libraries.
AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
GTK2_LIBS="$GTK_LIBS"
gtk2="yes"
GTK2_VERSION="`$PKG_CONFIG --modversion gtk+-2.0`"], [ gtk2="no" ])
+ OPTION_GTK_VERSION="Version 2 - ($GTK2_VERSION)"
fi
if test "$gtk2" = "no"; then
GTK12_LIBS="$GTK_LIBS"
gtk12="yes"
GTK12_VERSION="`$GTK_CONFIG $gtk_config_args --version`"], [ gtk12="no" ])
+ OPTION_GTK_VERSION="Version 1.2 - ($GTK12_VERSION)"
fi
if test "$gtk2" = "yes"; then
AC_CHECK_PROG(SOX_PROG, sox, yes)
if test "$SOX_PROG" = "yes"; then
AC_DEFINE(USE_SOX_INPUT)
+ OPTION_SOX="yes"
fi
fi
if test "$madlib" = "yes"; then
LIBS="$LIBS -lmad"
AC_DEFINE(USE_MAD_INPUT)
+ OPTION_MAD="yes"
fi
fi
fi
if test "$vorbisfile_libs" = "yes"; then
LIBS="$LIBS -lvorbisfile"
AC_DEFINE(USE_VORBIS_INPUT)
+ OPTION_VORBIS="yes"
else
LIBS=PREV_LIBS
fi
fi
fi
+if test "$enable_audiofile" != "no"; then
+ AC_CHECK_PROG(af_config,audiofile-config,yes,no)
+ if test "$af_config" = "yes"; then
+ af_cflags=`audiofile-config --cflags`
+ if test "$af_cflags" != ""; then
+ CFLAGS="$CFLAGS $af_cflags"
+ fi
+ af_libs=`audiofile-config --libs`
+ LIBS="$LIBS $af_libs"
+ AC_DEFINE(USE_AUDIOFILE_INPUT)
+ OPTION_AUDIOFILE="yes"
+ else
+ AC_CHECK_HEADERS(audiofile.h,audiofile_headers=yes,audiofile_headers=no)
+ if test "$audiofile_headers" = "yes"; then
+ AC_CHECK_LIB(audiofile,afOpenFile,audiofile_libs=yes,audiofile_libs=no)
+ if test "$audiofile_libs" = "yes"; then
+ LIBS="$LIBS -laudiofile"
+ AC_DEFINE(USE_AUDIOFILE_INPUT)
+ OPTION_AUDIOFILE="yes"
+ fi
+ fi
+ fi
+fi
+
if test "$enable_mpg123" != "no"; then
AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
if test "$MPG123_PROG" = "yes"; then
if test "$SOX_PROG" = "yes"; then
AC_DEFINE(USE_MPG123_INPUT)
+ OPTION_MPG123="yes"
else
AC_CHECK_PROG(SOX_PROG, sox, yes)
if test "$SOX_PROG" = "yes"; then
AC_DEFINE(USE_MPG123_INPUT)
+ OPTION_MPG123="yes"
else
AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
fi
AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
if test "$OGG123_PROG" = "yes"; then
AC_DEFINE(USE_OGG123_INPUT)
+ OPTION_OGG123="yes"
fi
fi
if test "$enable_wav" != "no";
then
AC_DEFINE(USE_BUILTIN_WAV)
+ OPTION_WAV="yes"
fi
if test "$enable_flash" = "no"; then
AC_SUBST(gnomedatadir)
AM_CONDITIONAL(GNOMEpresent, test "$gnomepresent" = yes)
AC_MSG_RESULT([Found GNOME - installing terminatorX.desktop.])
+ OPTION_GNOME="yes"
else
AC_MSG_RESULT([GNOME not found.])
fi
AC_CHECK_LIB(Xxf86dga, XDGASelectInput,, AC_MSG_ERROR([** DGA2 not installed. Try using dga1 instead. **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
fi
AC_OUTPUT(Makefile src/Makefile gnome-support/Makefile gnome-support/terminatorX.keys src/gui_icons/Makefile src/smallknob/Makefile doc/Makefile doc/img/Makefile terminatorX.spec terminatorX.1)
+
+echo
+echo configured terminatorX for:
+echo ---------------------------
+echo
+echo "sox support: $OPTION_SOX"
+echo "mpg123 support: $OPTION_MPG123"
+echo "mad support: $OPTION_MAD"
+echo "ogg123 support: $OPTION_OGG123"
+echo "vorbis support: $OPTION_VORBIS"
+echo "audiofile support: $OPTION_AUDIOFILE"
+echo "builtin-wav support: $OPTION_WAV"
+echo "gtk+ Version: $OPTION_GTK_VERSION"
+echo "GNOME support: $OPTION_GNOME"
+echo
+echo You can now run \'make\' to compile terminatorX
int main(int argc, char **argv)
{
- FILE *gtk_rc_file;
-
fprintf(stderr, "%s - Copyright (C) 1999-2002 by Alexander König\n", VERSIONSTRING);
fprintf(stderr, "terminatorX comes with ABSOLUTELY NO WARRANTY - for details read the license.\n");
int tX_audiodevice_oss :: close()
{
- void *dummy;
-
if (!fd)
{
return(1);
# include <errno.h>
#endif
+#ifdef USE_AUDIOFILE_INPUT
+# include <audiofile.h>
+#endif
+
tx_audiofile :: tx_audiofile()
{
mem_type=TX_AUDIO_UNDEFINED;
ld_set_progress(0);
figure_file_type();
+
+#ifdef USE_AUDIOFILE_INPUT
+ if ((load_err) && (file_type!=TX_FILE_MPG123) && (file_type!=TX_FILE_OGG123)) {
+ load_err=load_af();
+ }
+#endif
#ifdef USE_BUILTIN_WAV
if ((load_err) && (file_type==TX_FILE_WAV)) {
#endif
#ifdef USE_SOX_INPUT
-tX_audio_error tx_audiofile :: load_sox()
-{
+tX_audio_error tx_audiofile :: load_sox() {
+ tX_debug("tx_audiofile::load_sox()");
+
char command[PATH_MAX*2];
sprintf(command, SOX_STR, filename);
#endif
#ifdef USE_MPG123_INPUT
-tX_audio_error tx_audiofile :: load_mpg123()
-{
+tX_audio_error tx_audiofile :: load_mpg123() {
+ tX_debug("tx_audiofile::load_mpg123()");
+
char command[PATH_MAX*2];
sprintf(command, MPG123_STR, filename);
#endif
#ifdef USE_OGG123_INPUT
-tX_audio_error tx_audiofile :: load_ogg123()
-{
+tX_audio_error tx_audiofile :: load_ogg123() {
+ tX_debug("tx_audiofile::load_ogg123()");
+
char command[PATH_MAX*2];
sprintf(command, OGG123_STR, filename);
#ifdef USE_BUILTIN_WAV
#define min(a,b) ((a) < (b) ? (a) : (b))
-tX_audio_error tx_audiofile :: load_wav()
-{
+tX_audio_error tx_audiofile :: load_wav() {
+ tX_debug("tx_audiofile::load_wav()");
+
wav_sig wav_in;
int16_t *data;
int16_t *p;
ssize_t allbytes=0;
ssize_t bytes=0;
- int i;
mem_type=TX_AUDIO_LOAD;
#ifdef USE_MAD_INPUT
tX_audio_error tx_audiofile::load_mad() {
+ tX_debug("tx_audiofile::load_mad()");
+
struct stat stat_dat;
int fd;
int res;
unsigned int target_samples;
unsigned int current_sample;
unsigned int sample_rate;
+ unsigned int lost_sync_counter;
} tX_mad_buffer;
const unsigned char *last_current=NULL;
static enum mad_flow tX_mad_error(void *data, struct mad_stream *stream, struct mad_frame *frame) {
tX_mad_buffer *buffer = (tX_mad_buffer *) data;
- tX_error("Error 0x%04x loading via mad: (%s)\n", stream->error, mad_stream_errorstr(stream));
- return MAD_FLOW_CONTINUE;
+ if (MAD_RECOVERABLE(stream->error)) {
+ if ((stream->error==MAD_ERROR_LOSTSYNC) && (buffer->lost_sync_counter<3)) {
+ /* Ignore at least two sync errors to not annoy people
+ about ID3 tags.
+ */
+ buffer->lost_sync_counter++;
+ return MAD_FLOW_CONTINUE;
+ }
+ tX_warning("mad reported stream error (%i) '%s'.", stream->error, mad_stream_errorstr(stream));
+ return MAD_FLOW_CONTINUE;
+ }
+ tX_error("mad reported fatal stream error (%i) '%s'.", stream->error, mad_stream_errorstr(stream));
+ return MAD_FLOW_STOP;
}
/* From minimad.c of mad */
buffer->target_buffer=(int16_t *) realloc(buffer->target_buffer, buffer->target_samples<<1);
if (!buffer->target_buffer) {
- tX_error("Failed allocating sample memory!\n");
+ tX_error("tX_mad_output(): Failed allocating sample memory!\n");
return MAD_FLOW_STOP;
}
buffer.end = &start[length];
buffer.last_frame = NULL;
buffer.size = length;
- //buffer.next_block = 0;
- //buffer.blocks = length/TX_MAD_BLOCKSIZE + (length%TX_MAD_BLOCKSIZE ? 1 : 0);
buffer.target_buffer = NULL;
buffer.target_samples = 0;
buffer.current_sample = 0;
buffer.first_call=true;
buffer.sample_rate=0;
+ buffer.lost_sync_counter=0;
tX_debug("tx_audiofile::mad_decode() - start %08x, length %i", buffer.start, buffer.size);
/* configure input, output, and error functions */
#define VORBIS_BUFF_SIZE 4096 /*recommended*/
tX_audio_error tx_audiofile::load_vorbis() {
+ tX_debug("tx_audiofile::load_vorbis()");
+
/* VORBIS Callbacks */
ov_callbacks org_callbacks;
/* evil casting - to make g++ shut up */
/* buffer */
char pcmout[VORBIS_BUFF_SIZE];
- char mono[VORBIS_BUFF_SIZE];
OggVorbis_File vf;
bool eof=false;
int current_section=0;
-
+ unsigned int i;
struct stat stat_dat;
callbacks->read_func=ogg_read;
unsigned int channels=vi->channels;
unsigned int samples_read=0;
+ unsigned int mono_samples;
int16_t* data=NULL;
size_t bytes=0;
- while((!eof) && (!current_section)){
+ while((!eof) && (!current_section)) {
#ifdef BIG_ENDIAN_MACHINE
# define ENDIANP 1
#else
/* ignore stream errors */
} else {
int16_t *new_data;
-
bytes+=ret;
new_data=(int16_t *) realloc(data, bytes/channels);
if (!new_data) {
if (data) free(data);
return TX_AUDIO_ERR_ALLOC;\r
}
- data=new_data;
- int mono_samples=(ret/2)/channels;
+ data=new_data;
+ int16_t *src=(int16_t *) &pcmout;
- int i=0;
- while (i<mono_samples) {
- int16_t *src=(int16_t *) &pcmout;
- double value=0.0;
+ switch (channels) {
+ case 1:
+ mono_samples=ret/2;
+ for (i=0; i<mono_samples; i++) {
+ data[samples_read+i]=src[i];
+ }
+ break;
+
+ case 2:
+ mono_samples=ret/4;
+ for (i=0; i<mono_samples; i++) {
+ double l_value, r_value;
+ l_value=src[i*2];
+ r_value=src[i*2+1];
+ data[samples_read+i]=(int16_t) ((l_value+r_value)/2.0);
+ }
+ break;
+
+ default:
+ mono_samples=(ret/2)/channels;
+ for (i=0; i<mono_samples; i++) {
+ double value=0.0;
- for (int c=0; c<channels; c++) {
- value+=(double) src[i*channels+c];
- }
- value/=(double) channels;
-
- data[samples_read+i]=(int16_t) value;
- i++;
+ for (unsigned int c=0; c<channels; c++) {
+ value+=(double) src[i*channels+c];
+ }
+ value/=(double) channels;
+ data[samples_read+i]=(int16_t) value;
+ }
}
samples_read+=mono_samples;
-
- //memcpy(&data[last_pos], pcmout, ret);
}
- //printf("current %i\n", current_section);
}
ov_clear(&vf);
mem=(int16_t *) data;
- //no_samples=bytes>>1;
no_samples=samples_read;
+ if (no_samples==0) {
+ if (mem) free(mem);
+ mem=NULL;
+ return TX_AUDIO_ERR_VORBIS_NODATA;
+ }
+
+ return TX_AUDIO_SUCCESS;
+}
+#endif
+
+#ifdef USE_AUDIOFILE_INPUT
+#define TX_AF_SAMPLES_PER_BLOCK 2048
+
+tX_audio_error tx_audiofile::load_af() {
+ tX_debug("tx_audiofile::load_af()");
+
+ AFfilehandle af_file;
+ AFframecount all_frames, frames_read=0, current_frames=1;
+ int16_t *data=NULL;
+
+ af_file = afOpenFile(filename, "r", NULL);
+ if (af_file==AF_NULL_FILEHANDLE) {
+ return TX_AUDIO_ERR_AF_OPEN;
+ }
+
+ all_frames=afGetFrameCount(af_file, AF_DEFAULT_TRACK);
+ sample_rate=(unsigned int) afGetRate(af_file, AF_DEFAULT_TRACK);
+ afSetVirtualChannels(af_file, AF_DEFAULT_TRACK, 1);
+ afSetVirtualSampleFormat(af_file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); // 2 == 16 Bit?
+#ifdef BIG_ENDIAN_MACHINE
+ afSetVirtualByteOrder(af_file, AF_DEFAULT_TRACK, AF_BYTEORDER_BIGENDIAN);
+#else
+ afSetVirtualByteOrder(af_file, AF_DEFAULT_TRACK, AF_BYTEORDER_LITTLEENDIAN);
+#endif
+
+ while (current_frames) {
+ int16_t *new_data;
+
+ new_data=(int16_t*) realloc(data, (frames_read+TX_AF_SAMPLES_PER_BLOCK)*2);
+ if (!new_data) {
+ if (data) free(data);
+ afCloseFile(af_file);
+ return TX_AUDIO_ERR_ALLOC;
+ }
+ data=new_data;
+ current_frames=afReadFrames(af_file,AF_DEFAULT_TRACK,(void *) &data[frames_read],TX_AF_SAMPLES_PER_BLOCK);
+ frames_read+=current_frames;
+ ld_set_progress(((double) frames_read)/((double) all_frames));
+ }
+ afCloseFile(af_file);
+
+ if (!frames_read) {
+ if (data) free(data);
+ return TX_AUDIO_ERR_AF_NODATA;
+ }
+
+ /* shorten to the actually read size of samples */
+ if (!realloc(data, frames_read*2)) {
+ if (data) free(data);
+ return TX_AUDIO_ERR_ALLOC;
+ }
+
+ mem=data;
+ no_samples=frames_read;
+
return TX_AUDIO_SUCCESS;
}
#endif
TX_AUDIO_ERR_MAD_DECODE,
TX_AUDIO_ERR_MAD_MMAP,
TX_AUDIO_ERR_MAD_MUNMAP,
- TX_AUDIO_ERR_VORBIS_OPEN
+ TX_AUDIO_ERR_VORBIS_OPEN,
+ TX_AUDIO_ERR_VORBIS_NODATA,
+ TX_AUDIO_ERR_AF_OPEN,
+ TX_AUDIO_ERR_AF_NODATA
};
enum tX_audio_storage_type {
int16_t *mem;
size_t memsize;
long no_samples;
- unsigned int sample_rate; //in HZ
+ unsigned int sample_rate; //in HZ
#ifdef USE_BUILTIN_WAV
tX_audio_error load_wav();
#define NEED_PIPED 1
#endif
+#ifdef USE_AUDIOFILE_INPUT
+ tX_audio_error load_af();
+#endif
+
#ifdef USE_MAD_INPUT
tX_audio_error load_mad();
int mad_decode(unsigned char const *start, unsigned long length);
public:
tx_audiofile();
+ unsigned int get_sample_rate() { return sample_rate; }
tX_audio_error load(char *p_file_name);
int16_t *get_buffer() { return mem; };
gpointer data)
{
GtkTxDial *tx_dial;
- gint image;
g_return_if_fail (adjustment != NULL);
g_return_if_fail (data != NULL);
int opt_hidden=0;
-void apply_options()
-{
+void apply_options() {
char *text;
- int i;
strcpy(globals.audio_device, gtk_entry_get_text(GTK_ENTRY(audio_device)));
globals.buff_no=(int)buff_no->value;
GtkWidget *scroll;
GdkPixmap *pmap=NULL;
- int loop;
-
if (about)
{
gdk_window_raise(about->window);
" endian machine.\n";
char buffer[4096];
- char *str;
strcpy(buffer, about_prefix_umlaut);
strcat(buffer, about_rest);
}
void tX_engine :: loop() {
- int16_t *temp;
+ int16_t *temp=NULL;
int result;
while (!thread_terminate) {
return FALSE;
}
-static void
-gtk_tx_flash_update (GtkTxFlash *tx_flash)
-{
- g_return_if_fail (tx_flash != NULL);
- g_return_if_fail (GTK_IS_TX_FLASH (tx_flash));
-
- gtk_widget_draw (GTK_WIDGET(tx_flash), NULL);
-}
-
void
gtk_tx_flash_set_level(GtkWidget *widget, f_prec new_value)
{
GtkTxFlash *tx_flash;
gint i, y;
- int new_level, end_level;
+ int new_level;
int red=0;
g_return_if_fail (widget != NULL);
GtkWidget* gtk_tx_flash_new ();
guint gtk_tx_flash_get_type (void);
-static void gtk_tx_flash_prepare (GtkWidget *widget);
void gtk_tx_flash_set_level (GtkWidget *widget, f_prec new_value);
void gtk_tx_flash_clear (GtkWidget *widget);
if (!globals.true_block_size) globals.true_block_size=1<globals.buff_size;
}
-void load_globals() {
- if (load_globals_xml()!=0) {
- fprintf(stderr, "tX: Failed loading terminatorXrc - trying to load old binary rc.\n");
- load_globals_old();
- }
-}
-
#define restore_int(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) { sscanf(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%i", &i); }}
#define restore_float(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {sscanf(xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), "%lf", &dvalue); i=dvalue;}}
#define restore_string(s, i); if ((!elementFound) && (!xmlStrcmp(cur->name, (const xmlChar *) s))) { elementFound=1; if (xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)) {strcpy(i, xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); }}
fprintf(rc,"</terminatorXrc>\n");
}
}
+
+void load_globals() {
+ if (load_globals_xml()!=0) {
+ fprintf(stderr, "tX: Failed loading terminatorXrc - trying to load old binary rc.\n");
+ load_globals_old();
+ }
+}
#endif
#define tX_error(fmt, args...); { fprintf(stderr, "* tX_error: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
+#define tX_warning(fmt, args...); { fprintf(stderr, "+ tX_warning: "); fprintf(stderr, fmt , ## args); fprintf(stderr, "\n"); }
typedef struct {
char audio_device[PATH_MAX];
void LADSPA_Plugin :: handlelib(void *lib, LADSPA_Descriptor_Function desc_func, char *filename)
{
long i;
- long port;
+ unsigned long port;
const LADSPA_Descriptor *descriptor;
int in_audio, out_audio, in_ctrl;
}
else
{
- fprintf(stderr, "tX: Error: %s is not a LADSPA plugin library.");
+ fprintf(stderr, "tX: Error: %s is not a LADSPA plugin library.", filename);
dlclose(handle);
}
}
for (plugin=plugin_list.begin(); plugin != plugin_list.end(); plugin++)
{
- printf("plugin: %60s | id: %5i | ports: %2i\n", (*plugin)->getName(), (*plugin)->getUniqueID(), (*plugin)->getPortCount());
+ printf("plugin: %60s | id: %5li | ports: %2li\n", (*plugin)->getName(), (*plugin)->getUniqueID(), (*plugin)->getPortCount());
}
}
ladspa_descriptor = ld;
plugin_list.push_back(this);
strcpy(file, filename);
- sprintf (info_string, " LADSPA-Plugin: %s \n Label: %s \n File: %s \n Unique ID: %i \n Maker: %s \n Copyright: %s ", ld->Name, ld->Label, file, ld->UniqueID, ld->Maker, ld->Copyright);
+ sprintf (info_string, " LADSPA-Plugin: %s \n Label: %s \n File: %s \n Unique ID: %li \n Maker: %s \n Copyright: %s ", ld->Name, ld->Label, file, ld->UniqueID, ld->Maker, ld->Copyright);
}
LADSPA_Plugin * LADSPA_Plugin :: getPluginByIndex(int i)
void ld_set_progress(gfloat progress)
{
- progress=floor(progress*1000.0)/1000.0;
-
+ progress=floor(progress*200.0)/200.0;
+ if (progress>1.0) progress=1.0;
//printf("%f\n", progress);
if (progress!=ld_old_prog)
GtkSignalFunc new_table(GtkWidget *, char *fn)
{
- int i;
-
turn_audio_off();
if (fn)
{
char filename[PATH_MAX];
char *fn;
- int s;
- void *prr;
strncpy(filename, (char *) selection_data->data, (size_t) selection_data->length);
filename[selection_data->length]=0;
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(load_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_load_tables), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(load_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_load_tables), NULL);
gtk_signal_connect (GTK_OBJECT(load_dialog), "delete-event", GTK_SIGNAL_FUNC(cancel_load_tables), NULL);
+
+ return NULL;
}
GtkSignalFunc drop_set(GtkWidget *widget, GdkDragContext *context,
{
char filename[PATH_MAX];
char *fn;
- int s;
- void *prr;
strncpy(filename, (char *) selection_data->data, (size_t) selection_data->length);
filename[selection_data->length]=0;
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(save_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_save_tables), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(save_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_save_tables), NULL);
gtk_signal_connect (GTK_OBJECT(save_dialog), "delete-event", GTK_SIGNAL_FUNC(cancel_save_tables), NULL);
+
+ return NULL;
}
GtkSignalFunc master_volume_changed (GtkWidget *wid, void *d)
seq_stop(NULL, NULL);
mg_enable_critical_buttons(1);
}
+
+ return NULL;
}
GtkSignalFunc cancel_rec(GtkWidget *wid)
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(rec_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_rec), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(rec_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_rec), NULL);
gtk_signal_connect (GTK_OBJECT(rec_dialog), "delete-event", GTK_SIGNAL_FUNC(cancel_rec), NULL);
+
+ return NULL;
}
GtkSignalFunc tape_on(GtkWidget *w, void *d)
{
engine->set_recording_request(false);
}
+
+ return NULL;
}
void grab_on(GtkWidget *w, void *d)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(engine_btn), 1);
}
+
+ return NULL;
}
GtkSignalFunc seq_stop(GtkWidget *w, void *)
minu=sec=hun=0;
}
- sprintf(buffer, "%02li:%02li.%02li", minu, sec, hun);
+ sprintf(buffer, "%02i:%02i.%02i", minu, sec, hun);
gtk_entry_set_text(GTK_ENTRY(seq_entry), buffer);
}
GtkWidget *small_box;
GtkWidget *smaller_box;
- int i;
static GtkTargetEntry drop_types [] = {
{ "text/uri-list", 0, 0}
};
#define TX_MOUSE_SPEED_NORMAL 0.05
#define TX_MOUSE_SPEED_WARP 250000
-tx_mouse :: tx_mouse()
-{
+tx_mouse :: tx_mouse() {
mask=PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask;
xmot=(XMotionEvent *) &xev;
xkey=(XKeyEvent *) &xev;
}
-int tx_mouse :: grab()
-{
+int tx_mouse :: grab() {
#ifdef USE_DGA2
XDGAMode *mode;
#endif
- int i, num=0;
if (grabbed) return(0);
}
}
-void prelis_start(char *name)
-{
- char buffer[PATH_MAX*2];
+void prelis_start(char *name) {
char *ext;
pid_t temp;
int usempg123=0;
}
}
-tX_seqpar* tX_seqpar :: get_sp_by_persistence_id(int pid)
+tX_seqpar* tX_seqpar :: get_sp_by_persistence_id(unsigned int pid)
{
list <tX_seqpar *> :: iterator sp;
void tX_seqpar_vtt_speed :: do_exec(const float value)
{
- tt->speed=value;
+ tt->speed=value*tt->audiofile_pitch_correction;
}
const char * tX_seqpar_vtt_speed :: get_name()
static void create_persistence_ids();
guint32 get_persistence_id() { return persistence_id; }
- unsigned int set_persistence_id(guint32 pid) { persistence_id=pid; }
- static tX_seqpar *get_sp_by_persistence_id(int pid);
+ void set_persistence_id(guint32 pid) { persistence_id=pid; }
+ static tX_seqpar *get_sp_by_persistence_id(unsigned int pid);
void record_value (const float value);
virtual void do_exec(const float value);
set_output_buffer_size(samples_in_mix_buffer/2);
audiofile = NULL;
+ audiofile_pitch_correction=0;
mix_solo=0;
mix_mute=0;
res_mute=mute;
audiofile=new tx_audiofile();
res=audiofile->load(fname);
- if (res==TX_AUDIO_SUCCESS)
- {
+ if (res==TX_AUDIO_SUCCESS) {
buffer=audiofile->get_buffer();
+ double file_rate=audiofile->get_sample_rate();
+ audiofile_pitch_correction=file_rate/44100.0;
+ recalc_pitch();
samples_in_buffer=audiofile->get_no_samples();
maxpos=audiofile->get_no_samples();
strcpy(filename, fname);
{
// res_pitch=fabs(globals.pitch)*rel_pitch;
res_pitch=globals.pitch*rel_pitch;
+ res_pitch*=audiofile_pitch_correction;
speed=res_pitch;
ec_set_length(ec_length);
}
void vtt_class :: ec_set_length(f_prec length)
{
int delay;
- int i=0;
-
+
ec_length=length;
if (res_pitch==0)
{
int32_t counter;
int32_t type;
long id;
- int i,t;
+ int i;
+ unsigned int t;
LADSPA_Plugin *plugin;
char buffer[256];
vtt_fx_ladspa *ladspa_effect;
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%i].", id);
+ sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
tx_note(buffer);
res++;
}
int32_t counter;
int32_t type;
long id;
- int i,t;
+ int i;
+ unsigned int t;
LADSPA_Plugin *plugin;
char buffer[256];
vtt_fx_ladspa *ladspa_effect;
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%i].", id);
+ sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
tx_note(buffer);
res++;
}
int32_t counter;
int32_t type;
long id;
- int i,t;
+ int i;
+ unsigned int t;
LADSPA_Plugin *plugin;
char buffer[256];
vtt_fx_ladspa *ladspa_effect;
}
else
{
- sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%i].", id);
+ sprintf(buffer,"Fatal Error: Couldn't find required plugin with ID [%li].", id);
tx_note(buffer);
res++;
}
int vtt_class :: load_all_10(FILE* input, char *fname)
{
int res=0, restmp=0;
- list <vtt_class *> :: iterator vtt;
- unsigned int i, max, size;
- int16_t *newbuffer;
+ unsigned int i, max;
vtt_class *newvtt;
char ftmp[PATH_MAX];
int vtt_class :: load_all_11(FILE* input, char *fname)
{
int res=0, restmp=0;
- list <vtt_class *> :: iterator vtt;
- unsigned int i, max, size;
- int16_t *newbuffer;
+ unsigned int i, max;
vtt_class *newvtt;
char ftmp[PATH_MAX];
guint32 pid;
int vtt_class :: load_all_12(FILE* input, char *fname)
{
int res=0, restmp=0;
- list <vtt_class *> :: iterator vtt;
- unsigned int i, max, size;
- int16_t *newbuffer;
+ unsigned int i, max;
vtt_class *newvtt;
char ftmp[PATH_MAX];
guint32 pid;
int vtt_class :: load_all_13(FILE* input, char *fname)
{
int res=0, restmp=0;
- list <vtt_class *> :: iterator vtt;
- unsigned int i, max, size;
- int16_t *newbuffer;
+ unsigned int i, max;
vtt_class *newvtt;
char ftmp[PATH_MAX];
guint32 pid;
int vtt_class :: load_all_14(FILE* input, char *fname)
{
int res=0, restmp=0;
- list <vtt_class *> :: iterator vtt;
- unsigned int i, max, size;
- int16_t *newbuffer;
+ unsigned int i, max;
vtt_class *newvtt;
char ftmp[PATH_MAX];
guint32 pid;
#endif
int16_t *buffer; // Actual audio data
- int samples_in_buffer; // No. of samples in audio data
+ unsigned int samples_in_buffer; // No. of samples in audio data
int do_scratch;
f_prec *output_buffer;
tX_seqpar_spin sp_spin;
tx_audiofile *audiofile;
+ f_prec audiofile_pitch_correction;
list <vtt_fx *> fx_list;
{
int port;
float min, max;
- const char* last_word;
char buffer[2048];
char buffer2[2048];
void vtt_fx_ladspa :: load (FILE *input)
{
guint32 count;
- int i;
+ unsigned int i;
list <tX_seqpar_vttfx *> :: iterator sp;
guint32 pid;
guint8 hidden;
if (count!=controls.size())
{
- fprintf(stderr, "tX: Ouch! Plugin %i has less/more controls than saved!\n", plugin->getUniqueID());
+ fprintf(stderr, "tX: Ouch! Plugin %li has less/more controls than saved!\n", plugin->getUniqueID());
}
- for (i=0, sp=controls.begin(); i<count, sp!=controls.end(); i++, sp++)
- {
+ for (i=0, sp=controls.begin(); (i<count) && (sp!=controls.end()); i++, sp++) {
fread((void *) &pid, sizeof(pid), 1, input);
(*sp)->set_persistence_id(pid);
fread((void *) &value, sizeof(value), 1, input);
{
char *fn;
char temp[PATH_MAX];
- int i;
fn=strrchr(source, '/');
if (fn) fn++;
void load_part(char *newfile, vtt_class *vtt)
{
int ret=0;
- char *fn;
ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
ld_set_filename(newfile);
void do_load_file(GtkWidget *wid, vtt_class *vtt)
{
- int ret;
char newfile[PATH_MAX];
- char buffer[1024]="Couldn't open loop file: ";
- char fn[FILENAME_BUTTON_MAX];
-
- int16_t *newbuffer;
- unsigned int newsize;
prelis_stop();
{
char filename[PATH_MAX];
char *fn;
- int s;
- void *prr;
strncpy(filename, (char *) selection_data->data, (size_t) selection_data->length);
gtk_drag_finish(context, TRUE, FALSE, time);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "cursor_changed", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
#else
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "select_row", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
-#endif
+#endif
+ return NULL;
}
void delete_vtt(GtkWidget *wid, vtt_class *vtt)
void solo_vtt(GtkWidget *widget, vtt_class *vtt)
{
- list <vtt_class *> :: iterator it_vtt;
-
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
{
vtt->set_mix_solo(1);
LADSPA_Plugin *plugin;
char buffer[1024];
char oldfile[1024]="";
- GtkWidget *submenu;
+ GtkWidget *submenu=NULL;
fx_vtt=vtt; /* AAAAARGH - Long live ugly code */
gtk_menu_append(GTK_MENU(g->ladspa_menu), item);
gtk_widget_show(item);
}
- sprintf(buffer, "%s - [%i, %s]", plugin->getName(), plugin->getUniqueID(), plugin->getLabel());
+ sprintf(buffer, "%s - [%li, %s]", plugin->getName(), plugin->getUniqueID(), plugin->getLabel());
item=gtk_menu_item_new_with_label(buffer);
gtk_menu_append(GTK_MENU(submenu), item);
gtk_widget_show(item);
#include "wav_file.h"
#include "tX_endian.h"
+#include <string.h>
void init_head(wav_sig *info){
- int16_t tmp16;
int32_t tmp32;
strcpy(info->head, "RIFF WAVEfmt data ");