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