~ubuntu-branches/ubuntu/dapper/lmms/dapper

« back to all changes in this revision

Viewing changes to include/midi_time.h

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ragwitz
  • Date: 2005-12-22 16:22:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051222162250-key3p7x0212jy6dn
Tags: 0.1.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * midi_time.h - declaration of class midiTime which provides data-type for
3
3
 *               position- and length-variables
4
4
 *
5
 
 * Linux MultiMedia Studio
6
 
 * Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
 
5
 * Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
6
 * 
 
7
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
7
8
 *
8
9
 * This program is free software; you can redistribute it and/or
9
10
 * modify it under the terms of the GNU General Public
32
33
class midiTime
33
34
{
34
35
public:
35
 
        inline midiTime( tact _tact, tact64th _tact_64th ) :
 
36
        inline midiTime( const tact _tact, const tact64th _tact_64th ) :
36
37
                m_tact( _tact ),
37
38
                m_tact64th( _tact_64th )
38
39
        {
39
40
        }
40
41
 
41
 
        inline midiTime( Sint32 _abs = 0 ) :
 
42
        inline midiTime( const Sint32 _abs = 0 ) :
42
43
                m_tact( _abs / 64 ),
43
44
                m_tact64th( _abs % 64 )
44
45
        {
97
98
        }
98
99
 
99
100
        // calculate number of frame that are needed this time
100
 
        inline Uint32 frames( float _frames_per_tact ) const
 
101
        inline Uint32 frames( const float _frames_per_tact ) const
101
102
        {
102
103
                if( m_tact >= 0 )
103
104
                {
110
111
                return( 0 );
111
112
        }
112
113
 
 
114
        static inline midiTime fromFrames( Uint32 _frames,
 
115
                                                const float _frames_per_tact )
 
116
        {
 
117
                return( midiTime( static_cast<Sint32>( _frames * 64.0f /
 
118
                                                        _frames_per_tact ) ) );
 
119
        }
 
120
 
113
121
 
114
122
private:
115
123
        tact m_tact;