~mixxxdevelopers/mixxx/features_library_scanner

« back to all changes in this revision

Viewing changes to mixxx/mixxx/soundsource.h

  • Committer: tuehaste
  • Date: 2002-02-26 11:12:07 UTC
  • Revision ID: vcs-imports@canonical.com-20020226111207-5rly26cj9gdd19ba
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          soundsource.h  -  description
 
3
                             -------------------
 
4
    begin                : Wed Feb 20 2002
 
5
    copyright            : (C) 2002 by Tue and Ken Haste Andersen
 
6
    email                : 
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#ifndef SOUNDSOURCE_H
 
19
#define SOUNDSOURCE_H
 
20
 
 
21
#include <qobject.h>
 
22
#include "defs.h"
 
23
#include <audiofile.h>
 
24
#include <stdio.h>
 
25
#include <fstream>
 
26
#include <stdlib.h>
 
27
#include <iostream>
 
28
#include <sys/stat.h>
 
29
#include <string.h>
 
30
#include <mad.h>
 
31
#include <vector>
 
32
#include "errno.h"
 
33
 
 
34
/**
 
35
  *@author Tue and Ken Haste Andersen
 
36
  */
 
37
 
 
38
class SoundSource : public QObject {
 
39
public:
 
40
  SoundSource();
 
41
  virtual ~SoundSource();
 
42
  virtual long seek(long) = 0;
 
43
  virtual unsigned read(unsigned long size, const SAMPLE*) = 0;
 
44
  virtual long unsigned length() = 0;
 
45
};
 
46
 
 
47
class AFlibfile : public SoundSource {
 
48
 private:
 
49
  int channels;
 
50
  AFfilehandle fh;
 
51
  long filelength, mp3filelength;
 
52
 public:
 
53
  AFlibfile(const char*);
 
54
  ~AFlibfile();
 
55
  long seek(long);
 
56
  unsigned read(unsigned long size, const SAMPLE*);
 
57
  long unsigned length();
 
58
};
 
59
 
 
60
class mp3file : public SoundSource {
 
61
 private:
 
62
  FILE *file;
 
63
  unsigned inputbuf_len;
 
64
  unsigned char *inputbuf;
 
65
  int bitrate;
 
66
  long filelength, mp3filelength;
 
67
  mad_stream Stream;
 
68
  mad_frame Frame;
 
69
  mad_synth Synth;
 
70
  vector<long> ftable,sampletable;
 
71
 public:
 
72
  mp3file(const char*);
 
73
  ~mp3file();
 
74
  long seek(long);
 
75
  unsigned read(unsigned long size, const SAMPLE*);
 
76
  long unsigned length();
 
77
};
 
78
 
 
79
 
 
80
#endif