summaryrefslogtreecommitdiff
path: root/libsidplay2/sidplay-libs-2.1.0/libsidplay/src/sidplay2.cpp
blob: e3535ddb5608daefe17dda89bae283a10be9922f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/***************************************************************************
                          sidplayer.cpp  -  Wrapper to hide private
                                            header files (see below)
                             -------------------
    begin                : Fri Jun 9 2000
    copyright            : (C) 2000 by Simon White
    email                : s_a_white@email.com
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
/***************************************************************************
 *  $Log: sidplay2.cpp,v $
 *  Revision 1.15  2002/03/04 19:05:49  s_a_white
 *  Fix C++ use of nothrow.
 *
 *  Revision 1.14  2001/12/13 08:28:08  s_a_white
 *  Added namespace support to fix problems with xsidplay.
 *
 *  Revision 1.13  2001/12/11 19:24:15  s_a_white
 *  More GCC3 Fixes.
 *
 *  Revision 1.12  2001/09/17 19:03:58  s_a_white
 *  2.1.0 interface stabalisation.
 *
 *  Revision 1.11  2001/09/01 11:16:12  s_a_white
 *  Renamed configure to config.
 *
 *  Revision 1.10  2001/07/25 17:01:13  s_a_white
 *  Support for new configuration interface.
 *
 *  Revision 1.9  2001/07/14 16:46:16  s_a_white
 *  Sync with sidbuilder class project.
 *
 *  Revision 1.8  2001/07/14 12:57:38  s_a_white
 *  Added credits and debug functions.  Removed external filter.
 *
 *  Revision 1.7  2001/03/21 22:31:22  s_a_white
 *  Filter redefinition support.
 *
 *  Revision 1.6  2001/03/01 23:46:37  s_a_white
 *  Support for sample mode to be selected at runtime.
 *
 *  Revision 1.5  2001/02/21 21:49:21  s_a_white
 *  Now uses new player::getErrorString function.
 *
 *  Revision 1.4  2001/02/13 21:32:35  s_a_white
 *  Windows DLL export fix.
 *
 *  Revision 1.3  2001/02/07 20:57:08  s_a_white
 *  New SID_EXPORT define.  Supports SidTune now.
 *
 *  Revision 1.2  2001/01/23 21:26:28  s_a_white
 *  Only way to load a tune now is by passing in a sidtune object.  This is
 *  required for songlength database support.
 *
 *  Revision 1.1  2000/12/12 19:14:44  s_a_white
 *  Library wrapper.
 *
 ***************************************************************************/

//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
// Redirection to private version of sidplayer (This method is called Cheshire Cat)
// [ms: which is J. Carolan's name for a degenerate 'bridge']
// This interface can be directly replaced with a libsidplay1 or C interface wrapper.
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------

#include "config.h"
#include "player.h"

#ifdef HAVE_EXCEPTIONS
#   include <new>
#endif

sidplay2::sidplay2 ()
#ifdef HAVE_EXCEPTIONS
: sidplayer (*(new(std::nothrow) SIDPLAY2_NAMESPACE::Player))
#else
: sidplayer (*(new SIDPLAY2_NAMESPACE::Player))
#endif
{
}

sidplay2::~sidplay2 ()
{   if (&sidplayer) delete &sidplayer; }

int sidplay2::config (const sid2_config_t &cfg)
{   return sidplayer.config (cfg); }

const sid2_config_t &sidplay2::config (void) const
{   return sidplayer.config (); }

void sidplay2::stop (void)
{   sidplayer.stop (); }

void sidplay2::pause (void)
{   sidplayer.pause (); }

uint_least32_t sidplay2::play (void *buffer, uint_least32_t length)
{   return sidplayer.play (buffer, length); }

int sidplay2::load (SidTune *tune)
{   return sidplayer.load (tune); }

const sid2_info_t &sidplay2::info () const
{   return sidplayer.info (); }

uint_least32_t sidplay2::time (void) const
{   return sidplayer.time (); }

uint_least32_t sidplay2::mileage (void) const
{   return sidplayer.mileage (); }

const char *sidplay2::error (void) const
{   return sidplayer.error (); }

int  sidplay2::fastForward  (uint percent)
{   return sidplayer.fastForward (percent); }

void sidplay2::debug (bool enable)
{   sidplayer.debug (enable); }

sid2_player_t sidplay2::state (void) const
{   return sidplayer.state (); }