/*
  Copyright (c) 2021 Alex Diener
  
  This software is provided 'as-is', without any express or implied
  warranty. In no event will the authors be held liable for any damages
  arising from the use of this software.
  
  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:
  
  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
  
  Alex Diener alex@ludobloom.com
*/

#ifndef __WaveSampler_sawtooth_H__
#define __WaveSampler_sawtooth_H__

typedef struct WaveSampler_sawtooth WaveSampler_sawtooth;
#define WaveSampler_sawtooth_superclass WaveSampler

#include "audiosynth/WaveSampler.h"

#define WaveSampler_sawtooth_ivars \
	WaveSampler_ivars \
	\
	float incline; \
	float amplitude;

#define WaveSampler_sawtooth_vtable(self_type) \
	WaveSampler_vtable(self_type)

stemobject_declare(WaveSampler_sawtooth)

WaveSampler_sawtooth * WaveSampler_sawtooth_create(float incline, float amplitude);
bool WaveSampler_sawtooth_init(WaveSampler_sawtooth * self, float incline, float amplitude);
void WaveSampler_sawtooth_dispose(WaveSampler_sawtooth * self);

WaveSampler_sawtooth * WaveSampler_sawtooth_copy(WaveSampler_sawtooth * self);
bool WaveSampler_sawtooth_isEqual(WaveSampler_sawtooth * self, compat_type(WaveSampler_sawtooth *) compare);
uint32_t WaveSampler_sawtooth_hash(WaveSampler_sawtooth * self, uint32_t initval);
void WaveSampler_sawtooth_initCopy(WaveSampler_sawtooth * self, WaveSampler_sawtooth * original);
SamplerObject_state * WaveSampler_sawtooth_initState(WaveSampler_sawtooth * self);
void WaveSampler_sawtooth_disposeState(WaveSampler_sawtooth * self, SamplerObject_state * state);
unsigned int WaveSampler_sawtooth_getPropertyCount(WaveSampler_sawtooth * self);
SynthProperty WaveSampler_sawtooth_getPropertyAtIndex(WaveSampler_sawtooth * self, unsigned int index);
float WaveSampler_sawtooth_getPropertyValueStateless(WaveSampler_sawtooth * self, SynthPropertyIdentifier propertyIdentifier);
void WaveSampler_sawtooth_setPropertyValue(WaveSampler_sawtooth * self, SamplerObject_state * state, SynthPropertyIdentifier propertyIdentifier, float value);
float WaveSampler_sawtooth_sample(WaveSampler_sawtooth * self, SamplerObject_state * state, float phase, float phaseDelta, float time, float timeDelta);

#endif
