//
//  AudioPlay.h
//  X-BASIC'
//
//  Created by AIG-Soft(iMac) on 2012/10/25.
//  Copyright (c) 2012-15年 AIG-Soft. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

// .playingバグ回避のため・・・と思ったが、原因はこれではなかった (v2.2)
//#define USE_NOWPLAYING

@interface AudioPlay : NSObject
<AVAudioPlayerDelegate>
{
#ifdef USE_NOWPLAYING
	int		nowPlaying;
#endif
}
@property (nonatomic,strong) AVAudioPlayer	*avAudioPlayer;

@property (nonatomic) NSInteger intArg;		// int引数用
@property (nonatomic) float		floatArg;	// float引数用
@property (nonatomic) float		floatArg2;	// float第２引数用

enum {
	AUDIOPLAY_NONE=0,
	AUDIOPLAY_PLAY,
	AUDIOPLAY_PAUSE,
	AUDIOPLAY_STOP,
	AUDIOPLAY_END,
	AUDIOPLAY_CONT,
	AUDIOPLAY_SPEED,
	AUDIOPLAY_VOLUME,
	AUDIOPLAY_PAN,
	AUDIOPLAY_LOOP,
	AUDIOPLAY_STAT,
	AUDIOPLAY_PAN_AND_VOLUME,
};

#ifdef USE_NOWPLAYING
enum { // nowPlayingの値(v2.2)
	PLAYING_NONE=0,
	PLAYING_PAUSE,
	PLAYING_NOW,	// X68互換のため(=2)
};
#endif

-(instancetype)initWithData:(NSData *)data;
-(instancetype)initWithFile:(NSString *)path;
-(instancetype)initWithADPCMFile:(NSString *)fname rate:(int)rate;
-(instancetype)initWithPCMFile:  (NSString *)fname rate:(int)rate multiple:(int)multiple;
-(void)operation:(NSInteger)ope intArg:(NSInteger)intArg_;
-(void)operation:(NSInteger)ope doubleArg:(double)doubleArg_;
-(void)operation:(NSInteger)ope floatArg:(float)floatArg_;
-(void)operation:(NSInteger)ope floatArg1:(float)floatArg1_ floatArg2:(float)floatArg2_;
-(void)operation:(NSInteger)ope;
-(BOOL)audioplayStat;
-(void)end;

@end
