summaryrefslogtreecommitdiff
path: root/vfg/src/music.h
blob: 39ffd9525ad595570f235a1fb86ef76b33bf9b1e (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#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
		bool activated;
		void playerActivated() { activated=true; }
};
//---------------------------------------------------------------------------------------------------------------------------------------------
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();
	
		void playerControl(int key);
	//in wrong object?
		int missedTime;
	private:
		map<int,note*> notes;
		map<int,note*> stars;
		int timeframe;
		ofImage flake;
	
	//in wrong object?
		int interactionThresh;
		
		
		int playerKey;
};
//---------------------------------------------------------------------------------------------------------------------------------------------
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;
		void playerControl(int key);
	private:
		ofSoundPlayer backing;
		ofSoundPlayer melody;
		lyricscore lyrics;
		musicscore notes;
		long startTime;
		bool isPreroll;
	
		int missedInterval;
		
};
//---------------------------------------------------------------------------------------------------------------------------------------------