-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtimecoder.h
More file actions
76 lines (59 loc) · 2.61 KB
/
timecoder.h
File metadata and controls
76 lines (59 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (C) 2007 Mark Hills <mark@pogo.org.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details.
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef TIMECODER_H
#define TIMECODER_H
#define DEVICE_CHANNELS 2
#define DEVICE_RATE 44100
#define DEVICE_FRAME 32
#define TIMECODER_CHANNELS DEVICE_CHANNELS
#define TIMECODER_RATE DEVICE_RATE
struct timecoder_channel_t {
signed short zero, signal_level, half_peak, wave_peak, ref_level;
int positive, /* wave is in positive part of cycle */
crossings; /* number of zero crossings */
unsigned int bitstream, /* actual bits from the record */
timecode, /* corrected timecode */
valid_counter, /* number of successful error checks */
crossings_ticker, /* number of samples from which crossings counted */
cycle_ticker, /* samples since wave last crossed zero */
timecode_ticker; /* samples since valid timecode was read */
};
struct timecoder_t {
struct timecoder_channel_t state[TIMECODER_CHANNELS];
int forwards;
unsigned char *mon; /* visual monitor of waveform */
int mon_size, mon_counter, mon_scale,
log_fd; /* optional file descriptor to log to, or -1 for none */
};
/* Building the lookup table is global. Need a good way to share
* lookup tables soon, so we can use a different timecode on
* each timecoder, and switch between them. */
int timecoder_build_lookup(char *timecode_name);
void timecoder_free_lookup(void);
void timecoder_init(struct timecoder_t *tc);
void timecoder_clear(struct timecoder_t *tc);
void timecoder_monitor_init(struct timecoder_t *tc, int size, int scale);
void timecoder_monitor_clear(struct timecoder_t *tc);
int timecoder_submit(struct timecoder_t *tc, signed short *pcm, int samples);
int timecoder_get_pitch(struct timecoder_t *tc, float *pitch);
signed int timecoder_get_position(struct timecoder_t *tc, int *when);
int timecoder_get_alive(struct timecoder_t *tc);
unsigned int timecoder_get_safe(struct timecoder_t *tc);
int timecoder_get_resolution(struct timecoder_t *tc);
#endif