Esempio n. 1
0
void roadmap_sound_initialize ()
{

   int curLvl;
   char sound_dir[MAX_SOUND_NAME];

   // Initialize the volume labels for GUI
   SND_VOLUME_LVLS_LABELS[0] = roadmap_lang_get( "Silent" );
   SND_VOLUME_LVLS_LABELS[1] = roadmap_lang_get( "Low" );
   SND_VOLUME_LVLS_LABELS[2] = roadmap_lang_get( "Medium" );
   SND_VOLUME_LVLS_LABELS[3] = roadmap_lang_get( "High" );

   // Set current volume from the configuration
   roadmap_config_declare("user", &RoadMapConfigVolControl, SND_DEFAULT_VOLUME_LVL, NULL );
   curLvl = roadmap_config_get_integer( &RoadMapConfigVolControl );
//   FreeMapNativeManager_SetVolume( curLvl, SND_VOLUME_LVLS[0], SND_VOLUME_LVLS[SND_VOLUME_LVLS_COUNT-1] );

   // Preload the sound resources
   snprintf( sound_dir, sizeof( sound_dir ), "%s//%s//%s",
				roadmap_path_downloads(), "sound", roadmap_prompts_get_name() );
   FreeMapNativeSoundManager_LoadSoundData( sound_dir );

   sgInitialized = TRUE;
   // Log the operation
   roadmap_log( ROADMAP_DEBUG, "Current volume initialized to level : %d.", curLvl );
}
Esempio n. 2
0
static const char* get_full_name( const char* name )
{
   static char full_name[256];
   const char *suffix = "";

   if ( !strchr( name, '.' ) )
   {
      suffix = ".bin";
   }

   if ( roadmap_path_is_full_path( name ) )
   {
      strncpy_safe( full_name, name, sizeof( full_name ) );
   }
   else
   {
      snprintf( full_name, sizeof( full_name ), "%s//%s//%s//%s%s",
            roadmap_path_downloads(), "sound", roadmap_prompts_get_name(), name, suffix );
   }
   return full_name;
}
Esempio n. 3
0
static void *load_resource (unsigned int type, unsigned int flags,
                            const char *name, int *mem) {

   const char *cursor;
   void *data = NULL;

   if (flags & RES_SKIN) {
#ifndef RIMAPI
      for (cursor = roadmap_path_first ("skin");
            cursor != NULL;
            cursor = roadmap_path_next ("skin", cursor)) {
         switch (type) {
            case RES_BITMAP:
               *mem = 0;

               data = roadmap_canvas_load_image (cursor, name);
               break;
            case RES_SOUND:
               data = roadmap_sound_load (cursor, name, mem);
               break;
#ifdef IPHONE_NATIVE
            case RES_NATIVE_IMAGE:
               *mem = 0;

               data = roadmap_main_load_image (cursor, name);
               break;
#endif
         }
         if (data) break;
      }
#else // RIMAPI
      data = rim_load_resources(type, flags, name, mem);
#endif

   } else {

      const char *user_path = roadmap_path_user ();
      char path[512];
      switch (type) {
         case RES_BITMAP:
            *mem = 0;
            roadmap_path_format (path, sizeof (path), user_path, "icons");
            data = roadmap_canvas_load_image (path, name);
            break;
         case RES_SOUND:
            roadmap_path_format (path, sizeof (path), roadmap_path_downloads(), "sound");
            roadmap_path_format (path, sizeof (path), path, roadmap_prompts_get_name());
            data = roadmap_sound_load (path, name, mem);
            break;
#ifdef IPHONE_NATIVE
         case RES_NATIVE_IMAGE:
            *mem = 0;
            roadmap_path_format (path, sizeof (path), user_path, "icons");
            data = roadmap_main_load_image (path, name);
            break;
#endif
      }
   }

   return data;
}