Compare commits

..

No commits in common. "6b23590ac89412fc56cd18bdc139e7cef0e8410c" and "f7b2c481e6b4c8077116d093c57cd8c03623a787" have entirely different histories.

4 changed files with 13 additions and 21 deletions

View file

@ -356,12 +356,8 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
}
- (IBAction)prev:(id)sender {
double pos = [audioPlayer amountPlayed];
if(pos < 5.0) {
if([playlistController prev] == NO)
return;
}
if([playlistController prev] == NO)
return;
[self playEntry:[playlistController currentEntry]];
}

View file

@ -269,7 +269,6 @@ 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;
@ -286,6 +285,7 @@ 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) {

View file

@ -28,6 +28,9 @@ using std::atomic_long;
#import <CogAudio/HeadphoneFilter.h>
//#define OUTPUT_LOG
#ifdef OUTPUT_LOG
#import <stdio.h>
#endif
@class OutputNode;
@ -99,7 +102,7 @@ using std::atomic_long;
ChunkList *outputBuffer;
#ifdef OUTPUT_LOG
NSFileHandle *_logFile;
FILE *_logFile;
#endif
}

View file

@ -19,10 +19,6 @@
#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";
@ -150,7 +146,7 @@ static void *kOutputCoreAudioContext = &kOutputCoreAudioContext;
#ifdef OUTPUT_LOG
NSString *logName = [NSTemporaryDirectory() stringByAppendingPathComponent:@"CogAudioLog.raw"];
_logFile = [NSFileHandle fileHandleForWritingAtPath:logName createFile:YES];
_logFile = fopen([logName UTF8String], "wb");
#endif
}
@ -625,7 +621,9 @@ 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];
@ -650,7 +648,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
__block NSMutableArray *faders = self->fadedBuffers;
#ifdef OUTPUT_LOG
__block NSFileHandle *logFile = _logFile;
__block FILE *logFile = _logFile;
#endif
_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);
[_self updateLatency:secondsRendered];
#ifdef OUTPUT_LOG
NSData *outData = [NSData dataWithBytes:outSamples length:frameCount * format->mBytesPerPacket];
[logFile writeData:outData];
#endif
}
#ifdef _DEBUG
@ -931,7 +924,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
}
#ifdef OUTPUT_LOG
if(_logFile) {
[_logFile closeFile];
fclose(_logFile);
_logFile = NULL;
}
#endif