Compare commits
4 commits
f7b2c481e6
...
6b23590ac8
Author | SHA1 | Date | |
---|---|---|---|
|
6b23590ac8 | ||
|
2282538c42 | ||
|
73951d6fe7 | ||
|
8c019c7302 |
4 changed files with 21 additions and 13 deletions
|
@ -356,8 +356,12 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
}
|
||||
|
||||
- (IBAction)prev:(id)sender {
|
||||
double pos = [audioPlayer amountPlayed];
|
||||
|
||||
if(pos < 5.0) {
|
||||
if([playlistController prev] == NO)
|
||||
return;
|
||||
}
|
||||
|
||||
[self playEntry:[playlistController currentEntry]];
|
||||
}
|
||||
|
|
|
@ -269,6 +269,7 @@ void scale_by_volume(float *buffer, size_t count, float volume) {
|
|||
size_t inputSamples = ioNumberPackets / floatFormat.mBytesPerPacket;
|
||||
ioNumberPackets = (UInt32)inputSamples;
|
||||
ioNumberPackets = (UInt32)ceil((float)ioNumberPackets * sampleRatio);
|
||||
ioNumberPackets += soxr_delay(soxr);
|
||||
ioNumberPackets = (ioNumberPackets + 255) & ~255;
|
||||
|
||||
size_t newSize = ioNumberPackets * floatFormat.mBytesPerPacket;
|
||||
|
@ -285,7 +286,6 @@ void scale_by_volume(float *buffer, size_t count, float volume) {
|
|||
size_t outputDone = 0;
|
||||
|
||||
if(!skipResampler) {
|
||||
ioNumberPackets += soxr_delay(soxr);
|
||||
soxr_process(soxr, (float *)(((uint8_t *)inputBuffer) + inpOffset), inputSamples, &inputDone, floatBuffer, ioNumberPackets, &outputDone);
|
||||
|
||||
if(latencyEatenPost) {
|
||||
|
|
|
@ -28,9 +28,6 @@ using std::atomic_long;
|
|||
#import <CogAudio/HeadphoneFilter.h>
|
||||
|
||||
//#define OUTPUT_LOG
|
||||
#ifdef OUTPUT_LOG
|
||||
#import <stdio.h>
|
||||
#endif
|
||||
|
||||
@class OutputNode;
|
||||
|
||||
|
@ -102,7 +99,7 @@ using std::atomic_long;
|
|||
ChunkList *outputBuffer;
|
||||
|
||||
#ifdef OUTPUT_LOG
|
||||
FILE *_logFile;
|
||||
NSFileHandle *_logFile;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
#import <CogAudio/VisualizationController.h>
|
||||
|
||||
#ifdef OUTPUT_LOG
|
||||
#import <NSFileHandle+CreateFile.h>
|
||||
#endif
|
||||
|
||||
extern void scale_by_volume(float *buffer, size_t count, float volume);
|
||||
|
||||
static NSString *CogPlaybackDidBeginNotificiation = @"CogPlaybackDidBeginNotificiation";
|
||||
|
@ -146,7 +150,7 @@ static void *kOutputCoreAudioContext = &kOutputCoreAudioContext;
|
|||
|
||||
#ifdef OUTPUT_LOG
|
||||
NSString *logName = [NSTemporaryDirectory() stringByAppendingPathComponent:@"CogAudioLog.raw"];
|
||||
_logFile = fopen([logName UTF8String], "wb");
|
||||
_logFile = [NSFileHandle fileHandleForWritingAtPath:logName createFile:YES];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -621,9 +625,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
|
||||
AudioChunk *chunk = [self renderInput:512];
|
||||
size_t frameCount = 0;
|
||||
if(chunk) {
|
||||
frameCount = [chunk frameCount];
|
||||
|
||||
if(chunk && (frameCount = [chunk frameCount])) {
|
||||
[outputLock lock];
|
||||
[outputBuffer addChunk:chunk];
|
||||
[outputLock unlock];
|
||||
|
@ -648,7 +650,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
__block NSMutableArray *faders = self->fadedBuffers;
|
||||
|
||||
#ifdef OUTPUT_LOG
|
||||
__block FILE *logFile = _logFile;
|
||||
__block NSFileHandle *logFile = _logFile;
|
||||
#endif
|
||||
|
||||
_au.outputProvider = ^AUAudioUnitStatus(AudioUnitRenderActionFlags *_Nonnull actionFlags, const AudioTimeStamp *_Nonnull timestamp, AUAudioFrameCount frameCount, NSInteger inputBusNumber, AudioBufferList *_Nonnull inputData) {
|
||||
|
@ -742,6 +744,11 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
scale_by_volume(outSamples, frameCount * channels, volumeScale * _self->volume);
|
||||
|
||||
[_self updateLatency:secondsRendered];
|
||||
|
||||
#ifdef OUTPUT_LOG
|
||||
NSData *outData = [NSData dataWithBytes:outSamples length:frameCount * format->mBytesPerPacket];
|
||||
[logFile writeData:outData];
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -924,7 +931,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
}
|
||||
#ifdef OUTPUT_LOG
|
||||
if(_logFile) {
|
||||
fclose(_logFile);
|
||||
[_logFile closeFile];
|
||||
_logFile = NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue