annotate src/sndstretch/sndstretch_xmms.c @ 1071:bd897d14d627 trunk

[svn] - update sndstretch to plugin API v2
author nenolod
date Thu, 24 May 2007 12:24:11 -0700
parents 6bb0e52df3d6
children 6d87598ff8a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
881
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
1 // sndstretch_xmms.c
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
2 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
3 // sndstretch_xmms - xmms-output plugin for adjusting
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
4 // pitch and speed of s16le data
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
5 // Copyright (C) 2001 Florian Berger
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
6 // Email: florian.berger@jk.uni-linz.ac.at
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
7 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
8 // This program is free software; you can redistribute it and/or modify
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
9 // it under the terms of the GNU General Public License Version 2 as
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
10 // published by the Free Software Foundation;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
11 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
12 // This program is distributed in the hope that it will be useful,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
15 // GNU General Public License for more details.
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
16 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
17 // You should have received a copy of the GNU General Public License
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
18 // along with this program; if not, write to the Free Software
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
20 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
21 //
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
22
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
23 #include "sndstretch.h"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
24 #include "sndstretch_xmms-logo.xpm"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
25 #include "FB_logo.xpm"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
26
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
27 #include "audacious/configdb.h"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
28 #include "audacious/plugin.h"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
29 #include <gtk/gtk.h>
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
30 #include <math.h>
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
31 #include <stdlib.h>
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
32 #include <stdio.h>
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
33 #include <string.h>
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
34
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
35 #define SNDSTRETCH_VERSION_STRING "0.7"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
36
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
37 #define SS sndstretch_var
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
38
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
39 void sndstretch_init (void);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
40 void sndstretch_about (void);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
41 void sndstretch_config (void);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
42 int sndstretch_mod_samples (gpointer *ptr, gint length, AFormat fmt, gint srate, gint nch);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
43
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
44 EffectPlugin sndstretch_ep = {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
45 NULL,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
46 NULL,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
47 "SndStretch",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
48 sndstretch_init,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
49 NULL,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
50 sndstretch_about,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
51 sndstretch_config,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
52 sndstretch_mod_samples,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
53 NULL
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
54 };
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
55
1071
bd897d14d627 [svn] - update sndstretch to plugin API v2
nenolod
parents: 881
diff changeset
56 EffectPlugin *sndstretch_eplist[] = { &sndstretch_ep, NULL };
881
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
57
1071
bd897d14d627 [svn] - update sndstretch to plugin API v2
nenolod
parents: 881
diff changeset
58 DECLARE_PLUGIN(sndstretch, NULL, NULL, NULL, NULL, sndstretch_eplist, NULL, NULL);
881
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
59
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
60 static struct {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
61 int handle; // file handle
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
62 int fragsize;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
63 int chnr;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
64 int paused;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
65 int time_offs;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
66 int fmtsize;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
67 int fmt;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
68 int sampfreq;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
69 int written;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
70 int bpsec;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
71 int vol_l,vol_r;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
72 int going;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
73 double pitch;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
74 double speed;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
75 double scale;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
76 int short_overlap;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
77 int volume_corr;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
78 GtkObject * pitch_adj;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
79 GtkObject * speed_adj;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
80 GtkObject * scale_adj;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
81 } sndstretch_var;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
82
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
83
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
84 static const char sndstretch_title_text[] = "SndStretch xmms - " SNDSTRETCH_VERSION_STRING;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
85
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
86 static const gchar sndstretch_about_text[] =
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
87 "Copyright (C) 2001 Florian Berger\n<harpin_floh@yahoo.de>\n"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
88 "Ported to Audacious by Michael Färber\n"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
89 "http://www.geocities.com/harpin_floh/home.html";
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
90
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
91 static const gchar sndstretch_GPL_text[] =
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
92 "This program is free software; you can redistribute it and/or modify "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
93 "it under the terms of the GNU General Public License as published by "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
94 "the Free Software Foundation; either version 2 of the License, or "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
95 "(at your option) any later version.\n\n"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
96 "This program is distributed in the hope that it will be useful, "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
97 "but WITHOUT ANY WARRANTY; without even the implied warranty of "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
98 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
99 "GNU General Public License for more details.\n\n"
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
100 "You should have received a copy of the GNU General Public License "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
101 "along with this program; if not, write to the Free Software "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
102 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, "
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
103 "USA.";
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
104
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
105 GtkWidget * sndstretch_about_dialog = NULL;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
106 GtkWidget * sndstretch_config_dialog = NULL;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
107
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
108
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
109 static gint sndstretch_about_destroy_cb(GtkWidget * w, GdkEventAny * e, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
110 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
111 gtk_widget_destroy(sndstretch_about_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
112 sndstretch_about_dialog = NULL;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
113 return TRUE;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
114 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
115
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
116 static void sndstretch_about_ok_cb(GtkButton * button, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
117 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
118 gtk_widget_destroy(GTK_WIDGET(sndstretch_about_dialog));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
119 sndstretch_about_dialog = NULL;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
120 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
121
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
122 void sndstretch_about(void)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
123 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
124 GtkWidget * vbox, * scrolltext, * button;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
125 GtkWidget * titlelabel, * copylabel;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
126 GtkWidget * text;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
127 GtkTextBuffer * textbuffer;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
128 GtkTextIter iter;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
129
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
130 GdkPixmap * logopix;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
131 GdkBitmap * logomask;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
132 GtkWidget * logo;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
133
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
134 GdkPixmap * FBlogopix;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
135 GdkBitmap * FBlogomask;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
136 GtkWidget * FBlogo;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
137 GtkWidget * copyhbox, * copy_rbox, * copy_lbox;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
138
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
139
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
140 if (sndstretch_about_dialog != NULL)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
141 return;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
142
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
143 sndstretch_about_dialog = gtk_dialog_new();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
144 gtk_widget_show(sndstretch_about_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
145
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
146 /* title logo */
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
147 logopix = gdk_pixmap_create_from_xpm_d(sndstretch_about_dialog->window, &logomask,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
148 NULL,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
149 (gchar **) sndstretch_xmms_logo_xpm);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
150 logo = gtk_pixmap_new(logopix,logomask);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
151
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
152 /* FB-logo */
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
153 FBlogopix = gdk_pixmap_create_from_xpm_d(sndstretch_about_dialog->window, &FBlogomask,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
154 NULL,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
155 (gchar **) FB_logo_xpm);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
156 FBlogo = gtk_pixmap_new(FBlogopix,FBlogomask);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
157
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
158
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
159 gtk_signal_connect(GTK_OBJECT(sndstretch_about_dialog), "destroy",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
160 GTK_SIGNAL_FUNC(sndstretch_about_destroy_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
161 gtk_window_set_title(GTK_WINDOW(sndstretch_about_dialog), "About SndStretch");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
162
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
163
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
164 /* labels */
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
165 titlelabel = gtk_label_new(sndstretch_title_text);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
166 copylabel = gtk_label_new(sndstretch_about_text);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
167 gtk_label_set_justify(GTK_LABEL(copylabel), GTK_JUSTIFY_LEFT);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
168
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
169 copy_lbox = gtk_hbox_new(FALSE,0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
170 copy_rbox = gtk_hbox_new(FALSE,0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
171 gtk_box_pack_end (GTK_BOX(copy_lbox), FBlogo, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
172 gtk_box_pack_start(GTK_BOX(copy_rbox), copylabel, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
173 copyhbox = gtk_hbox_new(FALSE,0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
174 gtk_box_pack_start(GTK_BOX(copyhbox), copy_lbox, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
175 gtk_box_pack_start(GTK_BOX(copyhbox), copy_rbox, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
176
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
177 vbox = gtk_vbox_new(FALSE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
178 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(sndstretch_about_dialog)->vbox), vbox,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
179 TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
180
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
181 scrolltext = gtk_scrolled_window_new(NULL,NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
182 text = gtk_text_view_new();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
183 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
184 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
185 textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
186 gtk_text_buffer_get_iter_at_offset(textbuffer, &iter, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
187 gtk_text_buffer_insert(textbuffer, &iter,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
188 sndstretch_GPL_text, strlen(sndstretch_GPL_text));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
189
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
190
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
191 scrolltext = gtk_scrolled_window_new(NULL, NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
192 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolltext),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
193 GTK_POLICY_AUTOMATIC,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
194 GTK_POLICY_AUTOMATIC);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
195 gtk_container_add(GTK_CONTAINER(scrolltext), text);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
196
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
197 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
198 gtk_box_pack_start(GTK_BOX(vbox), titlelabel, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
199 gtk_box_pack_start(GTK_BOX(vbox), copyhbox, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
200 gtk_box_pack_start(GTK_BOX(vbox), scrolltext, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
201 gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
202 gtk_widget_set_usize(scrolltext, -1, 110);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
203
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
204 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
205 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(sndstretch_about_dialog)->action_area),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
206 button, FALSE, FALSE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
207 gtk_signal_connect(GTK_OBJECT(button), "clicked",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
208 GTK_SIGNAL_FUNC(sndstretch_about_ok_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
209 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
210 gtk_widget_grab_default(button);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
211 gtk_widget_show(button);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
212 gtk_widget_show_all(sndstretch_about_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
213 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
214
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
215
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
216
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
217 static void speed_change_cb(GtkAdjustment * adj, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
218 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
219 SS.speed = pow(2.0, GTK_ADJUSTMENT(adj)->value / (GTK_ADJUSTMENT(adj)->upper-10));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
220 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
221
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
222 static void pitch_change_cb(GtkAdjustment * adj, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
223 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
224 SS.pitch = pow(2.0, GTK_ADJUSTMENT(adj)->value / (GTK_ADJUSTMENT(adj)->upper-10));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
225 gtk_adjustment_set_value(GTK_ADJUSTMENT(SS.scale_adj),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
226 (GTK_ADJUSTMENT(SS.scale_adj)->upper-10.0)*log(SS.pitch)/log(2.0));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
227 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
228
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
229 static void scale_change_cb(GtkAdjustment * adj, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
230 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
231 double speed_eff;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
232
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
233 SS.scale = pow(2.0, GTK_ADJUSTMENT(adj)->value / (GTK_ADJUSTMENT(adj)->upper-10));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
234 speed_eff= SS.speed/SS.pitch;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
235 SS.pitch = SS.scale;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
236 SS.speed = speed_eff*SS.scale;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
237 if (SS.speed>2.0) SS.speed=2.0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
238 if (SS.speed<0.5) SS.speed=0.5;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
239 gtk_adjustment_set_value(GTK_ADJUSTMENT(SS.speed_adj),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
240 (GTK_ADJUSTMENT(SS.speed_adj)->upper-10.0)*log(SS.speed)/log(2.0));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
241 gtk_adjustment_set_value(GTK_ADJUSTMENT(SS.pitch_adj),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
242 (GTK_ADJUSTMENT(SS.pitch_adj)->upper-10.0)*log(SS.pitch)/log(2.0));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
243 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
244
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
245 static void overlap_toggle_cb(GtkToggleButton *butt, gpointer user_data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
246 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
247 SS.short_overlap = gtk_toggle_button_get_active(butt);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
248 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
249
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
250 static void volume_toggle_cb(GtkToggleButton *butt, gpointer user_data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
251 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
252 SS.volume_corr = gtk_toggle_button_get_active(butt);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
253 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
254
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
255 static void sndstretch_config_logobutton_cb(GtkButton * button, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
256 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
257 sndstretch_about();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
258 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
259
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
260 static gint sndstretch_config_destroy_cb(GtkWidget * w, GdkEventAny * e, gpointer data)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
261 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
262 ConfigDb *db = bmp_cfg_db_open();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
263
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
264 bmp_cfg_db_set_double(db, "sndstretch", "pitch", SS.pitch);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
265 bmp_cfg_db_set_double(db, "sndstretch", "speed", SS.speed);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
266
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
267 bmp_cfg_db_set_bool(db, "sndstretch", "short_overlap", SS.short_overlap);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
268 bmp_cfg_db_set_bool(db, "sndstretch", "volume_corr", SS.volume_corr);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
269
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
270 bmp_cfg_db_close(db);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
271
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
272 gtk_widget_destroy(sndstretch_config_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
273 sndstretch_config_dialog = NULL;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
274 return TRUE;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
275 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
276
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
277 void sndstretch_config(void)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
278 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
279 GtkWidget * vbox;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
280 GtkWidget * speed_scale, * pitch_scale, * scale_scale;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
281 GtkWidget * speed_spin, * pitch_spin, * scale_spin;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
282 GtkWidget * speed_hbox, * pitch_hbox, * scale_hbox, * opt_hbox;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
283 GtkWidget * speed_frame, * pitch_frame, * scale_frame, * opt_frame;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
284 GdkPixmap * logopix;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
285 GdkBitmap * logomask;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
286 GtkWidget * logo;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
287 GtkWidget * logohbox;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
288 GtkWidget * logobutton;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
289 GtkWidget * volume_toggle;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
290 GtkWidget * overlap_toggle;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
291
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
292 if (sndstretch_config_dialog != NULL)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
293 return;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
294
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
295 sndstretch_config_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
296 gtk_widget_show(sndstretch_config_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
297
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
298 logopix = gdk_pixmap_create_from_xpm_d(sndstretch_config_dialog->window, &logomask,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
299 NULL, (gchar **)sndstretch_xmms_logo_xpm);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
300
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
301 logo = gtk_pixmap_new(logopix,logomask);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
302
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
303 logobutton = gtk_button_new();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
304 gtk_button_set_relief(GTK_BUTTON(logobutton), GTK_RELIEF_NONE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
305 gtk_container_add(GTK_CONTAINER(logobutton), logo);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
306 gtk_signal_connect(GTK_OBJECT(logobutton), "clicked",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
307 GTK_SIGNAL_FUNC(sndstretch_config_logobutton_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
308 GTK_WIDGET_SET_FLAGS(logobutton, GTK_CAN_DEFAULT);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
309 gtk_widget_grab_default(logobutton);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
310
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
311 logohbox = gtk_hbox_new(FALSE,0); // to make it rightbound
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
312 gtk_box_pack_end(GTK_BOX(logohbox), logobutton, FALSE, TRUE, 4);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
313
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
314 SS.speed_adj = gtk_adjustment_new( 100.0*log(SS.speed)/log(2.0),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
315 -100, 100+10, 2, 10, 10);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
316 SS.pitch_adj = gtk_adjustment_new( 120.0*log(SS.pitch)/log(2.0),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
317 -120, 120+10, 2, 10, 10);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
318 SS.scale_adj = gtk_adjustment_new( 100.0*log(SS.scale)/log(2.0),
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
319 -100, 100+10, 2, 10, 10);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
320
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
321 volume_toggle = gtk_check_button_new_with_label("Volume corr.");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
322 overlap_toggle = gtk_check_button_new_with_label("Short Overlap");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
323 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(volume_toggle), SS.volume_corr );
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
324 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(overlap_toggle), SS.short_overlap );
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
325
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
326
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
327 gtk_signal_connect(GTK_OBJECT(SS.speed_adj), "value-changed",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
328 GTK_SIGNAL_FUNC(speed_change_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
329
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
330 gtk_signal_connect(GTK_OBJECT(SS.pitch_adj), "value-changed",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
331 GTK_SIGNAL_FUNC(pitch_change_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
332
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
333 gtk_signal_connect(GTK_OBJECT(SS.scale_adj), "value-changed",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
334 GTK_SIGNAL_FUNC(scale_change_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
335
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
336 gtk_signal_connect(GTK_OBJECT(volume_toggle), "toggled",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
337 GTK_SIGNAL_FUNC(volume_toggle_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
338
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
339 gtk_signal_connect(GTK_OBJECT(overlap_toggle), "toggled",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
340 GTK_SIGNAL_FUNC(overlap_toggle_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
341
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
342 speed_scale = gtk_hscale_new(GTK_ADJUSTMENT(SS.speed_adj));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
343 pitch_scale = gtk_hscale_new(GTK_ADJUSTMENT(SS.pitch_adj));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
344 scale_scale = gtk_hscale_new(GTK_ADJUSTMENT(SS.scale_adj));
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
345 gtk_scale_set_draw_value (GTK_SCALE(speed_scale),FALSE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
346 gtk_scale_set_draw_value (GTK_SCALE(pitch_scale),FALSE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
347 gtk_scale_set_draw_value (GTK_SCALE(scale_scale),FALSE);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
348
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
349 speed_spin = gtk_spin_button_new(GTK_ADJUSTMENT(SS.speed_adj),1.0,2);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
350 pitch_spin = gtk_spin_button_new(GTK_ADJUSTMENT(SS.pitch_adj),1.0,2);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
351 scale_spin = gtk_spin_button_new(GTK_ADJUSTMENT(SS.scale_adj),1.0,2);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
352 gtk_widget_set_usize (speed_spin,70,20);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
353 gtk_widget_set_usize (pitch_spin,70,20);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
354 gtk_widget_set_usize (scale_spin,70,20);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
355 gtk_entry_set_max_length (GTK_ENTRY(pitch_spin),7);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
356 gtk_entry_set_max_length (GTK_ENTRY(speed_spin),7);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
357 gtk_entry_set_max_length (GTK_ENTRY(scale_spin),7);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
358
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
359 speed_hbox = gtk_hbox_new(FALSE,5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
360 pitch_hbox = gtk_hbox_new(FALSE,5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
361 scale_hbox = gtk_hbox_new(FALSE,5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
362 opt_hbox = gtk_hbox_new(FALSE,5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
363 gtk_container_set_border_width(GTK_CONTAINER(speed_hbox), 3);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
364 gtk_container_set_border_width(GTK_CONTAINER(pitch_hbox), 3);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
365 gtk_container_set_border_width(GTK_CONTAINER(scale_hbox), 3);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
366 gtk_container_set_border_width(GTK_CONTAINER(opt_hbox), 3);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
367 gtk_box_pack_start(GTK_BOX(speed_hbox), speed_spin, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
368 gtk_box_pack_start(GTK_BOX(speed_hbox), speed_scale, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
369 gtk_box_pack_start(GTK_BOX(pitch_hbox), pitch_spin, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
370 gtk_box_pack_start(GTK_BOX(pitch_hbox), pitch_scale, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
371 gtk_box_pack_start(GTK_BOX(scale_hbox), scale_spin, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
372 gtk_box_pack_start(GTK_BOX(scale_hbox), scale_scale, TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
373 gtk_box_pack_start(GTK_BOX(opt_hbox), volume_toggle, FALSE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
374 gtk_box_pack_start(GTK_BOX(opt_hbox), overlap_toggle,TRUE, TRUE, 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
375
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
376 speed_frame = gtk_frame_new("Speed");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
377 pitch_frame = gtk_frame_new("Pitch");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
378 scale_frame = gtk_frame_new("Scale");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
379 opt_frame = gtk_frame_new("Options");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
380 gtk_container_add(GTK_CONTAINER(speed_frame), speed_hbox);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
381 gtk_container_add(GTK_CONTAINER(pitch_frame), pitch_hbox);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
382 gtk_container_add(GTK_CONTAINER(scale_frame), scale_hbox);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
383 gtk_container_add(GTK_CONTAINER(opt_frame), opt_hbox);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
384 gtk_container_set_border_width(GTK_CONTAINER(speed_frame), 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
385 gtk_container_set_border_width(GTK_CONTAINER(pitch_frame), 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
386 gtk_container_set_border_width(GTK_CONTAINER(scale_frame), 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
387 gtk_container_set_border_width(GTK_CONTAINER(opt_frame), 5);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
388
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
389 vbox=gtk_vbox_new(FALSE,0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
390 gtk_box_pack_start(GTK_BOX(vbox), pitch_frame, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
391 gtk_box_pack_start(GTK_BOX(vbox), speed_frame, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
392 gtk_box_pack_start(GTK_BOX(vbox), scale_frame, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
393 gtk_box_pack_start(GTK_BOX(vbox), opt_frame, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
394 gtk_box_pack_start(GTK_BOX(vbox), logohbox, FALSE, TRUE, 0);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
395
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
396 gtk_signal_connect(GTK_OBJECT(sndstretch_config_dialog), "destroy",
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
397 GTK_SIGNAL_FUNC(sndstretch_config_destroy_cb), NULL);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
398 gtk_window_set_title(GTK_WINDOW(sndstretch_config_dialog), "SndStretch - Configuration");
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
399 gtk_container_add(GTK_CONTAINER(sndstretch_config_dialog), vbox);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
400
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
401 gtk_widget_set_usize(sndstretch_config_dialog, 275, -1);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
402 gtk_widget_show_all(sndstretch_config_dialog);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
403 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
404
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
405
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
406 void sndstretch_init(void)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
407 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
408 ConfigDb *db;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
409
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
410 db = bmp_cfg_db_open();
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
411
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
412 SS.fragsize=0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
413 SS.chnr=2;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
414 SS.paused=0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
415 SS.time_offs=0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
416 SS.fmtsize=2;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
417 SS.fmt=FMT_S16_NE;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
418 SS.sampfreq=44100;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
419 SS.written=0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
420 SS.bpsec=176400;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
421 SS.vol_r=50;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
422 SS.vol_l=50;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
423 SS.pitch=1.0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
424 SS.speed=1.0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
425 SS.scale=1.0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
426
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
427 gboolean b;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
428 bmp_cfg_db_get_double(db, "sndstretch", "pitch", &SS.pitch);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
429 bmp_cfg_db_get_double(db, "sndstretch", "speed", &SS.speed);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
430 if (bmp_cfg_db_get_bool(db, "sndstretch", "short_overlap", &b))
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
431 SS.short_overlap = b;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
432 if (bmp_cfg_db_get_bool(db, "sndstretch", "volume_corr", &b))
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
433 SS.volume_corr = b;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
434 bmp_cfg_db_close(db);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
435 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
436
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
437 int sndstretch_mod_samples (gpointer *ptr, gint length, AFormat fmt, gint srate, gint nch)
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
438 {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
439 static short int * buff_o;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
440 static int prod_size;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
441 static PitchSpeedJob job;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
442 static int init_job=1;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
443
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
444 buff_o = realloc(buff_o, 65536);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
445
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
446 if (init_job) {
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
447 InitPitchSpeedJob(&job);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
448 init_job = 0;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
449 }
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
450 snd_pitch_speed_job(*ptr, nch, length/2, 0, SS.pitch, SS.speed,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
451 (SS.short_overlap) ? 882 : 1764,
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
452 buff_o, &prod_size, &job, SS.volume_corr);
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
453
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
454 *ptr = (gpointer) buff_o;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
455
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
456 return prod_size*2;
6bb0e52df3d6 [svn] - Made port of XMMS plugin SndStretch
mf0102
parents:
diff changeset
457 }