}
tx_audiofile :: ~tx_audiofile() {
- switch (mem_type) {
- case TX_AUDIO_MMAP: break;
- case TX_AUDIO_LOAD: {
- free(mem);
- break;
- }
- case TX_AUDIO_UNDEFINED: break;
- }
-
- if (file) {
- if (mem_type==TX_AUDIO_MMAP) {
- // free mmap
- }
+ if (mem) {
+ free(mem);
}
}
tX_engine :: ~tX_engine() {
void *dummy;
-
+
thread_terminate=true;
stop_flag=true;
pthread_mutex_unlock(&start);
tX_debug("~tX_engine() - Waiting for engine thread to terminate.");
pthread_join(thread, &dummy);
+
+ delete mouse;
+ delete midi;
+ delete tape;
}
}
turn_audio_off();
+ vtt_class::delete_all();
+
if (update_tag)
gtk_timeout_remove(update_tag);
globals.width=main_window->allocation.width;
int useogg123=0;
int res;
char dev[PATH_MAX];
- char ogg123_dev[PATH_MAX];
+ char ogg123_dev[PATH_MAX]="dev:";
char nm[PATH_MAX];
if (!globals.prelis) return;
{
ext++;
#ifdef USE_OGG123_INPUT
- strcpy(ogg123_dev, "dev:");
if (!strncasecmp("ogg", ext, 2))
useogg123=1;
else
strcpy(filename, "NONE");
buffer=NULL;
samples_in_buffer=0;
+ pos_i_max=0;
pan=0;
rel_pitch=1;
buffer=NULL;
samples_in_buffer=0;
maxpos=0;
+ pos_i_max=0;
strcpy(filename,"");
audiofile=new tx_audiofile();
audiofile_pitch_correction=file_rate/((double) last_sample_rate);
recalc_pitch();
samples_in_buffer=audiofile->get_no_samples();
+ pos_i_max=samples_in_buffer-1;
maxpos=audiofile->get_no_samples();
strcpy(filename, fname);
if (was_playing) trigger();
ptr=&buffer[pos_i];
sample_a=(f_prec) *ptr;
- if (pos_i == samples_in_buffer)
+ if (pos_i == pos_i_max)
{
sample_b=*buffer;
}
d_prec pos_f;
unsigned int pos_i;
+ unsigned int pos_i_max;
d_prec maxpos;
bool mute;
void delete_vtt(GtkWidget *wid, vtt_class *vtt)
{
if (audioon) tx_note("Sorry, you'll have to stop playback first.");
- else
- delete(vtt);
+ else delete(vtt);
+
+ mg_update_status();
}
void edit_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
tx->current_fg=&tx->fg;
tx->current_bg=&tx->bg;
+
+ tx->spp=1;
+ tx->lastmute=-1;
+ tx->zoom=0;
+ tx->cursor_pos=0;
+ tx->cursor_x_pos=0;
}
GtkWidget *gtk_tx_new(int16_t * wavdata, int wavsamples) {
g_return_if_fail(object != NULL);
g_return_if_fail(GTK_IS_TX(object));
+ GtkTx *tx=GTK_TX(object);
+
+ if (tx->disp_data) { free(tx->disp_data); tx->disp_data=NULL; }
+
if (GTK_OBJECT_CLASS(parent_class)->destroy) {
(*GTK_OBJECT_CLASS(parent_class)->destroy) (object);
- }
+ }
}
#define MAX_ZOOM_WIDTH 500000.0
tx->yc = widget->allocation.height / 2;
- if (tx->disp_data) free(tx->disp_data);
+ if (tx->disp_data) { free(tx->disp_data); tx->disp_data=NULL; }
if (tx->data) {
int max_spp=tx->samples/widget->allocation.width;
} else {
tx->disp_data = NULL;
}
+
+ tx->cursor_pos=-1;
+ tx->lastmute=-1;
+
//tX_warning("spp: %i samples: %i width %i x %i", tx->spp, tx->samples, tx->display_width, x);
}
gtk_widget_draw(GTK_WIDGET(tx), NULL);
}
-void gtk_tx_prepare_pos_display(GtkTx * tx) {
- tx->cursor_pos=-1;
- tx->lastmute=-1;
-}
-
void gtk_tx_update_pos_display(GtkTx * tx, int sample, int mute) {
GtkWidget *widget;
GdkWindow *window;
//current_x = sample / tx->spp + FR_SIZE;
current_pos = sample / tx->spp;
- if ((current_pos == tx->cursor_pos) && (tx->lastmute == mute)) return;
+ if ((current_pos == tx->cursor_pos) &&
+ (tx->lastmute == mute)) return;
tx->lastmute = mute;
/* speedup + easyness */
ymax = widget->allocation.height-1;
/* clean up last pos */
-
+
x = tx->cursor_x_pos;
if (x >= 0) {
GtkWidget* gtk_tx_new (int16_t *wavdata, int wavsamples);
guint gtk_tx_get_type (void);
void gtk_tx_set_data (GtkTx *tx, int16_t *wavdata, int wavsamples);
-void gtk_tx_prepare_pos_display (GtkTx *tx);
void gtk_tx_cleanup_pos_display (GtkTx *tx);
void gtk_tx_update_pos_display (GtkTx *tx, int sample, int mute);
void gtk_tx_show_frame(GtkTx *tx, int show);