summaryrefslogtreecommitdiff
path: root/vfg/src/music.h
blob: aa38f46fe463d847a38c967a1bcee730fff50019 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include "ofMain.h"
#include "ofxXmlSettings.h"

//event times are absolute integer milliseconds
//---------------------------------------------------------------------------------------------------------------------------------------------
class note {
	public:
		note(int n,int v,int d=0);
		int num;
		int velocity;
		int duration; //may be needed another time?
		int updown; //-1 0 1 used for 3-button interaction
};
//---------------------------------------------------------------------------------------------------------------------------------------------
class score {
	//basics of timelime
	public:
		long startTime;
	protected:
		ofxXmlSettings XML;
};
//---------------------------------------------------------------------------------------------------------------------------------------------
class lyricscore: public score {
	//draws lyrics to screen for a certain time
	public:
};
//---------------------------------------------------------------------------------------------------------------------------------------------
class musicscore: public score {
	//draws notes to screen for a certain time and certain parameters, checks when they become ready
	public:
		musicscore();
		void parseMidi(string filename);
		void setTimeframe(int millis);
		void draw();
	private:
		map<int,note*> notes;
		map<int,note*> stars;
		int timeframe;
		ofImage flake;
};
//---------------------------------------------------------------------------------------------------------------------------------------------
class song {
	public:
		song(string backfile,string melfile,string musfile);
		void play();
		void stop();
		void preRoll(long preroll);
		void setTimeframe(int millis);
		void draw();
		bool isPlaying;
	private:
		ofSoundPlayer backing;
		ofSoundPlayer melody;
		lyricscore lyrics;
		musicscore notes;
		long startTime;
		bool isPreroll;
};
//---------------------------------------------------------------------------------------------------------------------------------------------