1 /*  cdrdao - write audio CD-Rs in disc-at-once mode
2  *
3  *  Copyright (C) 1998-2001  Andreas Mueller <andreas@daneb.de>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __MSF_H__
21 #define __MSF_H__
22 
23 #include "Sample.h"
24 
25 #ifdef min
26 /* I stupidly named a member function 'min' which clashes with the macro 'min'
27  * on some operating systems. The macro is simply undefined here since it is
28  * not used in this package anyway.
29  */
30 #undef min
31 #endif
32 
33 class Msf {
34 private:
35 
36   int min_; // minutes
37   int sec_; // seconds
38   int frac_; // fractions (blocks)
39 
40   long lba_; // logical block address
41 
42   void lba2Msf();
43 
44 public:
45   Msf(int min, int sec, int frac);
46   Msf(long lba);
47   Msf();
48 
min()49   int min() const { return min_; }
sec()50   int sec() const { return sec_; }
frac()51   int frac() const { return frac_; }
52 
lba()53   long lba() const { return lba_; }
54 
samples()55   unsigned long samples() const { return lba_ * SAMPLES_PER_BLOCK; }
56 
57   const char *str() const;
58 
59 };
60 
61 Msf operator+(const Msf &m1, const Msf &m2);
62 Msf operator-(const Msf &m1, const Msf &m2);
63 
64 #endif
65