| 1 |
|
| 2 |
nn |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include <glib.h> |
| 21 |
#include <glib-object.h> |
| 22 |
|
| 23 |
#include <CUnit/CUnit.h> |
| 24 |
#include <CUnit/Automated.h> |
| 25 |
#include <CUnit/Basic.h> |
| 26 |
|
| 27 |
#include <ags/libags.h> |
| 28 |
#include <ags/libags-audio.h> |
| 29 |
|
| 30 |
#include <math.h> |
| 31 |
|
| 32 |
int ags_fx_envelope_audio_signal_test_init_suite(); |
| 33 |
int ags_fx_envelope_audio_signal_test_clean_suite(); |
| 34 |
|
| 35 |
void ags_fx_envelope_audio_signal_test_new(); |
| 36 |
void ags_fx_envelope_audio_signal_test_run_inter(); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
int |
| 43 |
ags_fx_envelope_audio_signal_test_init_suite() |
| 44 |
{ |
| 45 |
return(0); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
int |
| 53 |
ags_fx_envelope_audio_signal_test_clean_suite() |
| 54 |
{ |
| 55 |
return(0); |
| 56 |
} |
| 57 |
|
| 58 |
void |
| 59 |
ags_fx_envelope_audio_signal_test_new() |
| 60 |
{ |
| 61 |
AgsAudioSignal *audio_signal; |
| 62 |
AgsFxEnvelopeAudioSignal *fx_envelope_audio_signal; |
| 63 |
|
| 64 |
audio_signal = g_object_new(AGS_TYPE_AUDIO_SIGNAL, |
| 65 |
NULL); |
| 66 |
|
| 67 |
fx_envelope_audio_signal = ags_fx_envelope_audio_signal_new(audio_signal); |
| 68 |
|
| 69 |
CU_ASSERT(fx_envelope_audio_signal != NULL); |
| 70 |
CU_ASSERT(AGS_RECALL_AUDIO_SIGNAL(fx_envelope_audio_signal)->source == audio_signal); |
| 71 |
} |
| 72 |
|
| 73 |
void |
| 74 |
ags_fx_envelope_audio_signal_test_run_inter() |
| 75 |
{ |
| 76 |
AgsAlsaDevout *devout; |
| 77 |
AgsAudio *audio; |
| 78 |
AgsChannel *channel; |
| 79 |
AgsRecycling *recycling; |
| 80 |
AgsAudioSignal *template, *audio_signal; |
| 81 |
AgsNote *note; |
| 82 |
AgsRecallContainer *recall_container; |
| 83 |
AgsFxEnvelopeAudio *fx_envelope_audio; |
| 84 |
AgsFxEnvelopeAudioProcessor *fx_envelope_audio_processor; |
| 85 |
AgsFxEnvelopeChannel *fx_envelope_channel; |
| 86 |
AgsFxEnvelopeChannelProcessor *fx_envelope_channel_processor; |
| 87 |
AgsFxEnvelopeRecycling *fx_envelope_recycling; |
| 88 |
AgsFxEnvelopeAudioSignal *fx_envelope_audio_signal; |
| 89 |
|
| 90 |
GValue value = {0,}; |
| 91 |
|
| 92 |
devout = ags_alsa_devout_new(); |
| 93 |
|
| 94 |
|
| 95 |
audio = g_object_new(AGS_TYPE_AUDIO, |
| 96 |
"output-soundcard", devout, |
| 97 |
NULL); |
| 98 |
|
| 99 |
recall_container = ags_recall_container_new(); |
| 100 |
ags_audio_add_recall_container(audio, |
| 101 |
recall_container); |
| 102 |
|
| 103 |
fx_envelope_audio = ags_fx_envelope_audio_new(audio); |
| 104 |
ags_recall_set_sound_scope(fx_envelope_audio, AGS_SOUND_SCOPE_PLAYBACK); |
| 105 |
ags_recall_container_add(recall_container, |
| 106 |
fx_envelope_audio); |
| 107 |
|
| 108 |
CU_ASSERT(fx_envelope_audio != NULL); |
| 109 |
|
| 110 |
|
| 111 |
fx_envelope_audio_processor = ags_fx_envelope_audio_processor_new(audio); |
| 112 |
ags_recall_set_sound_scope(fx_envelope_audio_processor, AGS_SOUND_SCOPE_PLAYBACK); |
| 113 |
|
| 114 |
g_object_set(fx_envelope_audio_processor, |
| 115 |
"recall-audio", fx_envelope_audio, |
| 116 |
NULL); |
| 117 |
|
| 118 |
ags_recall_container_add(recall_container, |
| 119 |
fx_envelope_audio_processor); |
| 120 |
|
| 121 |
CU_ASSERT(fx_envelope_audio_processor != NULL); |
| 122 |
|
| 123 |
|
| 124 |
channel = g_object_new(AGS_TYPE_CHANNEL, |
| 125 |
NULL); |
| 126 |
|
| 127 |
ags_channel_add_recall_container(channel, |
| 128 |
recall_container); |
| 129 |
|
| 130 |
fx_envelope_channel = ags_fx_envelope_channel_new(channel); |
| 131 |
ags_recall_set_sound_scope(fx_envelope_channel, AGS_SOUND_SCOPE_PLAYBACK); |
| 132 |
|
| 133 |
g_object_set(fx_envelope_channel, |
| 134 |
"recall-audio", fx_envelope_audio, |
| 135 |
NULL); |
| 136 |
|
| 137 |
ags_recall_container_add(recall_container, |
| 138 |
fx_envelope_channel); |
| 139 |
|
| 140 |
CU_ASSERT(fx_envelope_channel != NULL); |
| 141 |
|
| 142 |
|
| 143 |
fx_envelope_channel_processor = ags_fx_envelope_channel_processor_new(channel); |
| 144 |
ags_recall_set_sound_scope(fx_envelope_channel_processor, AGS_SOUND_SCOPE_PLAYBACK); |
| 145 |
|
| 146 |
g_object_set(fx_envelope_channel_processor, |
| 147 |
"recall-audio", fx_envelope_audio, |
| 148 |
"recall-channel", fx_envelope_channel, |
| 149 |
NULL); |
| 150 |
|
| 151 |
ags_recall_container_add(recall_container, |
| 152 |
fx_envelope_channel_processor); |
| 153 |
|
| 154 |
CU_ASSERT(fx_envelope_channel_processor != NULL); |
| 155 |
|
| 156 |
|
| 157 |
recycling = g_object_new(AGS_TYPE_RECYCLING, |
| 158 |
NULL); |
| 159 |
|
| 160 |
fx_envelope_recycling = ags_fx_envelope_recycling_new(recycling); |
| 161 |
ags_recall_set_sound_scope(fx_envelope_recycling, AGS_SOUND_SCOPE_PLAYBACK); |
| 162 |
|
| 163 |
ags_recall_add_child(fx_envelope_channel_processor, |
| 164 |
fx_envelope_recycling); |
| 165 |
|
| 166 |
CU_ASSERT(fx_envelope_recycling != NULL); |
| 167 |
|
| 168 |
|
| 169 |
template = g_object_new(AGS_TYPE_AUDIO_SIGNAL, |
| 170 |
"output-soundcard", devout, |
| 171 |
NULL); |
| 172 |
|
| 173 |
audio_signal = g_object_new(AGS_TYPE_AUDIO_SIGNAL, |
| 174 |
"output-soundcard", devout, |
| 175 |
"default-template", template, |
| 176 |
NULL); |
| 177 |
|
| 178 |
ags_audio_signal_stream_resize(audio_signal, |
| 179 |
3); |
| 180 |
audio_signal->stream_current = audio_signal->stream; |
| 181 |
|
| 182 |
note = ags_note_new(); |
| 183 |
g_object_set(note, |
| 184 |
"x0", 0, |
| 185 |
"x1", 1, |
| 186 |
NULL); |
| 187 |
g_object_set(audio_signal, |
| 188 |
"note", note, |
| 189 |
NULL); |
| 190 |
|
| 191 |
fx_envelope_audio_signal = ags_fx_envelope_audio_signal_new(audio_signal); |
| 192 |
ags_recall_set_sound_scope(fx_envelope_audio_signal, AGS_SOUND_SCOPE_PLAYBACK); |
| 193 |
|
| 194 |
ags_recall_add_child(fx_envelope_recycling, |
| 195 |
fx_envelope_audio_signal); |
| 196 |
|
| 197 |
CU_ASSERT(fx_envelope_audio_signal != NULL); |
| 198 |
|
| 199 |
|
| 200 |
ags_recall_run_inter(fx_envelope_audio_signal); |
| 201 |
|
| 202 |
|
| 203 |
audio_signal->stream_current = NULL; |
| 204 |
|
| 205 |
ags_recall_run_inter(fx_envelope_audio_signal); |
| 206 |
} |
| 207 |
|
| 208 |
int |
| 209 |
main(int argc, char **argv) |
| 210 |
{ |
| 211 |
CU_pSuite pSuite = NULL; |
| 212 |
|
| 213 |
putenv("LC_ALL=C"); |
| 214 |
putenv("LANG=C"); |
| 215 |
|
| 216 |
putenv("LADSPA_PATH=\"\""); |
| 217 |
putenv("DSSI_PATH=\"\""); |
| 218 |
putenv("LV2_PATH=\"\""); |
| 219 |
|
| 220 |
|
| 221 |
if(CUE_SUCCESS != CU_initialize_registry()){ |
| 222 |
return CU_get_error(); |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
pSuite = CU_add_suite("AgsFxEnvelopeAudioSignalTest", ags_fx_envelope_audio_signal_test_init_suite, ags_fx_envelope_audio_signal_test_clean_suite); |
| 227 |
|
| 228 |
if(pSuite == NULL){ |
| 229 |
CU_cleanup_registry(); |
| 230 |
|
| 231 |
return CU_get_error(); |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
if((CU_add_test(pSuite, "test of AgsFxEnvelopeAudioSignal new", ags_fx_envelope_audio_signal_test_new) == NULL) || |
| 236 |
(CU_add_test(pSuite, "test of AgsFxEnvelopeAudioSignal new", ags_fx_envelope_audio_signal_test_run_inter) == NULL)){ |
| 237 |
CU_cleanup_registry(); |
| 238 |
|
| 239 |
return CU_get_error(); |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
CU_basic_set_mode(CU_BRM_VERBOSE); |
| 244 |
CU_basic_run_tests(); |
| 245 |
|
| 246 |
CU_cleanup_registry(); |
| 247 |
|
| 248 |
return(CU_get_error()); |
| 249 |
} |