some more work on sound interface
This commit is contained in:
parent
17e78fab95
commit
d27fab9999
7 changed files with 33 additions and 8 deletions
|
@ -52,6 +52,7 @@ llcon_SOURCES = ../src/buffer.cpp \
|
|||
# these need to be generated before the rest can be compiled
|
||||
|
||||
BUILT_SOURCES=moc/moc_server.cpp \
|
||||
moc/moc_soundbase.cpp \
|
||||
moc/moc_client.cpp \
|
||||
moc/moc_protocol.cpp \
|
||||
moc/moc_channel.cpp \
|
||||
|
@ -78,6 +79,9 @@ nodist_llcon_SOURCES=$(BUILT_SOURCES)
|
|||
dist-hook:
|
||||
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
|
||||
$(QT_MOC) ../src/server.h -o moc/moc_server.cpp
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pP
|
|||
// register a "buffer size changed" callback function
|
||||
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
|
||||
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 );
|
||||
|
||||
// TODO actual implementation
|
||||
pSound->EmitReinitRequestSignal();
|
||||
|
||||
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
|
||||
// Wave in *********************************************************************
|
||||
void CSound::InitRecording()
|
||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
|||
// callbacks
|
||||
static int process ( jack_nframes_t nframes, void* arg );
|
||||
static int bufferSizeCallback ( jack_nframes_t nframes, void *arg );
|
||||
static void shutdownCallback ( void *arg );
|
||||
jack_client_t* pJackClient;
|
||||
};
|
||||
# else
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
/* Classes ********************************************************************/
|
||||
class CSoundBase : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CSoundBase ( const bool bNewIsCallbackAudioInterface,
|
||||
void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
|
||||
|
@ -48,6 +50,10 @@ public:
|
|||
|
||||
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:
|
||||
// function pointer to callback function
|
||||
void (*fpProcessCallback) ( CVector<short>& psData, void* arg );
|
||||
|
@ -69,6 +75,9 @@ protected:
|
|||
bool bIsCallbackAudioInterface;
|
||||
|
||||
CVector<short> vecsAudioSndCrdStereo;
|
||||
|
||||
signals:
|
||||
void ReinitRequest();
|
||||
};
|
||||
|
||||
#endif /* !defined ( SOUNDBASE_HOIHGEH8_3_4344456456345634565KJIUHF1912__INCLUDED_ ) */
|
||||
|
|
|
@ -38,6 +38,7 @@ rem .h --------------
|
|||
%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\channel.h -o moc\moc_channel.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\soundbase.h -o moc\moc_soundbase.cpp
|
||||
|
||||
|
||||
rem .ui -------------
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="llcon"
|
||||
ProjectGUID="{DBBC16FC-BBCA-4E3B-A9F4-0EC5202A8B2E}"
|
||||
RootNamespace="llcon"
|
||||
|
@ -824,6 +824,10 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\moc\moc_soundbase.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="moc\moc_util.cpp"
|
||||
>
|
||||
|
|
|
@ -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
|
||||
case kAsioBufferSizeChange:
|
||||
case kAsioResetRequest:
|
||||
|
||||
// TODO reinit sound interface and check for new buffer size
|
||||
// requires changes in client class, too
|
||||
|
||||
|
||||
ret = 0;//1L; // 1L if request is accepted or 0 otherwise
|
||||
pSound->EmitReinitRequestSignal();
|
||||
ret = 1L; // 1L if request is accepted or 0 otherwise
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue