This commit is contained in:
Pavel Lukandiy 2017-04-14 18:22:01 +03:00
parent 32d4330195
commit 4525951e5c
2 changed files with 15 additions and 4 deletions

View File

@ -239,9 +239,12 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn
/// Disposes the STKAudioPlayer and frees up all resources before returning
-(void) dispose;
//
/// Sets playback speed
-(void)setPlaybackSpeed:(double)speed;
/// Sets playback speed to 1.0
-(void)setDefaultPlaybackSpeed;
/// The QueueItemId of the currently playing item
-(NSObject*) currentlyPlayingQueueItemId;

View File

@ -343,7 +343,8 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
.componentManufacturer = kAudioUnitManufacturer_Apple
};
playbackSpeedUnitDescription = (AudioComponentDescription) {
playbackSpeedUnitDescription = (AudioComponentDescription)
{
.componentType = kAudioUnitType_FormatConverter,
.componentSubType = kAudioUnitSubType_AUiPodTimeOther,
.componentFlags = 0,
@ -1877,10 +1878,16 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[self stopThread];
}
- (void)setPlaybackSpeed:(double)speed {
-(void)setPlaybackSpeed:(double)speed
{
AudioUnitSetParameter(playbackSpeedUnit, kNewTimePitchParam_Rate, kAudioUnitScope_Global, 0, speed, 0);
}
-(void)setDefaultPlaybackSpeed
{
[self setPlaybackSpeed:1.f];
}
-(NSObject*) currentlyPlayingQueueItemId
{
OSSpinLockLock(&currentEntryReferencesLock);
@ -2141,7 +2148,8 @@ static BOOL GetHardwareCodecClassDesc(UInt32 formatId, AudioClassDescription* cl
CHECK_STATUS_AND_RETURN(AudioUnitSetProperty(outputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &canonicalAudioStreamBasicDescription, sizeof(canonicalAudioStreamBasicDescription)));
}
- (void)createPlaybackSpeedUnit {
-(void) createPlaybackSpeedUnit
{
OSStatus status;
CHECK_STATUS_AND_RETURN(AUGraphAddNode(audioGraph, &playbackSpeedUnitDescription, &playbackSpeedNode));