1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-08 15:52:53 +02:00

Track::mChannel has an enum type

This commit is contained in:
Paul Licameli 2018-09-20 12:39:05 -04:00
parent 998556205d
commit 35f5555216
4 changed files with 16 additions and 16 deletions

View File

@ -126,6 +126,13 @@ class AUDACITY_DLL_API Track /* not final */
public:
enum ChannelType
{
LeftChannel = 0,
RightChannel = 1,
MonoChannel = 2
};
TrackId GetId() const { return mId; }
private:
void SetId( TrackId id ) { mId = id; }
@ -234,20 +241,13 @@ public:
// Keep in Track
protected:
int mChannel;
ChannelType mChannel;
double mOffset;
mutable std::shared_ptr<DirManager> mDirManager;
public:
enum
{
LeftChannel = 0,
RightChannel = 1,
MonoChannel = 2
};
enum TrackKindEnum
{
None,
@ -291,13 +291,13 @@ private:
void DoSetLinked(bool l);
public:
virtual int GetChannel() const { return mChannel;};
virtual ChannelType GetChannel() const { return mChannel;}
virtual double GetOffset() const = 0;
void Offset(double t) { SetOffset(GetOffset() + t); }
virtual void SetOffset (double o) { mOffset = o; }
void SetChannel(int c) { mChannel = c; }
void SetChannel(ChannelType c) { mChannel = c; }
virtual void SetPan( float ){ ;}
virtual void SetPanFromChannelType(){ ;};

View File

@ -233,11 +233,11 @@ void WaveTrack::SetOffset(double o)
mOffset = o;
}
int WaveTrack::GetChannelIgnoringPan() const {
auto WaveTrack::GetChannelIgnoringPan() const -> ChannelType {
return mChannel;
}
int WaveTrack::GetChannel() const
auto WaveTrack::GetChannel() const -> ChannelType
{
if( mChannel != Track::MonoChannel )
return mChannel;
@ -1731,7 +1731,7 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
!XMLValueChecker::IsValidChannel(nValue))
return false;
mChannel = nValue;
mChannel = static_cast<Track::ChannelType>( nValue );
}
else if (!wxStrcmp(attr, wxT("linked")) &&
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))

View File

@ -98,8 +98,8 @@ private:
double GetOffset() const override;
void SetOffset(double o) override;
virtual int GetChannelIgnoringPan() const;
virtual int GetChannel() const override;
virtual ChannelType GetChannelIgnoringPan() const;
ChannelType GetChannel() const override;
virtual void SetPanFromChannelType() override;
/** @brief Get the time at which the first clip in the track starts

View File

@ -825,7 +825,7 @@ void WaveTrackMenuTable::OnChannelChange(wxCommandEvent & event)
wxASSERT(id >= OnChannelLeftID && id <= OnChannelMonoID);
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
wxASSERT(pTrack);
int channel;
Track::ChannelType channel;
wxString channelmsg;
switch (id) {
default: