diff --git a/Sound/BufferChain.m b/Sound/BufferChain.m index 1ebf4ab4a..7124fed86 100644 --- a/Sound/BufferChain.m +++ b/Sound/BufferChain.m @@ -78,8 +78,24 @@ NSLog(@"SEEKING IN BUFFERCHIAN"); [inputNode seek:time]; + [[converterNode readLock] lock]; + [[converterNode writeLock] lock]; + + [[inputNode readLock] lock]; + [[inputNode writeLock] lock]; + + //Signal so its waiting when we unlock + [[converterNode semaphore] signal]; + [[inputNode semaphore] signal]; + [converterNode resetBuffer]; [inputNode resetBuffer]; + + [[inputNode writeLock] unlock]; + [[inputNode readLock] unlock]; + + [[converterNode writeLock] unlock]; + [[converterNode readLock] unlock]; } - (void)endOfInputReached diff --git a/Sound/Node.m b/Sound/Node.m index 0ac92b449..581c3665c 100644 --- a/Sound/Node.m +++ b/Sound/Node.m @@ -153,14 +153,7 @@ - (void)resetBuffer { - [readLock lock]; - [writeLock lock]; - [semaphore signal]; - [buffer empty]; - - [writeLock unlock]; - [readLock unlock]; } - (NSLock *)readLock diff --git a/Sound/SoundFile/MADFile.m b/Sound/SoundFile/MADFile.m index e2552871d..bc6d45601 100644 --- a/Sound/SoundFile/MADFile.m +++ b/Sound/SoundFile/MADFile.m @@ -448,7 +448,6 @@ static inline signed int scale (mad_fixed_t sample) else { remainder = 0; - _seekSkip = NO; } len = fread(_inputBuffer+remainder, 1, INPUT_BUFFER_SIZE-remainder, _inFd); @@ -469,7 +468,7 @@ static inline signed int scale (mad_fixed_t sample) mad_stream_buffer(&_stream, _inputBuffer, len); _stream.error = 0; -/* if (_seekSkip) + if (_seekSkip) { int skip = 2; do @@ -486,7 +485,7 @@ static inline signed int scale (mad_fixed_t sample) _seekSkip = NO; } -*/ + } if (mad_frame_decode(&_frame, &_stream) == -1) { if (!MAD_RECOVERABLE (_stream.error))