/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceAsio.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceAsio.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1500 - (hide annotations) (download) (as text)
Wed Nov 21 00:52:09 2007 UTC (16 years, 6 months ago) by senoner
File MIME type: text/x-c++hdr
File size: 7000 byte(s)
* win32 port, work in progress:
 - added ASIO low latency audio output driver
* MME MIDI input driver:
 - fixed number of PORTS to 1 as the win32 MME MIDI API
 allows to connect to only one MIDI port at time,

1 senoner 1500 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * Copyright (C) 2005 - 2007 Christian Schoenebeck *
7     * *
8     * This program is free software; you can redistribute it and/or modify *
9     * it under the terms of the GNU General Public License as published by *
10     * the Free Software Foundation; either version 2 of the License, or *
11     * (at your option) any later version. *
12     * *
13     * This program is distributed in the hope that it will be useful, *
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16     * GNU General Public License for more details. *
17     * *
18     * You should have received a copy of the GNU General Public License *
19     * along with this program; if not, write to the Free Software *
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21     * MA 02111-1307 USA *
22     ***************************************************************************/
23    
24     #ifndef _LS_AUDIOOUTPUTDEVICEASIO_H_
25     #define _LS_AUDIOOUTPUTDEVICEASIO_H_
26    
27     #include <string.h>
28    
29     #include <asiosys.h>
30     #include <asio.h>
31     #include <asiodrivers.h>
32     #include <math.h>
33     #include "iasiothiscallresolver.h"
34    
35     #include "../../common/global_private.h"
36     #include "AudioOutputDevice.h"
37     #include "AudioChannel.h"
38     #include "../DeviceParameter.h"
39    
40     namespace LinuxSampler { //
41    
42     /** Asio audio output driver
43     *
44     * Implements audio output to the Advanced Linux Sound Architecture (Asio).
45     */
46     class AudioOutputDeviceAsio : public AudioOutputDevice {
47     public:
48     AudioOutputDeviceAsio(std::map<String,DeviceCreationParameter*> Parameters);
49     ~AudioOutputDeviceAsio();
50    
51     // derived abstract methods from class 'AudioOutputDevice'
52     virtual void Play();
53     virtual bool IsPlaying();
54     virtual void Stop();
55     virtual uint MaxSamplesPerCycle();
56     virtual uint SampleRate();
57     virtual AudioChannel* CreateChannel(uint ChannelNr);
58    
59     virtual String Driver();
60     static String Name();
61     static String Description();
62     static String Version();
63    
64     /** Device Parameter 'CARD'
65     *
66     * Used to select the desired Asio sound card.
67     */
68     class ParameterCard : public DeviceCreationParameterString {
69     public:
70     ParameterCard();
71     ParameterCard(String s) throw (Exception);
72     virtual String Description();
73     virtual bool Fix();
74     virtual bool Mandatory();
75     virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
76     virtual optional<String> DefaultAsString(std::map<String,String> Parameters);
77     virtual std::vector<String> PossibilitiesAsString(std::map<String,String> Parameters);
78     virtual void OnSetValue(String s) throw (Exception);
79     static String Name();
80     };
81    
82     /** Device Parameter 'SAMPLERATE'
83     *
84     * Used to set the sample rate of the audio output device.
85     */
86     class ParameterSampleRate : public AudioOutputDevice::ParameterSampleRate {
87     public:
88     ParameterSampleRate();
89     ParameterSampleRate(String s);
90     virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
91     virtual optional<int> DefaultAsInt(std::map<String,String> Parameters);
92     virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
93     };
94    
95     /** Device Parameters 'CHANNELS'
96     *
97     * Used to increase / decrease the number of audio channels of
98     * audio output device.
99     */
100     class ParameterChannels : public AudioOutputDevice::ParameterChannels {
101     public:
102     ParameterChannels();
103     ParameterChannels(String s);
104     virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
105     virtual optional<int> DefaultAsInt(std::map<String,String> Parameters);
106     virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters);
107     virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters);
108     };
109    
110    
111     /** Device Parameter 'FRAGMENTSIZE'
112     *
113     * Used to set the audio fragment size / period size.
114     */
115     class ParameterFragmentSize : public DeviceCreationParameterInt {
116     public:
117     ParameterFragmentSize();
118     ParameterFragmentSize(String s) throw (Exception);
119     virtual String Description();
120     virtual bool Fix();
121     virtual bool Mandatory();
122     virtual std::map<String,DeviceCreationParameter*> DependsAsParameters();
123     virtual optional<int> DefaultAsInt(std::map<String,String> Parameters);
124     virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters);
125     virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters);
126     virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters);
127     virtual void OnSetValue(int i) throw (Exception);
128     static String Name();
129    
130     };
131    
132     // make protected method public
133     AudioOutputDevice::RenderAudio;
134     AudioOutputDevice::Channels;
135    
136    
137     protected:
138     int Main(); ///< Implementation of virtual method from class Thread
139    
140     private:
141     uint uiAsioChannels;
142     uint uiSamplerate;
143     uint FragmentSize;
144     bool asioIsPlaying;
145    
146     static void bufferSwitch(long index, ASIOBool processNow);
147     static ASIOTime* bufferSwitchTimeInfo(ASIOTime *timeInfo, long index, ASIOBool processNow);
148    
149     };
150     }
151    
152     #endif // _LS_AUDIOOUTPUTDEVICEASIO_H_

  ViewVC Help
Powered by ViewVC