| 1 |
// |
| 2 |
// PlayingPanelCotroller.h |
| 3 |
// |
| 4 |
// Created by Toshi Nagata. |
| 5 |
/* |
| 6 |
Copyright (c) 2000-2011 Toshi Nagata. All rights reserved. |
| 7 |
|
| 8 |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
| 9 |
|
| 10 |
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
| 11 |
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. |
| 12 |
|
| 13 |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 14 |
*/ |
| 15 |
|
| 16 |
#import <Cocoa/Cocoa.h> |
| 17 |
#import "MDHeaders.h" |
| 18 |
|
| 19 |
@class MyDocument; |
| 20 |
|
| 21 |
@interface PlayingPanelController : NSWindowController |
| 22 |
{ |
| 23 |
IBOutlet id recordButton; |
| 24 |
IBOutlet id stopButton; |
| 25 |
IBOutlet id playButton; |
| 26 |
IBOutlet id pauseButton; |
| 27 |
IBOutlet id ffButton; |
| 28 |
IBOutlet id rewindButton; |
| 29 |
IBOutlet id countField; |
| 30 |
IBOutlet id markerPopup; |
| 31 |
IBOutlet id positionSlider; |
| 32 |
IBOutlet id timeField; |
| 33 |
IBOutlet id tunePopup; |
| 34 |
IBOutlet id progressIndicator; |
| 35 |
|
| 36 |
int activeIndex; /* The active document (the selected item of tunePopup) */ |
| 37 |
int status; /* The player status (kMDPlayer_ready, kMDPlayer_playing, kMDPlayer_suspended) */ |
| 38 |
NSMutableArray *docArray; /* The array of MyMIDIDocuments */ |
| 39 |
NSMutableArray *tickArray; /* Marker ticks (the marker names are stored in markerPopup) */ |
| 40 |
MDCalibrator *calibrator; /* For time<->tick conversion */ |
| 41 |
MDTimeType currentTime; /* Current time (in microseconds, tune top = 0) */ |
| 42 |
MDTimeType totalTime; /* Total playing time (in microseconds) */ |
| 43 |
NSTimer *timer; /* Refresh the display periodically during playing */ |
| 44 |
BOOL isRecording; /* True if the record button is pressed */ |
| 45 |
BOOL shouldContinuePlay; /* Flag to continue playing after FF/Rewind/Slider actions */ |
| 46 |
// NSTimer *resumeTimer; /* Timer to resume playing after FF/Rew/Slider actions */ |
| 47 |
} |
| 48 |
|
| 49 |
+ (PlayingPanelController *)sharedPlayingPanelController; |
| 50 |
- (IBAction)moveSlider:(id)sender; |
| 51 |
- (IBAction)pressFFButton:(id)sender; |
| 52 |
- (IBAction)pressPauseButton:(id)sender; |
| 53 |
- (IBAction)pressPlayButton:(id)sender; |
| 54 |
- (IBAction)pressRewindButton:(id)sender; |
| 55 |
- (IBAction)pressStopButton:(id)sender; |
| 56 |
- (IBAction)pressRecordButton:(id)sender; |
| 57 |
- (IBAction)selectMarker:(id)sender; |
| 58 |
- (IBAction)selectTune:(id)sender; |
| 59 |
- (void)selectTuneAtIndex:(int)index; |
| 60 |
- (int)refreshMIDIDocument: (MyDocument *)document; |
| 61 |
- (void)removeMIDIDocument: (MyDocument *)document; |
| 62 |
- (void)timerCallback: (NSTimer *)timer; |
| 63 |
- (void)refreshTimeDisplay; |
| 64 |
@end |