summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilippo Giunchedi <filippo@esaurito.net>2009-11-14 14:22:19 (GMT)
committer Filippo Giunchedi <filippo@esaurito.net>2009-11-14 14:22:19 (GMT)
commitddef7415b7b644c76921410ec6897ac8b67d6df5 (patch)
treea37dbff87e7482e79fc32e604f3eb9b9c8f509d8
parent86f27e300f43a263f622ca5edcae2f89ecf7ee6e (diff)
protect jack members via getter/setter
gcc 4.2 is more strict on access control, thus accessing private members won't work, this fixes the issue via getter/setter methods
-rw-r--r--src/dev_sound.cpp26
-rw-r--r--src/dev_sound.h28
2 files changed, 38 insertions, 16 deletions
diff --git a/src/dev_sound.cpp b/src/dev_sound.cpp
index 6c2e210..3ed8e5c 100644
--- a/src/dev_sound.cpp
+++ b/src/dev_sound.cpp
@@ -41,16 +41,16 @@ int dev_jack_process(jack_nframes_t nframes, void *arg) {
if(!dev->jack) return 0; // just return
// take output from pipe and send it to jack
- dev->jack_out_buf = (jack_default_audio_sample_t*)
- jack_port_get_buffer(dev->jack_out_port,nframes);
- opframes = dev->jack_out_pipe->read
- (nframes * sizeof(float) * 2 , dev->jack_out_buf);
+ dev->set_jack_out_buf((jack_default_audio_sample_t*)
+ jack_port_get_buffer(dev->get_jack_out_port(),nframes));
+ opframes = dev->get_jack_out_pipe()->read
+ (nframes * sizeof(float) * 2 , dev->get_jack_out_buf());
// take input from jack and send it in pipe
- dev->jack_in_buf = (jack_default_audio_sample_t*)
- jack_port_get_buffer(dev->jack_in_port,nframes);
- dev->jack_in_pipe->write // does the float2int conversion in one pass
- (nframes * sizeof(float) * 2 , dev->jack_in_buf);
+ dev->set_jack_in_buf((jack_default_audio_sample_t*)
+ jack_port_get_buffer(dev->get_jack_in_port(),nframes));
+ dev->get_jack_in_pipe()->write // does the float2int conversion in one pass
+ (nframes * sizeof(float) * 2 , dev->get_jack_in_buf());
return 0;
}
@@ -59,11 +59,11 @@ void dev_jack_shutdown(void *arg) {
SoundDevice *dev = (SoundDevice*)arg;
// close the jack channels
dev->jack = false;
- jack_port_unregister(dev->jack_client, dev->jack_in_port);
- jack_port_unregister(dev->jack_client, dev->jack_out_port);
- jack_deactivate(dev->jack_client);
- delete dev->jack_in_pipe;
- delete dev->jack_out_pipe;
+ jack_port_unregister(dev->get_jack_client(), dev->get_jack_in_port());
+ jack_port_unregister(dev->get_jack_client(), dev->get_jack_out_port());
+ jack_deactivate(dev->get_jack_client());
+ delete dev->get_jack_in_pipe();
+ delete dev->get_jack_out_pipe();
}
#endif
diff --git a/src/dev_sound.h b/src/dev_sound.h
index 88c2e7f..8008ea0 100644
--- a/src/dev_sound.h
+++ b/src/dev_sound.h
@@ -41,7 +41,7 @@ class SoundDevice {
Tries to open the sound device for read and/or write
if full-duplex is requested but not supported, it returns error
and must be called again to fallback on half-duplex mode
-
+
@param read true if device is opened for reading audio
@param write true if device is opened for writing audio
@return true in case of success, false otherwise
@@ -53,9 +53,9 @@ class SoundDevice {
bool output(bool state); ///< activate sound output
void close(); ///< close the sound device
-
+
int read(void *buf, int len); ///< reads audio data from the device in a buffer, len is samples
-
+
int write(void *buf, int len); ///< writes audio data from a buffer to the device, len is samples
void flush_input();
void flush_output();
@@ -64,6 +64,28 @@ class SoundDevice {
bool jack;
bool jack_in;
bool jack_out;
+
+ jack_default_audio_sample_t *get_jack_in_buf() { return jack_in_buf; };
+ void set_jack_in_buf(jack_default_audio_sample_t *arg) { jack_in_buf = arg; };
+
+ jack_default_audio_sample_t *get_jack_out_buf() { return jack_out_buf; };
+ void set_jack_out_buf(jack_default_audio_sample_t *arg) { jack_out_buf = arg; };
+
+ jack_port_t *get_jack_in_port() { return jack_in_port; };
+ void set_jack_in_port(jack_port_t *arg) { jack_in_port = arg; };
+
+ jack_port_t *get_jack_out_port() { return jack_out_port; };
+ void set_jack_out_port(jack_port_t *arg) { jack_out_port = arg; };
+
+ Pipe *get_jack_out_pipe() { return jack_out_pipe; };
+ void set_jack_out_pipe(Pipe *arg) { jack_out_pipe = arg; };
+
+ Pipe *get_jack_in_pipe() { return jack_in_pipe; };
+ void set_jack_in_pipe(Pipe *arg) { jack_in_pipe = arg; };
+
+ jack_client_t *get_jack_client() { return jack_client; };
+ void set_jack_client(jack_client_t *arg) { jack_client = arg; };
+
#endif
#ifdef HAVE_PORTAUDIO