root/branches/transport_redesign/libs/hydrogen/src/IO/OssDriver.h @ 872

Revision 872, 2.4 KB (checked in by gabriel@…, 4 years ago)

Add H2CORE_ to include guards in libhydrogen headers.

This isn't solving any problem... but adding the namespace to the include guards
promotes the use of simple names. Adding the namespace to the include guard
avoids potential future conflicts with other libraries that have used the same
simple names.

Line 
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 *
21 */
22
23
24#ifndef H2CORE_OSS_AUDIO_DRIVER_H
25#define H2CORE_OSS_AUDIO_DRIVER_H
26
27#include <hydrogen/IO/AudioOutput.h>
28#include <hydrogen/IO/NullDriver.h>
29
30// check if OSS support is enabled
31#ifdef OSS_SUPPORT
32
33
34#ifdef __NetBSD__
35#include <soundcard.h>
36#else
37#include <sys/soundcard.h>
38#endif
39#include <sys/ioctl.h>
40#include <stdio.h>
41#include <sys/types.h>
42#include <sys/stat.h>
43#include <fcntl.h>
44#include <iostream>
45#include <unistd.h>
46#include <inttypes.h>
47
48#include <hydrogen/globals.h>
49
50/*
51#ifdef __NetBSD__
52        #define AUDIO_DEVICE "/dev/audio"
53#else
54        #define AUDIO_DEVICE "/dev/dsp"
55#endif
56*/
57
58namespace H2Core
59{
60
61typedef int  ( *audioProcessCallback )( uint32_t, void * );
62
63///
64/// OSS Audio Driver
65///
66class OssDriver : public AudioOutput
67{
68public:
69        OssDriver( audioProcessCallback processCallback );
70        ~OssDriver();
71
72        int init( unsigned bufferSize );
73        int connect();
74        void disconnect();
75
76        void write();
77        unsigned getBufferSize();
78        unsigned getSampleRate();
79        float* getOut_L();
80        float* getOut_R();
81
82        virtual void play();
83        virtual void stop();
84        virtual void locate( unsigned long nFrame );
85        virtual void updateTransportInfo();
86        virtual void setBpm( float fBPM );
87
88private:
89        /** file descriptor, for writing to /dev/dsp */
90        int fd;
91
92        short* audioBuffer;
93        float* out_L;
94        float* out_R;
95
96        audioProcessCallback processCallback;
97        int log2( int n );
98
99};
100
101#else
102
103namespace H2Core {
104
105class OssDriver : public NullDriver
106{
107public:
108        OssDriver( audioProcessCallback processCallback ) : NullDriver( processCallback ) {}
109
110};
111
112
113
114#endif // OSS_SUPPORT
115
116};
117
118#endif // H2CORE_OSS_AUDIO_DRIVER_H
Note: See TracBrowser for help on using the browser.