comparison src/xmms-sid.c @ 672:f22a708d29fd

Remove some camelcasing / hungarian notation.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 21 Apr 2008 18:41:01 +0300
parents b0743dc9165d
children ba851baac5a0
comparison
equal deleted inserted replaced
671:e45d01557f25 672:f22a708d29fd
126 /* 126 /*
127 * Initialization functions 127 * Initialization functions
128 */ 128 */
129 void xs_reinit(void) 129 void xs_reinit(void)
130 { 130 {
131 gint iPlayer; 131 gint player;
132 gboolean isInitialized; 132 gboolean initialized;
133 133
134 /* Stop playing, if we are */ 134 /* Stop playing, if we are */
135 XS_MUTEX_LOCK(xs_status); 135 XS_MUTEX_LOCK(xs_status);
136 if (xs_status.isPlaying) { 136 if (xs_status.isPlaying) {
137 XS_MUTEX_UNLOCK(xs_status); 137 XS_MUTEX_UNLOCK(xs_status);
165 xs_status.oversampleFactor = xs_cfg.oversampleFactor; 165 xs_status.oversampleFactor = xs_cfg.oversampleFactor;
166 166
167 /* Try to initialize emulator engine */ 167 /* Try to initialize emulator engine */
168 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine); 168 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine);
169 169
170 iPlayer = 0; 170 player = 0;
171 isInitialized = FALSE; 171 initialized = FALSE;
172 while ((iPlayer < xs_nplayerlist) && !isInitialized) { 172 while ((player < xs_nplayerlist) && !initialized) {
173 if (xs_playerlist[iPlayer].plrIdent == xs_cfg.playerEngine) { 173 if (xs_playerlist[player].plrIdent == xs_cfg.playerEngine) {
174 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { 174 if (xs_playerlist[player].plrInit(&xs_status)) {
175 isInitialized = TRUE; 175 initialized = TRUE;
176 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[iPlayer]; 176 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[player];
177 } 177 }
178 } 178 }
179 iPlayer++; 179 player++;
180 } 180 }
181 181
182 XSDEBUG("init#1: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); 182 XSDEBUG("init#1: %s, %i\n", (initialized) ? "OK" : "FAILED", player);
183 183
184 iPlayer = 0; 184 player = 0;
185 while ((iPlayer < xs_nplayerlist) && !isInitialized) { 185 while ((player < xs_nplayerlist) && !initialized) {
186 if (xs_playerlist[iPlayer].plrInit(&xs_status)) { 186 if (xs_playerlist[player].plrInit(&xs_status)) {
187 isInitialized = TRUE; 187 initialized = TRUE;
188 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[iPlayer]; 188 xs_status.sidPlayer = (xs_player_t *) & xs_playerlist[player];
189 xs_cfg.playerEngine = xs_playerlist[iPlayer].plrIdent; 189 xs_cfg.playerEngine = xs_playerlist[player].plrIdent;
190 } else 190 } else
191 iPlayer++; 191 player++;
192 } 192 }
193 193
194 XSDEBUG("init#2: %s, %i\n", (isInitialized) ? "OK" : "FAILED", iPlayer); 194 XSDEBUG("init#2: %s, %i\n", (initialized) ? "OK" : "FAILED", player);
195 195
196 196
197 /* Get settings back, in case the chosen emulator backend changed them */ 197 /* Get settings back, in case the chosen emulator backend changed them */
198 xs_cfg.audioFrequency = xs_status.audioFrequency; 198 xs_cfg.audioFrequency = xs_status.audioFrequency;
199 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; 199 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample;
838 838
839 839
840 /* 840 /*
841 * Set the time-seek position 841 * Set the time-seek position
842 * The playing thread will do the "seeking", which means sub-tune 842 * The playing thread will do the "seeking", which means sub-tune
843 * changing in XMMS-SID's case. iTime argument is time in seconds, 843 * changing in XMMS-SID's case. time argument is time in seconds,
844 * in contrast to milliseconds used in other occasions. 844 * in contrast to milliseconds used in other occasions.
845 * 845 *
846 * This function is called whenever position slider is clicked or 846 * This function is called whenever position slider is clicked or
847 * other method of seeking is used (keyboard, etc.) 847 * other method of seeking is used (keyboard, etc.)
848 */ 848 */
849 void xs_seek(gint iTime) 849 void xs_seek(gint time)
850 { 850 {
851 /* Check status */ 851 /* Check status */
852 XS_MUTEX_LOCK(xs_status); 852 XS_MUTEX_LOCK(xs_status);
853 if (!xs_status.tuneInfo || !xs_status.isPlaying) { 853 if (!xs_status.tuneInfo || !xs_status.isPlaying) {
854 XS_MUTEX_UNLOCK(xs_status); 854 XS_MUTEX_UNLOCK(xs_status);
856 } 856 }
857 857
858 /* Act according to settings */ 858 /* Act according to settings */
859 switch (xs_cfg.subsongControl) { 859 switch (xs_cfg.subsongControl) {
860 case XS_SSC_SEEK: 860 case XS_SSC_SEEK:
861 if (iTime < xs_status.lastTime) { 861 if (time < xs_status.lastTime) {
862 if (xs_status.currSong > 1) 862 if (xs_status.currSong > 1)
863 xs_status.currSong--; 863 xs_status.currSong--;
864 } else if (iTime > xs_status.lastTime) { 864 } else if (time > xs_status.lastTime) {
865 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes) 865 if (xs_status.currSong < xs_status.tuneInfo->nsubTunes)
866 xs_status.currSong++; 866 xs_status.currSong++;
867 } 867 }
868 break; 868 break;
869 869
872 break; 872 break;
873 873
874 /* If we have song-position patch, check settings */ 874 /* If we have song-position patch, check settings */
875 #ifdef HAVE_SONG_POSITION 875 #ifdef HAVE_SONG_POSITION
876 case XS_SSC_PATCH: 876 case XS_SSC_PATCH:
877 if ((iTime > 0) && (iTime <= xs_status.tuneInfo->nsubTunes)) 877 if ((time > 0) && (time <= xs_status.tuneInfo->nsubTunes))
878 xs_status.currSong = iTime; 878 xs_status.currSong = time;
879 break; 879 break;
880 #endif 880 #endif
881 } 881 }
882 882
883 XS_MUTEX_UNLOCK(xs_status); 883 XS_MUTEX_UNLOCK(xs_status);
936 * Subsequent changes to information are made by the player thread, 936 * Subsequent changes to information are made by the player thread,
937 * which uses xs_plugin_ip.set_info(); 937 * which uses xs_plugin_ip.set_info();
938 */ 938 */
939 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength) 939 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength)
940 { 940 {
941 xs_tuneinfo_t *pInfo; 941 xs_tuneinfo_t *info;
942 942
943 XS_MUTEX_LOCK(xs_status); 943 XS_MUTEX_LOCK(xs_status);
944 944
945 /* Get tune information from emulation engine */ 945 /* Get tune information from emulation engine */
946 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); 946 info = xs_status.sidPlayer->plrGetSIDInfo(songFilename);
947 if (!pInfo) { 947 if (!info) {
948 XS_MUTEX_UNLOCK(xs_status); 948 XS_MUTEX_UNLOCK(xs_status);
949 return; 949 return;
950 } 950 }
951 951
952 /* Get sub-tune information, if available */ 952 /* Get sub-tune information, if available */
953 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { 953 if ((info->startTune > 0) && (info->startTune <= info->nsubTunes)) {
954 gint tmpInt; 954 gint tmpInt;
955 955
956 (*songTitle) = xs_make_titlestring(pInfo, pInfo->startTune); 956 (*songTitle) = xs_make_titlestring(info, info->startTune);
957 957
958 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; 958 tmpInt = info->subTunes[info->startTune-1].tuneLength;
959 if (tmpInt < 0) 959 if (tmpInt < 0)
960 (*songLength) = -1; 960 (*songLength) = -1;
961 else 961 else
962 (*songLength) = (tmpInt * 1000); 962 (*songLength) = (tmpInt * 1000);
963 } 963 }
964 964
965 /* Free tune information */ 965 /* Free tune information */
966 xs_tuneinfo_free(pInfo); 966 xs_tuneinfo_free(info);
967 XS_MUTEX_UNLOCK(xs_status); 967 XS_MUTEX_UNLOCK(xs_status);
968 } 968 }
969 969