From 72c0b4ed83223f01968b1a6932e2eeb635e0524e Mon Sep 17 00:00:00 2001 From: deadwood Date: Sun, 8 Nov 2015 17:17:04 +0000 Subject: [PATCH] alsa.audio: add debug logs git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@51205 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/devs/AHI/Drivers/Alsa/alsa-bridge/alsa_hostlib.c | 6 ++++++ workbench/devs/AHI/Drivers/Alsa/alsa-init.c | 5 +++++ workbench/devs/AHI/Drivers/Alsa/alsa-main.c | 10 ++++++++++ workbench/devs/AHI/Drivers/Alsa/alsa-playslave.c | 2 ++ 4 files changed, 23 insertions(+) diff --git a/workbench/devs/AHI/Drivers/Alsa/alsa-bridge/alsa_hostlib.c b/workbench/devs/AHI/Drivers/Alsa/alsa-bridge/alsa_hostlib.c index eda1266ff2..6bdb93b6ac 100644 --- a/workbench/devs/AHI/Drivers/Alsa/alsa-bridge/alsa_hostlib.c +++ b/workbench/devs/AHI/Drivers/Alsa/alsa-bridge/alsa_hostlib.c @@ -66,13 +66,19 @@ BOOL ALSA_HostLib_Init() HostLibBase = OpenResource("hostlib.resource"); if (!HostLibBase) + { + D(bug("[ALSA] failed to open hostlib.resource\n")); return FALSE; + } libasoundhandle = hostlib_load_so(LIBASOUND_SOFILE, alsa_func_names, ALSA_NUM_FUNCS, (void **)&alsa_func); if (!libasoundhandle) + { + bug("[ALSA] failed to open "LIBASOUND_SOFILE"\n"); return FALSE; + } return TRUE; } diff --git a/workbench/devs/AHI/Drivers/Alsa/alsa-init.c b/workbench/devs/AHI/Drivers/Alsa/alsa-init.c index da98e5d823..feff6387b2 100644 --- a/workbench/devs/AHI/Drivers/Alsa/alsa-init.c +++ b/workbench/devs/AHI/Drivers/Alsa/alsa-init.c @@ -1,4 +1,5 @@ +#include #include #include "library.h" @@ -15,6 +16,8 @@ DriverInit( struct DriverBase* AHIsubBase ) { struct AlsaBase* AlsaBase = (struct AlsaBase*) AHIsubBase; + D(bug("[Alsa]: DriverInit()\n")); + AlsaBase->dosbase = (struct DosLibrary *)OpenLibrary( DOSNAME, 37 ); if( AlsaBase->dosbase == NULL ) @@ -26,6 +29,8 @@ DriverInit( struct DriverBase* AHIsubBase ) if (!ALSA_Init()) return FALSE; + D(bug("[Alsa]: DriverInit() completed\n")); + return TRUE; } diff --git a/workbench/devs/AHI/Drivers/Alsa/alsa-main.c b/workbench/devs/AHI/Drivers/Alsa/alsa-main.c index e5bc2073fa..aaccf06e15 100644 --- a/workbench/devs/AHI/Drivers/Alsa/alsa-main.c +++ b/workbench/devs/AHI/Drivers/Alsa/alsa-main.c @@ -1,3 +1,4 @@ +#include #include #include @@ -44,6 +45,8 @@ _AHIsub_AllocAudio( struct TagItem* taglist, struct AlsaBase* AlsaBase = (struct AlsaBase*) AHIsubBase; ULONG freq = AudioCtrl->ahiac_MixFreq; + D(bug("[Alsa]: AllocAudio enter\n")); + AudioCtrl->ahiac_DriverData = AllocVec( sizeof( struct AlsaData ), MEMF_CLEAR | MEMF_PUBLIC ); @@ -68,11 +71,13 @@ _AHIsub_AllocAudio( struct TagItem* taglist, if (dd->alsahandle == NULL) { + bug("[Alsa]: Failed opening ALSA\n"); return AHISF_ERROR; } if (!ALSA_SetHWParams(dd->alsahandle, &freq)) { + bug("[Alsa]: Failed setting ALSA hardware parameters\n"); ALSA_DropAndClose(dd->alsahandle); dd->alsahandle = NULL; return AHISF_ERROR; @@ -80,6 +85,8 @@ _AHIsub_AllocAudio( struct TagItem* taglist, AudioCtrl->ahiac_MixFreq = freq; + D(bug("[Alsa]: AllocAudio completed\n")); + return ( AHISF_KNOWSTEREO | AHISF_MIXING | AHISF_TIMING ); } @@ -164,6 +171,8 @@ _AHIsub_Start( ULONG flags, if( dd->mixbuffer == NULL ) return AHIE_NOMEM; + D(bug("[Alsa]: AHIsub_Start\n")); + Forbid(); dd->slavetask = CreateNewProc( proctags ); @@ -233,6 +242,7 @@ _AHIsub_Stop( ULONG flags, { Signal( (struct Task*) dd->slavetask, 1L << dd->slavesignal ); // Kill him! + D(bug("[Alsa]: AHIsub_Stop\n")); } Wait( 1L << dd->mastersignal ); // Wait for slave to die diff --git a/workbench/devs/AHI/Drivers/Alsa/alsa-playslave.c b/workbench/devs/AHI/Drivers/Alsa/alsa-playslave.c index 1a9876425d..59eb1e7cc6 100644 --- a/workbench/devs/AHI/Drivers/Alsa/alsa-playslave.c +++ b/workbench/devs/AHI/Drivers/Alsa/alsa-playslave.c @@ -113,6 +113,7 @@ Slave( struct ExecBase* SysBase ) framesfree = ALSA_Avail(dd->alsahandle); if (framesfree == ALSA_XRUN) { + D(bug("[Alsa] ALSA_Avail() == XRUN\n")); ALSA_Prepare(dd->alsahandle); framesfree = ALSA_Avail(dd->alsahandle); } @@ -147,6 +148,7 @@ Slave( struct ExecBase* SysBase ) framesfree)); if (written == ALSA_XRUN) { + D(bug("[Alsa] ALSA_Write() == XRUN %d, %d\n", framesfree, framesready)); ALSA_Prepare(dd->alsahandle); written = ALSA_Write(dd->alsahandle, framesptr, min(framesready, framesfree)); -- 2.11.4.GIT