diff --git a/English.lproj/VLDocument.nib/classes.nib b/English.lproj/VLDocument.nib/classes.nib
index 5bb4969..97ad09d 100644
--- a/English.lproj/VLDocument.nib/classes.nib
+++ b/English.lproj/VLDocument.nib/classes.nib
@@ -30,7 +30,7 @@
{
CLASS = VLSheetWindow;
LANGUAGE = ObjC;
- OUTLETS = {logToolItem = id; outputToolItem = id; runToolItem = id; };
+ OUTLETS = {logToolItem = id; outputToolItem = id; playToolItem = id; runToolItem = id; };
SUPERCLASS = NSWindowController;
}
);
diff --git a/English.lproj/VLDocument.nib/info.nib b/English.lproj/VLDocument.nib/info.nib
index 9ce18dc..4cfe7ec 100644
--- a/English.lproj/VLDocument.nib/info.nib
+++ b/English.lproj/VLDocument.nib/info.nib
@@ -12,6 +12,6 @@
5
IBSystem Version
- 9A294
+ 9A300
diff --git a/English.lproj/VLDocument.nib/keyedobjects.nib b/English.lproj/VLDocument.nib/keyedobjects.nib
index bc635eb..bb4afc4 100644
Binary files a/English.lproj/VLDocument.nib/keyedobjects.nib and b/English.lproj/VLDocument.nib/keyedobjects.nib differ
diff --git a/Sources/VLDocument.mm b/Sources/VLDocument.mm
index 0ddef31..c5bb5f4 100644
--- a/Sources/VLDocument.mm
+++ b/Sources/VLDocument.mm
@@ -14,6 +14,7 @@
#import "VLPDFWindow.h"
#import "VLLogWindow.h"
#import "VLSheetWindow.h"
+#import "VLSoundOut.h"
@implementation VLDocument
@@ -281,6 +282,16 @@
}
}
+- (IBAction) play:(id)sender
+{
+ NSError * err;
+ [self writeToURL:[self fileURLWithExtension:@"mid"]
+ ofType:@"VLMIDIType" error:&err];
+ VLSoundOut::Instance()->PlayFile(
+ CFDataRef([NSData dataWithContentsOfURL:
+ [self fileURLWithExtension:@"mid"]]));
+}
+
- (IBAction) showOutput:(id)sender
{
[[self pdfWin] showWindow:sender];
diff --git a/Sources/VLSheetWindow.h b/Sources/VLSheetWindow.h
index ecfaca8..048ea02 100644
--- a/Sources/VLSheetWindow.h
+++ b/Sources/VLSheetWindow.h
@@ -27,6 +27,7 @@
IBOutlet id runToolItem;
IBOutlet id outputToolItem;
IBOutlet id logToolItem;
+ IBOutlet id playToolItem;
}
- (VLEditable *) editTarget;
diff --git a/Sources/VLSheetWindow.mm b/Sources/VLSheetWindow.mm
index cb31518..24c5993 100644
--- a/Sources/VLSheetWindow.mm
+++ b/Sources/VLSheetWindow.mm
@@ -46,6 +46,7 @@ static NSString* sInputToolbarIdentifier = @"Vocalese Sheet Window Toolbar Id
static NSString* sOutputToolbarItemIdentifier = @"Output Toolbar Item Identifier";
static NSString* sLogToolbarItemIdentifier = @"Log Toolbar Item Identifier";
static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
+static NSString* sPlayToolbarItemIdentifier = @"Play Toolbar Item Identifier";
- (id)initWithWindow:(NSWindow *)window
{
@@ -87,6 +88,8 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
prototype = logToolItem;
else if ([itemIdent isEqual: sRunToolbarItemIdentifier])
prototype = runToolItem;
+ else if ([itemIdent isEqual: sPlayToolbarItemIdentifier])
+ prototype = playToolItem;
if (prototype) {
toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
@@ -106,6 +109,7 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar {
return [NSArray arrayWithObjects:
sRunToolbarItemIdentifier,
+ sPlayToolbarItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
sOutputToolbarItemIdentifier,
sLogToolbarItemIdentifier, nil];
@@ -114,6 +118,7 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar {
return [NSArray arrayWithObjects:
sRunToolbarItemIdentifier,
+ sPlayToolbarItemIdentifier,
sOutputToolbarItemIdentifier,
sLogToolbarItemIdentifier,
NSToolbarCustomizeToolbarItemIdentifier,
diff --git a/Sources/VLSoundOut.cpp b/Sources/VLSoundOut.cpp
index fa82c58..a49fe9a 100644
--- a/Sources/VLSoundOut.cpp
+++ b/Sources/VLSoundOut.cpp
@@ -21,6 +21,7 @@ public:
virtual void PlayNote(const VLNote & note);
virtual void PlayChord(const VLChord & chord);
+ virtual void PlayFile(CFDataRef file);
virtual ~VLAUSoundOut();
@@ -169,3 +170,16 @@ void VLAUSoundOut::Play(const int8_t * note, size_t numNotes)
PlaySequence(music);
}
+
+void VLAUSoundOut::PlayFile(CFDataRef file)
+{
+ MusicSequence music;
+ MusicTrack track;
+
+ NewMusicSequence(&music);
+ MusicSequenceNewTrack(music, &track);
+ MusicSequenceLoadSMFDataWithFlags(music, file,
+ kMusicSequenceLoadSMF_ChannelsToTracks);
+ PlaySequence(music);
+}
+
diff --git a/Sources/VLSoundOut.h b/Sources/VLSoundOut.h
index 99c8890..5b191a4 100644
--- a/Sources/VLSoundOut.h
+++ b/Sources/VLSoundOut.h
@@ -8,6 +8,7 @@
*/
#include "VLModel.h"
+#import
class VLSoundEvent {
protected:
@@ -32,6 +33,7 @@ public:
virtual void PlayNote(const VLNote & note) = 0;
virtual void PlayChord(const VLChord & chord) = 0;
+ virtual void PlayFile(CFDataRef file) = 0;
virtual ~VLSoundOut();
};