1 /***************************************************************************
2                           sidplayer.cpp  -  Wrapper to hide private
3                                             header files (see below)
4                              -------------------
5     begin                : Fri Jun 9 2000
6     copyright            : (C) 2000 by Simon White
7     email                : s_a_white@email.com
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  *  $Log: sidplay2.cpp,v $
19  *  Revision 1.15  2002/03/04 19:05:49  s_a_white
20  *  Fix C++ use of nothrow.
21  *
22  *  Revision 1.14  2001/12/13 08:28:08  s_a_white
23  *  Added namespace support to fix problems with xsidplay.
24  *
25  *  Revision 1.13  2001/12/11 19:24:15  s_a_white
26  *  More GCC3 Fixes.
27  *
28  *  Revision 1.12  2001/09/17 19:03:58  s_a_white
29  *  2.1.0 interface stabalisation.
30  *
31  *  Revision 1.11  2001/09/01 11:16:12  s_a_white
32  *  Renamed configure to config.
33  *
34  *  Revision 1.10  2001/07/25 17:01:13  s_a_white
35  *  Support for new configuration interface.
36  *
37  *  Revision 1.9  2001/07/14 16:46:16  s_a_white
38  *  Sync with sidbuilder class project.
39  *
40  *  Revision 1.8  2001/07/14 12:57:38  s_a_white
41  *  Added credits and debug functions.  Removed external filter.
42  *
43  *  Revision 1.7  2001/03/21 22:31:22  s_a_white
44  *  Filter redefinition support.
45  *
46  *  Revision 1.6  2001/03/01 23:46:37  s_a_white
47  *  Support for sample mode to be selected at runtime.
48  *
49  *  Revision 1.5  2001/02/21 21:49:21  s_a_white
50  *  Now uses new player::getErrorString function.
51  *
52  *  Revision 1.4  2001/02/13 21:32:35  s_a_white
53  *  Windows DLL export fix.
54  *
55  *  Revision 1.3  2001/02/07 20:57:08  s_a_white
56  *  New SID_EXPORT define.  Supports SidTune now.
57  *
58  *  Revision 1.2  2001/01/23 21:26:28  s_a_white
59  *  Only way to load a tune now is by passing in a sidtune object.  This is
60  *  required for songlength database support.
61  *
62  *  Revision 1.1  2000/12/12 19:14:44  s_a_white
63  *  Library wrapper.
64  *
65  ***************************************************************************/
66 
67 //---------------------------------------------------------------------------------------------
68 //---------------------------------------------------------------------------------------------
69 // Redirection to private version of sidplayer (This method is called Cheshire Cat)
70 // [ms: which is J. Carolan's name for a degenerate 'bridge']
71 // This interface can be directly replaced with a libsidplay1 or C interface wrapper.
72 //---------------------------------------------------------------------------------------------
73 //---------------------------------------------------------------------------------------------
74 
75 #include "config.h"
76 #include "player.h"
77 
78 #ifdef HAVE_EXCEPTIONS
79 #   include <new>
80 #endif
81 
sidplay2()82 sidplay2::sidplay2 ()
83 #ifdef HAVE_EXCEPTIONS
84 : sidplayer (*(new(std::nothrow) SIDPLAY2_NAMESPACE::Player))
85 #else
86 : sidplayer (*(new SIDPLAY2_NAMESPACE::Player))
87 #endif
88 {
89 }
90 
~sidplay2()91 sidplay2::~sidplay2 ()
92 {   if (&sidplayer) delete &sidplayer; }
93 
config(const sid2_config_t & cfg)94 int sidplay2::config (const sid2_config_t &cfg)
95 {   return sidplayer.config (cfg); }
96 
config(void) const97 const sid2_config_t &sidplay2::config (void) const
98 {   return sidplayer.config (); }
99 
stop(void)100 void sidplay2::stop (void)
101 {   sidplayer.stop (); }
102 
pause(void)103 void sidplay2::pause (void)
104 {   sidplayer.pause (); }
105 
play(void * buffer,uint_least32_t length)106 uint_least32_t sidplay2::play (void *buffer, uint_least32_t length)
107 {   return sidplayer.play (buffer, length); }
108 
load(SidTune * tune)109 int sidplay2::load (SidTune *tune)
110 {   return sidplayer.load (tune); }
111 
info() const112 const sid2_info_t &sidplay2::info () const
113 {   return sidplayer.info (); }
114 
time(void) const115 uint_least32_t sidplay2::time (void) const
116 {   return sidplayer.time (); }
117 
mileage(void) const118 uint_least32_t sidplay2::mileage (void) const
119 {   return sidplayer.mileage (); }
120 
error(void) const121 const char *sidplay2::error (void) const
122 {   return sidplayer.error (); }
123 
fastForward(uint percent)124 int  sidplay2::fastForward  (uint percent)
125 {   return sidplayer.fastForward (percent); }
126 
debug(bool enable)127 void sidplay2::debug (bool enable)
128 {   sidplayer.debug (enable); }
129 
state(void) const130 sid2_player_t sidplay2::state (void) const
131 {   return sidplayer.state (); }
132