mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 21:33:40 -07:00
format
This commit is contained in:
parent
0fb52ab567
commit
49a1d62009
4 changed files with 20 additions and 20 deletions
|
@ -22,13 +22,13 @@ bool SfxExtractor::isAllSilence(int16_t* buffer, size_t count) {
|
|||
}
|
||||
bool SfxExtractor::isSilentSample(int16_t sample) {
|
||||
return abs(sample) <= SFX_EXTRACTION_SILENCE_THRESHOLD;
|
||||
|
||||
}
|
||||
|
||||
// Find the beginning of a captured signal.
|
||||
size_t SfxExtractor::adjustedStartOfInput() {
|
||||
size_t startOfInput = 0;
|
||||
while (startOfInput + 2 < SFX_EXTRACTION_BUFFER_SIZE * 2 && isSilentSample(tempBuffer[startOfInput]) && isSilentSample(tempBuffer[startOfInput + 1])) {
|
||||
while (startOfInput + 2 < SFX_EXTRACTION_BUFFER_SIZE * 2 && isSilentSample(tempBuffer[startOfInput]) &&
|
||||
isSilentSample(tempBuffer[startOfInput + 1])) {
|
||||
startOfInput += 2;
|
||||
}
|
||||
return startOfInput;
|
||||
|
@ -168,7 +168,8 @@ void SfxExtractor::frameCallback() {
|
|||
}
|
||||
|
||||
void SfxExtractor::prime() {
|
||||
int frameLimit = 0;//A couple of sounds don't come to a full stop until another sound is loaded, but should be effectively silent after a couple of seconds.
|
||||
int frameLimit = 0; // A couple of sounds don't come to a full stop until another sound is loaded, but should be
|
||||
// effectively silent after a couple of seconds.
|
||||
do {
|
||||
AudioMgr_CreateNextAudioBuffer(tempBuffer + 0, SFX_EXTRACTION_ONE_FRAME);
|
||||
} while (frameLimit++ < 200 && !isAllSilence(tempBuffer + 0, SFX_EXTRACTION_ONE_FRAME * 2));
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#define SFX_EXTRACTION_ONE_FRAME 560
|
||||
#define SFX_EXTRACTION_SILENCE_THRESHOLD 6 // Corresponds to an amplitude of -75dB.
|
||||
|
||||
|
||||
enum CaptureThreadStates {
|
||||
CT_WAITING, // for a sound to start ripping.
|
||||
CT_PRIMING,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue