We consider a statistical multiplexer which is modeled as a discrete-time single-server queueing system. Messages consisting of a variable number of fixed-length packets arrive to the muliplexer at the rate of one packet per slot (‘train arrivals’), which results in what we call a primary correlation in the packet arrival process. The distribution of the message lengths (in terms of packets) is general. Additionally, the arrival process exhibits a secondary correlation, which results from the fact that the distribution of the number of leading packet arrivals in a slot depends on some environment variable. We assume this environment to have two possible states, each with geometric sojourn times. By using generating functions and an infinite-dimensional state description, we derive closed-form expressions for the mean, the variance and the tail distribution of the buffer contents in the steady state. Some numerical examples illustrate the effect of both primary and secondary correlation on the multiplexer performance.