2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Includes */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
#define _DRUMMER_C_
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <drummer.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* DR_Init */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status DR_Init( DRT_Base *Base_Ptr)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status status;
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_DataStruct_Init( Base_Ptr, DRD_SAMPLE_RATE_DEFAULT)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
fprintf( stderr, "Can't init data structures (%d) !", status);
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-03-23 22:57:26 +01:00
|
|
|
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* DR_DeInit */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status DR_DeInit( DRT_Base *Base_Ptr)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Status status;
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_DataStruct_DeInit( Base_Ptr)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
printf( "Can't deinit data structures (%d)!\n", status);
|
|
|
|
return( status);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return( status);
|
|
|
|
}
|
|
|
|
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-04-20 12:37:32 +02:00
|
|
|
/* main */
|
2022-03-20 23:46:24 +01:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
int main( int argc, char **argv)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
DRT_Base base;
|
|
|
|
DRT_Status status;
|
|
|
|
DRT_Kit *kit_ptr;
|
2022-03-23 22:57:26 +01:00
|
|
|
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Init( &base)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-03-23 22:57:26 +01:00
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Kits_Load( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Kit_Id_Find( &kit_ptr, base.Kit_DS_Ptr, 0)) != DRS_OK)
|
|
|
|
// if( ( status = DR_Kit_Name_Find( &kit_ptr, base.Kit_DS_Ptr, "Mars LM1: 01-777 Clean Kit")) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Kit_Sample_Load( kit_ptr, base.SampleRate)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-20 12:37:32 +02:00
|
|
|
/*
|
|
|
|
fprintf( stderr, "Before!\n");
|
2022-03-20 23:46:24 +01:00
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
if( ( status = DR_Kit_Sample_UnLoad( kit_ptr)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
2022-04-20 12:37:32 +02:00
|
|
|
*/
|
|
|
|
fprintf( stderr, "After!\n");
|
|
|
|
|
|
|
|
if( ( status = DR_Kit_Sample_Load( kit_ptr, base.SampleRate)) != DRS_OK)
|
2022-03-20 23:46:24 +01:00
|
|
|
{
|
2022-04-20 12:37:32 +02:00
|
|
|
exit( -1);
|
2022-03-20 23:46:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-20 12:37:32 +02:00
|
|
|
fprintf( stderr, "hello world!\n");
|
2022-03-20 23:46:24 +01:00
|
|
|
|
|
|
|
if( ( status = DR_Kits_Dump( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ( status = DR_DeInit( &base)) != DRS_OK)
|
|
|
|
{
|
|
|
|
exit( -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit( 0);
|
|
|
|
}
|