git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2574 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
@@ -20,22 +20,35 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#ifndef __JackIOAdapter__ | |||
#define __JackIOAdapter__ | |||
#include "ringbuffer.h" | |||
namespace Jack | |||
{ | |||
class JackIOAdapterInterface | |||
{ | |||
private: | |||
protected: | |||
int fCaptureChannels; | |||
int fPlaybackChannels; | |||
jack_ringbuffer_t* fCaptureRingBuffer; | |||
jack_ringbuffer_t* fPlaybackRingBuffer; | |||
public: | |||
JackIOAdapterInterface() | |||
JackIOAdapterInterface(int input, int output) | |||
:fCaptureChannels(input), fPlaybackChannels(output) | |||
{} | |||
~JackIOAdapterInterface() | |||
{} | |||
void SetRingBuffers(jack_ringbuffer_t* input, jack_ringbuffer_t* output) | |||
{} | |||
void SetRingBuffers(jack_ringbuffer_t* input, jack_ringbuffer_t* output) | |||
{ | |||
fCaptureRingBuffer = input; | |||
fPlaybackRingBuffer = output; | |||
} | |||
}; | |||
} | |||
@@ -64,13 +64,13 @@ int JackNetIOAdapter::Process(jack_nframes_t frames, void* arg) | |||
return 0; | |||
} | |||
JackNetIOAdapter::JackNetIOAdapter(jack_client_t* jack_client, JackIOAdapterInterface* audio_io) | |||
JackNetIOAdapter::JackNetIOAdapter(jack_client_t* jack_client, JackIOAdapterInterface* audio_io, int input, int output) | |||
{ | |||
int i; | |||
char name[32]; | |||
fJackClient = jack_client; | |||
fCaptureChannels = 2; | |||
fPlaybackChannels = 2; | |||
fCaptureChannels = input; | |||
fPlaybackChannels = output; | |||
fIOAdapter = audio_io; | |||
@@ -159,7 +159,7 @@ extern "C" | |||
return 1; | |||
} else { | |||
jack_log("Loading NetAudio Adapter"); | |||
adapter = new Jack::JackNetIOAdapter(jack_client, new Jack::JackCoreAudioIOAdapter()); | |||
adapter = new Jack::JackNetIOAdapter(jack_client, new Jack::JackCoreAudioIOAdapter(2, 2), 2, 2); | |||
return (adapter) ? 0 : 1; | |||
} | |||
} | |||
@@ -48,7 +48,7 @@ namespace Jack | |||
public: | |||
JackNetIOAdapter(jack_client_t* jack_client, JackIOAdapterInterface* audio_io); | |||
JackNetIOAdapter(jack_client_t* jack_client, JackIOAdapterInterface* audio_io, int input, int output); | |||
~JackNetIOAdapter(); | |||
}; | |||
} | |||
@@ -192,7 +192,7 @@ def build(bld): | |||
create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib) | |||
create_jack_process_obj(bld, 'netioadapter', 'JackNetIOAdapter.cpp', serverlib) | |||
create_jack_process_obj(bld, 'netioadapter', 'JackNetIOAdapter.cpp ../macosx/JackCoreAudioIOAdapter.cpp', serverlib) | |||
install_files('PREFIX', 'include/jack', 'jack/*.h') | |||
@@ -0,0 +1,87 @@ | |||
/* | |||
Copyright (C) 2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation; either version 2 of the License, or | |||
(at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#include "JackCoreAudioIOAdapter.h" | |||
namespace Jack | |||
{ | |||
OSStatus JackCoreAudioIOAdapter::Render(void *inRefCon, | |||
AudioUnitRenderActionFlags *ioActionFlags, | |||
const AudioTimeStamp *inTimeStamp, | |||
UInt32 inBusNumber, | |||
UInt32 inNumberFrames, | |||
AudioBufferList *ioData) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetDeviceIDFromUID(const char* UID, AudioDeviceID* id) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetDefaultDevice(AudioDeviceID* id) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetDefaultInputDevice(AudioDeviceID* id) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetDefaultOutputDevice(AudioDeviceID* id) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetDeviceNameFromID(AudioDeviceID id, char* name) | |||
{ | |||
return noErr; | |||
} | |||
OSStatus JackCoreAudioIOAdapter::GetTotalChannels(AudioDeviceID device, int* channelCount, bool isInput) | |||
{ | |||
return noErr; | |||
} | |||
// Setup | |||
int JackCoreAudioIOAdapter::SetupDevices(const char* capture_driver_uid, | |||
const char* playback_driver_uid, | |||
char* capture_driver_name, | |||
char* playback_driver_name) | |||
{ | |||
return 0; | |||
} | |||
int JackCoreAudioIOAdapter::SetupChannels(bool capturing, | |||
bool playing, | |||
int& inchannels, | |||
int& outchannels, | |||
int& in_nChannels, | |||
int& out_nChannels, | |||
bool strict) | |||
{ | |||
return 0; | |||
} | |||
int JackCoreAudioIOAdapter::SetupBufferSizeAndSampleRate(jack_nframes_t nframes, jack_nframes_t samplerate) | |||
{ | |||
return 0; | |||
} | |||
} |
@@ -21,17 +21,69 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#define __JackCoreAudioIOAdapter__ | |||
#include "JackIOAdapter.h" | |||
#include "jack.h" | |||
#include <AudioToolbox/AudioConverter.h> | |||
#include <CoreAudio/CoreAudio.h> | |||
#include <AudioUnit/AudioUnit.h> | |||
namespace Jack | |||
{ | |||
typedef UInt8 CAAudioHardwareDeviceSectionID; | |||
#define kAudioDeviceSectionInput ((CAAudioHardwareDeviceSectionID)0x01) | |||
#define kAudioDeviceSectionOutput ((CAAudioHardwareDeviceSectionID)0x00) | |||
#define kAudioDeviceSectionGlobal ((CAAudioHardwareDeviceSectionID)0x00) | |||
#define kAudioDeviceSectionWildcard ((CAAudioHardwareDeviceSectionID)0xFF) | |||
class JackCoreAudioIOAdapter : public JackIOAdapterInterface | |||
{ | |||
private: | |||
AudioUnit fAUHAL; | |||
AudioDeviceID fDeviceID; | |||
AudioUnitRenderActionFlags* fActionFags; | |||
AudioTimeStamp* fCurrentTime; | |||
static OSStatus Render(void *inRefCon, | |||
AudioUnitRenderActionFlags *ioActionFlags, | |||
const AudioTimeStamp *inTimeStamp, | |||
UInt32 inBusNumber, | |||
UInt32 inNumberFrames, | |||
AudioBufferList *ioData); | |||
OSStatus GetDeviceIDFromUID(const char* UID, AudioDeviceID* id); | |||
OSStatus GetDefaultDevice(AudioDeviceID* id); | |||
OSStatus GetDefaultInputDevice(AudioDeviceID* id); | |||
OSStatus GetDefaultOutputDevice(AudioDeviceID* id); | |||
OSStatus GetDeviceNameFromID(AudioDeviceID id, char* name); | |||
OSStatus GetTotalChannels(AudioDeviceID device, int* channelCount, bool isInput); | |||
// Setup | |||
int SetupDevices(const char* capture_driver_uid, | |||
const char* playback_driver_uid, | |||
char* capture_driver_name, | |||
char* playback_driver_name); | |||
int SetupChannels(bool capturing, | |||
bool playing, | |||
int& inchannels, | |||
int& outchannels, | |||
int& in_nChannels, | |||
int& out_nChannels, | |||
bool strict); | |||
int SetupBufferSizeAndSampleRate(jack_nframes_t nframes, jack_nframes_t samplerate); | |||
public: | |||
JackCoreAudioIOAdapter() | |||
JackCoreAudioIOAdapter(int input, int output) | |||
:JackIOAdapterInterface(input, output) | |||
{} | |||
~JackCoreAudioIOAdapter() | |||
{} | |||
@@ -1207,7 +1207,7 @@ | |||
4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLockedEngine.h; path = ../common/JackLockedEngine.h; sourceTree = SOURCE_ROOT; }; | |||
4B60CE480AAABA31004956AA /* connect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = connect.c; path = "../example-clients/connect.c"; sourceTree = SOURCE_ROOT; }; | |||
4B66A8580934964500A89560 /* JackConstants.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackConstants.h; path = ../common/JackConstants.h; sourceTree = SOURCE_ROOT; }; | |||
4B699BB1097D421600A18468 /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B699BB1097D421600A18468 /* jackdmp */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B699C47097D421600A18468 /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B699CAC097D421600A18468 /* Jackdmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackdmp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B699CBB097D421600A18468 /* jack_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_metro; sourceTree = BUILT_PRODUCTS_DIR; }; | |||