summaryrefslogtreecommitdiffstats
path: root/oggvorbis_artsplugin/oggPlayObject_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'oggvorbis_artsplugin/oggPlayObject_impl.h')
-rw-r--r--oggvorbis_artsplugin/oggPlayObject_impl.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/oggvorbis_artsplugin/oggPlayObject_impl.h b/oggvorbis_artsplugin/oggPlayObject_impl.h
new file mode 100644
index 00000000..2f1b0c0c
--- /dev/null
+++ b/oggvorbis_artsplugin/oggPlayObject_impl.h
@@ -0,0 +1,62 @@
+#ifndef OGGPLAYER_IMPL_H
+#define OGGPLAYER_IMPL_H "$Id$"
+
+#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) || defined(__DragonFly__)
+/* union semun is defined by including <sys/sem.h> */
+#else
+/* according to X/OPEN we have to define it ourselves */
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
+ unsigned short int *array; /* array for GETALL, SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+#endif
+
+int buf_pos;
+
+namespace Arts {
+
+class oggPlayObject_impl
+ : public oggPlayObject_skel, public StdSynthModule
+{
+ public:
+ oggPlayObject_impl();
+ ~oggPlayObject_impl();
+ bool loadMedia(const std::string &filename);
+ std::string description();
+ poTime currentTime();
+ poTime overallTime();
+ poCapabilities capabilities();
+ std::string mediaName();
+ poState state();
+ void play();
+ void halt();
+ void seek(const class poTime &t);
+ void pause();
+ void streamInit();
+ void streamStart();
+ void calculateBlock(unsigned long samples);
+ void streamEnd();
+
+ protected:
+
+ static const int BACKBUFSIZ=4096;
+ OggVorbis_File vf;
+ std::string currentFile;
+
+ inline float conv_16le_float(short x)
+ { return static_cast<float>(x) / 32768.0; }
+
+ poState mState;
+ struct buf_t{
+ float left[BACKBUFSIZ];
+ float right[BACKBUFSIZ];
+ } *shm_buf;
+ int shm_id, child_pid;
+ int buflen_sem;
+};
+
+};
+
+#endif