1 /* 2 * Copyright (c) 2012, The MilkyTracker Team. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * - Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * - Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * - Neither the name of the <ORGANIZATION> nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef __AUDIODRIVER_HAIKU_H__ 31 #define __AUDIODRIVER_HAIKU_H__ 32 33 #include "AudioDriverBase.h" 34 35 #include <SupportDefs.h> 36 37 class BSoundPlayer; 38 struct media_raw_audio_format; 39 40 enum { 41 kChannelCount = 2 42 }; 43 44 45 class AudioDriver_Haiku : public AudioDriverBase 46 { 47 public: 48 AudioDriver_Haiku(); 49 virtual ~AudioDriver_Haiku(); 50 51 // --- AudioDriverBase API ---------------------------------------------------- 52 public: 53 virtual mp_sint32 initDevice(mp_sint32 bufferSizeInWords, 54 mp_uint32 mixFrequency, MasterMixer* mixer); 55 virtual mp_sint32 closeDevice(); 56 57 virtual mp_sint32 start(); 58 virtual mp_sint32 stop(); 59 virtual mp_sint32 pause(); 60 virtual mp_sint32 resume(); 61 62 virtual mp_uint32 getNumPlayedSamples() const; supportsTimeQuery()63 virtual bool supportsTimeQuery() const 64 { return false; } 65 getDriverID()66 virtual const char* getDriverID() 67 { return "Haiku MediaKit"; } 68 69 virtual mp_sint32 getPreferredBufferSize() const; 70 71 // --- MediaKit playback ------------------------------------------------------ 72 private: 73 static void _FillBuffer(void* theCookie, void* buffer, 74 size_t size, const media_raw_audio_format& format); 75 76 BSoundPlayer* fSoundPlayer; 77 }; 78 79 #endif // __AUDIODRIVER_HAIKU_H__ 80