Main Page · Modules · All Classes · Class Hierarchy
MASoundFile.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "MASoundBase.hpp"
25 
26 #include <stdio.h>
27 #include <string>
28 
37 class MASoundFile : public MASoundBase
38 {
39 public:
40  MASoundFile(const std::string& display_name, FILE* file_handler, int start_position,
41  int size, bool caching = false);
42  ~MASoundFile();
43 
44  virtual int GetSize() const;
45  virtual bool IsValid() const;
46  virtual bool IsCached() const;
47  virtual void AddToBuffer(int position, int count, int32_t* buffer);
48 private:
49  void Open(bool caching);
50 
51  FILE* FileHandler;
52  int16_t* Data;
53  int StartPosition;
54  int Size;
55  int CurrentFilePos;
56 };
57 
virtual void AddToBuffer(int position, int count, int32_t *buffer)
Add sound data to a buffer.
Definition: MASoundFile.cpp:63
Base class for sounds.
Definition: MASoundBase.hpp:45
virtual bool IsCached() const
Check if the sound data is cached.
Definition: MASoundFile.cpp:57
virtual bool IsValid() const
Check if the sound data is valid.
Definition: MASoundFile.cpp:51
virtual int GetSize() const
Get the sound data size.
Definition: MASoundFile.cpp:45
Sound file.
Definition: MASoundFile.hpp:37