Subject: Re: midi and spiralsynth
To: Dave <dgriffi@cs.csubak.edu>
From: Ben Collver <collver@peak.org>
List: tech-pkg
Date: 01/27/2005 21:33:20
I think this is what happens:

Synth.C --> main() --> Synth *synth=new Synth; --> Synth::Synth()
--> MidiDevice::Get()->SetDeviceName(SpiralInfo::MIDIFILE);

SpiralSound/Midi.h --> MidiDevice::Get() --> m_Singleton=new MidiDevice;
--> MidiDevice::MidiDevice() --> MidiDevice::Open()
--> MidiDevice::SetDeviceName

The problem is that SpiralSynth opens the MIDI device path before
calling SetDeviceName.

Unfortunately, I don't currently have MIDI hardware to test this on.
Would you try the following patch and see whether SpiralSynth can
actually use the MIDI device?  The patch is a kludge, but if it works
than I will try to make something better.  I am not sure, but you might
want to use /dev/rmidi* instead of /dev/sequencer.

Cheers,

Ben

--- Synth.C.orig	2005-01-27 21:22:26.000000000 -0800
+++ Synth.C	2005-01-27 21:27:14.000000000 -0800
@@ -82,6 +82,7 @@
 	LoadPatch(1);
 	
 	MidiDevice::Get()->SetDeviceName(SpiralInfo::MIDIFILE);
+	MidiDevice::Get()->PackUpAndGoHome();
 }
 
 Synth::~Synth()

On Thu, Jan 27, 2005 at 07:22:16PM -0800, Dave wrote:
> 
> Anyone here know how to convince SpiralSynth to open a midi device of any
> kind?  Here's what I get:
> 
> zaphod:~$ SpiralSynth
> Opening dsp output [/dev/audio]
> Opened midi device []
> 
> It doesn't seem to pick up the "Midi" line from .Spiralrc no matter what I
> do. Doing "cat /dev/sequencer" does, however, yield the expected result:
> 
> zaphod:~$ cat /dev/sequencer
> ;@_
> )@	<---- 	Assorted garbage that changes whenever a key on the midi
> 		keyboard is pressed or released.
> 
> -- 
> David Griffith
> dgriffi@cs.csubak.edu