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;
|
CLASS = VLSheetWindow;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {logToolItem = id; outputToolItem = id; runToolItem = id; };
|
OUTLETS = {logToolItem = id; outputToolItem = id; playToolItem = id; runToolItem = id; };
|
||||||
SUPERCLASS = NSWindowController;
|
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>
|
<integer>5</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>9A294</string>
|
<string>9A300</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</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 "VLPDFWindow.h"
|
||||||
#import "VLLogWindow.h"
|
#import "VLLogWindow.h"
|
||||||
#import "VLSheetWindow.h"
|
#import "VLSheetWindow.h"
|
||||||
|
#import "VLSoundOut.h"
|
||||||
|
|
||||||
@implementation VLDocument
|
@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
|
- (IBAction) showOutput:(id)sender
|
||||||
{
|
{
|
||||||
[[self pdfWin] showWindow:sender];
|
[[self pdfWin] showWindow:sender];
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
IBOutlet id runToolItem;
|
IBOutlet id runToolItem;
|
||||||
IBOutlet id outputToolItem;
|
IBOutlet id outputToolItem;
|
||||||
IBOutlet id logToolItem;
|
IBOutlet id logToolItem;
|
||||||
|
IBOutlet id playToolItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (VLEditable *) editTarget;
|
- (VLEditable *) editTarget;
|
||||||
|
|
|
@ -46,6 +46,7 @@ static NSString* sInputToolbarIdentifier = @"Vocalese Sheet Window Toolbar Id
|
||||||
static NSString* sOutputToolbarItemIdentifier = @"Output Toolbar Item Identifier";
|
static NSString* sOutputToolbarItemIdentifier = @"Output Toolbar Item Identifier";
|
||||||
static NSString* sLogToolbarItemIdentifier = @"Log Toolbar Item Identifier";
|
static NSString* sLogToolbarItemIdentifier = @"Log Toolbar Item Identifier";
|
||||||
static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
||||||
|
static NSString* sPlayToolbarItemIdentifier = @"Play Toolbar Item Identifier";
|
||||||
|
|
||||||
- (id)initWithWindow:(NSWindow *)window
|
- (id)initWithWindow:(NSWindow *)window
|
||||||
{
|
{
|
||||||
|
@ -87,6 +88,8 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
||||||
prototype = logToolItem;
|
prototype = logToolItem;
|
||||||
else if ([itemIdent isEqual: sRunToolbarItemIdentifier])
|
else if ([itemIdent isEqual: sRunToolbarItemIdentifier])
|
||||||
prototype = runToolItem;
|
prototype = runToolItem;
|
||||||
|
else if ([itemIdent isEqual: sPlayToolbarItemIdentifier])
|
||||||
|
prototype = playToolItem;
|
||||||
|
|
||||||
if (prototype) {
|
if (prototype) {
|
||||||
toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
|
toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
|
||||||
|
@ -106,6 +109,7 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
||||||
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar {
|
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar {
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
sRunToolbarItemIdentifier,
|
sRunToolbarItemIdentifier,
|
||||||
|
sPlayToolbarItemIdentifier,
|
||||||
NSToolbarFlexibleSpaceItemIdentifier,
|
NSToolbarFlexibleSpaceItemIdentifier,
|
||||||
sOutputToolbarItemIdentifier,
|
sOutputToolbarItemIdentifier,
|
||||||
sLogToolbarItemIdentifier, nil];
|
sLogToolbarItemIdentifier, nil];
|
||||||
|
@ -114,6 +118,7 @@ static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
||||||
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar {
|
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar {
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
sRunToolbarItemIdentifier,
|
sRunToolbarItemIdentifier,
|
||||||
|
sPlayToolbarItemIdentifier,
|
||||||
sOutputToolbarItemIdentifier,
|
sOutputToolbarItemIdentifier,
|
||||||
sLogToolbarItemIdentifier,
|
sLogToolbarItemIdentifier,
|
||||||
NSToolbarCustomizeToolbarItemIdentifier,
|
NSToolbarCustomizeToolbarItemIdentifier,
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
virtual void PlayNote(const VLNote & note);
|
virtual void PlayNote(const VLNote & note);
|
||||||
virtual void PlayChord(const VLChord & chord);
|
virtual void PlayChord(const VLChord & chord);
|
||||||
|
virtual void PlayFile(CFDataRef file);
|
||||||
|
|
||||||
virtual ~VLAUSoundOut();
|
virtual ~VLAUSoundOut();
|
||||||
|
|
||||||
|
@ -169,3 +170,16 @@ void VLAUSoundOut::Play(const int8_t * note, size_t numNotes)
|
||||||
|
|
||||||
PlaySequence(music);
|
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"
|
#include "VLModel.h"
|
||||||
|
#import <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
class VLSoundEvent {
|
class VLSoundEvent {
|
||||||
protected:
|
protected:
|
||||||
|
@ -32,6 +33,7 @@ public:
|
||||||
|
|
||||||
virtual void PlayNote(const VLNote & note) = 0;
|
virtual void PlayNote(const VLNote & note) = 0;
|
||||||
virtual void PlayChord(const VLChord & chord) = 0;
|
virtual void PlayChord(const VLChord & chord) = 0;
|
||||||
|
virtual void PlayFile(CFDataRef file) = 0;
|
||||||
|
|
||||||
virtual ~VLSoundOut();
|
virtual ~VLSoundOut();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user