some more work on sound interface

This commit is contained in:
Volker Fischer 2009-03-12 11:56:15 +00:00
parent 17e78fab95
commit d27fab9999
7 changed files with 33 additions and 8 deletions

View file

@ -52,6 +52,7 @@ llcon_SOURCES = ../src/buffer.cpp \
# these need to be generated before the rest can be compiled # these need to be generated before the rest can be compiled
BUILT_SOURCES=moc/moc_server.cpp \ BUILT_SOURCES=moc/moc_server.cpp \
moc/moc_soundbase.cpp \
moc/moc_client.cpp \ moc/moc_client.cpp \
moc/moc_protocol.cpp \ moc/moc_protocol.cpp \
moc/moc_channel.cpp \ moc/moc_channel.cpp \
@ -78,6 +79,9 @@ nodist_llcon_SOURCES=$(BUILT_SOURCES)
dist-hook: dist-hook:
mkdir $(distdir)/moc mkdir $(distdir)/moc
moc/moc_soundbase.cpp: ../src/soundbase.h
$(QT_MOC) ../src/soundbase.h -o moc/moc_soundbase.cpp
moc/moc_server.cpp: ../src/server.h moc/moc_server.cpp: ../src/server.h
$(QT_MOC) ../src/server.h -o moc/moc_server.cpp $(QT_MOC) ../src/server.h -o moc/moc_server.cpp

View file

@ -34,6 +34,9 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pP
// register a "buffer size changed" callback function // register a "buffer size changed" callback function
jack_set_buffer_size_callback ( pJackClient, bufferSizeCallback, this ); jack_set_buffer_size_callback ( pJackClient, bufferSizeCallback, this );
// register shutdown callback function
jack_on_shutdown ( pJackClient, shutdownCallback, this );
// TEST check sample rate, if not correct, just fire error // TEST check sample rate, if not correct, just fire error
if ( jack_get_sample_rate ( pJackClient ) != SND_CRD_SAMPLE_RATE ) if ( jack_get_sample_rate ( pJackClient ) != SND_CRD_SAMPLE_RATE )
{ {
@ -199,10 +202,17 @@ int CSound::bufferSizeCallback ( jack_nframes_t nframes, void *arg )
{ {
CSound* pSound = reinterpret_cast<CSound*> ( arg ); CSound* pSound = reinterpret_cast<CSound*> ( arg );
// TODO actual implementation pSound->EmitReinitRequestSignal();
return 0; // zero on success, non-zero on error return 0; // zero on success, non-zero on error
} }
void CSound::shutdownCallback ( void *arg )
{
// without a Jack server, our software makes no sense to run, throw
// error message
throw CGenErr ( "Jack server was shut down" );
}
# else # else
// Wave in ********************************************************************* // Wave in *********************************************************************
void CSound::InitRecording() void CSound::InitRecording()

View file

@ -80,6 +80,7 @@ protected:
// callbacks // callbacks
static int process ( jack_nframes_t nframes, void* arg ); static int process ( jack_nframes_t nframes, void* arg );
static int bufferSizeCallback ( jack_nframes_t nframes, void *arg ); static int bufferSizeCallback ( jack_nframes_t nframes, void *arg );
static void shutdownCallback ( void *arg );
jack_client_t* pJackClient; jack_client_t* pJackClient;
}; };
# else # else

View file

@ -33,6 +33,8 @@
/* Classes ********************************************************************/ /* Classes ********************************************************************/
class CSoundBase : public QThread class CSoundBase : public QThread
{ {
Q_OBJECT
public: public:
CSoundBase ( const bool bNewIsCallbackAudioInterface, CSoundBase ( const bool bNewIsCallbackAudioInterface,
void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ), void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
@ -48,6 +50,10 @@ public:
virtual void OpenDriverSetup() {} virtual void OpenDriverSetup() {}
// TODO this should be protected but since it is used
// in a callback function it has to be public -> better solution
void EmitReinitRequestSignal() { emit ReinitRequest(); }
protected: protected:
// function pointer to callback function // function pointer to callback function
void (*fpProcessCallback) ( CVector<short>& psData, void* arg ); void (*fpProcessCallback) ( CVector<short>& psData, void* arg );
@ -69,6 +75,9 @@ protected:
bool bIsCallbackAudioInterface; bool bIsCallbackAudioInterface;
CVector<short> vecsAudioSndCrdStereo; CVector<short> vecsAudioSndCrdStereo;
signals:
void ReinitRequest();
}; };
#endif /* !defined ( SOUNDBASE_HOIHGEH8_3_4344456456345634565KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( SOUNDBASE_HOIHGEH8_3_4344456456345634565KJIUHF1912__INCLUDED_ ) */

View file

@ -38,6 +38,7 @@ rem .h --------------
%qtdir%\bin\moc.exe ..\src\socket.h -o moc\moc_socket.cpp %qtdir%\bin\moc.exe ..\src\socket.h -o moc\moc_socket.cpp
%qtdir%\bin\moc.exe ..\src\protocol.h -o moc\moc_protocol.cpp %qtdir%\bin\moc.exe ..\src\protocol.h -o moc\moc_protocol.cpp
%qtdir%\bin\moc.exe ..\src\channel.h -o moc\moc_channel.cpp %qtdir%\bin\moc.exe ..\src\channel.h -o moc\moc_channel.cpp
%qtdir%\bin\moc.exe ..\src\soundbase.h -o moc\moc_soundbase.cpp
rem .ui ------------- rem .ui -------------

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8,00"
Name="llcon" Name="llcon"
ProjectGUID="{DBBC16FC-BBCA-4E3B-A9F4-0EC5202A8B2E}" ProjectGUID="{DBBC16FC-BBCA-4E3B-A9F4-0EC5202A8B2E}"
RootNamespace="llcon" RootNamespace="llcon"
@ -824,6 +824,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath=".\moc\moc_soundbase.cpp"
>
</File>
<File <File
RelativePath="moc\moc_util.cpp" RelativePath="moc\moc_util.cpp"
> >

View file

@ -558,12 +558,8 @@ long CSound::asioMessages ( long selector, long value, void* message, double* op
// both messages might be send if the buffer size changes // both messages might be send if the buffer size changes
case kAsioBufferSizeChange: case kAsioBufferSizeChange:
case kAsioResetRequest: case kAsioResetRequest:
pSound->EmitReinitRequestSignal();
// TODO reinit sound interface and check for new buffer size ret = 1L; // 1L if request is accepted or 0 otherwise
// requires changes in client class, too
ret = 0;//1L; // 1L if request is accepted or 0 otherwise
break; break;
} }
return ret; return ret;