aboutsummaryrefslogtreecommitdiff
path: root/src/lib/smpte.h
blob: fdaef3a41f177638d110184d2bea863e67ca6cd7 (plain)
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
#ifndef __smpte_h__
#define __smpte_h__

using namespace std;
#include "config.h"
#include <string>
#include <iostream>

class SMPTEgenerator
{
	private:		

		short* smpteword;
		int prevbitnum;
		int prevhalfbit;
		int prevoutval;
		int framerate;
		int nondrop;
		int haveframe; // indicates if a new frame word must be generated
		int samplerate;

		/* These are pre-calculated: */
		int bitsperframe;
		int bitspersecond;
		int samplesperbit;
		int samplesperframe;
		void recalcrates();
		void fillword(int hour,int min,int sec,int frame);

		void setsamplerate(__uint32 p_samplerate);
		void setframerate(__uint32 p_samplerate);

		int modulate(int currbitval,int bitnum,int halfbit);
	public:
		SMPTEgenerator(__uint32 p_samplerate);
		~SMPTEgenerator();
		int getbit(__uint32 insamnum);

};

#endif