foobar2000 SDK  2015-08-03
Public Types | Public Member Functions | Data Fields
t_cuesheet_index_list

#include <cuesheet_index_list.h>

Public Types

enum  { count = 100 }
 

Public Member Functions

 t_cuesheet_index_list ()
 
bool from_infos (file_info const &p_in, double p_base)
 
bool is_empty () const
 
bool is_valid () const
 
double pregap () const
 
void reset ()
 
double start () const
 
void to_infos (file_info &p_out) const
 

Data Fields

double m_positions [count]
 

Detailed Description

Definition at line 1 of file cuesheet_index_list.h.

Member Enumeration Documentation

anonymous enum
Enumerator
count 

Definition at line 3 of file cuesheet_index_list.h.

Constructor & Destructor Documentation

t_cuesheet_index_list::t_cuesheet_index_list ( )
inline

Definition at line 4 of file cuesheet_index_list.h.

Member Function Documentation

bool t_cuesheet_index_list::from_infos ( file_info const &  p_in,
double  p_base 
)

Definition at line 52 of file cuesheet_index_list.cpp.

53 {
54  double pregap;
55  bool found = false;
56  if (!parse_value(p_in.info_get("pregap"),pregap)) pregap = 0;
57  else found = true;
58  m_positions[0] = p_base - pregap;
59  m_positions[1] = p_base;
60  for(unsigned n=2;n<count;n++)
61  {
62  char namebuffer[16];
63  sprintf_s(namebuffer,"index %02u",n);
64  double temp;
65  if (parse_value(p_in.info_get(namebuffer),temp)) {
66  m_positions[n] = temp + p_base; found = true;
67  } else {
68  m_positions[n] = 0;
69  }
70  }
71  return found;
72 }
static bool parse_value(const char *p_name, double &p_out)
bool t_cuesheet_index_list::is_empty ( ) const

Definition at line 74 of file cuesheet_index_list.cpp.

74  {
75  for(unsigned n=0;n<count;n++) if (m_positions[n] != m_positions[1]) return false;
76  return true;
bool t_cuesheet_index_list::is_valid ( ) const

Definition at line 7 of file cuesheet_index_list.cpp.

7  {
8  if (m_positions[1] < m_positions[0]) return false;
9  for(t_size n = 2; n < count && m_positions[n] > 0; n++) {
10  if (m_positions[n] < m_positions[n-1]) return false;
11  }
12  return true;
13 }
size_t t_size
Definition: int_types.h:48
double t_cuesheet_index_list::pregap ( ) const
inline

Definition at line 15 of file cuesheet_index_list.h.

15 {return m_positions[1] - m_positions[0];}
void t_cuesheet_index_list::reset ( )
inline

Definition at line 5 of file cuesheet_index_list.h.

5 {for(unsigned n=0;n<count;n++) m_positions[n]=0;}
double t_cuesheet_index_list::start ( ) const
inline

Definition at line 14 of file cuesheet_index_list.h.

14 {return m_positions[1];}
void t_cuesheet_index_list::to_infos ( file_info p_out) const

Definition at line 15 of file cuesheet_index_list.cpp.

16 {
17  double base = m_positions[1];
18 
19  if (base > 0) {
20  p_out.info_set("referenced_offset",cuesheet_format_index_time(base));
21  }
22 
23  if (m_positions[0] < base)
24  p_out.info_set("pregap",cuesheet_format_index_time(base - m_positions[0]));
25  else
26  p_out.info_remove("pregap");
27 
28  p_out.info_remove("index 00");
29  p_out.info_remove("index 01");
30 
31  for(unsigned n=2;n<count;n++)
32  {
33  char namebuffer[16];
34  sprintf_s(namebuffer,"index %02u",n);
35  double position = m_positions[n] - base;
36  if (position > 0)
37  p_out.info_set(namebuffer,cuesheet_format_index_time(position));
38  else
39  p_out.info_remove(namebuffer);
40  }
41 }
bool info_remove(const char *p_name)
Definition: file_info.h:170
t_size info_set(const char *p_name, const char *p_value)
Definition: file_info.h:167

Field Documentation

double t_cuesheet_index_list::m_positions[count]

Definition at line 12 of file cuesheet_index_list.h.


The documentation for this struct was generated from the following files: