| 1 |
// |
| 2 |
// MyMIDISequence.h |
| 3 |
// |
| 4 |
// Created by Toshi Nagata on Sun Jun 03 2001. |
| 5 |
/* |
| 6 |
Copyright (c) 2000-2016 Toshi Nagata. All rights reserved. |
| 7 |
|
| 8 |
This program is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation version 2 of the License. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
*/ |
| 17 |
|
| 18 |
#import <Cocoa/Cocoa.h> |
| 19 |
#import "MDHeaders.h" |
| 20 |
|
| 21 |
@class MyDocument; |
| 22 |
@class MDTrackObject; |
| 23 |
|
| 24 |
enum { |
| 25 |
kRecordingModeCountOff = 0, |
| 26 |
kRecordingModeWaitForNote |
| 27 |
}; |
| 28 |
|
| 29 |
enum { |
| 30 |
kAudioRecordingAIFFFormat = 0, |
| 31 |
kAudioRecordingWAVFormat |
| 32 |
}; |
| 33 |
|
| 34 |
enum { |
| 35 |
kAudioRecordingMonoFormat = 0, |
| 36 |
kAudioRecordingStereoFormat |
| 37 |
}; |
| 38 |
|
| 39 |
extern NSString |
| 40 |
*MyRecordingInfoSourceDeviceKey, // NSString; MIDI device name (nil if any device is acceptable) |
| 41 |
*MyRecordingInfoDestinationDeviceKey, // NSString; MIDI device name |
| 42 |
*MyRecordingInfoSourceAudioDeviceKey, // NSString; Audio device name |
| 43 |
*MyRecordingInfoDestinationAudioDeviceKey, // NSString; Audio device name |
| 44 |
*MyRecordingInfoFolderNameKey, // NSString; destination folder name (for audio only) |
| 45 |
*MyRecordingInfoFileNameKey, // NSString; destination file name (for audio only) |
| 46 |
*MyRecordingInfoOverwriteExistingFileFlagKey, // bool; silently overwrite existing files (for audio only) |
| 47 |
*MyRecordingInfoMultiFileNamesKey, // NSMutableArray of NSString; destination file names (for multiple audio recording only) |
| 48 |
*MyRecordingInfoTrackSelectionsKey, // NSMutableArray of IntGroupObjects; representing track selections (for multiple audio recording only) |
| 49 |
*MyRecordingInfoIsAudioKey, // bool; is audio recording? |
| 50 |
*MyRecordingInfoAudioPlayThroughKey, // bool; audio play through? |
| 51 |
*MyRecordingInfoDestinationChannelKey, // int; MIDI channel (0..15; 16 if incoming channel is to be kept) |
| 52 |
*MyRecordingInfoTargetTrackKey, // int; track number (-1 if new track is to be created) |
| 53 |
*MyRecordingInfoReplaceFlagKey, // bool; replace (YES) or overdub (NO) |
| 54 |
*MyRecordingInfoStartTickKey, // double; start tick |
| 55 |
*MyRecordingInfoStopTickKey, // double; stop tick |
| 56 |
*MyRecordingInfoStopFlagKey, // bool; if YES then stop recording at stoptick |
| 57 |
*MyRecordingInfoRecordingModeKey, // int; kRecordingMode{CountOff, WaitForNote} |
| 58 |
*MyRecordingInfoCountOffNumberKey, // int; count off number |
| 59 |
*MyRecordingInfoBarBeatFlagKey, // bool; countOffNumber is bar (YES) or beat (NO) |
| 60 |
*MyRecordingInfoMIDITransposeKey, // int; MIDI transpose |
| 61 |
*MyRecordingInfoAudioRecordingFormatKey, // int; kAudioRecording{AIFF,WAV}Format |
| 62 |
*MyRecordingInfoAudioBitRateKey, // float; audio bit rate |
| 63 |
*MyRecordingInfoAudioChannelFormatKey; // int; kAudioRecording{Mono,Stereo}Format |
| 64 |
|
| 65 |
extern NSString *MyRecordingInfoFileExtensionForFormat(int format); |
| 66 |
|
| 67 |
@interface MyMIDISequence : NSObject { |
| 68 |
@private |
| 69 |
MyDocument * myDocument; |
| 70 |
MDSequence * mySequence; |
| 71 |
MDPlayer * myPlayer; |
| 72 |
MDTrack * recordTrack; |
| 73 |
NSDictionary * recordingInfo; |
| 74 |
MDCalibrator * calib; |
| 75 |
// MDTrack * recordNoteOffTrack; |
| 76 |
} |
| 77 |
|
| 78 |
- (id)init; |
| 79 |
- (id)initWithDocument:(MyDocument *)document; |
| 80 |
- (MyDocument *)myDocument; |
| 81 |
- (MDSequence *)mySequence; |
| 82 |
- (MDTrack *)getTrackAtIndex: (int)index; |
| 83 |
- (int32_t)lookUpTrack:(MDTrack *)track; |
| 84 |
- (int32_t)trackCount; |
| 85 |
- (MDTickType)sequenceDuration; |
| 86 |
//- (void)updateTrackName:(int32_t)index; |
| 87 |
- (NSString *)trackName:(int32_t)index; |
| 88 |
- (NSString *)deviceName:(int32_t)index; |
| 89 |
- (int)trackChannel:(int32_t)index; |
| 90 |
- (MDTrackAttribute)trackAttributeAtIndex: (int32_t)index; |
| 91 |
- (void)setTrackAttribute: (MDTrackAttribute)attribute atIndex: (int32_t)index; |
| 92 |
|
| 93 |
- (MDCalibrator *)sharedCalibrator; |
| 94 |
|
| 95 |
- (NSDictionary *)recordingInfo; |
| 96 |
- (void)setRecordingInfo: (NSDictionary *)anInfo; |
| 97 |
|
| 98 |
- (MDStatus)readSMFFromFile:(NSString *)fileName withCallback: (MDSequenceCallback)callback andData: (void *)data; |
| 99 |
- (MDStatus)writeSMFToFile:(NSString *)fileName withCallback: (MDSequenceCallback)callback andData: (void *)data errorMessage: (char **)errorMessage; |
| 100 |
|
| 101 |
- (MDPlayer *)myPlayer; |
| 102 |
//- (id)startPlay:(id)sender; |
| 103 |
//- (id)stopPlay:(id)sender; |
| 104 |
- (BOOL)isPlaying; |
| 105 |
- (BOOL)isSuspended; |
| 106 |
- (float)playingTime; |
| 107 |
//- (float)playingBeat; |
| 108 |
|
| 109 |
- (MDStatus)startMIDIRecording; |
| 110 |
- (int32_t)collectRecordedEvents; |
| 111 |
- (MDTrackObject *)finishMIDIRecording; |
| 112 |
- (MDTrack *)recordTrack; |
| 113 |
- (MDStatus)startAudioRecordingWithName: (NSString *)filename; |
| 114 |
- (MDStatus)finishAudioRecordingByMIDISequence; |
| 115 |
|
| 116 |
//- (MDStatus)finishMIDIRecordingAndGetTrack: (MDTrackObject **)outTrack andTrackIndex: (int32_t *)outIndex; |
| 117 |
|
| 118 |
@end |