Mercurial > hg > svcore
comparison plugin/plugins/SamplePlayer.h @ 0:da6937383da8
initial import
author | Chris Cannam |
---|---|
date | Tue, 10 Jan 2006 16:33:16 +0000 |
parents | |
children | d86891498eef |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:da6937383da8 |
---|---|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 A waveform viewer and audio annotation editor. | |
5 Chris Cannam, Queen Mary University of London, 2005 | |
6 | |
7 This is experimental software. Not for distribution. | |
8 */ | |
9 | |
10 #ifndef _SAMPLE_PLAYER_H_ | |
11 #define _SAMPLE_PLAYER_H_ | |
12 | |
13 #define DSSI_API_LEVEL 2 | |
14 | |
15 #include <ladspa.h> | |
16 #include <dssi.h> | |
17 #include <seq_event.h> | |
18 | |
19 #include <QMutex> | |
20 #include <QString> | |
21 #include <vector> | |
22 | |
23 class SamplePlayer | |
24 { | |
25 public: | |
26 static const DSSI_Descriptor *getDescriptor(unsigned long index); | |
27 | |
28 private: | |
29 SamplePlayer(int sampleRate); | |
30 ~SamplePlayer(); | |
31 | |
32 enum { | |
33 OutputPort = 0, | |
34 RetunePort = 1, | |
35 BasePitchPort = 2, | |
36 SustainPort = 3, | |
37 ReleasePort = 4, | |
38 PortCount = 5 | |
39 }; | |
40 | |
41 enum { | |
42 Polyphony = 128 | |
43 }; | |
44 | |
45 static const char *const portNames[PortCount]; | |
46 static const LADSPA_PortDescriptor ports[PortCount]; | |
47 static const LADSPA_PortRangeHint hints[PortCount]; | |
48 static const LADSPA_Properties properties; | |
49 static const LADSPA_Descriptor ladspaDescriptor; | |
50 static const DSSI_Descriptor dssiDescriptor; | |
51 static const DSSI_Host_Descriptor *hostDescriptor; | |
52 | |
53 static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long); | |
54 static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *); | |
55 static void activate(LADSPA_Handle); | |
56 static void run(LADSPA_Handle, unsigned long); | |
57 static void deactivate(LADSPA_Handle); | |
58 static void cleanup(LADSPA_Handle); | |
59 static const DSSI_Program_Descriptor *getProgram(LADSPA_Handle, unsigned long); | |
60 static void selectProgram(LADSPA_Handle, unsigned long, unsigned long); | |
61 static int getMidiController(LADSPA_Handle, unsigned long); | |
62 static void runSynth(LADSPA_Handle, unsigned long, | |
63 snd_seq_event_t *, unsigned long); | |
64 static void receiveHostDescriptor(const DSSI_Host_Descriptor *descriptor); | |
65 static void workThreadCallback(LADSPA_Handle); | |
66 | |
67 void searchSamples(); | |
68 void loadSampleData(QString path); | |
69 void runImpl(unsigned long, snd_seq_event_t *, unsigned long); | |
70 void addSample(int, unsigned long, unsigned long); | |
71 | |
72 float *m_output; | |
73 float *m_retune; | |
74 float *m_basePitch; | |
75 float *m_sustain; | |
76 float *m_release; | |
77 | |
78 float *m_sampleData; | |
79 size_t m_sampleCount; | |
80 int m_sampleRate; | |
81 | |
82 long m_ons[Polyphony]; | |
83 long m_offs[Polyphony]; | |
84 int m_velocities[Polyphony]; | |
85 long m_sampleNo; | |
86 | |
87 QString m_program; | |
88 std::vector<std::pair<QString, QString> > m_samples; // program name, path | |
89 bool m_sampleSearchComplete; | |
90 int m_pendingProgramChange; | |
91 | |
92 QMutex m_mutex; | |
93 }; | |
94 | |
95 | |
96 #endif |