Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889/*This file is part of Darling.
Copyright (C) 2015-2016 Lubos Dolezel
Darling is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.
Darling is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.
You should have received a copy of the GNU General Public Licensealong with Darling. If not, see <http://www.gnu.org/licenses/>.*/
#include "AudioHardwareImpl.h"#include <typeinfo>#include <iostream>
AudioHardwareImpl::AudioHardwareImpl(){}
AudioHardwareImpl::~AudioHardwareImpl(){} void AudioHardwareImpl::show(){ std::cout << typeid(*this).name() << std::endl;}
OSStatus AudioHardwareImpl::createIOProcID(AudioDeviceIOProc inProc, void* inClientData, AudioDeviceIOProcID* outIOProcID){ std::lock_guard<std::mutex> guard(m_procMutex); if (!outIOProcID || !inProc) return paramErr; *outIOProcID = reinterpret_cast<AudioDeviceIOProcID>(m_nextProcId++); m_proc[*outIOProcID] = std::pair(inProc, inClientData); return noErr;}
OSStatus AudioHardwareImpl::destroyIOProcID(AudioDeviceIOProcID inIOProcID){ std::lock_guard<std::mutex> guard(m_procMutex); auto it = m_proc.find(inIOProcID); if (it == m_proc.end()) return paramErr; m_proc.erase(it); return noErr;}
OSStatus AudioHardwareImpl::start(AudioDeviceIOProcID inProcID, AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags){ AudioHardwareStream* stream; if (m_streams.find(inProcID) != m_streams.end()) return noErr; stream = createStream(inProcID); m_streams[inProcID] = stream; // TODO: time return stream;}
OSStatus AudioHardwareImpl::stop(AudioDeviceIOProcID inProcID){ auto it = m_streams.find(inProcID); if (it == m_streams.end()) return kAudioHardwareNotRunningError; m_streams.erase(it); return noErr;}