Re: Zinf 2.2.4 Will Not Compile!

David Vrabel <[email protected]> Sat, 24 Jan 2004 17:46:11 +0000
Newsgroups gmane.comp.audio.zinf.devel
Message-ID <[email protected]>
Steve Holmes wrote:
> I attempted to compile zinf 2.2.4 from sources today on my Slackware
> 9.1 with gcc version 3.2.3 and I keep getting a "invalid integer
> conversion".
> [...]
> make[2]: Entering directory `/home/steve/zinf-2.2.4/io/alsa'
 > [...]
> g++ -DHAVE_CONFIG_H -I. -I. -I../../config -D_REENTRANT -I../../base/include -I../../base/unix/include -I../../lib/utf8 -I../../ui/include -I../../lmc/include -I../../io/include -I./unix/linux/include -Wall -O -MT alsapmo.lo -MD -MP -MF .deps/alsapmo.Tpo -c unix/linux/src/alsapmo.cpp  -fPIC -DPIC -o alsapmo.lo
> unix/linux/src/alsapmo.cpp: In member function `virtual Error 
>    AlsaPMO::Init(OutputInfo*)':
> unix/linux/src/alsapmo.cpp:240: invalid conversion from `int' to `unsigned int*'

Try the attached patch (against CVS). It fixes the error for me.

It appears to be caused by Alsa version >= 1.0.0.

David Vrabel
zinf-alsa-compile-fix.patch (text/plain, 1.8 KB)
Index: io/alsa/unix/linux/include/alsapmo.h
===================================================================
RCS file: /cvsroot/zinf/zinf/io/alsa/unix/linux/include/alsapmo.h,v
retrieving revision 1.14
diff -u -b -B -w -p -u -r1.14 alsapmo.h
--- io/alsa/unix/linux/include/alsapmo.h	16 Sep 2003 17:34:57 -0000	1.14
+++ io/alsa/unix/linux/include/alsapmo.h	24 Jan 2004 17:39:06 -0000
@@ -111,7 +111,8 @@ public:
     int		m_iChannel;
     snd_pcm_t	*m_handle;
     FAContext   *m_context;
-    int		m_channels, m_samples, m_samplesPerFrame;
+    int		m_channels, m_samplesPerFrame;
+    unsigned    m_samples;
     long int		totalWrittenToALSABuffer;
 };
 
Index: io/alsa/unix/linux/src/alsapmo.cpp
===================================================================
RCS file: /cvsroot/zinf/zinf/io/alsa/unix/linux/src/alsapmo.cpp,v
retrieving revision 1.28
diff -u -b -B -w -p -u -r1.28 alsapmo.cpp
--- io/alsa/unix/linux/src/alsapmo.cpp	16 Sep 2003 17:34:57 -0000	1.28
+++ io/alsa/unix/linux/src/alsapmo.cpp	24 Jan 2004 17:39:06 -0000
@@ -78,7 +78,7 @@ AlsaPMO::AlsaPMO(FAContext *context) :
 
    m_handle = NULL;
    m_channels = -1;
-   m_samples = -1;                                                            
+   m_samples = 0;
     snd_mixer_elem_t *selem;
     snd_mixer_selem_id_t *m_sid;
     snd_mixer_selem_id_alloca(&m_sid);
@@ -238,7 +238,7 @@ Error AlsaPMO::Init(OutputInfo* info) 
     err = snd_pcm_hw_params_set_format(m_handle, params, SND_PCM_FORMAT_S16_BE);
 #endif        
     err = snd_pcm_hw_params_set_channels(m_handle, params, m_channels);
-    err = snd_pcm_hw_params_set_rate_near(m_handle, params, m_samples, 0);
+    err = snd_pcm_hw_params_set_rate_near(m_handle, params, &m_samples, 0);
     err = snd_pcm_hw_params_set_period_size(m_handle, params,m_iDataSize/16, 0);
     err = snd_pcm_hw_params(m_handle, params);
     if (err < 0){