LMMS
Loading...
Searching...
No Matches
player.h
Go to the documentation of this file.
1/*
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats.
3 * Copyright (C) 1999 - 2007 Simon Peter, <dn.tlp@gmx.net>, et al.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * player.h - Replayer base class, by Simon Peter <dn.tlp@gmx.net>
20 */
21
22#ifndef H_ADPLUG_PLAYER
23#define H_ADPLUG_PLAYER
24
25#include <string>
26
27#include "fprovide.h"
28#include "opl.h"
29#include "database.h"
30
32{
33public:
34 CPlayer(Copl *newopl);
35 virtual ~CPlayer();
36
37/***** Operational methods *****/
38 void seek(unsigned long ms);
39
40 virtual bool load(const std::string &filename, // loads file
41 const CFileProvider &fp = CProvider_Filesystem()) = 0;
42 virtual bool update() = 0; // executes replay code for 1 tick
43 virtual void rewind(int subsong = -1) = 0; // rewinds to specified subsong
44 virtual float getrefresh() = 0; // returns needed timer refresh rate
45
46/***** Informational methods *****/
47 unsigned long songlength(int subsong = -1);
48
49 virtual std::string gettype() = 0; // returns file type
50 virtual std::string gettitle() // returns song title
51 { return std::string(); }
52 virtual std::string getauthor() // returns song author name
53 { return std::string(); }
54 virtual std::string getdesc() // returns song description
55 { return std::string(); }
56 virtual unsigned int getpatterns() // returns number of patterns
57 { return 0; }
58 virtual unsigned int getpattern() // returns currently playing pattern
59 { return 0; }
60 virtual unsigned int getorders() // returns size of orderlist
61 { return 0; }
62 virtual unsigned int getorder() // returns currently playing song position
63 { return 0; }
64 virtual unsigned int getrow() // returns currently playing row
65 { return 0; }
66 virtual unsigned int getspeed() // returns current song speed
67 { return 0; }
68 virtual unsigned int getsubsongs() // returns number of subsongs
69 { return 1; }
70 virtual unsigned int getsubsong() // returns current subsong
71 { return 0; }
72 virtual unsigned int getinstruments() // returns number of instruments
73 { return 0; }
74 virtual std::string getinstrument(unsigned int n) // returns n-th instrument name
75 { return std::string(); }
76
77protected:
78 Copl *opl; // our OPL chip
79 CAdPlugDatabase *db; // AdPlug Database
80
81 static const unsigned short note_table[12]; // standard adlib note table
82 static const unsigned char op_table[9]; // the 9 operators as expected by the OPL
83};
84
85#endif
Definition database.h:32
Definition fprovide.h:29
virtual std::string getauthor()
Definition player.h:52
static const unsigned short note_table[12]
Definition player.h:28
virtual bool update()=0
virtual unsigned int getsubsongs()
Definition player.h:68
virtual bool load(const std::string &filename, const CFileProvider &fp=CProvider_Filesystem())=0
virtual float getrefresh()=0
virtual unsigned int getspeed()
Definition player.h:66
virtual void rewind(int subsong=-1)=0
virtual std::string getinstrument(unsigned int n)
Definition player.h:74
virtual unsigned int getorder()
Definition player.h:62
unsigned long songlength(int subsong=-1)
Definition player.cpp:43
virtual unsigned int getpattern()
Definition player.h:58
void seek(unsigned long ms)
Definition player.cpp:63
CPlayer(Copl *newopl)
Definition player.cpp:34
virtual unsigned int getsubsong()
Definition player.h:70
static const unsigned char op_table[9]
Definition player.h:31
virtual std::string gettitle()
Definition player.h:50
Copl * opl
Definition player.h:78
virtual ~CPlayer()
Definition player.cpp:39
virtual unsigned int getrow()
Definition player.h:64
virtual std::string getdesc()
Definition player.h:54
virtual unsigned int getorders()
Definition player.h:60
CAdPlugDatabase * db
Definition player.h:79
virtual unsigned int getpatterns()
Definition player.h:56
virtual std::string gettype()=0
virtual unsigned int getinstruments()
Definition player.h:72
Definition fprovide.h:44
Definition opl.h:26
static char filename[]
Definition features.c:5
int n
Definition crypt.c:458