Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mauser committed Dec 4, 2014
2 parents 84108a5 + 89b087c commit 6d894d6
Show file tree
Hide file tree
Showing 43 changed files with 2,807 additions and 852 deletions.
Binary file added data/img/gray/instrumentEditor/btn_dropdown_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/gray/instrumentEditor/btn_dropdown_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/gray/instrumentEditor/btn_dropdown_over.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 32 additions & 1 deletion data/xsd/drumkit.xsd
Expand Up @@ -20,6 +20,30 @@
</xsd:restriction>
</xsd:simpleType>

<!-- INSTRUMENT COMPONENT -->
<xsd:element name="instrumentComponent">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="component_id" type="xsd:integer"/>
<xsd:element name="gain" type="xsd:float" default="1.0"/>
<xsd:sequence>
<xsd:element ref="h2:layer" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<!-- DRUMKIT COMPONENT -->
<xsd:element name="drumkitComponent">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:integer"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="volume" type="xsd:float" default="1.0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<!-- LAYER -->
<xsd:element name="layer">
<xsd:complexType>
Expand Down Expand Up @@ -69,7 +93,7 @@
<xsd:element name="FX3Level" type="xsd:decimal" default="0.0" minOccurs="0"/>
<xsd:element name="FX4Level" type="xsd:decimal" default="0.0" minOccurs="0"/>
<xsd:sequence>
<xsd:element ref="h2:layer" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="h2:instrumentComponent" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:sequence>
<!--</xsd:all>-->
Expand All @@ -84,6 +108,13 @@
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="info" type="xsd:string"/>
<xsd:element name="license" type="xsd:string"/>
<xsd:element name="componentList">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="h2:drumkitComponent" maxOccurs="1000"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="instrumentList">
<xsd:complexType>
<xsd:sequence>
Expand Down
10 changes: 9 additions & 1 deletion src/core/include/hydrogen/IO/JackOutput.h
Expand Up @@ -29,6 +29,7 @@
// check if jack support is enabled
#ifdef H2CORE_HAVE_JACK

#include <map>
#include <pthread.h>
#include <jack/jack.h>

Expand All @@ -46,6 +47,10 @@
namespace H2Core
{

class Song;
class Instrument;
class InstrumentComponent;

///
/// Jack (Jack Audio Connection Kit) server driver.
///
Expand Down Expand Up @@ -74,7 +79,7 @@ class JackOutput : public AudioOutput


void makeTrackOutputs( Song * );
void setTrackOutput( int, Instrument * );
void setTrackOutput( int, Instrument *, InstrumentComponent * );

void setConnectDefaults( bool flag ) {
m_bConnectOutFlag = flag;
Expand All @@ -87,6 +92,8 @@ class JackOutput : public AudioOutput
float* getOut_R();
float* getTrackOut_L( unsigned nTrack );
float* getTrackOut_R( unsigned nTrack );
float* getTrackOut_L( Instrument *, InstrumentComponent * );
float* getTrackOut_R( Instrument *, InstrumentComponent * );

int init( unsigned bufferSize );

Expand Down Expand Up @@ -134,6 +141,7 @@ class JackOutput : public AudioOutput
jack_port_t * output_port_2;
QString output_port_name_1;
QString output_port_name_2;
std::map<string,int> track_map;
int track_port_count;
jack_port_t * track_output_ports_L[MAX_INSTRUMENTS];
jack_port_t * track_output_ports_R[MAX_INSTRUMENTS];
Expand Down
12 changes: 11 additions & 1 deletion src/core/include/hydrogen/basics/drumkit.h
Expand Up @@ -30,6 +30,7 @@ namespace H2Core

class XMLNode;
class InstrumentList;
class DrumkitComponent;

/**
* Drumkit info
Expand Down Expand Up @@ -109,7 +110,7 @@ class Drumkit : public H2Core::Object
* \oaram overwrite allows to write over existing drumkit files
* \return true on success
*/
static bool save( const QString& name, const QString& author, const QString& info, const QString& license, InstrumentList* instruments, bool overwrite=false );
static bool save( const QString& name, const QString& author, const QString& info, const QString& license, InstrumentList* instruments, std::vector<DrumkitComponent*>* components, bool overwrite=false );
/**
* install a drumkit from a filename
* \param path the path to the new drumkit archive
Expand Down Expand Up @@ -153,6 +154,9 @@ class Drumkit : public H2Core::Object

void dump();

std::vector<DrumkitComponent*>* get_components();
void set_components( std::vector<DrumkitComponent*>* components );

private:
QString __path; ///< absolute drumkit path
QString __name; ///< drumkit name
Expand All @@ -172,6 +176,7 @@ class Drumkit : public H2Core::Object
* \param dk_path the directory holding the drumkit data
*/
static Drumkit* load_from( XMLNode* node, const QString& dk_path );
std::vector<DrumkitComponent*>* __components; ///< list of drumkit component
};

// DEFINITIONS
Expand Down Expand Up @@ -236,6 +241,11 @@ inline const bool Drumkit::samples_loaded() const
return __samples_loaded;
}

