LMMS
Loading...
Searching...
No Matches
Bank.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 Bank.h - Instrument Bank
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of version 2 of the GNU General Public License
10 as published by the Free Software Foundation.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License (version 2 or later) for more details.
16
17 You should have received a copy of the GNU General Public License (version 2)
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21*/
22
23#ifndef BANK_H
24#define BANK_H
25
26#include <string>
27#include <vector>
28
29//entries in a bank
30#define BANK_SIZE 160
31
33class Bank
34{
35 public:
37 Bank();
38 ~Bank();
39 std::string getname(unsigned int ninstrument);
40 std::string getnamenumbered(unsigned int ninstrument);
41 void setname(unsigned int ninstrument,
42 const std::string &newname,
43 int newslot); //if newslot==-1 then this is ignored, else it will be put on that slot
44 bool isPADsynth_used(unsigned int ninstrument);
45
47 bool emptyslot(unsigned int ninstrument);
48
50 void clearslot(unsigned int ninstrument);
52 void savetoslot(unsigned int ninstrument, class Part * part);
54 void loadfromslot(unsigned int ninstrument, class Part * part);
55
57 void swapslot(unsigned int n1, unsigned int n2);
58
59 int loadbank(std::string bankdirname);
60 int newbank(std::string newbankdirname);
61
62 std::string bankfiletitle; //this is shown on the UI of the bank (the title of the window)
63 int locked();
64
65 void rescanforbanks();
66
67 struct bankstruct {
68 bool operator<(const bankstruct &b) const;
69 std::string dir;
70 std::string name;
71 };
72
73 std::vector<bankstruct> banks;
74
75 private:
76
77 //it adds a filename to the bank
78 //if pos is -1 it try to find a position
79 //returns -1 if the bank is full, or 0 if the instrument was added
80 int addtobank(int pos, std::string filename, std::string name);
81
82 void deletefrombank(int pos);
83
84 void clearbank();
85
86 std::string defaultinsname;
87
88 struct ins_t {
89 ins_t();
90 bool used;
91 std::string name;
92 std::string filename;
93 struct {
97
98 std::string dirname;
99
100 void scanrootdir(std::string rootdir); //scans a root dir for banks
101
103 void expanddirname(std::string &dirname);
104
107 void normalizedirsuffix(std::string &dirname) const;
108};
109
110#endif
#define BANK_SIZE
Definition Bank.h:23
void setname(unsigned int ninstrument, const std::string &newname, int newslot)
int addtobank(int pos, std::string filename, std::string name)
int loadbank(std::string bankdirname)
void clearslot(unsigned int ninstrument)
Definition Bank.cpp:138
std::vector< bankstruct > banks
Definition Bank.h:73
bool isPADsynth_used(unsigned int ninstrument)
Definition Bank.cpp:466
void deletefrombank(int pos)
Definition Bank.cpp:475
std::string bankfiletitle
Definition Bank.h:62
bool emptyslot(unsigned int ninstrument)
Definition Bank.cpp:122
void normalizedirsuffix(std::string &dirname) const
void expanddirname(std::string &dirname)
Definition Bank.cpp:488
int locked()
Definition Bank.cpp:291
void savetoslot(unsigned int ninstrument, class Part *part)
Definition Bank.cpp:150
int newbank(std::string newbankdirname)
std::string dirname
Definition Bank.h:98
std::string defaultinsname
Definition Bank.h:86
void loadfromslot(unsigned int ninstrument, class Part *part)
Definition Bank.cpp:179
void rescanforbanks()
Definition Bank.cpp:333
~Bank()
Definition Bank.cpp:63
Bank()
Definition Bank.cpp:55
void clearbank()
Definition Bank.cpp:417
std::string getnamenumbered(unsigned int ninstrument)
Definition Bank.cpp:81
std::string getname(unsigned int ninstrument)
Definition Bank.cpp:71
void scanrootdir(std::string rootdir)
void swapslot(unsigned int n1, unsigned int n2)
Definition Bank.cpp:299
struct Bank::ins_t ins[BANK_SIZE]
Definition Part.h:45
static char filename[]
Definition features.c:5
static const char * name
Definition pugl.h:1582
struct backing_store_struct * info
Definition jmemsys.h:183
Definition Bank.h:67
std::string name
Definition Bank.h:70
std::string dir
Definition Bank.h:69
bool operator<(const bankstruct &b) const
Definition Bank.cpp:324
std::string name
Definition Bank.h:91
bool PADsynth_used
Definition Bank.h:94
ins_t()
Definition Bank.cpp:482
std::string filename
Definition Bank.h:92
bool used
Definition Bank.h:90
b
Definition crypt.c:628