File indexing completed on 2024-05-12 04:51:02
0001 /* 0002 SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "k3baudiozerodata.h" 0007 #include "k3baudiozerodatareader.h" 0008 #include "k3baudiotrack.h" 0009 #include "k3b_i18n.h" 0010 0011 0012 K3b::AudioZeroData::AudioZeroData( const K3b::Msf& len ) 0013 : K3b::AudioDataSource(), 0014 m_length(len) 0015 { 0016 } 0017 0018 0019 K3b::AudioZeroData::AudioZeroData( const K3b::AudioZeroData& zero ) 0020 : K3b::AudioDataSource( zero ), 0021 m_length( zero.m_length ) 0022 { 0023 } 0024 0025 0026 K3b::AudioZeroData::~AudioZeroData() 0027 { 0028 } 0029 0030 0031 void K3b::AudioZeroData::setLength( const K3b::Msf& msf ) 0032 { 0033 if( msf > 0 ) 0034 m_length = msf; 0035 else 0036 m_length = 1; // 1 frame 0037 0038 emitChange(); 0039 } 0040 0041 0042 QString K3b::AudioZeroData::type() const 0043 { 0044 return i18n("Silence"); 0045 } 0046 0047 0048 QString K3b::AudioZeroData::sourceComment() const 0049 { 0050 return QString(); 0051 } 0052 0053 0054 K3b::AudioDataSource* K3b::AudioZeroData::copy() const 0055 { 0056 return new K3b::AudioZeroData( *this ); 0057 } 0058 0059 0060 QIODevice* K3b::AudioZeroData::createReader( QObject* parent ) 0061 { 0062 return new AudioZeroDataReader( *this, parent ); 0063 } 0064 0065 0066 void K3b::AudioZeroData::setStartOffset( const K3b::Msf& pos ) 0067 { 0068 if( pos >= length() ) 0069 setLength( 1 ); 0070 else 0071 setLength( length() - pos ); 0072 } 0073 0074 0075 void K3b::AudioZeroData::setEndOffset( const K3b::Msf& pos ) 0076 { 0077 if( pos < 1 ) 0078 setLength( 1 ); 0079 else 0080 setLength( pos ); 0081 }