mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Merge branch 'master' into antifrag
This commit is contained in:
commit
4fefad1028
11
.travis.yml
11
.travis.yml
@ -1,12 +1,17 @@
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
- gcc-4.8
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libwxgtk3.0-dev libgtk2.0-dev
|
||||
- git show -s --format="wxT(\"<a href=\\\"http://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")"
|
||||
- git show -s --format="wxT(\"<a href=\\\"http://github.com/audacity/audacity/commit/%H\\\">%h</a> of %cd\")" > ./src/RevisionIdent.h
|
||||
- export CXX="g++-4.8" CC="gcc-4.8"
|
||||
language:
|
||||
- cpp
|
||||
compiler:
|
||||
- gcc
|
||||
script:
|
||||
- aclocal --install -I m4 && automake && ./configure && make
|
||||
|
||||
|
@ -216,6 +216,10 @@ OBJCXXLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_OBJCXXLD = $(am__v_OBJCXXLD_@AM_V@)
|
||||
# Overwrite C++ variables with values for Objective-C, because in the end there
|
||||
# is only one linker command that should be configured correctly.
|
||||
@MAC_TRUE@CXXLINK = $(OBJCXXLINK)
|
||||
@MAC_TRUE@AM_V_CXXLD = $(AM_V_OBJCXXLD)
|
||||
am__v_OBJCXXLD_ = $(am__v_OBJCXXLD_@AM_DEFAULT_V@)
|
||||
am__v_OBJCXXLD_0 = @echo " OBJCXXLD" $@;
|
||||
am__v_OBJCXXLD_1 =
|
||||
@ -521,7 +525,7 @@ win/libFileDialog_la-FileDialogPrivate.lo: win/$(am__dirstamp) \
|
||||
win/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
libFileDialog.la: $(libFileDialog_la_OBJECTS) $(libFileDialog_la_DEPENDENCIES) $(EXTRA_libFileDialog_la_DEPENDENCIES)
|
||||
$(AM_V_OBJCXXLD)$(OBJCXXLINK) -rpath $(libdir) $(libFileDialog_la_OBJECTS) $(libFileDialog_la_LIBADD) $(LIBS)
|
||||
$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libFileDialog_la_OBJECTS) $(libFileDialog_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
@ -3,38 +3,40 @@ is 10.6. To build Audacity using Xcode 5.1 or newer, you need
|
||||
to extract the 10.6 SDK from an earlier version of Xcode.
|
||||
|
||||
In the instructions below, Xcode 4.3.3 (for the 10.6 SDK) and
|
||||
Xcode 5.1.1 will be used. Xcode 6.1.1, 6.3, 6.4.1, and 7.0
|
||||
Xcode 5.1.1 will be used. Xcode 6.1.1, 6.3, 6.4.1, and 7.1
|
||||
have been verified to work as well.
|
||||
|
||||
1) Download Xcode 5.1.1 or greater and install it to /Applications
|
||||
2) Download Xcode 4.3.3 and open it in Finder
|
||||
3) Right click the "Xcode.app" bundle and select "Show Package Contents"
|
||||
4) Navigate down the directories to get to:
|
||||
1) Download Xcode 5.1.1 or greater and install it to /Applications.
|
||||
2) Download Xcode 4.3.3 (it includes the 10.6 and 10.7 SDK's despite
|
||||
the downloads page says it only has the 10.7 SDK).
|
||||
3) Open the DMG in Finder.
|
||||
4) Right-click the "Xcode.app" bundle and select "Show Package Contents".
|
||||
5) Navigate down the directories to get to:
|
||||
|
||||
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
|
||||
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ .
|
||||
|
||||
5) Copy the MacOSX10.6.sdk folder to:
|
||||
6) Copy the MacOSX10.6.sdk folder to:
|
||||
|
||||
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
|
||||
|
||||
Xcode is now ready.
|
||||
|
||||
6) Download wxWidgets. We currently require version 3.0.2, which can be downloaded from:
|
||||
7) Download wxWidgets. We currently require version 3.0.2, which can be downloaded from:
|
||||
|
||||
http://sourceforge.net/projects/wxwindows/files/3.0.2/wxWidgets-3.0.2.tar.bz2
|
||||
|
||||
7) Once the download is complete, untar it (your browser may have already done this):
|
||||
8) Once the download is complete, untar it (your browser may have already done this):
|
||||
|
||||
tar xf wxWidgets-3.0.2.tar.bz2
|
||||
tar xf wxWidgets-3.0.2.tar.bz2 .
|
||||
|
||||
8) Apply the following fixes to wxWidgets:
|
||||
9) Apply the following fixes to wxWidgets:
|
||||
|
||||
cd wxWidgets-3.0.2
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch
|
||||
patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch .
|
||||
|
||||
9) And finally build/install wxWidgets:
|
||||
10) And finally build/install wxWidgets:
|
||||
|
||||
sudo <path to Audacity source>/mac/build_wxwidgets
|
||||
sudo <path to Audacity source>/mac/build_wxwidgets .
|
||||
|
||||
You should now be able to build Audacity using either the Xcode application or the
|
||||
xcodebuild command line tool.
|
||||
|
@ -1107,8 +1107,13 @@ void AudioIO::HandleDeviceChange()
|
||||
return;
|
||||
|
||||
// get the selected record and playback devices
|
||||
int playDeviceNum = getPlayDevIndex();
|
||||
int recDeviceNum = getRecordDevIndex();
|
||||
const int playDeviceNum = getPlayDevIndex();
|
||||
const int recDeviceNum = getRecordDevIndex();
|
||||
|
||||
// If no change needed, return
|
||||
if (mCachedPlaybackIndex == playDeviceNum &&
|
||||
mCachedCaptureIndex == recDeviceNum)
|
||||
return;
|
||||
|
||||
// cache playback/capture rates
|
||||
mCachedPlaybackRates = GetSupportedPlaybackRates(playDeviceNum);
|
||||
|
@ -283,6 +283,28 @@ RecordingRecoveryHandler::RecordingRecoveryHandler(AudacityProject* proj)
|
||||
mNumChannels = -1;
|
||||
}
|
||||
|
||||
int RecordingRecoveryHandler::FindTrack() const
|
||||
{
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
int index;
|
||||
if (mAutoSaveIdent)
|
||||
{
|
||||
for (index = 0; index < (int)tracks.GetCount(); index++)
|
||||
{
|
||||
if (tracks[index]->GetAutoSaveIdent() == mAutoSaveIdent)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index = tracks.GetCount() - mNumChannels + mChannel;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
||||
const wxChar **attrs)
|
||||
{
|
||||
@ -296,23 +318,9 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
||||
return false;
|
||||
}
|
||||
|
||||
// We need to find the track and sequence where the blockfile belongs
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
int index;
|
||||
if (mAutoSaveIdent)
|
||||
{
|
||||
for (index = 0; index < (int) tracks.GetCount(); index++)
|
||||
{
|
||||
if (tracks[index]->GetAutoSaveIdent() == mAutoSaveIdent)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index = tracks.GetCount() - mNumChannels + mChannel;
|
||||
}
|
||||
int index = FindTrack();
|
||||
// We need to find the track and sequence where the blockfile belongs
|
||||
|
||||
if (index < 0 || index >= (int) tracks.GetCount())
|
||||
{
|
||||
@ -326,10 +334,14 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
||||
Sequence* seq = clip->GetSequence();
|
||||
|
||||
// Load the blockfile from the XML
|
||||
BlockFile* blockFile = NULL;
|
||||
DirManager* dirManager = mProject->GetDirManager();
|
||||
dirManager->SetLoadingFormat(seq->GetSampleFormat());
|
||||
dirManager->SetLoadingTarget(&blockFile);
|
||||
|
||||
BlockArray array;
|
||||
array.resize(1);
|
||||
dirManager->SetLoadingTarget(&array, 0);
|
||||
BlockFile *& blockFile = array[0].f;
|
||||
|
||||
if (!dirManager->HandleXMLTag(tag, attrs) || !blockFile)
|
||||
{
|
||||
// This should only happen if there is a bug
|
||||
@ -387,6 +399,29 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecordingRecoveryHandler::HandleXMLEndTag(const wxChar *tag)
|
||||
{
|
||||
if (wxStrcmp(tag, wxT("simpleblockfile")) == 0)
|
||||
// Still in inner looop
|
||||
return;
|
||||
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
int index = FindTrack();
|
||||
// We need to find the track and sequence where the blockfile belongs
|
||||
|
||||
if (index < 0 || index >= (int)tracks.GetCount()) {
|
||||
// This should only happen if there is a bug
|
||||
wxASSERT(false);
|
||||
}
|
||||
else {
|
||||
WaveTrack* track = tracks.Item(index);
|
||||
WaveClip* clip = track->NewestOrNewClip();
|
||||
Sequence* seq = clip->GetSequence();
|
||||
|
||||
seq->ConsistencyCheck(wxT("RecordingRecoveryHandler::HandleXMLEndTag"));
|
||||
}
|
||||
}
|
||||
|
||||
XMLTagHandler* RecordingRecoveryHandler::HandleXMLChild(const wxChar *tag)
|
||||
{
|
||||
if (wxStrcmp(tag, wxT("simpleblockfile")) == 0)
|
||||
|
@ -46,12 +46,16 @@ class RecordingRecoveryHandler: public XMLTagHandler
|
||||
public:
|
||||
RecordingRecoveryHandler(AudacityProject* proj);
|
||||
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
|
||||
virtual void HandleXMLEndTag(const wxChar *tag);
|
||||
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
|
||||
|
||||
// This class only knows reading tags
|
||||
virtual void WriteXML(XMLWriter & WXUNUSED(xmlFile)) { wxASSERT(false); }
|
||||
|
||||
private:
|
||||
|
||||
int FindTrack() const;
|
||||
|
||||
AudacityProject* mProject;
|
||||
int mChannel;
|
||||
int mNumChannels;
|
||||
|
@ -60,7 +60,7 @@ WX_DECLARE_HASH_MAP(BlockFile *, bool,
|
||||
// in the current set of tracks. Enumerating that array allows
|
||||
// you to process all block files in the current set.
|
||||
static void GetAllSeqBlocks(AudacityProject *project,
|
||||
BlockArray *outBlocks)
|
||||
BlockPtrArray *outBlocks)
|
||||
{
|
||||
TrackList *tracks = project->GetTracks();
|
||||
TrackListIterator iter(tracks);
|
||||
@ -72,10 +72,10 @@ static void GetAllSeqBlocks(AudacityProject *project,
|
||||
while(node) {
|
||||
WaveClip *clip = node->GetData();
|
||||
Sequence *sequence = clip->GetSequence();
|
||||
BlockArray *blocks = sequence->GetBlockArray();
|
||||
BlockArray &blocks = sequence->GetBlockArray();
|
||||
int i;
|
||||
for (i = 0; i < (int)blocks->GetCount(); i++)
|
||||
outBlocks->Add(blocks->Item(i));
|
||||
for (i = 0; i < (int)blocks.size(); i++)
|
||||
outBlocks->push_back(&blocks.at(i));
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
@ -92,11 +92,11 @@ static void ReplaceBlockFiles(AudacityProject *project,
|
||||
ReplacedBlockFileHash &hash)
|
||||
{
|
||||
DirManager *dirManager = project->GetDirManager();
|
||||
BlockArray blocks;
|
||||
BlockPtrArray blocks;
|
||||
GetAllSeqBlocks(project, &blocks);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < (int)blocks.GetCount(); i++) {
|
||||
for (i = 0; i < (int)blocks.size(); i++) {
|
||||
if (hash.count(blocks[i]->f) > 0) {
|
||||
BlockFile *src = blocks[i]->f;
|
||||
BlockFile *dst = hash[src];
|
||||
@ -114,14 +114,14 @@ void FindDependencies(AudacityProject *project,
|
||||
{
|
||||
sampleFormat format = project->GetDefaultFormat();
|
||||
|
||||
BlockArray blocks;
|
||||
BlockPtrArray blocks;
|
||||
GetAllSeqBlocks(project, &blocks);
|
||||
|
||||
AliasedFileHash aliasedFileHash;
|
||||
BoolBlockFileHash blockFileHash;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < (int)blocks.GetCount(); i++) {
|
||||
for (i = 0; i < (int)blocks.size(); i++) {
|
||||
BlockFile *f = blocks[i]->f;
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
{
|
||||
@ -181,13 +181,13 @@ static void RemoveDependencies(AudacityProject *project,
|
||||
aliasedFileHash[fileNameStr] = &aliasedFiles->Item(i);
|
||||
}
|
||||
|
||||
BlockArray blocks;
|
||||
BlockPtrArray blocks;
|
||||
GetAllSeqBlocks(project, &blocks);
|
||||
|
||||
const sampleFormat format = project->GetDefaultFormat();
|
||||
ReplacedBlockFileHash blockFileHash;
|
||||
wxLongLong completedBytes = 0;
|
||||
for (i = 0; i < blocks.GetCount(); i++) {
|
||||
for (i = 0; i < blocks.size(); i++) {
|
||||
BlockFile *f = blocks[i]->f;
|
||||
if (f->IsAlias() && (blockFileHash.count(f) == 0))
|
||||
{
|
||||
|
@ -98,6 +98,7 @@
|
||||
#include "Internat.h"
|
||||
#include "Project.h"
|
||||
#include "Prefs.h"
|
||||
#include "Sequence.h"
|
||||
#include "widgets/Warning.h"
|
||||
#include "widgets/MultiDialog.h"
|
||||
|
||||
@ -349,6 +350,7 @@ DirManager::DirManager()
|
||||
projName = wxT("");
|
||||
|
||||
mLoadingTarget = NULL;
|
||||
mLoadingTargetIdx = 0;
|
||||
mMaxSamples = -1;
|
||||
|
||||
// toplevel pool hash is fully populated to begin
|
||||
@ -1009,10 +1011,12 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
|
||||
BlockFile* pBlockFile = NULL;
|
||||
|
||||
if( !wxStricmp(tag, wxT("silentblockfile")) ) {
|
||||
BlockFile *&target = mLoadingTarget->at(mLoadingTargetIdx).f;
|
||||
|
||||
if (!wxStricmp(tag, wxT("silentblockfile"))) {
|
||||
// Silent blocks don't actually have a file associated, so
|
||||
// we don't need to worry about the hash table at all
|
||||
*mLoadingTarget = SilentBlockFile::BuildFromXML(*this, attrs);
|
||||
target = SilentBlockFile::BuildFromXML(*this, attrs);
|
||||
return true;
|
||||
}
|
||||
else if ( !wxStricmp(tag, wxT("simpleblockfile")) )
|
||||
@ -1074,7 +1078,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
*mLoadingTarget = pBlockFile;
|
||||
target = pBlockFile;
|
||||
|
||||
//
|
||||
// If the block we loaded is already in the hash table, then the
|
||||
@ -1082,21 +1086,21 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
// return a reference to the existing object instead.
|
||||
//
|
||||
|
||||
wxString name = (*mLoadingTarget)->GetFileName().GetName();
|
||||
wxString name = target->GetFileName().GetName();
|
||||
BlockFile *retrieved = mBlockFileHash[name];
|
||||
if (retrieved) {
|
||||
// Lock it in order to delete it safely, i.e. without having
|
||||
// it delete the file, too...
|
||||
(*mLoadingTarget)->Lock();
|
||||
delete (*mLoadingTarget);
|
||||
target->Lock();
|
||||
delete target;
|
||||
|
||||
Ref(retrieved); // Add one to its reference count
|
||||
*mLoadingTarget = retrieved;
|
||||
target = retrieved;
|
||||
return true;
|
||||
}
|
||||
|
||||
// This is a new object
|
||||
mBlockFileHash[name]=*mLoadingTarget;
|
||||
mBlockFileHash[name] = target;
|
||||
// MakeBlockFileName wasn't used so we must add the directory
|
||||
// balancing information
|
||||
BalanceInfoAdd(name);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "xml/XMLTagHandler.h"
|
||||
|
||||
class wxHashTable;
|
||||
class BlockArray;
|
||||
class BlockFile;
|
||||
class SequenceTest;
|
||||
|
||||
@ -101,10 +102,17 @@ class DirManager: public XMLTagHandler {
|
||||
// For debugging only
|
||||
int GetRefCount(BlockFile * f);
|
||||
|
||||
void SetLoadingTarget(BlockFile **target) { mLoadingTarget = target; }
|
||||
void SetLoadingTarget(BlockArray *pArray, unsigned idx)
|
||||
{
|
||||
mLoadingTarget = pArray;
|
||||
mLoadingTargetIdx = idx;
|
||||
}
|
||||
void SetLoadingFormat(sampleFormat format) { mLoadingFormat = format; }
|
||||
void SetLoadingBlockLength(sampleCount len) { mLoadingBlockLen = len; }
|
||||
void SetMaxSamples(sampleCount max) { mMaxSamples = max; }
|
||||
|
||||
// Note: following affects only the loading of block files when opening a project
|
||||
void SetLoadingMaxSamples(sampleCount max) { mMaxSamples = max; }
|
||||
|
||||
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
|
||||
XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; }
|
||||
void WriteXML(XMLWriter & WXUNUSED(xmlFile)) { wxASSERT(false); } // This class only reads tags.
|
||||
@ -186,7 +194,8 @@ class DirManager: public XMLTagHandler {
|
||||
|
||||
wxArrayString aliasList;
|
||||
|
||||
BlockFile **mLoadingTarget;
|
||||
BlockArray *mLoadingTarget;
|
||||
unsigned mLoadingTargetIdx;
|
||||
sampleFormat mLoadingFormat;
|
||||
sampleCount mLoadingBlockLen;
|
||||
|
||||
|
@ -47,6 +47,7 @@ libaudacity_la_SOURCES = \
|
||||
$(NULL)
|
||||
|
||||
audacity_CPPFLAGS = \
|
||||
-std=c++11 \
|
||||
-Wno-deprecated-declarations \
|
||||
-D__STDC_CONSTANT_MACROS \
|
||||
-DLIBDIR=\"$(libdir)\" \
|
||||
|
@ -3737,10 +3737,11 @@ void AudacityProject::AddImportedTracks(wxString fileName,
|
||||
if (newTracks[i]->GetKind() == WaveTrack::Wave)
|
||||
{
|
||||
WaveClip* clip = ((WaveTrack*)newTracks[i])->GetClipByIndex(0);
|
||||
if (clip && clip->GetSequence()->GetBlockArray()->GetCount())
|
||||
BlockArray &blocks = clip->GetSequence()->GetBlockArray();
|
||||
if (clip && blocks.size())
|
||||
{
|
||||
SeqBlock* block = clip->GetSequence()->GetBlockArray()->Item(0);
|
||||
if (block->f->IsAlias())
|
||||
SeqBlock& block = blocks.at(0);
|
||||
if (block.f->IsAlias())
|
||||
{
|
||||
mImportedDependencies = true;
|
||||
}
|
||||
@ -5189,7 +5190,7 @@ void AudacityProject::CaptureKeyboard(wxWindow *handler)
|
||||
}
|
||||
|
||||
// static
|
||||
void AudacityProject::ReleaseKeyboard(wxWindow *handler)
|
||||
void AudacityProject::ReleaseKeyboard(wxWindow * /* handler */)
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
if (project)
|
||||
|
1207
src/Sequence.cpp
1207
src/Sequence.cpp
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
||||
#ifndef __AUDACITY_SEQUENCE__
|
||||
#define __AUDACITY_SEQUENCE__
|
||||
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include <wx/dynarray.h>
|
||||
|
||||
@ -36,15 +37,27 @@ class SeqBlock {
|
||||
BlockFile * f;
|
||||
///the sample in the global wavetrack that this block starts at.
|
||||
sampleCount start;
|
||||
|
||||
SeqBlock()
|
||||
: f(NULL), start(0)
|
||||
{}
|
||||
|
||||
SeqBlock(BlockFile *f_, sampleCount start_)
|
||||
: f(f_), start(start_)
|
||||
{}
|
||||
|
||||
// Construct a SeqBlock with changed start, same file
|
||||
SeqBlock Plus(sampleCount delta) const
|
||||
{
|
||||
return SeqBlock(f, start + delta);
|
||||
}
|
||||
};
|
||||
WX_DEFINE_ARRAY(SeqBlock *, BlockArray);
|
||||
class BlockArray : public std::vector<SeqBlock> {};
|
||||
WX_DEFINE_ARRAY(SeqBlock *, BlockPtrArray);
|
||||
|
||||
class Sequence: public XMLTagHandler {
|
||||
public:
|
||||
|
||||
// Temporary: only until we delete TrackArtist once and for all
|
||||
friend class TrackArtist;
|
||||
|
||||
//
|
||||
// Static methods
|
||||
//
|
||||
@ -66,7 +79,7 @@ class Sequence: public XMLTagHandler {
|
||||
return new Sequence(*this, projDirManager);
|
||||
}
|
||||
|
||||
virtual ~Sequence();
|
||||
~Sequence();
|
||||
|
||||
//
|
||||
// Editing
|
||||
@ -86,7 +99,7 @@ class Sequence: public XMLTagHandler {
|
||||
// where[p] up to (but excluding) where[p + 1].
|
||||
// bl is negative wherever data are not yet available.
|
||||
// Return true if successful.
|
||||
bool GetWaveDisplay(float *min, float *max, float *rms,int* bl,
|
||||
bool GetWaveDisplay(float *min, float *max, float *rms, int* bl,
|
||||
int len, const sampleCount *where);
|
||||
|
||||
bool Copy(sampleCount s0, sampleCount s1, Sequence **dest);
|
||||
@ -98,7 +111,7 @@ class Sequence: public XMLTagHandler {
|
||||
bool Delete(sampleCount start, sampleCount len);
|
||||
bool AppendAlias(wxString fullPath,
|
||||
sampleCount start,
|
||||
sampleCount len, int channel,bool useOD);
|
||||
sampleCount len, int channel, bool useOD);
|
||||
|
||||
bool AppendCoded(wxString fName, sampleCount start,
|
||||
sampleCount len, int channel, int decodeType);
|
||||
@ -146,7 +159,7 @@ class Sequence: public XMLTagHandler {
|
||||
//
|
||||
|
||||
sampleFormat GetSampleFormat() const;
|
||||
bool SetSampleFormat(sampleFormat format);
|
||||
// bool SetSampleFormat(sampleFormat format);
|
||||
bool ConvertToSampleFormat(sampleFormat format, bool* pbChanged);
|
||||
|
||||
//
|
||||
@ -172,12 +185,27 @@ class Sequence: public XMLTagHandler {
|
||||
// you're doing!
|
||||
//
|
||||
|
||||
BlockArray *GetBlockArray() {return mBlock;}
|
||||
BlockArray &GetBlockArray() {return mBlock;}
|
||||
|
||||
///
|
||||
void LockDeleteUpdateMutex(){mDeleteUpdateMutex.Lock();}
|
||||
void UnlockDeleteUpdateMutex(){mDeleteUpdateMutex.Unlock();}
|
||||
|
||||
// RAII idiom wrapping the functions above
|
||||
struct DeleteUpdateMutexLocker {
|
||||
DeleteUpdateMutexLocker(Sequence &sequence)
|
||||
: mSequence(sequence)
|
||||
{
|
||||
mSequence.LockDeleteUpdateMutex();
|
||||
}
|
||||
~DeleteUpdateMutexLocker()
|
||||
{
|
||||
mSequence.UnlockDeleteUpdateMutex();
|
||||
}
|
||||
private:
|
||||
Sequence &mSequence;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
//
|
||||
@ -192,7 +220,7 @@ class Sequence: public XMLTagHandler {
|
||||
|
||||
DirManager *mDirManager;
|
||||
|
||||
BlockArray *mBlock;
|
||||
BlockArray mBlock;
|
||||
sampleFormat mSampleFormat;
|
||||
sampleCount mNumSamples;
|
||||
|
||||
@ -208,29 +236,24 @@ class Sequence: public XMLTagHandler {
|
||||
// Private methods
|
||||
//
|
||||
|
||||
void CalcSummaryInfo();
|
||||
void DerefAllFiles();
|
||||
|
||||
int FindBlock(sampleCount pos) const;
|
||||
int FindBlock(sampleCount pos, sampleCount lo,
|
||||
sampleCount guess, sampleCount hi) const;
|
||||
|
||||
bool AppendBlock(SeqBlock *b);
|
||||
bool AppendBlock(const SeqBlock &b);
|
||||
|
||||
bool Read(samplePtr buffer, sampleFormat format,
|
||||
SeqBlock * b,
|
||||
const SeqBlock &b,
|
||||
sampleCount start, sampleCount len) const;
|
||||
|
||||
// These are the two ways to write data to a block
|
||||
bool FirstWrite(samplePtr buffer, SeqBlock * b, sampleCount len);
|
||||
bool CopyWrite(samplePtr buffer, SeqBlock * b,
|
||||
bool CopyWrite(SampleBuffer &scratch,
|
||||
samplePtr buffer, SeqBlock &b,
|
||||
sampleCount start, sampleCount len);
|
||||
|
||||
// Both block-writing methods and AppendAlias call this
|
||||
// method to write the summary data
|
||||
void *GetSummary(samplePtr buffer, sampleCount len,
|
||||
float *min, float *max, float *rms);
|
||||
void Blockify(BlockArray &list, sampleCount start, samplePtr buffer, sampleCount len);
|
||||
|
||||
BlockArray *Blockify(samplePtr buffer, sampleCount len);
|
||||
bool Get(int b, samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, sampleCount len) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -240,11 +263,11 @@ class Sequence: public XMLTagHandler {
|
||||
|
||||
// This function makes sure that the track isn't messed up
|
||||
// because of inconsistent block starts & lengths
|
||||
bool ConsistencyCheck(const wxChar *whereStr);
|
||||
bool ConsistencyCheck(const wxChar *whereStr) const;
|
||||
|
||||
// This function prints information to stdout about the blocks in the
|
||||
// tracks and indicates if there are inconsistencies.
|
||||
void DebugPrintf(wxString *dest);
|
||||
void DebugPrintf(wxString *dest) const;
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_SEQUENCE__
|
||||
|
@ -383,7 +383,7 @@ void ThemeBase::RegisterImage( int &iIndex, const wxImage &Image, const wxString
|
||||
wxASSERT( iIndex == -1 ); // Don't initialise same bitmap twice!
|
||||
mImages.Add( Image );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#ifdef __APPLE__
|
||||
// On Mac, bitmaps with alpha don't work.
|
||||
// So we convert to a mask and use that.
|
||||
// It isn't quite as good, as alpha gives smoother edges.
|
||||
|
@ -80,9 +80,9 @@ void UndoManager::CalculateSpaceUsage()
|
||||
{
|
||||
// Scan all blockfiles within current clip
|
||||
BlockArray *blocks = it->GetData()->GetSequenceBlockArray();
|
||||
for (size_t b = 0, cnt = blocks->GetCount(); b < cnt; b++)
|
||||
for (size_t b = 0, cnt = blocks->size(); b < cnt; b++)
|
||||
{
|
||||
BlockFile *file = blocks->Item(b)->f;
|
||||
BlockFile *file = blocks->at(b).f;
|
||||
|
||||
// Accumulate space used by the file if the file didn't exist
|
||||
// in the previous level
|
||||
|
@ -366,7 +366,7 @@ bool WaveClip::SetSamples(samplePtr buffer, sampleFormat format,
|
||||
|
||||
BlockArray* WaveClip::GetSequenceBlockArray()
|
||||
{
|
||||
return mSequence->GetBlockArray();
|
||||
return &mSequence->GetBlockArray();
|
||||
}
|
||||
|
||||
double WaveClip::GetStartTime() const
|
||||
@ -1708,7 +1708,7 @@ void WaveClip::CloseLock()
|
||||
{
|
||||
GetSequence()->CloseLock();
|
||||
for (WaveClipList::compatibility_iterator it = mCutLines.GetFirst(); it; it=it->GetNext())
|
||||
it->GetData()->Lock();
|
||||
it->GetData()->CloseLock();
|
||||
}
|
||||
|
||||
void WaveClip::Unlock()
|
||||
|
@ -190,7 +190,7 @@ void ODComputeSummaryTask::Update()
|
||||
seq = clip->GetSequence();
|
||||
//This lock may be way too big since the whole file is one sequence.
|
||||
//TODO: test for large files and find a way to break it down.
|
||||
seq->LockDeleteUpdateMutex();
|
||||
Sequence::DeleteUpdateMutexLocker locker(*seq);
|
||||
|
||||
//See Sequence::Delete() for why need this for now..
|
||||
//We don't need the mBlockFilesMutex here because it is only for the vector list.
|
||||
@ -202,25 +202,27 @@ void ODComputeSummaryTask::Update()
|
||||
|
||||
insertCursor =0;//OD TODO:see if this works, removed from inner loop (bfore was n*n)
|
||||
|
||||
for(i=0; i<(int)blocks->GetCount(); i++)
|
||||
for(i=0; i<(int)blocks->size(); i++)
|
||||
{
|
||||
//if there is data but no summary, this blockfile needs summarizing.
|
||||
if(blocks->Item(i)->f->IsDataAvailable() && !blocks->Item(i)->f->IsSummaryAvailable())
|
||||
SeqBlock &block = blocks->at(i);
|
||||
BlockFile *const file = block.f;
|
||||
if(file->IsDataAvailable() && !file->IsSummaryAvailable())
|
||||
{
|
||||
blocks->Item(i)->f->Ref();
|
||||
((ODPCMAliasBlockFile*)blocks->Item(i)->f)->SetStart(blocks->Item(i)->start);
|
||||
((ODPCMAliasBlockFile*)blocks->Item(i)->f)->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
|
||||
file->Ref();
|
||||
ODPCMAliasBlockFile *const odpcmaFile = static_cast<ODPCMAliasBlockFile*>(file);
|
||||
odpcmaFile->SetStart(block.start);
|
||||
odpcmaFile->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
|
||||
|
||||
//these will always be linear within a sequence-lets take advantage of this by keeping a cursor.
|
||||
while(insertCursor<(int)tempBlocks.size()&&
|
||||
(sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) <
|
||||
(sampleCount)(((ODPCMAliasBlockFile*)blocks->Item(i)->f)->GetStart()+((ODPCMAliasBlockFile*)blocks->Item(i)->f)->GetClipOffset()))
|
||||
(sampleCount)(odpcmaFile->GetStart()+odpcmaFile->GetClipOffset()))
|
||||
insertCursor++;
|
||||
|
||||
tempBlocks.insert(tempBlocks.begin()+insertCursor++,(ODPCMAliasBlockFile*)blocks->Item(i)->f);
|
||||
tempBlocks.insert(tempBlocks.begin() + insertCursor++, odpcmaFile);
|
||||
}
|
||||
}
|
||||
seq->UnlockDeleteUpdateMutex();
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
|
@ -154,22 +154,26 @@ void ODDecodeTask::Update()
|
||||
int insertCursor;
|
||||
|
||||
insertCursor =0;//OD TODO:see if this works, removed from inner loop (bfore was n*n)
|
||||
for(i=0; i<(int)blocks->GetCount(); i++)
|
||||
for (i = 0; i<(int)blocks->size(); i++)
|
||||
{
|
||||
//since we have more than one ODBlockFile, we will need type flags to cast.
|
||||
if(!blocks->Item(i)->f->IsDataAvailable() && ((ODDecodeBlockFile*)blocks->Item(i)->f)->GetDecodeType()==this->GetODType())
|
||||
SeqBlock &block = blocks->at(i);
|
||||
BlockFile *const file = block.f;
|
||||
ODDecodeBlockFile *oddbFile;
|
||||
if (!file->IsDataAvailable() &&
|
||||
(oddbFile = static_cast<ODDecodeBlockFile*>(file))->GetDecodeType() == this->GetODType())
|
||||
{
|
||||
blocks->Item(i)->f->Ref();
|
||||
((ODDecodeBlockFile*)blocks->Item(i)->f)->SetStart(blocks->Item(i)->start);
|
||||
((ODDecodeBlockFile*)blocks->Item(i)->f)->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
|
||||
file->Ref();
|
||||
oddbFile->SetStart(block.start);
|
||||
oddbFile->SetClipOffset((sampleCount)(clip->GetStartTime()*clip->GetRate()));
|
||||
|
||||
//these will always be linear within a sequence-lets take advantage of this by keeping a cursor.
|
||||
while(insertCursor<(int)tempBlocks.size()&&
|
||||
(sampleCount)(tempBlocks[insertCursor]->GetStart()+tempBlocks[insertCursor]->GetClipOffset()) <
|
||||
(sampleCount)(((ODDecodeBlockFile*)blocks->Item(i)->f)->GetStart()+((ODDecodeBlockFile*)blocks->Item(i)->f)->GetClipOffset()))
|
||||
(sampleCount)((oddbFile->GetStart()+oddbFile->GetClipOffset())))
|
||||
insertCursor++;
|
||||
|
||||
tempBlocks.insert(tempBlocks.begin()+insertCursor++,(ODDecodeBlockFile*)blocks->Item(i)->f);
|
||||
tempBlocks.insert(tempBlocks.begin()+insertCursor++, oddbFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user