* Fixed build with new code

* 3g and indigo are now built in separate drivers (though indigo isn't built because these cards are CardBus based)
* reworked multi audio interface to publish all available output/input streams (as 16 bits/stereo/48kHz)
* tested ok on a Gina3g on R5 (with Haiku MultiAudio media addon), CLAmp, SoundRecorder
* default output is to be chosen with the Media preferences panel


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14496 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2005-10-24 18:17:55 +00:00
parent 557411309f
commit 08661eb233
9 changed files with 283 additions and 66 deletions

View File

@ -9,11 +9,9 @@ UsePrivateHeaders [ FDirName kernel ] ; # For kernel_cpp.cpp
# set some additional defines
SubDirCcFlags -DECHO_BEOS -DECHO24_FAMILY ;
SubDirC++Flags -DECHO_BEOS -DECHO24_FAMILY -fno-rtti ;
SubDirC++Flags -DECHO_BEOS -DECHO24_FAMILY -fno-rtti -DAUTO_DUCK_ALLOCATE ;
local echo_files =
C3g.cpp
C3gDco.cpp
CChannelMask.cpp
CDaffyDuck.cpp
CDspCommObject.cpp

View File

@ -0,0 +1,84 @@
SubDir OBOS_TOP src add-ons kernel drivers audio echo 3g ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic DSP ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic ASIC ;
UsePrivateHeaders [ FDirName kernel ] ; # For kernel_cpp.cpp
# set some additional defines
SubDirCcFlags -DECHO_BEOS -DECHO3G_FAMILY ;
SubDirC++Flags -DECHO_BEOS -DECHO3G_FAMILY -fno-rtti -DAUTO_DUCK_ALLOCATE ;
local echo_files =
C3g.cpp
C3gDco.cpp
CChannelMask.cpp
CDaffyDuck.cpp
CDspCommObject.cpp
CDspCommObjectVmixer.cpp
CEchoGals.cpp
CEchoGals_info.cpp
CEchoGals_midi.cpp
CEchoGals_mixer.cpp
CEchoGals_power.cpp
CEchoGals_transport.cpp
CEchoGalsMTC.cpp
CEchoGalsVmixer.cpp
CLineLevel.cpp
CMidiInQ.cpp
CMonitorCtrl.cpp
CMtcSync.cpp
CPipeOutCtrl.cpp
;
R5KernelAddon echo3g : kernel drivers bin :
kernel_cpp.cpp
debug.c
echo.cpp
multi.cpp
util.c
$(echo_files)
OsSupportBeOS.cpp
;
# suppress warnings on some files including the echo headers which provoke ugly warnings
ObjectC++Flags $(echo_files) : -w ;
ObjectC++Flags echo.cpp : -w ;
SEARCH on [ FGristFiles
$(echo_files)
OsSupportBeOS.cpp
] = [ FDirName $(OBOS_TOP) src add-ons kernel drivers audio echo generic ] ;
SEARCH on [ FGristFiles
kernel_cpp.cpp
] = [ FDirName $(OBOS_TOP) src system kernel util ] ;
SEARCH on [ FGristFiles
debug.c
echo.cpp
multi.cpp
util.c
] = [ FDirName $(OBOS_TOP) src add-ons kernel drivers audio echo ] ;
Package haiku-echo3g-cvs
:
echo3g
:
boot home config add-ons kernel drivers bin ;
Package haiku-echo3g-cvs
:
<kernel!drivers!dev!audio!multi>echo3g
:
boot home config add-ons kernel drivers dev audio multi ;
# Link to kernel/drivers/dev/audio/multi
{
local dir = [ FDirName $(OBOS_ADDON_DIR) kernel drivers dev audio multi ] ;
local instDriver = <kernel!drivers!dev!audio!multi>echo3g ;
MakeLocate $(instDriver) : $(dir) ;
RelSymLink $(instDriver) : echo3g ;
}

View File

@ -2,3 +2,5 @@ SubDir OBOS_TOP src add-ons kernel drivers audio echo ;
SubInclude OBOS_TOP src add-ons kernel drivers audio echo gals ;
SubInclude OBOS_TOP src add-ons kernel drivers audio echo 24 ;
SubInclude OBOS_TOP src add-ons kernel drivers audio echo 3g ;
#SubInclude OBOS_TOP src add-ons kernel drivers audio echo indigo ; # Indigo are CardBus based

View File

@ -37,6 +37,12 @@
#ifdef ECHOGALS_FAMILY
#define DRIVER_NAME "echogals"
#endif
#ifdef INDIGO_FAMILY
#define DRIVER_NAME "echoindigo"
#endif
#ifdef ECHO3G_FAMILY
#define DRIVER_NAME "echo3g"
#endif
#define VERSION "0.0"
/*

View File

@ -33,6 +33,9 @@
#include "CDarla.h"
#include "CGina.h"
#include "CGina24.h"
#include "CIndigo.h"
#include "CIndigoDJ.h"
#include "CIndigoIO.h"
#include "CLayla.h"
#include "CLayla24.h"
#include "CMia.h"
@ -444,10 +447,14 @@ init_hardware(void)
|| (card_type == LAYLA24)
|| (card_type == MONA)
|| (card_type == MIA)
|| (card_type == INDIGO)
#endif
#ifdef INDIGO_FAMILY
(card_type == INDIGO)
|| (card_type == INDIGO_IO)
|| (card_type == INDIGO_DJ)
|| (card_type == ECHO3G)
#endif
#ifdef ECHO3G_FAMILY
(card_type == ECHO3G)
#endif
)) {
err = B_OK;
@ -498,10 +505,14 @@ init_driver(void)
|| (card_type == LAYLA24)
|| (card_type == MONA)
|| (card_type == MIA)
|| (card_type == INDIGO)
#endif
#ifdef INDIGO_FAMILY
(card_type == INDIGO)
|| (card_type == INDIGO_IO)
|| (card_type == INDIGO_DJ)
|| (card_type == ECHO3G)
#endif
#ifdef ECHO3G_FAMILY
(card_type == ECHO3G)
#endif
)) {
@ -600,6 +611,22 @@ echo_setup(echo_dev * card)
card->pEG = new CMia(card->pOSS);
name = "Echo Mia";
break;
#endif
#ifdef INDIGO_FAMILY
case INDIGO:
card->pEG = new CIndigo(card->pOSS);
name = "Echo Mia";
break;
case INDIGO_IO:
card->pEG = new CIndigoIO(card->pOSS);
name = "Echo Mia";
break;
case INDIGO_DJ:
card->pEG = new CIndigoDJ(card->pOSS);
name = "Echo Mia";
break;
#endif
#ifdef ECHO3G_FAMILY
case ECHO3G:
card->pEG = new C3g(card->pOSS);
name = "Echo 3g";
@ -650,7 +677,7 @@ echo_setup(echo_dev * card)
echo_dump_caps(card);
#ifdef ECHO24_FAMILY
#ifdef ECHO3G_FAMILY
if (card->type == ECHO3G) {
strncpy(card->caps.szName, ((C3g*)card->pEG)->Get3gBoxName(), ECHO_MAXNAMELEN);
}

View File

@ -99,7 +99,7 @@ typedef struct _echo_dev {
LIST_HEAD(, _echo_stream) streams;
LIST_HEAD(, _echo_mem) mems;
echo_stream *pstream, *pstream2;
echo_stream *pstream;
echo_stream *rstream;
/* multi_audio */

View File

@ -9,7 +9,7 @@ UsePrivateHeaders [ FDirName kernel ] ; # For kernel_cpp.cpp
# set some additional defines
SubDirCcFlags -DECHO_BEOS -DECHOGALS_FAMILY ;
SubDirC++Flags -DECHO_BEOS -DECHOGALS_FAMILY -fno-rtti ;
SubDirC++Flags -DECHO_BEOS -DECHOGALS_FAMILY -fno-rtti -DAUTO_DUCK_ALLOCATE ;
local echo_files =
CChannelMask.cpp

View File

@ -0,0 +1,85 @@
SubDir OBOS_TOP src add-ons kernel drivers audio echo indigo ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic DSP ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel drivers audio echo generic ASIC ;
UsePrivateHeaders [ FDirName kernel ] ; # For kernel_cpp.cpp
# set some additional defines
SubDirCcFlags -DECHO_BEOS -DINDIGO_FAMILY ;
SubDirC++Flags -DECHO_BEOS -DINDIGO_FAMILY -fno-rtti -DAUTO_DUCK_ALLOCATE ;
local echo_files =
CChannelMask.cpp
CDaffyDuck.cpp
CDspCommObject.cpp
CDspCommObjectVmixer.cpp
CEchoGals.cpp
CEchoGals_info.cpp
CEchoGals_midi.cpp
CEchoGals_mixer.cpp
CEchoGals_power.cpp
CEchoGals_transport.cpp
CEchoGalsVmixer.cpp
CIndigo.cpp
CIndigoDspCommObject.cpp
CIndigoIO.cpp
CIndigoIODspCommObject.cpp
CIndigoDJ.cpp
CIndigoDJDspCommObject.cpp
CLineLevel.cpp
CMonitorCtrl.cpp
CPipeOutCtrl.cpp
;
R5KernelAddon echoindigo : kernel drivers bin :
kernel_cpp.cpp
debug.c
echo.cpp
multi.cpp
util.c
$(echo_files)
OsSupportBeOS.cpp
;
# suppress warnings on some files including the echo headers which provoke ugly warnings
ObjectC++Flags $(echo_files) : -w ;
ObjectC++Flags echo.cpp : -w ;
SEARCH on [ FGristFiles
$(echo_files)
OsSupportBeOS.cpp
] = [ FDirName $(OBOS_TOP) src add-ons kernel drivers audio echo generic ] ;
SEARCH on [ FGristFiles
kernel_cpp.cpp
] = [ FDirName $(OBOS_TOP) src system kernel util ] ;
SEARCH on [ FGristFiles
debug.c
echo.cpp
multi.cpp
util.c
] = [ FDirName $(OBOS_TOP) src add-ons kernel drivers audio echo ] ;
Package haiku-echoindigo-cvs
:
echoindigo
:
boot home config add-ons kernel drivers bin ;
Package haiku-echoindigo-cvs
:
<kernel!drivers!dev!audio!multi>echoindigo
:
boot home config add-ons kernel drivers dev audio multi ;
# Link to kernel/drivers/dev/audio/multi
{
local dir = [ FDirName $(OBOS_ADDON_DIR) kernel drivers dev audio multi ] ;
local instDriver = <kernel!drivers!dev!audio!multi>echoindigo ;
MakeLocate $(instDriver) : $(dir) ;
RelSymLink $(instDriver) : echoindigo ;
}

View File

@ -577,7 +577,8 @@ echo_get_global_format(echo_dev *card, multi_format_info *data)
static status_t
echo_get_buffers(echo_dev *card, multi_buffer_list *data)
{
int32 i, j, pchannels, rchannels, pchannels2;
int32 i, j, channels;
echo_stream *stream;
LOG(("flags = %#x\n",data->flags));
LOG(("request_playback_buffers = %#x\n",data->request_playback_buffers));
@ -587,14 +588,8 @@ echo_get_buffers(echo_dev *card, multi_buffer_list *data)
LOG(("request_record_channels = %#x\n",data->request_record_channels));
LOG(("request_record_buffer_size = %#x\n",data->request_record_buffer_size));
pchannels = card->pstream->channels;
pchannels2 = card->pstream2->channels;
rchannels = card->rstream->channels;
if (data->request_playback_buffers < BUFFER_COUNT ||
data->request_playback_channels < (pchannels + pchannels2) ||
data->request_record_buffers < BUFFER_COUNT ||
data->request_record_channels < (rchannels)) {
data->request_record_buffers < BUFFER_COUNT) {
LOG(("not enough channels/buffers\n"));
}
@ -604,30 +599,44 @@ echo_get_buffers(echo_dev *card, multi_buffer_list *data)
// data->flags = 0;
data->return_playback_buffers = BUFFER_COUNT; /* playback_buffers[b][] */
data->return_playback_channels = pchannels + pchannels2; /* playback_buffers[][c] */
data->return_playback_channels = 0; /* playback_buffers[][c] */
data->return_playback_buffer_size = BUFFER_FRAMES; /* frames */
for(i=0; i<BUFFER_COUNT; i++)
for(j=0; j<pchannels; j++)
echo_stream_get_nth_buffer(card->pstream, j, i,
&data->playback_buffers[i][j].base,
&data->playback_buffers[i][j].stride);
for(i=0; i<BUFFER_COUNT; i++)
for(j=0; j<pchannels2; j++)
echo_stream_get_nth_buffer(card->pstream2, j, i,
&data->playback_buffers[i][pchannels + j].base,
&data->playback_buffers[i][pchannels + j].stride);
LIST_FOREACH(stream, &card->streams, next) {
if ((stream->use & ECHO_USE_PLAY) == 0)
continue;
LOG(("get_buffers pipe %d\n", stream->pipe));
channels = data->return_playback_channels;
data->return_playback_channels += stream->channels;
if (data->request_playback_channels < data->return_playback_channels) {
LOG(("not enough channels\n"));
}
for(i=0; i<BUFFER_COUNT; i++)
for(j=0; j<stream->channels; j++)
echo_stream_get_nth_buffer(stream, j, i,
&data->playback_buffers[i][channels+j].base,
&data->playback_buffers[i][channels+j].stride);
}
data->return_record_buffers = BUFFER_COUNT;
data->return_record_channels = rchannels;
data->return_record_channels = 0;
data->return_record_buffer_size = BUFFER_FRAMES; /* frames */
for(i=0; i<BUFFER_COUNT; i++)
for(j=0; j<rchannels; j++)
echo_stream_get_nth_buffer(card->rstream, j, i,
&data->record_buffers[i][j].base,
&data->record_buffers[i][j].stride);
LIST_FOREACH(stream, &card->streams, next) {
if ((stream->use & ECHO_USE_PLAY) != 0)
continue;
LOG(("get_buffers pipe %d\n", stream->pipe));
channels = data->return_record_channels;
data->return_record_channels += stream->channels;
if (data->request_record_channels < data->return_record_channels) {
LOG(("not enough channels\n"));
}
for(i=0; i<BUFFER_COUNT; i++)
for(j=0; j<stream->channels; j++)
echo_stream_get_nth_buffer(stream, j, i,
&data->record_buffers[i][channels+j].base,
&data->record_buffers[i][channels+j].stride);
}
return B_OK;
}
@ -679,17 +688,17 @@ static status_t
echo_buffer_exchange(echo_dev *card, multi_buffer_info *data)
{
cpu_status status;
echo_stream *pstream, *rstream;
echo_stream *pstream, *rstream, *stream;
data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD;
if (!(card->pstream->state & ECHO_STATE_STARTED))
echo_stream_start(card->pstream, echo_play_inth, card->pstream);
if (!(card->pstream2->state & ECHO_STATE_STARTED))
echo_stream_start(card->pstream2, echo_play_inth, card->pstream2);
if (!(card->rstream->state & ECHO_STATE_STARTED))
echo_stream_start(card->rstream, echo_record_inth, card->rstream);
LIST_FOREACH(stream, &card->streams, next) {
if ((stream->state & ECHO_STATE_STARTED) != 0)
continue;
echo_stream_start(stream,
(stream->use & ECHO_USE_PLAY == 0) ? echo_record_inth : echo_play_inth, stream);
}
if(acquire_sem_etc(card->buffer_ready_sem, 1, B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000)
== B_TIMED_OUT) {
LOG(("buffer_exchange timeout ff\n"));
@ -841,13 +850,14 @@ static status_t
echo_open(const char *name, uint32 flags, void** cookie)
{
echo_dev *card = NULL;
int ix;
int ix, i, first_record_channel;
echo_stream *stream = NULL;
LOG(("echo_open()\n"));
for (ix=0; ix<num_cards; ix++) {
if (!strcmp(cards[ix].name, name)) {
card = &cards[ix];
for (i=0; i<num_cards; i++) {
if (!strcmp(cards[i].name, name)) {
card = &cards[i];
}
}
@ -865,30 +875,35 @@ echo_open(const char *name, uint32 flags, void** cookie)
return B_ERROR;
if (card->rstream != NULL)
return B_ERROR;
if (card->pstream2 != NULL)
return B_ERROR;
*cookie = card;
card->multi.card = card;
LOG(("stream_new\n"));
card->rstream = echo_stream_new(card, ECHO_USE_RECORD, BUFFER_FRAMES, BUFFER_COUNT);
card->pstream2= echo_stream_new(card, ECHO_USE_PLAY, BUFFER_FRAMES, BUFFER_COUNT);
card->pstream = echo_stream_new(card, ECHO_USE_PLAY, BUFFER_FRAMES, BUFFER_COUNT);
LOG(("creating play streams\n"));
for (i=card->caps.wNumPipesOut - 2; i >=0 ; i-=2) {
stream = echo_stream_new(card, ECHO_USE_PLAY, BUFFER_FRAMES, BUFFER_COUNT);
if (!card->pstream)
card->pstream = stream;
echo_stream_set_audioparms(stream, 2, 16, 48000, i);
stream->first_channel = i;
}
first_record_channel = card->caps.wNumPipesOut;
LOG(("creating record streams\n"));
for (i=card->caps.wNumPipesIn - 2; i >= 0; i-=2) {
stream = echo_stream_new(card, ECHO_USE_RECORD, BUFFER_FRAMES, BUFFER_COUNT);
if (!card->rstream)
card->rstream = stream;
echo_stream_set_audioparms(stream, 2, 16, 48000, i);
stream->first_channel = i + first_record_channel;
}
card->buffer_ready_sem = create_sem(0, "pbuffer ready");
LOG(("stream_setaudio\n"));
echo_stream_set_audioparms(card->pstream, 2, 16, 48000, 0);
echo_stream_set_audioparms(card->pstream2, 2, 16, 48000, 2);
echo_stream_set_audioparms(card->rstream, 2, 16, 48000, 0);
card->pstream->first_channel = 0;
card->pstream2->first_channel = 2;
card->rstream->first_channel = 4;
LOG(("creating channels list\n"));
echo_create_channels_list(&card->multi);
return B_OK;