mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Implement (Rudimentary) MIDI playing
This commit is contained in:
parent
f4c1d7b591
commit
ff05955b00
2
English.lproj/VLDocument.nib/classes.nib
generated
2
English.lproj/VLDocument.nib/classes.nib
generated
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
|
2
English.lproj/VLDocument.nib/info.nib
generated
2
English.lproj/VLDocument.nib/info.nib
generated
|
@ -12,6 +12,6 @@
|
|||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A294</string>
|
||||
<string>9A300</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
English.lproj/VLDocument.nib/keyedobjects.nib
generated
BIN
English.lproj/VLDocument.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -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];
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
IBOutlet id runToolItem;
|
||||
IBOutlet id outputToolItem;
|
||||
IBOutlet id logToolItem;
|
||||
IBOutlet id playToolItem;
|
||||
}
|
||||
|
||||
- (VLEditable *) editTarget;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "VLModel.h"
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
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();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user