
|
[openbeos-midi]
||
[Date Prev]
[01-2003 Date Index]
[Date Next]
||
[Thread Prev]
[01-2003 Thread Index]
[Thread Next]
[openbeos-midi] Re: 2nd Version
- From: "Matthijs Hollemans" <matthijs@xxxxxxxxxxxxxxxxxxx>
- To: <openbeos-midi@xxxxxxxxxxxxx>
- Date: Sun, 12 Jan 2003 16:16:58 +0100
Hi Jerome,
> Test it and tell me if that work with your computer.
I used Be's midi_server and libmidi2.so and started PatchBay. I also
used the VirtualMidi driver because I don't have a driver for my
soundcard. The PatchBay screen correctly shows the endpoints that
the midi_server makes, and the endpoints that your program makes. So
I hooked up a MidiKeyboard program and InternalMidi, and connected
them to the VirtualMidi buses. Then I started playing. But after a
few key presses, my whole system froze up. The midi_server was going
nuts, and kept on sending many many MIDI events to the endpoints. I
had to reset my computer to make it work again ;-) (I did not check
whether this also happens without your app.)
I haven't studied the MIDI driver protocol enough to comment on your
code, but I do have a little suggestion about the thread. In the
MidiPortProducer constructor, you fill in a Poducer_Thread_Data
structure, and you pass that to spawn_thread. I understand why you
are doing this, but there is a much simpler solution. I suggest you
do it like this:
-----------------cut--here------
class MidiPortProducer : public BMidiLocalProducer
{
public:
....
private:
static int32 SpawnThread(void* data);
int32 GetData(); // not static
int filedescriptor; // why not just call this "fd" ?
};
The functions then look like:
MidiPortProducer::MidiPortProducer(
int filedescriptor, const char *name)
: BMidiLocalProducer(name)
{
fd = filedescriptor;
thread_id thread = spawn_thread(
SpawnThread, "MidiPortProducer",
B_REAL_TIME_DISPLAY_PRIORITY, this);
//should check for errors here...
resume_thread(thread);
}
int32 MidiPortProducer::SpawnThread(void* data)
{
return ((BMidiPortProducer) data)->GetData();
}
int32 MidiPortProducer::GetData()
{
....
}
-----------------cut--here------
Matthijs
|

|