summaryrefslogtreecommitdiff
path: root/audio/spiralsynth
diff options
context:
space:
mode:
authorben <ben@pkgsrc.org>2005-04-24 14:41:28 +0000
committerben <ben@pkgsrc.org>2005-04-24 14:41:28 +0000
commit4cda63c0a789c4a3b8bb67424768b66d12281fbd (patch)
tree284cb4de401d43f5e77a7261550740a63b255213 /audio/spiralsynth
parent25013bab63dc213c00866aeeb9b7342f6ca37a2e (diff)
downloadpkgsrc-4cda63c0a789c4a3b8bb67424768b66d12281fbd.tar.gz
Fixes for SpiralSound/Midi.C
* test for failure of open() should be == -1, not == 0 This causes Open() to behave as intended, only creating the m_MidiReader thread if the MIDI device is successfully opened. * unconditionally initialize m_Mutex in Open() * conditionally close m_MidiReader in Close(), if NULL do nothing * make m_MidiFd and m_MidiWrFd the same file descriptor. The MIDI device special file can only be opened once at a time.
Diffstat (limited to 'audio/spiralsynth')
-rw-r--r--audio/spiralsynth/distinfo4
-rw-r--r--audio/spiralsynth/patches/patch-an57
2 files changed, 48 insertions, 13 deletions
diff --git a/audio/spiralsynth/distinfo b/audio/spiralsynth/distinfo
index d2744eea126..44e1c31cb67 100644
--- a/audio/spiralsynth/distinfo
+++ b/audio/spiralsynth/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.9 2005/04/24 03:29:11 ben Exp $
+$NetBSD: distinfo,v 1.10 2005/04/24 14:41:28 ben Exp $
SHA1 (SpiralSynth-2.0.0.tar.gz) = ea42c5b7710237139f5281cf0c4ca155c184c4cd
RMD160 (SpiralSynth-2.0.0.tar.gz) = c05f38a9ae8b8b87f520c11854631e6dfa00c034
@@ -15,5 +15,5 @@ SHA1 (patch-aj) = 7e3e29fbfd38428d68f195db8a7f5007c1417c88
SHA1 (patch-ak) = 67643c5abea0498f8ea046c5abd52f2d328a5538
SHA1 (patch-al) = 7436bce933cbddcd4f869ab2cbbe27762d4273e5
SHA1 (patch-am) = 4899c78015028a6e8047e5527362646e40a10708
-SHA1 (patch-an) = b99c57cd7aa4d5c95bbeffea6c992e9cd7b7c414
+SHA1 (patch-an) = d93e9a613ca52ac0ed21b38d58902783666ac5b1
SHA1 (patch-ao) = 138f58bd7fae0226690747efcb8daf472e3a5337
diff --git a/audio/spiralsynth/patches/patch-an b/audio/spiralsynth/patches/patch-an
index 147a1be3180..d36052ac1d8 100644
--- a/audio/spiralsynth/patches/patch-an
+++ b/audio/spiralsynth/patches/patch-an
@@ -1,16 +1,51 @@
-$NetBSD: patch-an,v 1.1 2004/11/25 17:24:27 ben Exp $
+$NetBSD: patch-an,v 1.2 2005/04/24 14:41:28 ben Exp $
---- SpiralSound/Midi.C.orig Tue Jun 11 15:08:56 2002
+--- SpiralSound/Midi.C.orig 2002-06-11 15:08:56.000000000 -0700
+++ SpiralSound/Midi.C
-@@ -174,7 +174,10 @@ void MidiDevice::SendEvent(int Device,co
- void MidiDevice::ReadByte(unsigned char *c)
+@@ -76,12 +76,12 @@ MidiDevice::~MidiDevice()
+ void MidiDevice::Close()
{
- *c=MIDI_CLOCK;
-- do read(m_MidiFd,c,1);
-+ do {
-+ read(m_MidiFd,c,1);
-+ sched_yield();
-+ }
- while (*c>=STATUS_END);
+ pthread_mutex_lock(m_Mutex);
+- pthread_cancel(m_MidiReader);
++ if (m_MidiReader != NULL)
++ pthread_cancel(m_MidiReader);
+ pthread_mutex_unlock(m_Mutex);
+ pthread_mutex_destroy(m_Mutex);
+
+ close(m_MidiFd);
+- close(m_MidiWrFd);
+ cerr<<"Closed midi device"<<endl;
+ }
+
+@@ -90,24 +90,19 @@ void MidiDevice::Open()
+ {
+ //if (!SpiralInfo::WANTMIDI) return;
+
+- m_MidiFd = open(m_DeviceName.c_str(),O_RDONLY|O_SYNC);
+- if (!m_MidiFd)
+- {
+- cerr<<"Couldn't open midi for reading ["<<m_DeviceName<<"]"<<endl;
+- return;
+- }
+-
+- m_MidiWrFd = open(m_DeviceName.c_str(),O_WRONLY);
+- if (!m_MidiWrFd)
++ m_Mutex = new pthread_mutex_t;
++ pthread_mutex_init(m_Mutex, NULL);
++ m_MidiReader = NULL;
++
++ m_MidiWrFd = m_MidiFd = open(m_DeviceName.c_str(),O_RDWR|O_SYNC);
++ if (m_MidiFd == -1)
+ {
+- cerr<<"Couldn't open midi for writing ["<<m_DeviceName<<"]"<<endl;
++ cerr<<"Couldn't open midi ["<<m_DeviceName<<"]"<<endl;
+ return;
+ }
+
+ cerr<<"Opened midi device ["<<m_DeviceName<<"]"<<endl;
+
+- m_Mutex = new pthread_mutex_t;
+- pthread_mutex_init(m_Mutex, NULL);
+ int ret=pthread_create(&m_MidiReader,NULL,(void*(*)(void*))MidiDevice::MidiReaderCallback,(void*)this);
}