Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11472/src
Modified Files:
AudacityApp.cpp AudioIO.cpp AudioIO.h Experimental.h
TrackArtist.cpp TrackPanel.cpp
Log Message:
Added the 'portmidi' library (used for MIDI playback) to the repository.
Edited AudioIO.cpp to allow for MIDI playback (all changes are wrapped within
EXPERIMENTAL_MIDI_OUT).
Edited MidiIOprefs.cpp to allow changing MIDI devices via the MIDI preferences
panel.
Other various MIDI-related bug fixes in portmidi, portsmf, and libscorealign.
Index: AudioIO.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- AudioIO.h 23 May 2009 14:51:22 -0000 1.69
+++ AudioIO.h 24 Jun 2009 20:37:27 -0000 1.70
@@ -15,10 +15,13 @@
#include "portaudio.h"
#include "Audacity.h"
+#include "Experimental.h"
#ifdef USE_MIDI
-//#include "portmidi.h"
-//#include "porttime.h"
+#ifdef EXPERIMENTAL_MIDI_OUT
+#include "portmidi.h"
+#include "porttime.h"
+#endif // EXPERIMENTAL_MIDI_OUT
#include "allegro.h"
#endif // USE_MIDI
@@ -89,8 +92,9 @@
* instance. For use with IsStreamActive() below */
int StartStream(WaveTrackArray playbackTracks, WaveTrackArray captureTracks,
-/* REQUIRES PORTMIDI */
- //NoteTrackArray midiTracks,
+#ifdef EXPERIMENTAL_MIDI_OUT
+ NoteTrackArray *midiTracks,
+#endif
TimeTrack *timeTrack, double sampleRate,
double t0, double t1,
AudioIOListener* listener,
@@ -123,6 +127,12 @@
bool IsStreamActive();
bool IsStreamActive(int token);
+#ifdef EXPERIMENTAL_MIDI_OUT
+ /** \brief Are any Note tracks playing MIDI?
+ */
+ bool IsMidiActive(); //
+#endif
+
/** \brief Returns true if the stream is active, or even if audio I/O is
* busy cleaning up its data or writing to disk.
*
@@ -284,14 +294,14 @@
unsigned int numPlaybackChannels,
unsigned int numCaptureChannels,
sampleFormat captureFormat);
-
-/* REQUIRES PORTMIDI */
-// bool StartPortMidiStream();
-
void FillBuffers();
-/* REQUIRES PORTMIDI */
-// void FillMidiBuffers();
+#ifdef EXPERIMENTAL_MIDI_OUT
+ bool StartPortMidiStream();
+ void OutputEvent();
+ void FillMidiBuffers();
+ void GetNextEvent();
+#endif
/** \brief Get the number of audio samples free in all of the playback
* buffers.
@@ -336,20 +346,32 @@
double NormalizeStreamTime(double absoluteTime) const;
-// MIDI_PLAYBACK:
-// PmStream *mMidiStream;
-// PmEvent mMidiBuffer[MAX_MIDI_BUFFER_SIZE];
-// PmEvent mMidiQueue[MAX_MIDI_BUFFER_SIZE];
-// PmError mLastPmError;
-// long mCurrentMidiTime;
-// long mLastMidiTime;
-// Alg_seq *mSeq;
-// int mVC; // Visible Channel
-// int mCnt;
-// long mMidiWait;
-// bool mMidiStreamActive;
-// bool mUpdateMidiTracks;
+#ifdef EXPERIMENTAL_MIDI_OUT
+ // MIDI_PLAYBACK:
+ PmStream *mMidiStream;
+ // PmEvent mMidiBuffer[MAX_MIDI_BUFFER_SIZE];
+ // PmEvent mMidiQueue[MAX_MIDI_BUFFER_SIZE];
+ PmError mLastPmError;
+ long mCurrentMidiTime;
+ long mMidiLatency; // latency value for PortMidi
+ long mLastMidiTime; // timestamp of last midi message
+ Alg_seq_ptr mSeq;
+ Alg_iterator_ptr mIterator;
+ Alg_event_ptr mNextEvent; // the next event to play (or null)
+ double mNextEventTime; // the time of the next event
+ // (note that this could be a note's time+duration)
+ bool mNextIsNoteOn; // is the next event a note-off?
+ int mVC; // Visible Channel mask
+ // int mCnt;
+ long mMidiWait;
+ bool mMidiStreamActive;
+ // when true, mSendMidiState means send only updates, not note-on's,
+ // used to send state changes that precede the selected notes
+ bool mSendMidiState;
+ NoteTrackArray *mMidiPlaybackTracks;
+ // NoteTrackArray mMidiCaptureTracks;
+#endif
AudioThread *mThread;
Resample **mResample;
RingBuffer **mCaptureBuffers;
@@ -357,11 +379,6 @@
RingBuffer **mPlaybackBuffers;
WaveTrackArray mPlaybackTracks;
-/* REQUIRES PORTMIDI */
-// NoteTrackArray mMidiPlaybackTracks;
-// RingBuffer **mMidiPlaybackBuffers;
-// NoteTrackArray mMidiCaptureTracks;
-
Mixer **mPlaybackMixers;
int mStreamToken;
int mStopStreamCount;
@@ -369,9 +386,9 @@
double mFactor;
double mRate;
double mT;
- double mT0;
- double mT1;
- double mTime;
+ double mT0; // playback starts at offset of mT0
+ double mT1; // and ends at offset of mT1
+ double mTime; // current time position during playback
double mWarpedT1;
double mSeek;
double mPlaybackRingBufferSecs;
Index: AudacityApp.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudacityApp.cpp,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -d -r1.235 -r1.236
--- AudacityApp.cpp 30 May 2009 19:54:12 -0000 1.235
+++ AudacityApp.cpp 24 Jun 2009 20:37:27 -0000 1.236
@@ -154,6 +154,14 @@
# if defined(USE_MIDI)
# pragma comment(lib, "portsmf")
+# endif
+
+# if defined(EXPERIMENTAL_MIDI_OUT)
+# pragma comment(lib, "portmidi")
+# endif
+
+# if defined(EXPERIMENTAL_SCOREALIGN)
+# pragma comment(lib, "libscorealign")
# endif
# if defined(USE_NYQUIST)
@@ -164,10 +172,6 @@
# pragma comment(lib, "portmixer")
# endif
-# if defined(EXPERIMENTAL_SCOREALIGN)
-# pragma comment(lib, "libscorealign")
-# endif
-
# if defined(USE_SLV2)
# pragma comment(lib, "slv2")
# pragma comment(lib, "librdf")
Index: Experimental.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Experimental.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- Experimental.h 10 Jun 2009 19:19:52 -0000 1.55
+++ Experimental.h 24 Jun 2009 20:37:27 -0000 1.56
@@ -73,6 +73,18 @@
// Allow keyboard seeking before initial playback position
//#define EXPERIMENTAL_SEEK_BEHIND_CURSOR
+// RBD, 1 Sep 2008
+// Enables MIDI Output of NoteTrack (MIDI) data during playback
+// USE_MIDI must be defined in order for EXPERIMENTAL_MIDI_OUT to work
+#ifdef USE_MIDI
+//#define EXPERIMENTAL_MIDI_OUT
+#endif
+
+// USE_MIDI must be defined in order for EXPERIMENTAL_SCOREALIGN to work
+#ifdef USE_MIDI
+//#define EXPERIMENTAL_SCOREALIGN
+#endif
+
#ifdef EXPERIMENTAL_FEATURES
// The first experimental feature is a notebook that adds
// a tabbed divider to the project.
Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.461
retrieving revision 1.462
diff -u -d -r1.461 -r1.462
--- TrackPanel.cpp 14 Jun 2009 22:02:09 -0000 1.461
+++ TrackPanel.cpp 24 Jun 2009 20:37:27 -0000 1.462
@@ -153,6 +153,7 @@
#include "Audacity.h"
+#include "Experimental.h"
#include "TrackPanel.h"
#include <math.h>
@@ -812,9 +813,12 @@
// Each time the loop, check to see if we were playing or
// recording audio, but the stream has stopped.
if (p->GetAudioIOToken()>0 &&
- !gAudioIO->IsStreamActive(p->GetAudioIOToken())) {
+ !gAudioIO->IsStreamActive(p->GetAudioIOToken())
+#ifdef EXPERIMENTAL_MIDI_OUT
+ && !gAudioIO->IsMidiActive()
+#endif
+ ) {
p->GetControlToolBar()->OnStop(dummyEvent);
- // printf( "HCK OnTimer\n" );
}
// Next, check to see if we were playing or recording
@@ -823,7 +827,11 @@
// and flush the tracks once we've completely finished
// recording new state.
if (p->GetAudioIOToken()>0 &&
- !gAudioIO->IsAudioTokenActive(p->GetAudioIOToken())) {
+ !gAudioIO->IsAudioTokenActive(p->GetAudioIOToken())
+#ifdef EXPERIMENTAL_MIDI_OUT
+ && !gAudioIO->IsMidiActive()
+#endif
+ ) {
if (gAudioIO->GetNumCaptureChannels() > 0) {
// Tracks are buffered during recording. This flushes
Index: AudioIO.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- AudioIO.cpp 30 May 2009 16:48:03 -0000 1.211
+++ AudioIO.cpp 24 Jun 2009 20:37:27 -0000 1.212
@@ -45,8 +45,6 @@
#include <math.h>
#include <stdlib.h>
-// MIDI_PLAYBACK:
-//#include <string.h>
#ifdef __WXMSW__
#include <malloc.h>
@@ -68,8 +66,15 @@
#include "AudacityApp.h"
#include "AudioIO.h"
[...1154 lines suppressed...]
-/* REQUIRES PORTMIDI */
-//int compareTime( const void* a, const void* b )
-//{
-// return( (int)((*(PmEvent*)a).timestamp - (*(PmEvent*)b).timestamp ) );
-//}
+#ifdef EXPERIMENTAL_MIDI_OUT
+int compareTime( const void* a, const void* b )
+{
+ return( (int)((*(PmEvent*)a).timestamp - (*(PmEvent*)b).timestamp ) );
+}
+#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
@@ -2836,4 +2943,3 @@
//
// vim: et sts=3 sw=3
// arch-tag: 7ee3c9aa-b58b-4069-8a07-8866f2303963
-
Index: TrackArtist.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackArtist.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- TrackArtist.cpp 2 Jun 2009 05:03:15 -0000 1.150
+++ TrackArtist.cpp 24 Jun 2009 20:37:27 -0000 1.151
@@ -2272,12 +2272,13 @@
// We want to draw in seconds, so we need to convert to seconds
seq->convert_to_seconds();
- seq->iteration_begin();
+ Alg_iterator iterator(seq, false);
+ iterator.begin();
//for every event
Alg_event_ptr evt;
printf ("go time\n");
- while ((evt = seq->iteration_next())) {
-
+ while (evt = iterator.next()) {
+
//printf ("one note");
//if the event is a note
@@ -2503,7 +2504,7 @@
}
}
}
- seq->iteration_end();
+ iterator.end();
dc.DestroyClippingRegion();
}
#endif // USE_MIDI
------------------------------------------------------------------------------
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs