1 /* wavbreaker - A tool to split a wave file up into multiple wave.
2  * Copyright (C) 2002-2005 Timothy Robinson
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18 
19 #ifndef SAMPLE_H
20 #define SAMPLE_H
21 
22 #include <glib.h>
23 
24 typedef struct Points_ Points;
25 struct Points_ {
26         int min, max;
27 };
28 
29 typedef struct GraphData_ GraphData;
30 struct GraphData_{
31 	unsigned long numSamples;
32 	unsigned long maxSampleValue;
33         unsigned long maxSampleAmp;
34         unsigned long minSampleAmp;
35 	Points *data;
36 };
37 
38 typedef struct WriteInfo_ WriteInfo;
39 struct WriteInfo_ {
40 	guint num_files;
41 	guint cur_file;
42 	char *cur_filename;
43 	char *merge_filename;
44 	double pct_done;
45 	guint sync;
46 	gint check_file_exists;
47 	gint skip_file; /* -1 = waiting for check
48                      * 0 = don't overwrite file
49                      * 1 = file is ok to overwrite
50                      * 2 = overwrite all files
51                      */
52     gint sync_check_file_overwrite_to_write_progress;
53 };
54 
55 #define DEFAULT_BUF_SIZE 4096
56 
57 #define CD_BLOCKS_PER_SEC               (75)
58 
59 /* Responses for the ask open raw dialog */
60 #define WB_RESPONSE_LITTLE_ENDIAN 1
61 #define WB_RESPONSE_BIG_ENDIAN 2
62 
63 typedef struct SampleInfo_ SampleInfo;
64 
65 struct SampleInfo_ {
66     unsigned short  channels;
67     unsigned int    samplesPerSec;
68     unsigned int    avgBytesPerSec;
69     unsigned short  blockAlign;
70     unsigned short  bitsPerSample;
71     unsigned long   numBytes;
72     unsigned int    bufferSize;
73     unsigned int    blockSize;
74 };
75 
76 char *sample_get_error_message();
77 
78 void sample_init();
79 void sample_set_audio_dev(char *str);
80 char * sample_get_audio_dev();
81 
82 char * sample_get_sample_file();
83 
84 int sample_is_playing();
85 int sample_is_writing();
86 int play_sample(gulong startpos, gulong *play_marker);
87 void stop_sample();
88 int sample_open_file(const char *, GraphData *, double *);
89 void sample_close_file();
90 void sample_write_files(GList *, WriteInfo *, char *);
91 void sample_merge_files(char *merge_filename, GList *filenames, WriteInfo *write_info);
92 
93 #endif /* SAMPLE_H*/
94