inline std::vector<DrumkitComponent*>* Drumkit::get_components()
{
return __components;
}

};

#endif // H2C_DRUMKIT_H
Expand Down
166 changes: 166 additions & 0 deletions src/core/include/hydrogen/basics/drumkit_component.h
@@ -0,0 +1,166 @@
/*
* Hydrogen
* Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
*
* http://www.hydrogen-music.org
*
* 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#ifndef H2C_DRUMKITCOMPONENT_H
#define H2C_DRUMKITCOMPONENT_H

#include <cassert>
#include <inttypes.h>

#include <hydrogen/object.h>

namespace H2Core
{

class XMLNode;
class ADSR;
class Drumkit;
class InstrumentLayer;

class DrumkitComponent : public H2Core::Object
{
H2_OBJECT
public:
DrumkitComponent( const int id, const QString& name );
DrumkitComponent( DrumkitComponent* other );
~DrumkitComponent();

void save_to( XMLNode* node );
static DrumkitComponent* load_from( XMLNode* node, const QString& dk_path );

void load_from( Drumkit* drumkit, DrumkitComponent* component, bool is_live = true );

void set_name( const QString& name );
const QString& get_name() const;

void set_id( const int id );
int get_id() const;

void set_volume( float volume );
float get_volume() const;

void set_muted( bool active );
bool is_muted() const;

void set_soloed( bool soloed );
bool is_soloed() const;

void set_peak_l( float val );
float get_peak_l() const;
void set_peak_r( float val );
float get_peak_r() const;

void reset_outs( uint32_t nFrames );
void set_outs( int nBufferPos, float valL, float valR );
float get_out_L( int nBufferPos );
float get_out_R( int nBufferPos );

private:
int __id;
QString __name;
float __volume;
bool __muted;
bool __soloed;

float __peak_l;
float __peak_r;

float *__out_L;
float *__out_R;
};

// DEFINITIONS

inline void DrumkitComponent::set_name( const QString& name )
{
__name = name;
}

inline const QString& DrumkitComponent::get_name() const
{
return __name;
}

inline void DrumkitComponent::set_id( const int id )
{
__id = id;
}

inline int DrumkitComponent::get_id() const
{
return __id;
}

inline void DrumkitComponent::set_volume( float volume )
{
__volume = volume;
}

inline float DrumkitComponent::get_volume() const
{
return __volume;
}

inline void DrumkitComponent::set_muted( bool muted )
{
__muted = muted;
}

inline bool DrumkitComponent::is_muted() const
{
return __muted;
}

inline void DrumkitComponent::set_soloed( bool soloed )
{
__soloed = soloed;
}

inline bool DrumkitComponent::is_soloed() const
{
return __soloed;
}

inline void DrumkitComponent::set_peak_l( float val )
{
__peak_l = val;
}

inline float DrumkitComponent::get_peak_l() const
{
return __peak_l;
}

inline void DrumkitComponent::set_peak_r( float val )
{
__peak_r = val;
}

inline float DrumkitComponent::get_peak_r() const
{
return __peak_r;
}

};


#endif

0 comments on commit 6d894d6

Please sign in to comment.