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:
parent
998556205d
commit
35f5555216
20
src/Track.h
20
src/Track.h
@ -126,6 +126,13 @@ class AUDACITY_DLL_API Track /* not final */
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum ChannelType
|
||||||
|
{
|
||||||
|
LeftChannel = 0,
|
||||||
|
RightChannel = 1,
|
||||||
|
MonoChannel = 2
|
||||||
|
};
|
||||||
|
|
||||||
TrackId GetId() const { return mId; }
|
TrackId GetId() const { return mId; }
|
||||||
private:
|
private:
|
||||||
void SetId( TrackId id ) { mId = id; }
|
void SetId( TrackId id ) { mId = id; }
|
||||||
@ -234,20 +241,13 @@ public:
|
|||||||
// Keep in Track
|
// Keep in Track
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int mChannel;
|
ChannelType mChannel;
|
||||||
double mOffset;
|
double mOffset;
|
||||||
|
|
||||||
mutable std::shared_ptr<DirManager> mDirManager;
|
mutable std::shared_ptr<DirManager> mDirManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
LeftChannel = 0,
|
|
||||||
RightChannel = 1,
|
|
||||||
MonoChannel = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum TrackKindEnum
|
enum TrackKindEnum
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
@ -291,13 +291,13 @@ private:
|
|||||||
void DoSetLinked(bool l);
|
void DoSetLinked(bool l);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual int GetChannel() const { return mChannel;};
|
virtual ChannelType GetChannel() const { return mChannel;}
|
||||||
virtual double GetOffset() const = 0;
|
virtual double GetOffset() const = 0;
|
||||||
|
|
||||||
void Offset(double t) { SetOffset(GetOffset() + t); }
|
void Offset(double t) { SetOffset(GetOffset() + t); }
|
||||||
virtual void SetOffset (double o) { mOffset = o; }
|
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 SetPan( float ){ ;}
|
||||||
virtual void SetPanFromChannelType(){ ;};
|
virtual void SetPanFromChannelType(){ ;};
|
||||||
|
|
||||||
|
@ -233,11 +233,11 @@ void WaveTrack::SetOffset(double o)
|
|||||||
mOffset = o;
|
mOffset = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaveTrack::GetChannelIgnoringPan() const {
|
auto WaveTrack::GetChannelIgnoringPan() const -> ChannelType {
|
||||||
return mChannel;
|
return mChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaveTrack::GetChannel() const
|
auto WaveTrack::GetChannel() const -> ChannelType
|
||||||
{
|
{
|
||||||
if( mChannel != Track::MonoChannel )
|
if( mChannel != Track::MonoChannel )
|
||||||
return mChannel;
|
return mChannel;
|
||||||
@ -1731,7 +1731,7 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||||||
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
|
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
|
||||||
!XMLValueChecker::IsValidChannel(nValue))
|
!XMLValueChecker::IsValidChannel(nValue))
|
||||||
return false;
|
return false;
|
||||||
mChannel = nValue;
|
mChannel = static_cast<Track::ChannelType>( nValue );
|
||||||
}
|
}
|
||||||
else if (!wxStrcmp(attr, wxT("linked")) &&
|
else if (!wxStrcmp(attr, wxT("linked")) &&
|
||||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
|
@ -98,8 +98,8 @@ private:
|
|||||||
|
|
||||||
double GetOffset() const override;
|
double GetOffset() const override;
|
||||||
void SetOffset(double o) override;
|
void SetOffset(double o) override;
|
||||||
virtual int GetChannelIgnoringPan() const;
|
virtual ChannelType GetChannelIgnoringPan() const;
|
||||||
virtual int GetChannel() const override;
|
ChannelType GetChannel() const override;
|
||||||
virtual void SetPanFromChannelType() override;
|
virtual void SetPanFromChannelType() override;
|
||||||
|
|
||||||
/** @brief Get the time at which the first clip in the track starts
|
/** @brief Get the time at which the first clip in the track starts
|
||||||
|
@ -825,7 +825,7 @@ void WaveTrackMenuTable::OnChannelChange(wxCommandEvent & event)
|
|||||||
wxASSERT(id >= OnChannelLeftID && id <= OnChannelMonoID);
|
wxASSERT(id >= OnChannelLeftID && id <= OnChannelMonoID);
|
||||||
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
|
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
|
||||||
wxASSERT(pTrack);
|
wxASSERT(pTrack);
|
||||||
int channel;
|
Track::ChannelType channel;
|
||||||
wxString channelmsg;
|
wxString channelmsg;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user