virtual int32 Recompress(FName Format, const TArray<uint8>& SrcBuffer, FSoundQualityInfo& QualityInfo, TArray<uint8>& OutBuffer) const override { check(Format == NAME_OPUS); FOpusAudioInfo AudioInfo; // Cannot quality preview multichannel sounds if( QualityInfo.NumChannels > 2 ) { return 0; } TArray<uint8> CompressedDataStore; if( !Cook( Format, SrcBuffer, QualityInfo, CompressedDataStore ) ) { return 0; } // Parse the opus header for the relevant information if( !AudioInfo.ReadCompressedInfo( CompressedDataStore.GetData(), CompressedDataStore.Num(), &QualityInfo ) ) { return 0; } // Decompress all the sample data OutBuffer.Empty(QualityInfo.SampleDataSize); OutBuffer.AddZeroed(QualityInfo.SampleDataSize); AudioInfo.ExpandFile( OutBuffer.GetData(), &QualityInfo ); return CompressedDataStore.Num(); }
Kitchen::Kitchen(int staffCount, float refreshRes, float pizzaMul, Waiter * wait) : _condReserve(_reserveLock), _condNewOrder(_orderLock), _orders(), _threadRes(start_reserve, this), _waiter(wait), _resRefreshRate(refreshRes) { // info _nbCooks = staffCount; for (int i = 0; i < NB_PIZZA; _infos.ready[i++] = 0); _infos.waiting = 0; _infos.inPrep = 0; _infos.destroyed = false; // content for (unsigned int i = 0; i < _nbCooks; ++i) { _staff.push_back(Cook(this, pizzaMul)); _threads.push_back(Thread(start_cooks, &(_staff.back()))); } for (int ing = 1; ing <= Amour; ing *= 2) _reserve[static_cast<Ingredients>(ing)] = 5; if (gettimeofday(&_lastTick, NULL)) std::cerr << "gettimeofday fail.\n"; }