Mercurial > octave-nkf
comparison libinterp/dldfcn/player_class.h @ 19508:91ee78cdba6c
New files for audio playback and recording
* player_class.cc, player_class.h: source files implementing player class
for audio playback
* recorder_class.cc, recorder_class.h: source files implementing recorder
class for audio recording
author | Vytautas Jančauskas <unaudio@gmail.com> |
---|---|
date | Wed, 11 Sep 2013 22:08:20 +0300 |
parents | |
children | b9df6b3fd5ef |
comparison
equal
deleted
inserted
replaced
19507:2e174b5e7703 | 19508:91ee78cdba6c |
---|---|
1 #ifndef PLAYER_CLASS_H | |
2 #define PLAYER_CLASS_H | |
3 | |
4 #include <string> | |
5 #include <octave/oct.h> | |
6 #include <octave/ov-int32.h> | |
7 #include <portaudio.h> | |
8 | |
9 #include "player_class.h" | |
10 | |
11 enum audio_type {INT8, UINT8, INT16, DOUBLE}; | |
12 | |
13 class audioplayer : public octave_base_value | |
14 { | |
15 public: | |
16 audioplayer(); | |
17 ~audioplayer(); | |
18 // Overloaded base functions | |
19 double player_value() const { return 0; } | |
20 virtual double scalar_value (bool frc_str_conv = false) const | |
21 { | |
22 return 0; | |
23 } | |
24 void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |
25 void print_raw (std::ostream& os, bool pr_as_read_syntax) const; | |
26 // Properties | |
27 bool is_constant (void) const { return true;} | |
28 bool is_defined (void) const { return true;} | |
29 bool print_as_scalar (void) const { return true;} | |
30 | |
31 void init(); | |
32 void init_fn(); | |
33 void set_y(octave_value y); | |
34 void set_y(octave_function *fn); | |
35 void set_y(std::string fn); | |
36 Matrix &get_y(); | |
37 RowVector *get_left(); | |
38 RowVector *get_right(); | |
39 void set_fs(int fs); | |
40 int get_fs(); | |
41 void set_nbits(int nbits); | |
42 int get_nbits(); | |
43 void set_id(int id); | |
44 int get_id(); | |
45 int get_channels(); | |
46 audio_type get_type(); | |
47 | |
48 void set_sample_number(unsigned int sample); | |
49 unsigned int get_sample_number(); | |
50 unsigned int get_total_samples(); | |
51 void set_end_sample(unsigned int sample); | |
52 unsigned int get_end_sample(); | |
53 void reset_end_sample(); | |
54 void set_tag(charMatrix tag); | |
55 charMatrix get_tag(); | |
56 void set_userdata(octave_value userdata); | |
57 octave_value get_userdata(); | |
58 PaStream *get_stream(); | |
59 octave_function *octave_callback_function; | |
60 | |
61 void playblocking(); | |
62 void play(); | |
63 void pause(); | |
64 void resume(); | |
65 void stop(); | |
66 bool isplaying(); | |
67 private: | |
68 Matrix y; | |
69 RowVector left; | |
70 RowVector right; | |
71 charMatrix tag; | |
72 octave_value userdata; | |
73 int channels; | |
74 int fs; | |
75 int nbits; | |
76 int id; | |
77 unsigned int sample_number; | |
78 unsigned int end_sample; | |
79 PaStream *stream; | |
80 PaStreamParameters output_parameters; | |
81 audio_type type; | |
82 DECLARE_OCTAVE_ALLOCATOR | |
83 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
84 }; | |
85 | |
86 #endif // PLAYER_CLASS_H |