1 /* tape.h: tape handling routines
2    Copyright (c) 1999-2016 Philip Kendall
3    Copyright (c) 2015 Sergio Baldoví
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9 
10    This program 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
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License along
16    with this program; if not, write to the Free Software Foundation, Inc.,
17    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19    Author contact information:
20 
21    E-mail: philip-fuse@shadowmagic.org.uk
22 
23 */
24 
25 #ifndef FUSE_TAPE_H
26 #define FUSE_TAPE_H
27 
28 #include <libspectrum.h>
29 
30 void tape_register_startup( void );
31 
32 int tape_open( const char *filename, int autoload );
33 
34 int
35 tape_read_buffer( unsigned char *buffer, size_t length, libspectrum_id_t type,
36 		  const char *filename, int autoload );
37 
38 int tape_close( void );
39 int tape_rewind( void );
40 int tape_select_block( size_t n );
41 int tape_select_block_no_update( size_t n );
42 int tape_get_current_block( void );
43 int tape_write( const char *filename );
44 
45 int tape_can_autoload( void );
46 
47 int tape_load_trap( void );
48 int tape_save_trap( void );
49 
50 int tape_do_play( int autoplay );
51 int tape_toggle_play( int autoplay );
52 
53 void tape_next_edge( libspectrum_dword last_tstates, int from_acceleration );
54 
55 int tape_stop( void );
56 int tape_is_playing( void );
57 int tape_present( void );
58 
59 void tape_record_start( void );
60 int tape_record_stop( void );
61 
62 /* Call a user-supplied function for every block in the current tape */
63 int
64 tape_foreach( void (*function)( libspectrum_tape_block *block,
65 				void *user_data),
66 	      void *user_data );
67 
68 /* Fill 'buffer' with up a maximum of 'length' characters of
69    information about 'block' */
70 int tape_block_details( char *buffer, size_t length,
71 			libspectrum_tape_block *block );
72 
73 extern int tape_microphone;
74 extern int tape_modified;
75 extern int tape_playing;
76 extern int tape_recording;
77 
78 extern int tape_edge_event;
79 
80 #endif
81