Thats because it is called 'getNextEvent' in your class declaration, but 'getNextNote' in your definition.no_signal wrote: c:\vstsdk\vstsdk2\source\vstxsynth2\event.cpp(45) : error C2039: 'getNextNote' : is not a member of 'EventQueue'
You could investigate using the queue template, and have a class for note events. Do you really need the EventQueue class? You could do this:So how can I do this ? I tryed to define the struct as public or static struct ... but than I get lot's of errors.
header:
Code: Select all
#ifndef NoteEventQueue_h
#define NoteEventQueue_h
#include <iosfwd>
namespace std {
template<typename T, class U = deque<T> > class queue;
}
class NoteEvent;
typedef std::queue<NoteEvent> NoteEventQueue;
class NoteEvent
{
public:
NoteEvent(int time, int note, int velocity)
: time_(time), note_(note), vel_(velocity) {}
int time() const { return time_; }
int note() const { return note_; }
int velocity() const { return vel_; }
void setTime(int t) { time_ = t; }
void setNote(int n) { note_ = n; }
void setVelocity(int v) { vel_ = v; }
private:
int time_;
int note_;
int vel_;
};
std::ostream&
operator<<(std::ostream &os, const NoteEvent &e);
#endif /* NoteEventQueue_h */
Code: Select all
#include <queue>
#include <memory>
#include <iostream>
#include "NoteEventQueue.h"
using namespace std;
ostream&
operator<<(ostream &os, const NoteEvent &e)
{
return os << "Note<t = " << e.time() << ", n = "
<< e.note() << ", v = " << e.velocity() << ">";
};
int main(int argc, char* argv[])
{
auto_ptr<NoteEventQueue> pq(new NoteEventQueue);
pq->push(NoteEvent(0, 10, 20));
pq->push(NoteEvent(40, 50, 60));
cout << pq->front() << endl;
pq->pop();
pq->push(NoteEvent(70, 80, 90));
cout << pq->front() << endl;
pq->pop();
cout << pq->front() << endl;
pq->pop();
return 0;
}