~ubuntu-branches/ubuntu/oneiric/xmp/oneiric

« back to all changes in this revision

Viewing changes to src/plugin/tunenet/DecodeFramePlayer.c

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2010-01-15 01:15:22 UTC
  • mfrom: (1.1.8 upstream) (4.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100115011522-r4otlsg687ee1yx4
Tags: 3.0.0+20090923-1ubuntu1
* Merge from debian testing (LP: #507732).  Reamining changes:
  + Add PulseAudio support:
    - debian/rules: Add --enable-pulseaudio to ./configure
  + RFE Compile with 128 bit mixer:
    - dpatch support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This is part of the TuneNet XMP plugin
 
2
 * written by Chris Young <chris@unsatisfactorysoftware.co.uk>
 
3
 * based on an example plugin by Paul Heams
 
4
 */
 
5
 
 
6
#include <exec/exec.h>
 
7
#include <proto/exec.h>
 
8
#include <dos/dos.h>
 
9
#include <utility/tagitem.h>
 
10
#include "include/proto/TNPlug.h"
 
11
#include <stdarg.h>
 
12
 
 
13
#include "include/LibBase.h"
 
14
 
 
15
LONG _TNPlug_DecodeFramePlayer(struct TNPlugIFace *Self, struct TuneNet * inTuneNet, WORD * outbuffer)
 
16
{
 
17
        struct TNPlugLibBase * MyBase = (struct TNPlugLibBase *)Self->Data.LibBase;
 
18
        struct ExecIFace * IExec = MyBase->IExec;
 
19
 
 
20
        ULONG size = 0;
 
21
        void *data;
 
22
 
 
23
        if (inTuneNet && inTuneNet->handle) 
 
24
        {
 
25
                if(xmp_player_frame((xmp_context)inTuneNet->handle) == 0)
 
26
                {
 
27
                        xmp_get_buffer((xmp_context)inTuneNet->handle,&data,&size);
 
28
                        inTuneNet->pcm[0]= data;
 
29
                        inTuneNet->pcm[1]= (inTuneNet->pcm[0]+sizeof(WORD));
 
30
                }
 
31
        }
 
32
        return (LONG)size/inTuneNet->dec_channels/sizeof(WORD); // ** Returning Zero assumes failure, otherwise return No of samples **
 
33
}