rpms/csound/OLPC-2 csound-5.03.0-add-oggplay.patch, NONE, 1.1 csound.spec, 1.13, 1.14
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Fri Aug 31 15:49:08 UTC 2007
Author: dcbw
Update of /cvs/extras/rpms/csound/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9778
Modified Files:
csound.spec
Added Files:
csound-5.03.0-add-oggplay.patch
Log Message:
* Fri Aug 31 2007 Dan Williams <dcbw at redhat.com> - 5.07.0-0.3.cvs20070830
- Add oggplay patch
csound-5.03.0-add-oggplay.patch:
--- NEW FILE csound-5.03.0-add-oggplay.patch ---
--- csound5/SConstruct.add-oggplay 2007-08-31 11:17:34.000000000 -0400
+++ csound5/SConstruct 2007-08-31 11:18:07.000000000 -0400
@@ -132,6 +132,9 @@ else:
commandOptions.Add('useUDP',
'Set to 1 if you want UDP support',
'0')
+commandOptions.Add('useOGG',
+ 'Set to 1 to build ogg opcodes',
+ '1')
commandOptions.Add('buildPythonOpcodes',
'Set to 1 to build Python opcodes',
'0')
@@ -1359,6 +1362,18 @@ else:
# end udp opcodes
+
+# OGG opcodes
+if commonEnvironment['useOGG'] == '0':
+ print "CONFIGURATION DECISION: Not building OGG plugins."
+else:
+ print "CONFIGURATION DECISION: Building OGG plugins."
+ oggEnvironment = pluginEnvironment.Copy()
+ oggEnvironment.Append(LINKFLAGS = ['-lvorbisfile', '-lvorbis', '-logg'])
+ makePlugin(oggEnvironment, 'oggplay', ['Opcodes/oggplay.c'])
+# end ogg opcodes
+
+
# FLUIDSYNTH OPCODES
if not (commonEnvironment['useFluidsynth'] == '1' and fluidsynthFound):
--- /dev/null 2007-08-31 07:17:38.862691409 -0400
+++ csound5/Opcodes/oggplay.c 2007-08-31 11:17:34.000000000 -0400
@@ -0,0 +1,144 @@
+#include <vorbis/vorbisfile.h>
+#include <inttypes.h>
+
+#include "csdl.h"
+
+#define OGGPLAY_MAXCHAN 2
+#define OGGPLAY_BUFLEN 1024
+
+typedef struct
+{
+ OPDS h;
+ MYFLT *aout[OGGPLAY_MAXCHAN]; /// outarg
+ MYFLT* *ifilename, *iseek; /// inargs
+ OggVorbis_File vf;
+ int bs;
+ int nsamples;
+ int buflen;
+ int doperf;
+ int nchannels;
+ int16_t *pint;
+ AUXCH pbuf;
+} OGGPLAY;
+
+
+int oggplay_init (CSOUND *csound, OGGPLAY * p)
+{
+ FILE *in;
+ char name[1024];
+ float iseek = *p->iseek;
+
+ /// check number of channels
+ p->nchannels = (int) (p->OUTOCOUNT);
+ if (p->nchannels < 1 || p->nchannels > OGGPLAY_MAXCHAN) {
+ return csound->InitError(csound, Str("oggplay: invalid number of channels"));
+ }
+
+ csound->strarg2name(csound, name, p->ifilename, "oggplay.", p->XSTRCODE);
+ in = fopen(name, "rb");
+ if(!in) {
+ return csound->InitError(csound, Str("oggplay: Failed to open file"));
+ }
+
+ if(ov_open(in, &p->vf, NULL, 0) < 0) {
+ fclose(in);
+ return csound->InitError(csound, Str("oggplay: Failed to open input as vorbis"));
+ }
+
+ /// check number of channels in file (must be equal the number of outargs)
+ if (ov_info(&p->vf, 0)->channels != p->nchannels) {
+ return csound->InitError(csound, Str("oggplay: number of output args "
+ "inconsistent with number of file channels"));
+ }
+
+ p->bs = 0;
+ p->nsamples = 0;
+ p->buflen = OGGPLAY_BUFLEN;
+ p->pint=NULL;
+ p->doperf = 1;
+
+ csound->AuxAlloc(csound, p->buflen, &(p->pbuf));
+
+ if(iseek){
+ if(ov_seekable(&p->vf)) {
+ /// get the total time in seconds of the physical bitstream
+ double length=ov_time_total(&p->vf,-1);
+ if(length > iseek){
+ csound->Message(csound, Str("oggplay: seek file to sec=%f \n"), iseek);
+ ov_time_seek(&p->vf, iseek);
+ }
+ else
+ csound->Message(csound, Str("oggplay: seek_point=%f > file_length=%f \n"), iseek, length);
+ }
+ else
+ csound->Message(csound, Str("oggplay: file is not seekable \n"));
+ }
+
+ return OK;
+}
+
+
+int oggplay_perf (CSOUND *csound, OGGPLAY * p)
+{
+ int ret;
+ int i, nsmps=csound->ksmps;
+
+
+ for (i = 0; i < nsmps; i++)
+ {
+ if (p->doperf == 1)
+ {
+ if(p->nsamples < p->nchannels)
+ {
+ if((ret = ov_read(&p->vf, p->pbuf.auxp, p->buflen, 0, 2, 1, &p->bs)) != 0)
+ {
+ if(p->bs != 0)
+ csound->Message(csound, Str("oggplay: Only one logical bitstream currently supported\n"));
+ if(ret < 0 )
+ csound->Message(csound, Str("oggplay: Warning hole in data\n"));
+ p->pint = (int16_t*) p->pbuf.auxp;
+ p->nsamples = ret/2;
+ p->doperf = 1;
+ }
+ else{
+ ov_clear(&p->vf);
+ /// End of file
+ p->doperf = 0;
+ return OK;
+ }
+ }
+ if (p->nchannels == 1) {
+ p->aout[0][i] = (MYFLT) (*p->pint);
+ }
+ else if (p->nchannels == 2) {
+ p->aout[0][i] = (MYFLT) (*p->pint);
+ (p->pint+=1);
+ p->nsamples-=1;
+ p->aout[1][i] = (MYFLT) (*p->pint);
+ }
+ (p->pint+=1);
+ p->nsamples-=1;
+ }
+ else{
+ if (p->nchannels == 1)
+ p->aout[0][i] = (MYFLT) 0;
+ else if (p->nchannels == 2) {
+ p->aout[0][i] = (MYFLT) 0;
+ p->aout[1][i] = (MYFLT) 0;
+ }
+ }
+ }
+ return OK;
+}
+
+
+
+#define S(x) sizeof(x)
+
+static OENTRY localops[] = {
+ { "oggplay", S(OGGPLAY), 5, "mm", "To",
+ (SUBR) oggplay_init, (SUBR) NULL, (SUBR) oggplay_perf }
+};
+
+LINKAGE
+
Index: csound.spec
===================================================================
RCS file: /cvs/extras/rpms/csound/OLPC-2/csound.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- csound.spec 30 Aug 2007 22:57:58 -0000 1.13
+++ csound.spec 31 Aug 2007 15:48:36 -0000 1.14
@@ -11,7 +11,7 @@
Summary: Csound - sound synthesis language and library
Name: csound
Version: 5.07.0
-Release: 0.2.cvs20070830%{?dist}
+Release: 0.3.cvs20070830%{?dist}
URL: http://csound.sourceforge.net/
License: LGPL
Group: Applications/Multimedia
@@ -43,6 +43,7 @@
Patch4: csound-5.03.0-default-opcodedir.patch
Patch5: csound-5.03.0-rtalsa-fix.patch
Patch6: csound-5.07-log-segfault-fix.patch
+Patch7: csound-5.03.0-add-oggplay.patch
%description
Csound is a sound and music synthesis system, providing facilities for
@@ -188,6 +189,7 @@
%patch4 -p1 -b .default-opcodedir
%patch5 -p1 -b .rtalsa-fix
%patch6 -p1 -b .logfile-segfault-fix
+%patch7 -p1 -b .add-oggplay
tar xf %{SOURCE1}
@@ -205,6 +207,7 @@
useALSA=1 \
usePortAudio=0 \
usePortMIDI=0 \
+ useOGG=1 \
useOSC=1 \
useJack=1 \
useFLTK=1 \
@@ -320,6 +323,7 @@
%{_libdir}/%{name}/plugins/libmixer.so
%{_libdir}/%{name}/plugins/libmodal4.so
%{_libdir}/%{name}/plugins/libmutexops.so
+%{_libdir}/%{name}/plugins/liboggplay.so
%{_libdir}/%{name}/plugins/libpartikkel.so
%{_libdir}/%{name}/plugins/libphisem.so
%{_libdir}/%{name}/plugins/libphysmod.so
@@ -415,6 +419,9 @@
%doc tutorial/*.py
%changelog
+* Fri Aug 31 2007 Dan Williams <dcbw at redhat.com> - 5.07.0-0.3.cvs20070830
+- Add oggplay patch
+
* Thu Aug 30 2007 Dan Williams <dcbw at redhat.com> - 5.07.0-0.2.cvs20070830
- Fix segfault when no logfile is specified
More information about the fedora-extras-commits
mailing list