1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-27 06:07:59 +02:00

Remove whitespace only changes

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
Emily Mabrey 2021-08-10 18:49:56 -04:00
parent d4a560f6f3
commit d7695f3c91
No known key found for this signature in database
GPG Key ID: 6F4EF47256A1B7DC
3 changed files with 92 additions and 91 deletions

View File

@ -18,8 +18,8 @@
********************************************************************//** ********************************************************************//**
\class AudioIoCallback \class AudioIoCallback
\brief AudioIoCallback is a class that implements the callback required \brief AudioIoCallback is a class that implements the callback required
by PortAudio. The callback needs to be responsive, has no GUI, and by PortAudio. The callback needs to be responsive, has no GUI, and
copies data into and out of the sound card buffers. It also sends data copies data into and out of the sound card buffers. It also sends data
to the meters. to the meters.
@ -408,7 +408,7 @@ callbacks for these events.
*//****************************************************************//** *//****************************************************************//**
\class AudioIOStartStreamOptions \class AudioIOStartStreamOptions
\brief struct holding stream options, including a pointer to the \brief struct holding stream options, including a pointer to the
time warp info and AudioIOListener and whether the playback is looped. time warp info and AudioIOListener and whether the playback is looped.
*//*******************************************************************/ *//*******************************************************************/
@ -961,7 +961,7 @@ AudioIO::AudioIO()
wxASSERT(false); wxASSERT(false);
} }
// This ASSERT because of casting in the callback // This ASSERT because of casting in the callback
// functions where we cast a tempFloats buffer to a (short*) buffer. // functions where we cast a tempFloats buffer to a (short*) buffer.
// We have to ASSERT in the GUI thread, if we are to see it properly. // We have to ASSERT in the GUI thread, if we are to see it properly.
wxASSERT( sizeof( short ) <= sizeof( float )); wxASSERT( sizeof( short ) <= sizeof( float ));
@ -986,8 +986,7 @@ AudioIO::AudioIO()
#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
mAILAActive = false; mAILAActive = false;
#endif #endif
mStreamToken = 0;
mStreamToken = 0;
mLastPaError = paNoError; mLastPaError = paNoError;
@ -1004,18 +1003,18 @@ AudioIO::AudioIO()
PaError err = Pa_Initialize(); PaError err = Pa_Initialize();
if (err != paNoError) { if (err != paNoError) {
auto errStr = XO("Could not find any audio devices.\n"); auto errStr = XO("Could not find any audio devices.\n");
errStr += XO("You will not be able to play or record audio.\n\n"); errStr += XO("You will not be able to play or record audio.\n\n");
const wxString paErrStr = LAT1CTOWX(Pa_GetErrorText(err)); const wxString paErrStr = LAT1CTOWX(Pa_GetErrorText(err));
if (!paErrStr.empty()) if (!paErrStr.empty())
errStr += XO("Error: %s").Format(paErrStr); errStr += XO("Error: %s").Format(paErrStr);
// XXX: we are in libaudacity, popping up dialogs not allowed! A // XXX: we are in libaudacity, popping up dialogs not allowed! A
// long-term solution will probably involve exceptions // long-term solution will probably involve exceptions
AudacityMessageBox( AudacityMessageBox(
errStr, errStr,
XO("Error Initializing Audio"), XO("Error Initializing Audio"),
wxICON_ERROR | wxOK); wxICON_ERROR|wxOK);
// Since PortAudio is not initialized, all calls to PortAudio // Since PortAudio is not initialized, all calls to PortAudio
// functions will fail. This will give reasonable behavior, since // functions will fail. This will give reasonable behavior, since
@ -1026,19 +1025,19 @@ AudioIO::AudioIO()
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
PmError pmErr = Pm_Initialize(); PmError pmErr = Pm_Initialize();
if (pmErr != pmNoError) { if (pmErr != pmNoError) {
auto errStr = auto errStr =
XO("There was an error initializing the midi i/o layer.\n"); XO("There was an error initializing the midi i/o layer.\n");
errStr += XO("You will not be able to play midi.\n\n"); errStr += XO("You will not be able to play midi.\n\n");
const wxString pmErrStr = LAT1CTOWX(Pm_GetErrorText(pmErr)); const wxString pmErrStr = LAT1CTOWX(Pm_GetErrorText(pmErr));
if (!pmErrStr.empty()) if (!pmErrStr.empty())
errStr += XO("Error: %s").Format(pmErrStr); errStr += XO("Error: %s").Format(pmErrStr);
// XXX: we are in libaudacity, popping up dialogs not allowed! A // XXX: we are in libaudacity, popping up dialogs not allowed! A
// long-term solution will probably involve exceptions // long-term solution will probably involve exceptions
AudacityMessageBox( AudacityMessageBox(
errStr, errStr,
XO("Error Initializing Midi"), XO("Error Initializing Midi"),
wxICON_ERROR | wxOK); wxICON_ERROR|wxOK);
// Same logic for PortMidi as described above for PortAudio // Same logic for PortMidi as described above for PortAudio
} }
@ -1253,13 +1252,13 @@ bool AudioIO::StartPortAudioStream(const AudioIOStartStreamOptions &options,
mRate = GetBestRate(numCaptureChannels > 0, numPlaybackChannels > 0, sampleRate); mRate = GetBestRate(numCaptureChannels > 0, numPlaybackChannels > 0, sampleRate);
// July 2016 (Carsten and Uwe) // July 2016 (Carsten and Uwe)
// BUG 193: Tell PortAudio sound card will handle 24 bit (under DirectSound) using // BUG 193: Tell PortAudio sound card will handle 24 bit (under DirectSound) using
// userData. // userData.
int captureFormat_saved = captureFormat; int captureFormat_saved = captureFormat;
// Special case: Our 24-bit sample format is different from PortAudio's // Special case: Our 24-bit sample format is different from PortAudio's
// 3-byte packed format. So just make PortAudio return float samples, // 3-byte packed format. So just make PortAudio return float samples,
// since we need float values anyway to apply the gain. // since we need float values anyway to apply the gain.
// ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to // ANSWER-ME: So we *never* actually handle 24-bit?! This causes mCapture to
// be set to floatSample below. // be set to floatSample below.
// JKC: YES that's right. Internally Audacity uses float, and float has space for // JKC: YES that's right. Internally Audacity uses float, and float has space for
// 24 bits as well as exponent. Actual 24 bit would require packing and // 24 bits as well as exponent. Actual 24 bit would require packing and
@ -1358,7 +1357,7 @@ bool AudioIO::StartPortAudioStream(const AudioIOStartStreamOptions &options,
#endif #endif
// July 2016 (Carsten and Uwe) // July 2016 (Carsten and Uwe)
// BUG 193: Possibly tell portAudio to use 24 bit with DirectSound. // BUG 193: Possibly tell portAudio to use 24 bit with DirectSound.
int userData = 24; int userData = 24;
int* lpUserData = (captureFormat_saved == int24Sample) ? &userData : NULL; int* lpUserData = (captureFormat_saved == int24Sample) ? &userData : NULL;
@ -1473,7 +1472,7 @@ void AudioIO::StartMonitoring( const AudioIOStartStreamOptions &options )
// FIXME: TRAP_ERR PaErrorCode 'noted' but not reported in StartMonitoring. // FIXME: TRAP_ERR PaErrorCode 'noted' but not reported in StartMonitoring.
// Now start the PortAudio stream! // Now start the PortAudio stream!
// TODO: ? Factor out and reuse error reporting code from end of // TODO: ? Factor out and reuse error reporting code from end of
// AudioIO::StartStream? // AudioIO::StartStream?
mLastPaError = Pa_StartStream( mPortStreamV19 ); mLastPaError = Pa_StartStream( mPortStreamV19 );
@ -1706,7 +1705,7 @@ int AudioIO::StartStream(const TransportTracks &tracks,
mPlaybackMixers[ii]->Reposition( time ); mPlaybackMixers[ii]->Reposition( time );
mPlaybackSchedule.RealTimeInit( time ); mPlaybackSchedule.RealTimeInit( time );
} }
// Now that we are done with SetTrackTime(): // Now that we are done with SetTrackTime():
mTimeQueue.mLastTime = mPlaybackSchedule.GetTrackTime(); mTimeQueue.mLastTime = mPlaybackSchedule.GetTrackTime();
if (mTimeQueue.mData) if (mTimeQueue.mData)
@ -1857,7 +1856,7 @@ bool AudioIO::AllocateBuffers(
// more frequent polling of the mouse // more frequent polling of the mouse
playbackTime = playbackTime =
lrint(options.pScrubbingOptions->delay * mRate) / mRate; lrint(options.pScrubbingOptions->delay * mRate) / mRate;
wxASSERT( playbackTime >= 0 ); wxASSERT( playbackTime >= 0 );
mPlaybackSamplesToCopy = playbackTime * mRate; mPlaybackSamplesToCopy = playbackTime * mRate;
@ -2005,7 +2004,7 @@ bool AudioIO::AllocateBuffers(
} }
} }
} while(!bDone); } while(!bDone);
success = true; success = true;
return true; return true;
} }
@ -2179,7 +2178,7 @@ void AudioIO::StopStream()
// Re-enable system sleep // Re-enable system sleep
wxPowerResource::Release(wxPOWER_RESOURCE_SCREEN); wxPowerResource::Release(wxPOWER_RESOURCE_SCREEN);
#endif #endif
if( mAudioThreadFillBuffersLoopRunning) if( mAudioThreadFillBuffersLoopRunning)
{ {
// PortAudio callback can use the information that we are stopping to fade // PortAudio callback can use the information that we are stopping to fade
@ -2187,7 +2186,7 @@ void AudioIO::StopStream()
mAudioThreadFillBuffersLoopRunning = false; mAudioThreadFillBuffersLoopRunning = false;
auto latency = static_cast<long>(AudioIOLatencyDuration.Read()); auto latency = static_cast<long>(AudioIOLatencyDuration.Read());
// If we can gracefully fade out in 200ms, with the faded-out play buffers making it through // If we can gracefully fade out in 200ms, with the faded-out play buffers making it through
// the sound card, then do so. If we can't, don't wait around. Just stop quickly and accept // the sound card, then do so. If we can't, don't wait around. Just stop quickly and accept
// there will be a click. // there will be a click.
if( mbMicroFades && (latency < 150 )) if( mbMicroFades && (latency < 150 ))
wxMilliSleep( latency + 50); wxMilliSleep( latency + 50);
@ -2305,7 +2304,7 @@ void AudioIO::StopStream()
#endif #endif
auto pListener = GetListener(); auto pListener = GetListener();
// If there's no token, we were just monitoring, so we can // If there's no token, we were just monitoring, so we can
// skip this next part... // skip this next part...
if (mStreamToken > 0) { if (mStreamToken > 0) {
@ -2373,7 +2372,7 @@ void AudioIO::StopStream()
} ); } );
} }
if (!mLostCaptureIntervals.empty()) if (!mLostCaptureIntervals.empty())
{ {
// This scope may combine many splittings of wave tracks // This scope may combine many splittings of wave tracks
@ -2427,7 +2426,7 @@ void AudioIO::StopStream()
e.SetInt(false); e.SetInt(false);
wxTheApp->ProcessEvent(e); wxTheApp->ProcessEvent(e);
} }
if (mNumCaptureChannels > 0) if (mNumCaptureChannels > 0)
{ {
wxCommandEvent e(wasMonitoring ? EVT_AUDIOIO_MONITOR : EVT_AUDIOIO_CAPTURE); wxCommandEvent e(wasMonitoring ? EVT_AUDIOIO_MONITOR : EVT_AUDIOIO_CAPTURE);
@ -2820,7 +2819,7 @@ void AudioIO::FillBuffers()
// wxASSERT(put == frames); // wxASSERT(put == frames);
// but we can't assert in this thread // but we can't assert in this thread
wxUnusedVar(put); wxUnusedVar(put);
} }
} }
available -= frames; available -= frames;
@ -3274,7 +3273,7 @@ void AudioIoCallback::GetNextEvent()
if (mNextEvent) { if (mNextEvent) {
mNextEventTime = (mNextIsNoteOn ? mNextEvent->time : mNextEventTime = (mNextIsNoteOn ? mNextEvent->time :
mNextEvent->get_end_time()) + nextOffset;; mNextEvent->get_end_time()) + nextOffset;;
} }
if (mNextEventTime > (mPlaybackSchedule.mT1 + midiLoopOffset)){ // terminate playback at mT1 if (mNextEventTime > (mPlaybackSchedule.mT1 + midiLoopOffset)){ // terminate playback at mT1
mNextEvent = &gAllNotesOff; mNextEvent = &gAllNotesOff;
mNextEventTime = mPlaybackSchedule.mT1 + midiLoopOffset - ALG_EPS; mNextEventTime = mPlaybackSchedule.mT1 + midiLoopOffset - ALG_EPS;
@ -3824,7 +3823,7 @@ bool AudioIoCallback::FillOutputBuffers(
return false; return false;
if( !outputBuffer ) if( !outputBuffer )
return false; return false;
if(numPlaybackChannels <= 0) if(numPlaybackChannels <= 0)
return false; return false;
float *outputFloats = (float *)outputBuffer; float *outputFloats = (float *)outputBuffer;
@ -3855,7 +3854,7 @@ bool AudioIoCallback::FillOutputBuffers(
// The drop and dropQuickly booleans are so named for historical reasons. // The drop and dropQuickly booleans are so named for historical reasons.
// JKC: The original code attempted to be faster by doing nothing on silenced audio. // JKC: The original code attempted to be faster by doing nothing on silenced audio.
// This, IMHO, is 'premature optimisation'. Instead clearer and cleaner code would // This, IMHO, is 'premature optimisation'. Instead clearer and cleaner code would
// simply use a gain of 0.0 for silent audio and go on through to the stage of // simply use a gain of 0.0 for silent audio and go on through to the stage of
// applying that 0.0 gain to the data mixed into the buffer. // applying that 0.0 gain to the data mixed into the buffer.
// Then (and only then) we would have if needed fast paths for: // Then (and only then) we would have if needed fast paths for:
// - Applying a uniform gain of 0.0. // - Applying a uniform gain of 0.0.
@ -3900,7 +3899,7 @@ bool AudioIoCallback::FillOutputBuffers(
if (dropQuickly) { if (dropQuickly) {
len = mPlaybackBuffers[t]->Discard(toGet); len = mPlaybackBuffers[t]->Discard(toGet);
// keep going here. // keep going here.
// we may still need to issue a paComplete. // we may still need to issue a paComplete.
} else { } else {
const auto ptrToSample = (samplePtr)bufHelper.get()->tempBufs[chanCnt]; const auto ptrToSample = (samplePtr)bufHelper.get()->tempBufs[chanCnt];
@ -4000,7 +3999,7 @@ void AudioIoCallback::UpdateTimePosition(unsigned long framesPerBuffer)
// Copy from PortAudio to our input buffers. // Copy from PortAudio to our input buffers.
// //
void AudioIoCallback::FillInputBuffers( void AudioIoCallback::FillInputBuffers(
const void *inputBuffer, const void *inputBuffer,
unsigned long framesPerBuffer, unsigned long framesPerBuffer,
const PaStreamCallbackFlags statusFlags, const PaStreamCallbackFlags statusFlags,
float * tempFloats float * tempFloats
@ -4071,10 +4070,10 @@ void AudioIoCallback::FillInputBuffers(
wxPrintf(wxT("lost %d samples\n"), (int)(framesPerBuffer - len)); wxPrintf(wxT("lost %d samples\n"), (int)(framesPerBuffer - len));
} }
if (len <= 0) if (len <= 0)
return; return;
// We have an ASSERT in the AudioIO constructor to alert us to // We have an ASSERT in the AudioIO constructor to alert us to
// possible issues with the (short*) cast. We'd have a problem if // possible issues with the (short*) cast. We'd have a problem if
// sizeof(short) > sizeof(float) since our buffers are sized for floats. // sizeof(short) > sizeof(float) since our buffers are sized for floats.
for(unsigned t = 0; t < numCaptureChannels; t++) { for(unsigned t = 0; t < numCaptureChannels; t++) {
@ -4111,7 +4110,7 @@ void AudioIoCallback::FillInputBuffers(
} // switch } // switch
// JKC: mCaptureFormat must be for samples with sizeof(float) or // JKC: mCaptureFormat must be for samples with sizeof(float) or
// fewer bytes (because tempFloats is sized for floats). All // fewer bytes (because tempFloats is sized for floats). All
// formats are 2 or 4 bytes, so we are OK. // formats are 2 or 4 bytes, so we are OK.
const auto put = const auto put =
mCaptureBuffers[t]->Put( mCaptureBuffers[t]->Put(
@ -4157,7 +4156,7 @@ void OldCodeToCalculateLatency()
// return true, IFF we have fully handled the callback. // return true, IFF we have fully handled the callback.
// Prime the output buffer with 0's, optionally adding in the playthrough. // Prime the output buffer with 0's, optionally adding in the playthrough.
void AudioIoCallback::DoPlaythrough( void AudioIoCallback::DoPlaythrough(
const void *inputBuffer, const void *inputBuffer,
void *outputBuffer, void *outputBuffer,
unsigned long framesPerBuffer, unsigned long framesPerBuffer,
float *outputMeterFloats float *outputMeterFloats
@ -4194,7 +4193,7 @@ void AudioIoCallback::DoPlaythrough(
// Also computes rms // Also computes rms
void AudioIoCallback::SendVuInputMeterData( void AudioIoCallback::SendVuInputMeterData(
float *inputSamples, float *inputSamples,
unsigned long framesPerBuffer unsigned long framesPerBuffer
) )
{ {
const auto numCaptureChannels = mNumCaptureChannels; const auto numCaptureChannels = mNumCaptureChannels;
@ -4235,7 +4234,7 @@ void AudioIoCallback::SendVuOutputMeterData(
return; return;
if( mOutputMeter->IsMeterDisabled() ) if( mOutputMeter->IsMeterDisabled() )
return; return;
if( !outputMeterFloats) if( !outputMeterFloats)
return; return;
// Get here if playback meter is live // Get here if playback meter is live
@ -4289,7 +4288,7 @@ unsigned AudioIoCallback::CountSoloingTracks(){
// TODO: Consider making the two Track status functions into functions of // TODO: Consider making the two Track status functions into functions of
// WaveTrack. // WaveTrack.
// true IFF the track should be silent. // true IFF the track should be silent.
// The track may not yet be silent, since it may still be // The track may not yet be silent, since it may still be
// fading out. // fading out.
bool AudioIoCallback::TrackShouldBeSilent( const WaveTrack &wt ) bool AudioIoCallback::TrackShouldBeSilent( const WaveTrack &wt )
@ -4320,8 +4319,8 @@ bool AudioIoCallback::AllTracksAlreadySilent()
const bool dropAllQuickly = std::all_of( const bool dropAllQuickly = std::all_of(
mPlaybackTracks.begin(), mPlaybackTracks.end(), mPlaybackTracks.begin(), mPlaybackTracks.end(),
[&]( const std::shared_ptr< WaveTrack > &vt ) [&]( const std::shared_ptr< WaveTrack > &vt )
{ return { return
TrackShouldBeSilent( *vt ) && TrackShouldBeSilent( *vt ) &&
TrackHasBeenFadedOut( *vt ); } TrackHasBeenFadedOut( *vt ); }
); );
return dropAllQuickly; return dropAllQuickly;
@ -4351,9 +4350,9 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
// but it does nothing unless we have EXPERIMENTAL_MIDI_OUT // but it does nothing unless we have EXPERIMENTAL_MIDI_OUT
// TODO: Possibly rename variables to make it clearer which ones are MIDI specific // TODO: Possibly rename variables to make it clearer which ones are MIDI specific
// and which ones affect all audio. // and which ones affect all audio.
ComputeMidiTimings( ComputeMidiTimings(
timeInfo, timeInfo,
framesPerBuffer framesPerBuffer
); );
#ifndef USE_MIDI_THREAD #ifndef USE_MIDI_THREAD
if (mMidiStream) if (mMidiStream)
@ -4369,10 +4368,10 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
float *tempFloats = (float *)alloca(framesPerBuffer*sizeof(float)* float *tempFloats = (float *)alloca(framesPerBuffer*sizeof(float)*
MAX(numCaptureChannels,numPlaybackChannels)); MAX(numCaptureChannels,numPlaybackChannels));
bool bVolEmulationActive = bool bVolEmulationActive =
(outputBuffer && mEmulateMixerOutputVol && mMixerOutputVol != 1.0); (outputBuffer && mEmulateMixerOutputVol && mMixerOutputVol != 1.0);
// outputMeterFloats is the scratch pad for the output meter. // outputMeterFloats is the scratch pad for the output meter.
// we can often reuse the existing outputBuffer and save on allocating // we can often reuse the existing outputBuffer and save on allocating
// something new. // something new.
float *outputMeterFloats = bVolEmulationActive ? float *outputMeterFloats = bVolEmulationActive ?
(float *)alloca(framesPerBuffer*numPlaybackChannels * sizeof(float)) : (float *)alloca(framesPerBuffer*numPlaybackChannels * sizeof(float)) :
@ -4397,10 +4396,10 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
// This function may queue up a pause or resume. // This function may queue up a pause or resume.
// TODO this is a bit dodgy as it toggles the Pause, and // TODO this is a bit dodgy as it toggles the Pause, and
// relies on an idle event to have handled that, so could // relies on an idle event to have handled that, so could
// queue up multiple toggle requests and so do nothing. // queue up multiple toggle requests and so do nothing.
// Eventually it will sort itself out by random luck, but // Eventually it will sort itself out by random luck, but
// the net effect is a delay in starting/stopping sound activated // the net effect is a delay in starting/stopping sound activated
// recording. // recording.
CheckSoundActivatedRecordingLevel( CheckSoundActivatedRecordingLevel(
inputSamples, inputSamples,
@ -4411,7 +4410,7 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
// Initialise output buffer to zero or to playthrough data. // Initialise output buffer to zero or to playthrough data.
// Initialise output meter values. // Initialise output meter values.
DoPlaythrough( DoPlaythrough(
inputBuffer, inputBuffer,
outputBuffer, outputBuffer,
framesPerBuffer, framesPerBuffer,
outputMeterFloats); outputMeterFloats);
@ -4433,7 +4432,7 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
// To capture input into track (sound from microphone) // To capture input into track (sound from microphone)
FillInputBuffers( FillInputBuffers(
inputBuffer, inputBuffer,
framesPerBuffer, framesPerBuffer,
statusFlags, statusFlags,
tempFloats); tempFloats);
@ -4508,7 +4507,7 @@ void AudioIoCallback::CallbackCheckCompletion(
done = mPlaybackSchedule.PlayingAtSpeed() done = mPlaybackSchedule.PlayingAtSpeed()
// some leftover length allowed in this case // some leftover length allowed in this case
|| (mPlaybackSchedule.PlayingStraight() && len == 0); || (mPlaybackSchedule.PlayingStraight() && len == 0);
if(!done) if(!done)
return; return;
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT

View File

@ -11,6 +11,9 @@ Paul Licameli split from AudioIO.h
#ifndef __AUDACITY_AUDIO_IO_BASE__ #ifndef __AUDACITY_AUDIO_IO_BASE__
#define __AUDACITY_AUDIO_IO_BASE__ #define __AUDACITY_AUDIO_IO_BASE__
#include <cfloat> #include <cfloat>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -35,7 +38,7 @@ class BoundedEnvelope;
// Windows build needs complete type for parameter of wxWeakRef // Windows build needs complete type for parameter of wxWeakRef
// class MeterPanelBase; // class MeterPanelBase;
#include "widgets/MeterPanelBase.h" #include "widgets/MeterPanelBase.h"
using PRCrossfadeData = std::vector< std::vector<float>>; using PRCrossfadeData = std::vector< std::vector < float > >;
#define BAD_STREAM_TIME (-DBL_MAX) #define BAD_STREAM_TIME (-DBL_MAX)

View File

@ -10,35 +10,34 @@ class AudioIOBufferHelper
private: private:
unsigned int numPlaybackChannels; unsigned int numPlaybackChannels;
unsigned long framesPerBuffer; unsigned long framesPerBuffer;
public: public:
WaveTrack** chans; WaveTrack** chans;
float** tempBufs; float** tempBufs;
AudioIOBufferHelper(const unsigned int numPlaybackChannels, const unsigned long framesPerBuffer) { AudioIOBufferHelper(const unsigned int numPlaybackChannels, const unsigned long framesPerBuffer) {
this->numPlaybackChannels = numPlaybackChannels; this->numPlaybackChannels = numPlaybackChannels;
this->framesPerBuffer = framesPerBuffer; this->framesPerBuffer = framesPerBuffer;
this->chans = safenew WaveTrack * [numPlaybackChannels]; this->chans = safenew WaveTrack * [numPlaybackChannels];
this->tempBufs = safenew float* [numPlaybackChannels]; this->tempBufs = safenew float* [numPlaybackChannels];
tempBufs[0] = safenew float[(size_t)numPlaybackChannels * framesPerBuffer]; tempBufs[0] = safenew float[(size_t)numPlaybackChannels * framesPerBuffer];
memset(tempBufs[0], 0, (size_t)numPlaybackChannels * (size_t)framesPerBuffer * sizeof(float)); memset(tempBufs[0], 0, (size_t)numPlaybackChannels * (size_t)framesPerBuffer * sizeof(float));
for (unsigned int c = 1; c < numPlaybackChannels; c++) { for (unsigned int c = 1; c < numPlaybackChannels; c++) {
tempBufs[c] = tempBufs[c - 1] + framesPerBuffer; tempBufs[c] = tempBufs[c - 1] + framesPerBuffer;
} }
} }
~AudioIOBufferHelper() { ~AudioIOBufferHelper() {
delete[] tempBufs[0];
delete[] tempBufs[0]; delete[] tempBufs;
delete[] tempBufs; delete[] chans;
delete[] chans; }
}
}; };
#endif #endif