Logo Search packages:      
Sourcecode: scummvm version File versions  Download package


/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2005 The ScummVM project
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * $Header: /cvsroot/scummvm/scummvm/scumm/player_nes.h,v 2005/10/18 02:11:21 sev Exp $

#ifndef PLAYER_NES_H
#define PLAYER_NES_H

#include "common/scummsys.h"
#include "scumm/music.h"
#include "sound/audiostream.h"

namespace Audio {
      class Mixer;

namespace Scumm {

class ScummEngine;

static const int MAXVOLUME = 0x7F;
static const int NUMSLOTS = 3;
static const int NUMCHANS = 4;

 * Scumm NES sound/music driver.
00045 class Player_NES : public AudioStream, public MusicEngine {
      Player_NES(ScummEngine *scumm);
      virtual ~Player_NES();

      virtual void setMusicVolume(int vol);
      virtual void startSound(int sound);
      virtual void stopSound(int sound);
      virtual void stopAllSounds();
      virtual int  getSoundStatus(int sound) const;

      // AudioStream API
      int readBuffer(int16 *buffer, const int numSamples);
00058       bool isStereo() const { return false; }
00059       bool endOfData() const { return false; }
00060       int getRate() const { return _sample_rate; }


      void sound_play();
      void playSFX(int nr);
      void playMusic();
      byte fetchSoundByte(int nr);
      void chainCommand(int chan);
      void checkSilenceChannels(int chan);

      void APU_writeChannel(int chan, int offset, byte value);
      void APU_writeControl(byte value);
      byte APU_readStatus();

      void do_mix(int16 *buf, uint len);

      ScummEngine *_vm;
      Audio::Mixer *_mixer;
      int _sample_rate;
      int _samples_per_frame;
      int _current_sample;
      int _maxvol;

      struct slot {
            int framesleft;
            int id;
            int type;
            byte *data;
            int offset;
      } _slot[NUMSLOTS];

      struct mchan {
            int command;
            int framedelay;
            int pitch;
            int volume;
            int voldelta;
            int envflags;
            int cmdlock;
      } _mchan[NUMCHANS];

      bool isSFXplaying, wasSFXplaying;

      byte *dataStart;
      int numNotes;
      byte *auxData1;
      byte *auxData2;

      byte *soundptr;

} // End of namespace Scumm


Generated by  Doxygen 1.6.0   Back to index